mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 15:01:23 +08:00
temp 2023/5/5
This commit is contained in:
@@ -8,6 +8,7 @@ import com.cfive.pinnacle.entity.UserWork;
|
||||
import com.cfive.pinnacle.entity.Work;
|
||||
import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||
import com.cfive.pinnacle.service.IUserWorkService;
|
||||
import com.cfive.pinnacle.service.IWorkService;
|
||||
import com.cfive.pinnacle.service.impl.UserWorkServiceImpl;
|
||||
import com.cfive.pinnacle.service.impl.WorkServiceImpl;
|
||||
@@ -31,9 +32,9 @@ import java.util.List;
|
||||
@RequestMapping("/work")
|
||||
public class WorkController {
|
||||
@Autowired
|
||||
private WorkServiceImpl workService;
|
||||
private IWorkService workService;
|
||||
@Autowired
|
||||
private UserWorkServiceImpl userWorkService;
|
||||
private IUserWorkService userWorkService;
|
||||
|
||||
@GetMapping
|
||||
public ResponseResult getAll() {
|
||||
@@ -50,6 +51,11 @@ public class WorkController {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getComplete(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/{workId}")
|
||||
public ResponseResult getOne(@PathVariable Long workId) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success",workService.getOne(workId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public ResponseResult addWork(@RequestBody Work work) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", workService.addWork(work));
|
||||
|
||||
@@ -56,12 +56,14 @@ public class Work implements Serializable {
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", timezone = "UTC")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 截止时间
|
||||
*/
|
||||
@TableField("deadline")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", timezone = "UTC")
|
||||
private LocalDateTime deadline;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,4 +22,6 @@ public interface WorkMapper extends BaseMapper<Work> {
|
||||
|
||||
List<Work> getComplete(Long userId);
|
||||
|
||||
Work getWork(Long workId);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IWorkService extends IService<Work> {
|
||||
List<Work> getAll();
|
||||
List<Work> getTodo(Long userId);
|
||||
List<Work> getComplete(Long userId);
|
||||
|
||||
Work getOne(Long workId);
|
||||
double getProgress(Long workId);
|
||||
|
||||
String getUserName(Long userId);
|
||||
|
||||
@@ -62,6 +62,14 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
||||
return workList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Work getOne(Long workId) {
|
||||
Work work = workMapper.getWork(workId);
|
||||
work.setProgress(getProgress(workId));
|
||||
work.setPublisherName(getUserName(work.getPublisherId()));
|
||||
return work;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(Long workId) {
|
||||
double workNum = userWorkMapper.selectCount(new QueryWrapper<UserWork>().eq("work_id",workId));
|
||||
|
||||
@@ -33,18 +33,23 @@
|
||||
and tuw.deleted = 0
|
||||
order by w.id desc;
|
||||
</select>
|
||||
<select id="getWork" parameterType="work" resultType="work">
|
||||
select id, user_id, content, create_time, deadline, task_status
|
||||
from t_task
|
||||
<where>
|
||||
<if test="task_status!=null">
|
||||
and task_status=#{task_status}
|
||||
</if>
|
||||
<if test="user_id!=null and user_id!=0">
|
||||
and user_id=#{user_id}
|
||||
</if>
|
||||
</where>
|
||||
order by deadline, id;
|
||||
<select id="getWork" parameterType="long" resultMap="workMap">
|
||||
select w.id,
|
||||
content,
|
||||
publisher_id,
|
||||
create_time,
|
||||
deadline,
|
||||
tuw.user_id worker_id,
|
||||
u.username worker_name,
|
||||
tuw.status status
|
||||
from t_work w,
|
||||
t_user u,
|
||||
t_user_work tuw
|
||||
where w.id = #{id}
|
||||
and w.id = tuw.work_id
|
||||
and tuw.user_id = u.id
|
||||
and w.deleted = 0
|
||||
and tuw.deleted = 0;
|
||||
</select>
|
||||
<select id="getTodo" parameterType="long" resultMap="workMap">
|
||||
select w.id,
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<template>
|
||||
<el-descriptions
|
||||
title="Vertical list with border"
|
||||
direction="vertical"
|
||||
:column="4"
|
||||
:size="5"
|
||||
:data="taskData"
|
||||
border
|
||||
>
|
||||
<el-descriptions-item label="创建者ID">{{ taskData.publisherId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ taskData.createTime }}</el-descriptions-item>
|
||||
<el-descriptions-item label="结束时间">{{ taskData.deadline }}</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
<template #default> {{}} </template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="负责员工" property="worker" />
|
||||
<el-descriptions-item label="工作信息">{{ taskData.content }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
taskData: {
|
||||
publisherId: '1',
|
||||
createTime: '1',
|
||||
deadline: '1',
|
||||
status: false,
|
||||
worker: '',
|
||||
content: '213'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
54
ui/src/components/DetailComponents.vue
Normal file
54
ui/src/components/DetailComponents.vue
Normal file
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<el-descriptions
|
||||
title="工作详细信息"
|
||||
direction="vertical"
|
||||
:column="3"
|
||||
:size="size"
|
||||
:data="taskData"
|
||||
border
|
||||
>
|
||||
<el-descriptions-item label="创建者">{{ taskData.publisherName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{
|
||||
formatDate(taskData.createTime)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="结束时间">{{
|
||||
formatDate(taskData.deadline)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
<el-progress :text-inside="true" :stroke-width="16" :percentage="taskData.progress" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="负责员工">
|
||||
<el-tag v-for="item in taskData.worker" style="margin-right: 10px">{{
|
||||
item.username
|
||||
}}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工作信息">{{ taskData.content }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
taskData: {
|
||||
publisherId: '',
|
||||
createTime: '',
|
||||
deadline: '',
|
||||
content: '',
|
||||
progress: '',
|
||||
worker: []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size: '10'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(time) {
|
||||
return new Date(time).toLocaleString()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -18,12 +18,11 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="终止时间" prop="deadline">
|
||||
<el-col :span="11">
|
||||
<el-col :span="10">
|
||||
<el-date-picker
|
||||
v-model="form.deadline"
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
value-format="YYYY-MM-DDTHH:mm:ss"
|
||||
placeholder="请选择时间"
|
||||
style="width: 100%"
|
||||
/>
|
||||
@@ -110,6 +109,7 @@ export default {
|
||||
this.$refs.ruleForm.validate((value) => {
|
||||
if (value) {
|
||||
console.log(form.deadline)
|
||||
console.log(typeof form.deadline)
|
||||
form.publisherId = String(1)
|
||||
if (this.editForm) {
|
||||
this.$emit('updateWork', form)
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="main-table">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%"
|
||||
v-loading="loading"
|
||||
element-loading-text="加载中..."
|
||||
>
|
||||
<el-table-column fixed prop="publisherName" label="发布者" width="120" />
|
||||
<el-table-column prop="content" label="内容" width="800" />
|
||||
<el-table-column prop="deadline" label="结束时间" width="200">
|
||||
@@ -11,7 +16,9 @@
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" size="large">查看</el-button>
|
||||
<el-button link type="primary" size="large" @click="viewClick(scope.row.id)"
|
||||
>查看</el-button
|
||||
>
|
||||
<el-popconfirm
|
||||
width="220"
|
||||
confirm-button-text="是"
|
||||
@@ -30,6 +37,9 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-dialog v-model="visible" width="60%">
|
||||
<detail-components :taskData="taskData"></detail-components>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -40,7 +50,10 @@ export default {
|
||||
name: 'CompletePage',
|
||||
data() {
|
||||
return {
|
||||
tableData: []
|
||||
tableData: [],
|
||||
visible: false,
|
||||
taskData: [],
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -65,14 +78,30 @@ export default {
|
||||
axios
|
||||
.get('http://localhost:8621/work/complete/1652714496280469506')
|
||||
.then((response) => {
|
||||
console.log(response.data.data)
|
||||
this.tableData = response.data.data
|
||||
console.log(this.tableData)
|
||||
if (this.tableData) {
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
})
|
||||
},
|
||||
getTaskData(workId) {
|
||||
console.log(workId)
|
||||
axios
|
||||
.get('http://localhost:8621/work/' + workId)
|
||||
.then((response) => {
|
||||
console.log(response.data.data)
|
||||
this.taskData = response.data.data
|
||||
console.log(this.tableData)
|
||||
return true
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
return false
|
||||
})
|
||||
},
|
||||
setTaskStatus(userWork) {
|
||||
console.log(userWork)
|
||||
axios
|
||||
@@ -84,6 +113,10 @@ export default {
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
})
|
||||
},
|
||||
viewClick(workId) {
|
||||
this.getTaskData(workId)
|
||||
this.visible = true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="main-table">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%"
|
||||
v-loading="loading"
|
||||
element-loading-text="加载中..."
|
||||
>
|
||||
<el-table-column prop="content" label="内容" width="800" />
|
||||
<el-table-column prop="publisherName" label="发布者" width="120" />
|
||||
<el-table-column prop="worker" label="工作人员" width="200">
|
||||
<template #default="{ row }">
|
||||
<span v-for="item in row.worker" :key="item.userId">
|
||||
{{ item.username }},
|
||||
</span>
|
||||
<el-tag
|
||||
v-for="item in row.worker"
|
||||
:key="item.userId"
|
||||
size="small"
|
||||
round
|
||||
style="margin-right: 10px"
|
||||
>
|
||||
{{ item.username }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deadline" label="结束时间" width="200">
|
||||
@@ -76,14 +87,11 @@ export default {
|
||||
tableData: [],
|
||||
rowData: [],
|
||||
addVisible: false,
|
||||
editVisible: false
|
||||
editVisible: false,
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(deadline) {
|
||||
console.log(new Date(deadline).toLocaleString())
|
||||
return new Date(deadline).toLocaleString()
|
||||
},
|
||||
handleClick(row) {
|
||||
this.rowData = row
|
||||
this.editVisible = true
|
||||
@@ -106,9 +114,10 @@ export default {
|
||||
axios
|
||||
.get('http://localhost:8621/work')
|
||||
.then((response) => {
|
||||
console.log(response.data.data)
|
||||
this.tableData = response.data.data
|
||||
console.log(this.tableData)
|
||||
if (this.tableData) {
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
@@ -143,7 +152,6 @@ export default {
|
||||
})
|
||||
},
|
||||
addWork(form) {
|
||||
console.log(form)
|
||||
axios
|
||||
.post('http://localhost:8621/work', form)
|
||||
.then((response) => {
|
||||
@@ -154,6 +162,9 @@ export default {
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
})
|
||||
},
|
||||
formatDate(time) {
|
||||
return new Date(time).toLocaleString()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" router>
|
||||
<el-menu-item index="1" route="/work/task/todo">待办工作</el-menu-item>
|
||||
<el-menu-item index="2" route="/work/task/complete">已办工作</el-menu-item>
|
||||
<el-menu :default-active="$route.path" class="el-menu-demo" mode="horizontal" router>
|
||||
<el-menu-item index="/work/task/todo">待办工作</el-menu-item>
|
||||
<el-menu-item index="/work/task/complete">已办工作</el-menu-item>
|
||||
</el-menu>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
@@ -11,7 +11,7 @@ export default {
|
||||
name: 'TaskPage',
|
||||
data() {
|
||||
return {
|
||||
activeIndex: '1'
|
||||
activeIndex: 'todo'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="main-table">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%"
|
||||
v-loading="loading"
|
||||
element-loading-text="加载中..."
|
||||
>
|
||||
<el-table-column fixed prop="publisherName" label="发布者" width="150" />
|
||||
<el-table-column prop="content" label="内容" width="800" />
|
||||
<el-table-column prop="deadline" label="结束时间" width="200">
|
||||
@@ -11,7 +16,9 @@
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" size="large">查看</el-button>
|
||||
<el-button link type="primary" size="large" @click="viewClick(scope.row.id)"
|
||||
>查看</el-button
|
||||
>
|
||||
<el-popconfirm
|
||||
width="220"
|
||||
confirm-button-text="是"
|
||||
@@ -30,6 +37,9 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-dialog v-model="visible" width="60%">
|
||||
<detail-components :taskData="taskData"></detail-components>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -39,13 +49,15 @@ export default {
|
||||
name: 'TodoPage',
|
||||
data() {
|
||||
return {
|
||||
tableData: []
|
||||
tableData: [],
|
||||
visible: false,
|
||||
taskData: [],
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(deadline) {
|
||||
console.log(new Date(deadline).toLocaleString())
|
||||
return new Date(deadline).toLocaleString()
|
||||
formatDate(time) {
|
||||
return new Date(time).toLocaleString()
|
||||
},
|
||||
completeConfirmEvent(row) {
|
||||
const userWork = {
|
||||
@@ -65,14 +77,30 @@ export default {
|
||||
axios
|
||||
.get('http://localhost:8621/work/todo/1652714496280469506')
|
||||
.then((response) => {
|
||||
console.log(response.data.data)
|
||||
this.tableData = response.data.data
|
||||
console.log(this.tableData)
|
||||
if (this.taskData) {
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
})
|
||||
},
|
||||
getTaskData(workId) {
|
||||
console.log(workId)
|
||||
axios
|
||||
.get('http://localhost:8621/work/' + workId)
|
||||
.then((response) => {
|
||||
console.log(response.data.data)
|
||||
this.taskData = response.data.data
|
||||
console.log(this.tableData)
|
||||
return true
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
return false
|
||||
})
|
||||
},
|
||||
setTaskStatus(userWork) {
|
||||
console.log(userWork)
|
||||
axios
|
||||
@@ -84,6 +112,10 @@ export default {
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
})
|
||||
},
|
||||
viewClick(workId) {
|
||||
this.getTaskData(workId)
|
||||
this.visible = true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
Reference in New Issue
Block a user