mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-04 22:41:24 +08:00
temp 2023/5/2
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
package com.cfive.pinnacle.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.cfive.pinnacle.entity.User;
|
||||
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.IWorkService;
|
||||
import com.cfive.pinnacle.service.impl.UserWorkServiceImpl;
|
||||
import com.cfive.pinnacle.service.impl.WorkServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -11,8 +25,45 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author FatttSnake
|
||||
* @since 2023-04-30
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/work")
|
||||
public class WorkController {
|
||||
@Autowired
|
||||
private WorkServiceImpl workService;
|
||||
@Autowired
|
||||
private UserWorkServiceImpl userWorkService;
|
||||
|
||||
@GetMapping
|
||||
public ResponseResult getAll() {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getAll());
|
||||
}
|
||||
|
||||
@GetMapping("/todo/{userId}")
|
||||
public ResponseResult getTodo(@PathVariable Long userId) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getTodo(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/complete/{userId}")
|
||||
public ResponseResult getComplete(@PathVariable Long userId) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getComplete(userId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public ResponseResult addWork(@RequestBody Work work) {
|
||||
System.out.println(work);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", workService.addWork(work));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseResult deleteById(@PathVariable long id) {
|
||||
System.out.println(id);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", workService.deleteByWorkId(id));
|
||||
}
|
||||
|
||||
@PutMapping("/setComplete")
|
||||
public ResponseResult updateWork(@RequestBody UserWork userWork) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", userWorkService.updateById(userWork));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -35,12 +37,14 @@ public class UserWork implements Serializable {
|
||||
* 用户
|
||||
*/
|
||||
@TableField("user_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 工作事项
|
||||
*/
|
||||
@TableField("work_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long workId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,11 @@ import com.baomidou.mybatisplus.annotation.Version;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -30,6 +34,7 @@ public class Work implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId("id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -44,6 +49,9 @@ public class Work implements Serializable {
|
||||
@TableField("publisher_id")
|
||||
private Long publisherId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String publisherName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@@ -81,4 +89,10 @@ public class Work implements Serializable {
|
||||
@TableField("version")
|
||||
@Version
|
||||
private Integer version;
|
||||
@TableField(exist = false)
|
||||
private List<UserWork> userWorkList;
|
||||
@TableField(exist = false)
|
||||
private List<User> worker;
|
||||
@TableField(exist = false)
|
||||
private double progress;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.cfive.pinnacle.entity.Work;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 工作事项 Mapper 接口
|
||||
@@ -14,5 +16,10 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface WorkMapper extends BaseMapper<Work> {
|
||||
List<Work> getAll();
|
||||
|
||||
List<Work> getTodo(Long userId);
|
||||
|
||||
List<Work> getComplete(Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.cfive.pinnacle.service;
|
||||
import com.cfive.pinnacle.entity.Work;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 工作事项 服务类
|
||||
@@ -12,5 +14,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @since 2023-04-30
|
||||
*/
|
||||
public interface IWorkService extends IService<Work> {
|
||||
List<Work> getAll();
|
||||
List<Work> getTodo(Long userId);
|
||||
List<Work> getComplete(Long userId);
|
||||
|
||||
double getProgress(Long workId);
|
||||
|
||||
String getUserName(Long userId);
|
||||
boolean addWork(Work work);
|
||||
boolean deleteByWorkId(Long wid);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,5 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class UserWorkServiceImpl extends ServiceImpl<UserWorkMapper, UserWork> implements IUserWorkService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
package com.cfive.pinnacle.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cfive.pinnacle.entity.User;
|
||||
import com.cfive.pinnacle.entity.UserWork;
|
||||
import com.cfive.pinnacle.entity.Work;
|
||||
import com.cfive.pinnacle.mapper.UserMapper;
|
||||
import com.cfive.pinnacle.mapper.UserWorkMapper;
|
||||
import com.cfive.pinnacle.mapper.WorkMapper;
|
||||
import com.cfive.pinnacle.service.IWorkService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 工作事项 服务实现类
|
||||
@@ -16,5 +24,74 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IWorkService {
|
||||
@Autowired
|
||||
private WorkMapper workMapper;
|
||||
@Autowired
|
||||
private UserWorkMapper userWorkMapper;
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
@Override
|
||||
public List<Work> getAll() {
|
||||
List<Work> workList = workMapper.getAll();
|
||||
for (Work work:
|
||||
workList) {
|
||||
work.setProgress(getProgress(work.getId()));
|
||||
work.setPublisherName(getUserName(work.getPublisherId()));
|
||||
}
|
||||
return workList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Work> getTodo(Long userId) {
|
||||
return workMapper.getTodo(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Work> getComplete(Long userId) {
|
||||
return workMapper.getComplete(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(Long workId) {
|
||||
double workNum = userWorkMapper.selectCount(new QueryWrapper<UserWork>().eq("work_id",workId));
|
||||
double completeNum = userWorkMapper.selectCount(new QueryWrapper<UserWork>().eq("work_id",workId).eq("status",1));
|
||||
double progress = 0;
|
||||
progress = (completeNum / workNum) * 100;
|
||||
return progress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserName(Long userId) {
|
||||
return userMapper.selectById(userId).getUsername();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addWork(Work work) {
|
||||
boolean flag = false;
|
||||
if (workMapper.insert(work) > 0) {
|
||||
flag = true;
|
||||
}
|
||||
long workId = work.getId();
|
||||
for (User user :
|
||||
work.getWorker()) {
|
||||
UserWork userWork = new UserWork();
|
||||
userWork.setWorkId(workId);
|
||||
userWork.setUserId(user.getId());
|
||||
if (userWorkMapper.insert(userWork) <= 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteByWorkId(Long workId) {
|
||||
boolean flag = false;
|
||||
if (userWorkMapper.delete(new QueryWrapper<UserWork>().eq("work_id", workId)) > 0 && workMapper.deleteById(workId) > 0) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cfive.pinnacle.mapper.WorkMapper">
|
||||
<resultMap id="workMap" type="work">
|
||||
<id property="id" column="id"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="publisherId" column="publisher_id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="deadline" column="deadline"/>
|
||||
<collection property="userWorkList" ofType="userWork">
|
||||
<result property="status" column="status"/>
|
||||
</collection>
|
||||
<collection property="worker" ofType="user">
|
||||
<id property="id" column="worker_id"/>
|
||||
<result property="username" column="worker_name"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="getAll" 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 = tuw.work_id
|
||||
and tuw.user_id = u.id
|
||||
and w.deleted = 0
|
||||
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>
|
||||
<select id="getTodo" 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 = tuw.work_id
|
||||
and tuw.user_id = u.id
|
||||
and tuw.user_id = #{userId}
|
||||
and status = false
|
||||
and w.deleted = 0
|
||||
and tuw.deleted = 0
|
||||
order by u.id desc;
|
||||
</select>
|
||||
<select id="getComplete" 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 = tuw.work_id
|
||||
and tuw.user_id = u.id
|
||||
and tuw.user_id = #{userId}
|
||||
and status = true
|
||||
and w.deleted = 0
|
||||
and tuw.deleted = 0
|
||||
order by u.id desc;
|
||||
</select>
|
||||
<delete id="deleteWorkById" parameterType="int">
|
||||
delete
|
||||
from t_task
|
||||
where id = #{id};
|
||||
</delete>
|
||||
<delete id="deleteWork" parameterType="list">
|
||||
delete
|
||||
from t_task
|
||||
<where>
|
||||
<foreach collection="list" item="id" open="id in(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</where>
|
||||
</delete>
|
||||
<update id="updateWork" parameterType="Work">
|
||||
update t_task
|
||||
<set>
|
||||
<if test="publisher_id!=null and publisher_id!=0">
|
||||
publisher_id = #{publisher_id}
|
||||
</if>
|
||||
<if test="taskStatus!=null">
|
||||
task_status=#{taskStatus}
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id};
|
||||
</update>
|
||||
<select id="getOneById" resultMap="workMap">
|
||||
select id, user_id, userName, task_content, create_time, deadline, task_status
|
||||
from t_task,
|
||||
t_user
|
||||
where user_id = userID
|
||||
and id = #{id};
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
.main {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
width: 98vw;
|
||||
width: 100vw;
|
||||
min-width: 600px;
|
||||
min-height: 600px;
|
||||
text-align: center;
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
:data="taskData"
|
||||
border
|
||||
>
|
||||
<el-descriptions-item label="创建者ID">{{ taskData.publisher_id }}</el-descriptions-item>
|
||||
<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="结束时间">{{ 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.taskContent }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作信息">{{ taskData.content }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
@@ -23,12 +23,12 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
taskData: {
|
||||
publisher_id: '1',
|
||||
publisherId: '1',
|
||||
createTime: '1',
|
||||
deadLine: '1',
|
||||
taskStatus: false,
|
||||
deadline: '1',
|
||||
status: false,
|
||||
worker: '',
|
||||
taskContent: '213'
|
||||
content: '213'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,30 +6,29 @@
|
||||
multiple
|
||||
filterable
|
||||
:reserve-keyword="false"
|
||||
value-key="userID"
|
||||
value-key="username"
|
||||
placeholder="选择相对应的工作人员"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in workers"
|
||||
:key="item.userID"
|
||||
:label="item.userName"
|
||||
:key="item.userId"
|
||||
:label="item.username"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="终止时间" prop="deadLine">
|
||||
<el-form-item label="终止时间" prop="deadline">
|
||||
<el-col :span="11">
|
||||
<el-date-picker
|
||||
v-model="form.deadLine"
|
||||
v-model="form.deadline"
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
placeholder="请选择时间"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作内容" prop="taskContent">
|
||||
<el-input v-model="form.taskContent" type="textarea" />
|
||||
<el-form-item label="工作内容" prop="content">
|
||||
<el-input v-model="form.content" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit(form)">创建</el-button>
|
||||
@@ -45,16 +44,16 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
publisher_id: '',
|
||||
publisherId: '',
|
||||
createTime: '',
|
||||
deadLine: '',
|
||||
taskContent: '',
|
||||
deadline: '',
|
||||
content: '',
|
||||
worker: []
|
||||
},
|
||||
workers: [
|
||||
{
|
||||
userID: '',
|
||||
userName: ''
|
||||
userId: '',
|
||||
username: ''
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
@@ -64,14 +63,14 @@ export default {
|
||||
message: '请选择相应的工作人员'
|
||||
}
|
||||
],
|
||||
deadLine: [
|
||||
deadline: [
|
||||
{
|
||||
type: 'date',
|
||||
required: true,
|
||||
message: '请输入终止日期'
|
||||
}
|
||||
],
|
||||
taskContent: [
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入工作内容'
|
||||
@@ -83,10 +82,10 @@ export default {
|
||||
methods: {
|
||||
getFormData() {
|
||||
axios
|
||||
.get('http://localhost:8080/user')
|
||||
.get('http://localhost:8621/user')
|
||||
.then((response) => {
|
||||
console.log(response.data)
|
||||
this.workers = response.data
|
||||
console.log(response.data.data)
|
||||
this.workers = response.data.data
|
||||
console.log(this.workers)
|
||||
})
|
||||
.catch((reportError) => {
|
||||
@@ -96,7 +95,7 @@ export default {
|
||||
addWork(form) {
|
||||
console.log(form)
|
||||
axios
|
||||
.post('http://localhost:8080/work', form)
|
||||
.post('http://localhost:8621/work', form)
|
||||
.then((response) => {
|
||||
console.log(response.data)
|
||||
})
|
||||
@@ -108,9 +107,9 @@ export default {
|
||||
//表单校验
|
||||
this.$refs.ruleForm.validate((value) => {
|
||||
if (value) {
|
||||
form.createTime = new Date().getTime().toString()
|
||||
console.log(form)
|
||||
form.publisher_id = String(1)
|
||||
console.log(form.deadline)
|
||||
form.createTime = new Date()
|
||||
form.publisherId = String(1)
|
||||
this.addWork(form)
|
||||
this.$emit('setDialogVisible', false)
|
||||
console.log('submit!')
|
||||
|
||||
@@ -2,28 +2,30 @@
|
||||
<div class="main">
|
||||
<div class="main-table">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column fixed prop="id" label="工作事项ID" width="150" />
|
||||
<el-table-column prop="publisher_id" label="发布者ID" width="120" />
|
||||
<el-table-column prop="taskContent" label="内容" width="800" />
|
||||
<el-table-column prop="content" label="内容" width="800" />
|
||||
<el-table-column prop="publisherName" label="发布者ID" 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 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">
|
||||
{{ formatDate(scope.row.deadLine) }}
|
||||
{{ formatDate(scope.row.deadline) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskStatus" label="状态" width="150" />
|
||||
<el-table-column prop="progress" label="进度" width="250">
|
||||
<template #default>
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="70" />
|
||||
<el-table-column fixed="right" prop="progress" label="进度" width="200">
|
||||
<template #default="scope">
|
||||
<el-progress
|
||||
:text-inside="true"
|
||||
:stroke-width="15"
|
||||
:percentage="scope.row.progress"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="240">
|
||||
<el-table-column fixed="right" label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" size="large" @click="handleClick"
|
||||
>编辑</el-button
|
||||
@@ -42,20 +44,20 @@
|
||||
<el-button link type="primary" size="default">删除</el-button>
|
||||
</template>
|
||||
</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>
|
||||
<!-- <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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -84,9 +86,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(deadLine) {
|
||||
console.log(new Date(deadLine).toLocaleString())
|
||||
return new Date(deadLine).toLocaleString()
|
||||
formatDate(deadline) {
|
||||
console.log(new Date(deadline).toLocaleString())
|
||||
return new Date(deadline).toLocaleString()
|
||||
},
|
||||
handleClick() {
|
||||
console.log('click')
|
||||
@@ -107,10 +109,10 @@ export default {
|
||||
},
|
||||
getTableData() {
|
||||
axios
|
||||
.get('http://localhost:8080/work')
|
||||
.get('http://localhost:8621/work')
|
||||
.then((response) => {
|
||||
console.log(response.data)
|
||||
this.tableData = response.data
|
||||
console.log(response.data.data)
|
||||
this.tableData = response.data.data
|
||||
console.log(this.tableData)
|
||||
})
|
||||
.catch((reportError) => {
|
||||
@@ -119,9 +121,9 @@ export default {
|
||||
},
|
||||
deleteTableData(row) {
|
||||
axios
|
||||
.delete('http://localhost:8080/work/' + row.id)
|
||||
.delete('http://localhost:8621/work/' + row.id)
|
||||
.then((response) => {
|
||||
console.log(response.data)
|
||||
console.log(response.data.data)
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<div class="main-table">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column fixed prop="id" label="工作事项ID" width="150" />
|
||||
<el-table-column prop="publisher_id" label="发布者ID" width="120" />
|
||||
<el-table-column prop="taskContent" label="内容" width="800" />
|
||||
<el-table-column prop="publisherId" label="发布者ID" width="120" />
|
||||
<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">
|
||||
@@ -12,9 +12,9 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deadLine" label="结束时间" width="200">
|
||||
<el-table-column prop="deadline" label="结束时间" width="200">
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.deadLine) }}
|
||||
{{ formatDate(scope.row.deadline) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="240">
|
||||
@@ -52,9 +52,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(deadLine) {
|
||||
console.log(new Date(deadLine).toLocaleString())
|
||||
return new Date(deadLine).toLocaleString()
|
||||
formatDate(deadline) {
|
||||
console.log(new Date(deadline).toLocaleString())
|
||||
return new Date(deadline).toLocaleString()
|
||||
},
|
||||
todoConfirmEvent(row) {
|
||||
console.log(row)
|
||||
@@ -80,7 +80,7 @@ export default {
|
||||
setTaskTodo(row) {
|
||||
var workDo = new Object()
|
||||
workDo.id = row.id
|
||||
workDo.taskStatus = false
|
||||
workDo.status = false
|
||||
axios
|
||||
.put('http://localhost:8080/work', workDo)
|
||||
.then((response) => {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<div class="main-table">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column fixed prop="id" label="工作事项ID" width="150" />
|
||||
<el-table-column prop="publisher_id" label="发布者ID" width="120" />
|
||||
<el-table-column prop="taskContent" label="内容" width="800" />
|
||||
<el-table-column prop="publisherId" label="发布者ID" width="120" />
|
||||
<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">
|
||||
@@ -12,9 +12,9 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deadLine" label="结束时间" width="200">
|
||||
<el-table-column prop="deadline" label="结束时间" width="200">
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.deadLine) }}
|
||||
{{ formatDate(scope.row.deadline) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="240">
|
||||
@@ -51,9 +51,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(deadLine) {
|
||||
console.log(new Date(deadLine).toLocaleString())
|
||||
return new Date(deadLine).toLocaleString()
|
||||
formatDate(deadline) {
|
||||
console.log(new Date(deadline).toLocaleString())
|
||||
return new Date(deadline).toLocaleString()
|
||||
},
|
||||
completeConfirmEvent(row) {
|
||||
console.log(row)
|
||||
@@ -79,7 +79,7 @@ export default {
|
||||
setTaskComplete(row) {
|
||||
var workDo = new Object()
|
||||
workDo.id = row.id
|
||||
workDo.taskStatus = true
|
||||
workDo.status = true
|
||||
axios
|
||||
.put('http://localhost:8080/work', workDo)
|
||||
.then((response) => {
|
||||
|
||||
Reference in New Issue
Block a user