mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-04 22:41:24 +08:00
temp 2023/5/3
This commit is contained in:
@@ -52,18 +52,23 @@ public class WorkController {
|
|||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResponseResult addWork(@RequestBody Work work) {
|
public ResponseResult addWork(@RequestBody Work work) {
|
||||||
System.out.println(work);
|
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", workService.addWork(work));
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", workService.addWork(work));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseResult deleteById(@PathVariable long id) {
|
public ResponseResult deleteById(@PathVariable Long id) {
|
||||||
System.out.println(id);
|
System.out.println(id);
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", workService.deleteByWorkId(id));
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", workService.deleteByWorkId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/setComplete")
|
@PutMapping("/setStatus")
|
||||||
public ResponseResult updateWork(@RequestBody UserWork userWork) {
|
public ResponseResult updateStatus(@RequestBody UserWork userWork) {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", userWorkService.updateById(userWork));
|
System.out.println(userWork);
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", workService.updateStatus(userWork));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public ResponseResult updateWork(@RequestBody Work work) {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", workService.updateWork(work));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ public class User implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cfive.pinnacle.service;
|
package com.cfive.pinnacle.service;
|
||||||
|
|
||||||
|
import com.cfive.pinnacle.entity.UserWork;
|
||||||
import com.cfive.pinnacle.entity.Work;
|
import com.cfive.pinnacle.entity.Work;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
@@ -23,4 +24,8 @@ public interface IWorkService extends IService<Work> {
|
|||||||
String getUserName(Long userId);
|
String getUserName(Long userId);
|
||||||
boolean addWork(Work work);
|
boolean addWork(Work work);
|
||||||
boolean deleteByWorkId(Long wid);
|
boolean deleteByWorkId(Long wid);
|
||||||
|
|
||||||
|
boolean updateStatus(UserWork userWork);
|
||||||
|
|
||||||
|
boolean updateWork(Work work);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,5 +17,4 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class UserWorkServiceImpl extends ServiceImpl<UserWorkMapper, UserWork> implements IUserWorkService {
|
public class UserWorkServiceImpl extends ServiceImpl<UserWorkMapper, UserWork> implements IUserWorkService {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cfive.pinnacle.service.impl;
|
package com.cfive.pinnacle.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.cfive.pinnacle.entity.User;
|
import com.cfive.pinnacle.entity.User;
|
||||||
import com.cfive.pinnacle.entity.UserWork;
|
import com.cfive.pinnacle.entity.UserWork;
|
||||||
import com.cfive.pinnacle.entity.Work;
|
import com.cfive.pinnacle.entity.Work;
|
||||||
@@ -43,12 +44,22 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Work> getTodo(Long userId) {
|
public List<Work> getTodo(Long userId) {
|
||||||
return workMapper.getTodo(userId);
|
List<Work> workList = workMapper.getTodo(userId);
|
||||||
|
for (Work work:
|
||||||
|
workList) {
|
||||||
|
work.setPublisherName(getUserName(work.getPublisherId()));
|
||||||
|
}
|
||||||
|
return workList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Work> getComplete(Long userId) {
|
public List<Work> getComplete(Long userId) {
|
||||||
return workMapper.getComplete(userId);
|
List<Work> workList = workMapper.getComplete(userId);
|
||||||
|
for (Work work:
|
||||||
|
workList) {
|
||||||
|
work.setPublisherName(getUserName(work.getPublisherId()));
|
||||||
|
}
|
||||||
|
return workList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,9 +78,9 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addWork(Work work) {
|
public boolean addWork(Work work) {
|
||||||
boolean flag = false;
|
boolean flag = true;
|
||||||
if (workMapper.insert(work) > 0) {
|
if (workMapper.insert(work) <= 0) {
|
||||||
flag = true;
|
flag = false;
|
||||||
}
|
}
|
||||||
long workId = work.getId();
|
long workId = work.getId();
|
||||||
for (User user :
|
for (User user :
|
||||||
@@ -93,5 +104,31 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateStatus(UserWork userWork) {
|
||||||
|
return userWorkMapper.update(userWork, new UpdateWrapper<UserWork>().eq("work_id", userWork.getWorkId()).eq("user_id", userWork.getUserId())) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateWork(Work work) {
|
||||||
|
boolean flag = true;
|
||||||
|
if (userWorkMapper.delete(new QueryWrapper<UserWork>().eq("work_id", work.getId())) <= 0) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
if (workMapper.updateById(work)<=0) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
for (User user :
|
||||||
|
work.getWorker()) {
|
||||||
|
UserWork userWork = new UserWork();
|
||||||
|
userWork.setWorkId(work.getId());
|
||||||
|
userWork.setUserId(user.getId());
|
||||||
|
if (userWorkMapper.insert(userWork) <= 0) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
and status = false
|
and status = false
|
||||||
and w.deleted = 0
|
and w.deleted = 0
|
||||||
and tuw.deleted = 0
|
and tuw.deleted = 0
|
||||||
order by u.id desc;
|
order by w.id desc;
|
||||||
</select>
|
</select>
|
||||||
<select id="getComplete" parameterType="long" resultMap="workMap">
|
<select id="getComplete" parameterType="long" resultMap="workMap">
|
||||||
select w.id,
|
select w.id,
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
and status = true
|
and status = true
|
||||||
and w.deleted = 0
|
and w.deleted = 0
|
||||||
and tuw.deleted = 0
|
and tuw.deleted = 0
|
||||||
order by u.id desc;
|
order by w.id desc;
|
||||||
</select>
|
</select>
|
||||||
<delete id="deleteWorkById" parameterType="int">
|
<delete id="deleteWorkById" parameterType="int">
|
||||||
delete
|
delete
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="zh">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/pinnacle.svg" />
|
<link rel="icon" type="image/svg+xml" href="/pinnacle.svg" />
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
}
|
}
|
||||||
.main {
|
.main {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100vh;
|
|
||||||
width: 100vw;
|
|
||||||
min-width: 600px;
|
min-width: 600px;
|
||||||
min-height: 600px;
|
min-height: 600px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -21,7 +19,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
bottom: 10vh;
|
bottom: 10vh;
|
||||||
justify-content: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.main-add-box {
|
.main-add-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
1
ui/src/assets/svg/work.svg
Normal file
1
ui/src/assets/svg/work.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1682965946166" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3580" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M228.928 320h534.144v64H228.928zM228.928 512h534.144v64H228.928zM228.928 704h534.144v64H228.928z" p-id="3581"></path><path d="M124.48 950.272L124.16 118.016h169.024v34.56c0 38.656 31.296 70.144 69.76 70.144h279.488a70.016 70.016 0 0 0 69.696-70.144v-34.56l168.704-0.32 0.32 832.32-756.672 0.256z m517.824-866.816l0.128 69.44-279.424-0.32v-69.12l-0.128-0.384 279.424 0.384zM880.704 50.56h-178.368c-12.096-22.208-34.24-37.312-59.904-37.312H362.88c-25.6 0-47.808 15.104-59.904 37.312H124.16c-38.4 0-69.504 33.28-69.504 74.24v820.736c0 40.96 31.232 74.24 69.568 74.24h756.928c38.4 0 69.44-33.28 69.504-74.24V124.8c-0.128-41.152-31.488-74.368-69.952-74.24z" p-id="3582"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1009 B |
@@ -3,7 +3,7 @@
|
|||||||
title="Vertical list with border"
|
title="Vertical list with border"
|
||||||
direction="vertical"
|
direction="vertical"
|
||||||
:column="4"
|
:column="4"
|
||||||
:size="size"
|
:size="5"
|
||||||
:data="taskData"
|
:data="taskData"
|
||||||
border
|
border
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.deadline"
|
v-model="form.deadline"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
|
format="YYYY-MM-DD HH:mm"
|
||||||
|
value-format="YYYY-MM-DDTHH:mm:ss"
|
||||||
placeholder="请选择时间"
|
placeholder="请选择时间"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
@@ -31,18 +33,30 @@
|
|||||||
<el-input v-model="form.content" type="textarea" />
|
<el-input v-model="form.content" type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit(form)">创建</el-button>
|
<el-button type="primary" @click="onSubmit(form)">
|
||||||
|
<template #default> {{ this.commitButton }}</template>
|
||||||
|
</el-button>
|
||||||
<el-button @click="reset">重置</el-button>
|
<el-button @click="reset">重置</el-button>
|
||||||
<el-button @click="cancel">取消</el-button>
|
<el-button @click="cancel">取消</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
export default {
|
export default {
|
||||||
|
props: {
|
||||||
|
editForm: {
|
||||||
|
publisherId: '',
|
||||||
|
createTime: '',
|
||||||
|
deadline: '',
|
||||||
|
content: '',
|
||||||
|
worker: []
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
commitButton: '创建',
|
||||||
form: {
|
form: {
|
||||||
publisherId: '',
|
publisherId: '',
|
||||||
createTime: '',
|
createTime: '',
|
||||||
@@ -65,7 +79,6 @@ export default {
|
|||||||
],
|
],
|
||||||
deadline: [
|
deadline: [
|
||||||
{
|
{
|
||||||
type: 'date',
|
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入终止日期'
|
message: '请输入终止日期'
|
||||||
}
|
}
|
||||||
@@ -92,26 +105,17 @@ export default {
|
|||||||
console.log(reportError)
|
console.log(reportError)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addWork(form) {
|
|
||||||
console.log(form)
|
|
||||||
axios
|
|
||||||
.post('http://localhost:8621/work', form)
|
|
||||||
.then((response) => {
|
|
||||||
console.log(response.data)
|
|
||||||
})
|
|
||||||
.catch((reportError) => {
|
|
||||||
console.log(reportError)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onSubmit(form) {
|
onSubmit(form) {
|
||||||
//表单校验
|
// 表单校验
|
||||||
this.$refs.ruleForm.validate((value) => {
|
this.$refs.ruleForm.validate((value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.log(form.deadline)
|
console.log(form.deadline)
|
||||||
form.createTime = new Date()
|
|
||||||
form.publisherId = String(1)
|
form.publisherId = String(1)
|
||||||
this.addWork(form)
|
if (this.editForm) {
|
||||||
this.$emit('setDialogVisible', false)
|
this.$emit('updateWork', form)
|
||||||
|
} else {
|
||||||
|
this.$emit('addWork', form)
|
||||||
|
}
|
||||||
console.log('submit!')
|
console.log('submit!')
|
||||||
} else {
|
} else {
|
||||||
console.log('fault!')
|
console.log('fault!')
|
||||||
@@ -125,7 +129,18 @@ export default {
|
|||||||
this.$emit('setDialogVisible', false)
|
this.$emit('setDialogVisible', false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updated() {
|
||||||
|
if (this.editForm) {
|
||||||
|
this.form = this.editForm
|
||||||
|
this.commitButton = '保存'
|
||||||
|
}
|
||||||
|
this.getFormData()
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
|
if (this.editForm) {
|
||||||
|
this.form = this.editForm
|
||||||
|
this.commitButton = '保存'
|
||||||
|
}
|
||||||
this.getFormData()
|
this.getFormData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,22 +2,14 @@
|
|||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="main-table">
|
<div class="main-table">
|
||||||
<el-table :data="tableData" style="width: 100%">
|
<el-table :data="tableData" style="width: 100%">
|
||||||
<el-table-column fixed prop="id" label="工作事项ID" width="150" />
|
<el-table-column fixed prop="publisherName" label="发布者" width="120" />
|
||||||
<el-table-column prop="publisherId" label="发布者ID" width="120" />
|
|
||||||
<el-table-column prop="content" label="内容" width="800" />
|
<el-table-column prop="content" label="内容" width="800" />
|
||||||
<el-table-column prop="worker" label="工作人员" width="200">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<span v-for="item in row.worker" :key="item.userID">
|
|
||||||
{{ item.userName }},
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="deadline" label="结束时间" width="200">
|
<el-table-column prop="deadline" label="结束时间" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatDate(scope.row.deadline) }}
|
{{ formatDate(scope.row.deadline) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" width="240">
|
<el-table-column fixed="right" label="操作" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" size="large">查看</el-button>
|
<el-button link type="primary" size="large">查看</el-button>
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
@@ -26,7 +18,7 @@
|
|||||||
cancel-button-text="否"
|
cancel-button-text="否"
|
||||||
:icon="InfoFilled"
|
:icon="InfoFilled"
|
||||||
icon-color="#00d4ff"
|
icon-color="#00d4ff"
|
||||||
title="是否确认完成?"
|
title="是否修改为未完成?"
|
||||||
@confirm="todoConfirmEvent(scope.row)"
|
@confirm="todoConfirmEvent(scope.row)"
|
||||||
@cancel="todoCancelEvent"
|
@cancel="todoCancelEvent"
|
||||||
>
|
>
|
||||||
@@ -57,34 +49,37 @@ export default {
|
|||||||
return new Date(deadline).toLocaleString()
|
return new Date(deadline).toLocaleString()
|
||||||
},
|
},
|
||||||
todoConfirmEvent(row) {
|
todoConfirmEvent(row) {
|
||||||
console.log(row)
|
const userWork = {
|
||||||
this.setTaskTodo(row)
|
workId: '',
|
||||||
console.log('complete confirm!')
|
userId: '1652714496280469506',
|
||||||
location.reload()
|
status: 1
|
||||||
|
}
|
||||||
|
userWork.workId = row.id
|
||||||
|
userWork.status = 0
|
||||||
|
this.setTaskStatus(userWork)
|
||||||
},
|
},
|
||||||
todoCancelEvent() {
|
todoCancelEvent() {
|
||||||
console.log('complete cancel!')
|
console.log('complete cancel!')
|
||||||
},
|
},
|
||||||
getTableData() {
|
getTableData() {
|
||||||
axios
|
axios
|
||||||
.get('http://localhost:8080/work/complete')
|
.get('http://localhost:8621/work/complete/1652714496280469506')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data.data)
|
||||||
this.tableData = response.data
|
this.tableData = response.data.data
|
||||||
console.log(this.tableData)
|
console.log(this.tableData)
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
console.log(reportError)
|
console.log(reportError)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setTaskTodo(row) {
|
setTaskStatus(userWork) {
|
||||||
var workDo = new Object()
|
console.log(userWork)
|
||||||
workDo.id = row.id
|
|
||||||
workDo.status = false
|
|
||||||
axios
|
axios
|
||||||
.put('http://localhost:8080/work', workDo)
|
.put('http://localhost:8621/work/setStatus', userWork)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data.data)
|
||||||
|
this.getTableData()
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
console.log(reportError)
|
console.log(reportError)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="main-table">
|
<div class="main-table">
|
||||||
<el-table :data="tableData" style="width: 100%">
|
<el-table :data="tableData" style="width: 100%">
|
||||||
<el-table-column prop="content" label="内容" width="800" />
|
<el-table-column prop="content" label="内容" width="800" />
|
||||||
<el-table-column prop="publisherName" label="发布者ID" width="120" />
|
<el-table-column prop="publisherName" label="发布者" width="120" />
|
||||||
<el-table-column prop="worker" label="工作人员" width="200">
|
<el-table-column prop="worker" label="工作人员" width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span v-for="item in row.worker" :key="item.userId">
|
<span v-for="item in row.worker" :key="item.userId">
|
||||||
@@ -25,16 +25,15 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" width="200">
|
<el-table-column fixed="right" label="操作" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" size="large" @click="handleClick"
|
<el-button link type="primary" size="large" @click="handleClick(scope.row)"
|
||||||
>编辑</el-button
|
>编辑</el-button
|
||||||
>
|
>
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
width="220"
|
width="220"
|
||||||
confirm-button-text="是"
|
confirm-button-text="是"
|
||||||
cancel-button-text="否"
|
cancel-button-text="否"
|
||||||
:icon="InfoFilled"
|
|
||||||
icon-color="#00d4ff"
|
icon-color="#00d4ff"
|
||||||
title="是否确定删除?"
|
title="是否确定删除?"
|
||||||
@confirm="deleteConfirmEvent(scope.row)"
|
@confirm="deleteConfirmEvent(scope.row)"
|
||||||
@@ -44,36 +43,29 @@
|
|||||||
<el-button link type="primary" size="default">删除</el-button>
|
<el-button link type="primary" size="default">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
<!-- <el-popconfirm-->
|
|
||||||
<!-- width="220"-->
|
|
||||||
<!-- confirm-button-text="是"-->
|
|
||||||
<!-- cancel-button-text="否"-->
|
|
||||||
<!-- :icon="InfoFilled"-->
|
|
||||||
<!-- icon-color="#00d4ff"-->
|
|
||||||
<!-- title="是否确认完成?"-->
|
|
||||||
<!-- @confirm="completeConfirmEvent"-->
|
|
||||||
<!-- @cancel="completeCancelEvent"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <template #reference>-->
|
|
||||||
<!-- <el-button link type="primary" size="default">完成</el-button>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- </el-popconfirm>-->
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="main-add-content">
|
<div class="main-add-content">
|
||||||
<div class="main-add-box">
|
<div class="main-add-box">
|
||||||
<el-button @click="dialogFormVisible = true">添加</el-button>
|
<el-button size="large" @click="addVisible = true">添加</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="dialogFormVisible" width="60%">
|
<el-dialog v-model="addVisible" width="60%">
|
||||||
<edit-work @setDialogVisible="setDialogVisible"></edit-work>
|
<edit-work @setDialogVisible="setDialogVisible" @addWork="addWork"></edit-work>
|
||||||
|
</el-dialog>
|
||||||
|
<el-dialog v-model="editVisible" width="60%">
|
||||||
|
<edit-work
|
||||||
|
:editForm="rowData"
|
||||||
|
@setDialogVisible="setDialogVisible"
|
||||||
|
@updateWork="updateWork"
|
||||||
|
></edit-work>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import EditWork from '@/components/EditWork.vue'
|
import EditWork from '@/components/EditWork.vue'
|
||||||
|
|
||||||
@@ -82,7 +74,9 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableData: [],
|
tableData: [],
|
||||||
dialogFormVisible: false
|
rowData: [],
|
||||||
|
addVisible: false,
|
||||||
|
editVisible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -90,12 +84,13 @@ export default {
|
|||||||
console.log(new Date(deadline).toLocaleString())
|
console.log(new Date(deadline).toLocaleString())
|
||||||
return new Date(deadline).toLocaleString()
|
return new Date(deadline).toLocaleString()
|
||||||
},
|
},
|
||||||
handleClick() {
|
handleClick(row) {
|
||||||
|
this.rowData = row
|
||||||
|
this.editVisible = true
|
||||||
console.log('click')
|
console.log('click')
|
||||||
},
|
},
|
||||||
deleteConfirmEvent(row) {
|
deleteConfirmEvent(row) {
|
||||||
this.deleteTableData(row)
|
this.deleteTableData(row)
|
||||||
location.reload()
|
|
||||||
console.log('delete confirm!')
|
console.log('delete confirm!')
|
||||||
},
|
},
|
||||||
deleteCancelEvent() {
|
deleteCancelEvent() {
|
||||||
@@ -123,6 +118,7 @@ export default {
|
|||||||
axios
|
axios
|
||||||
.delete('http://localhost:8621/work/' + row.id)
|
.delete('http://localhost:8621/work/' + row.id)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
this.getTableData()
|
||||||
console.log(response.data.data)
|
console.log(response.data.data)
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
@@ -131,8 +127,33 @@ export default {
|
|||||||
},
|
},
|
||||||
setDialogVisible(dialogVisible) {
|
setDialogVisible(dialogVisible) {
|
||||||
console.log(dialogVisible)
|
console.log(dialogVisible)
|
||||||
this.dialogFormVisible = dialogVisible
|
this.addVisible = dialogVisible
|
||||||
location.reload()
|
this.editVisible = dialogVisible
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
|
updateWork(form) {
|
||||||
|
axios
|
||||||
|
.put('http://localhost:8621/work', form)
|
||||||
|
.then((response) => {
|
||||||
|
this.editVisible = false
|
||||||
|
this.getTableData()
|
||||||
|
})
|
||||||
|
.catch((reportError) => {
|
||||||
|
console.log(reportError)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addWork(form) {
|
||||||
|
console.log(form)
|
||||||
|
axios
|
||||||
|
.post('http://localhost:8621/work', form)
|
||||||
|
.then((response) => {
|
||||||
|
this.addVisible = false
|
||||||
|
this.getTableData()
|
||||||
|
console.log(response.data)
|
||||||
|
})
|
||||||
|
.catch((reportError) => {
|
||||||
|
console.log(reportError)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -1,15 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
|
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" router>
|
||||||
<el-menu-item index="1"
|
<el-menu-item index="1" route="/work/task/todo">待办工作</el-menu-item>
|
||||||
><router-link to="/todo" style="text-decoration: none"
|
<el-menu-item index="2" route="/work/task/complete">已办工作</el-menu-item>
|
||||||
>待办工作</router-link
|
|
||||||
></el-menu-item
|
|
||||||
>
|
|
||||||
<el-menu-item index="2"
|
|
||||||
><router-link to="complete" style="text-decoration: none"
|
|
||||||
>已办工作</router-link
|
|
||||||
></el-menu-item
|
|
||||||
>
|
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<router-view></router-view>
|
<router-view></router-view>
|
||||||
</template>
|
</template>
|
||||||
@@ -21,9 +13,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
activeIndex: '1'
|
activeIndex: '1'
|
||||||
}
|
}
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.$router.push('/todo')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,22 +2,14 @@
|
|||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="main-table">
|
<div class="main-table">
|
||||||
<el-table :data="tableData" style="width: 100%">
|
<el-table :data="tableData" style="width: 100%">
|
||||||
<el-table-column fixed prop="id" label="工作事项ID" width="150" />
|
<el-table-column fixed prop="publisherName" label="发布者" width="150" />
|
||||||
<el-table-column prop="publisherId" label="发布者ID" width="120" />
|
|
||||||
<el-table-column prop="content" label="内容" width="800" />
|
<el-table-column prop="content" label="内容" width="800" />
|
||||||
<el-table-column prop="worker" label="工作人员" width="200">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<span v-for="item in row.worker" :key="item.userID">
|
|
||||||
{{ item.userName }},
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="deadline" label="结束时间" width="200">
|
<el-table-column prop="deadline" label="结束时间" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatDate(scope.row.deadline) }}
|
{{ formatDate(scope.row.deadline) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" width="240">
|
<el-table-column fixed="right" label="操作" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" size="large">查看</el-button>
|
<el-button link type="primary" size="large">查看</el-button>
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
@@ -56,34 +48,38 @@ export default {
|
|||||||
return new Date(deadline).toLocaleString()
|
return new Date(deadline).toLocaleString()
|
||||||
},
|
},
|
||||||
completeConfirmEvent(row) {
|
completeConfirmEvent(row) {
|
||||||
console.log(row)
|
const userWork = {
|
||||||
this.setTaskComplete(row)
|
workId: '',
|
||||||
|
userId: '1652714496280469506',
|
||||||
|
status: 0
|
||||||
|
}
|
||||||
|
userWork.workId = row.id
|
||||||
|
userWork.status = 1
|
||||||
|
this.setTaskStatus(userWork)
|
||||||
console.log('complete confirm!')
|
console.log('complete confirm!')
|
||||||
location.reload()
|
|
||||||
},
|
},
|
||||||
completeCancelEvent() {
|
completeCancelEvent() {
|
||||||
console.log('complete cancel!')
|
console.log('complete cancel!')
|
||||||
},
|
},
|
||||||
getTableData() {
|
getTableData() {
|
||||||
axios
|
axios
|
||||||
.get('http://localhost:8080/work/todo')
|
.get('http://localhost:8621/work/todo/1652714496280469506')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data.data)
|
||||||
this.tableData = response.data
|
this.tableData = response.data.data
|
||||||
console.log(this.tableData)
|
console.log(this.tableData)
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
console.log(reportError)
|
console.log(reportError)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setTaskComplete(row) {
|
setTaskStatus(userWork) {
|
||||||
var workDo = new Object()
|
console.log(userWork)
|
||||||
workDo.id = row.id
|
|
||||||
workDo.status = true
|
|
||||||
axios
|
axios
|
||||||
.put('http://localhost:8080/work', workDo)
|
.put('http://localhost:8621/work/setStatus', userWork)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data.data)
|
||||||
|
this.getTableData()
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
console.log(reportError)
|
console.log(reportError)
|
||||||
|
|||||||
Reference in New Issue
Block a user