mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 06:51:23 +08:00
temp 2023/5/2
This commit is contained in:
@@ -1,7 +1,21 @@
|
|||||||
package com.cfive.pinnacle.controller;
|
package com.cfive.pinnacle.controller;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
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>
|
* <p>
|
||||||
@@ -11,8 +25,45 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
* @since 2023-04-30
|
* @since 2023-04-30
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
@RequestMapping("/work")
|
@RequestMapping("/work")
|
||||||
public class WorkController {
|
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.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;
|
||||||
|
|
||||||
@@ -35,12 +37,14 @@ public class UserWork implements Serializable {
|
|||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作事项
|
* 工作事项
|
||||||
*/
|
*/
|
||||||
@TableField("work_id")
|
@TableField("work_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long workId;
|
private Long workId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
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.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -30,6 +34,7 @@ public class Work 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +49,9 @@ public class Work implements Serializable {
|
|||||||
@TableField("publisher_id")
|
@TableField("publisher_id")
|
||||||
private Long publisherId;
|
private Long publisherId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String publisherName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@@ -81,4 +89,10 @@ public class Work implements Serializable {
|
|||||||
@TableField("version")
|
@TableField("version")
|
||||||
@Version
|
@Version
|
||||||
private Integer 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 com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 工作事项 Mapper 接口
|
* 工作事项 Mapper 接口
|
||||||
@@ -14,5 +16,10 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface WorkMapper extends BaseMapper<Work> {
|
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.cfive.pinnacle.entity.Work;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 工作事项 服务类
|
* 工作事项 服务类
|
||||||
@@ -12,5 +14,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* @since 2023-04-30
|
* @since 2023-04-30
|
||||||
*/
|
*/
|
||||||
public interface IWorkService extends IService<Work> {
|
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
|
@Service
|
||||||
public class UserWorkServiceImpl extends ServiceImpl<UserWorkMapper, UserWork> implements IUserWorkService {
|
public class UserWorkServiceImpl extends ServiceImpl<UserWorkMapper, UserWork> implements IUserWorkService {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
package com.cfive.pinnacle.service.impl;
|
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.entity.Work;
|
||||||
|
import com.cfive.pinnacle.mapper.UserMapper;
|
||||||
|
import com.cfive.pinnacle.mapper.UserWorkMapper;
|
||||||
import com.cfive.pinnacle.mapper.WorkMapper;
|
import com.cfive.pinnacle.mapper.WorkMapper;
|
||||||
import com.cfive.pinnacle.service.IWorkService;
|
import com.cfive.pinnacle.service.IWorkService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 工作事项 服务实现类
|
* 工作事项 服务实现类
|
||||||
@@ -16,5 +24,74 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IWorkService {
|
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"?>
|
<?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">
|
<!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">
|
<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>
|
</mapper>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
.main {
|
.main {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 98vw;
|
width: 100vw;
|
||||||
min-width: 600px;
|
min-width: 600px;
|
||||||
min-height: 600px;
|
min-height: 600px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
:data="taskData"
|
:data="taskData"
|
||||||
border
|
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.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="状态">
|
<el-descriptions-item label="状态">
|
||||||
<template #default> {{}} </template>
|
<template #default> {{}} </template>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="负责员工" property="worker" />
|
<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>
|
</el-descriptions>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
taskData: {
|
taskData: {
|
||||||
publisher_id: '1',
|
publisherId: '1',
|
||||||
createTime: '1',
|
createTime: '1',
|
||||||
deadLine: '1',
|
deadline: '1',
|
||||||
taskStatus: false,
|
status: false,
|
||||||
worker: '',
|
worker: '',
|
||||||
taskContent: '213'
|
content: '213'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,30 +6,29 @@
|
|||||||
multiple
|
multiple
|
||||||
filterable
|
filterable
|
||||||
:reserve-keyword="false"
|
:reserve-keyword="false"
|
||||||
value-key="userID"
|
value-key="username"
|
||||||
placeholder="选择相对应的工作人员"
|
placeholder="选择相对应的工作人员"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in workers"
|
v-for="item in workers"
|
||||||
:key="item.userID"
|
:key="item.userId"
|
||||||
:label="item.userName"
|
:label="item.username"
|
||||||
:value="item"
|
:value="item"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="终止时间" prop="deadLine">
|
<el-form-item label="终止时间" prop="deadline">
|
||||||
<el-col :span="11">
|
<el-col :span="11">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.deadLine"
|
v-model="form.deadline"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
format="YYYY-MM-DD HH:mm"
|
|
||||||
placeholder="请选择时间"
|
placeholder="请选择时间"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="工作内容" prop="taskContent">
|
<el-form-item label="工作内容" prop="content">
|
||||||
<el-input v-model="form.taskContent" 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)">创建</el-button>
|
||||||
@@ -45,16 +44,16 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
publisher_id: '',
|
publisherId: '',
|
||||||
createTime: '',
|
createTime: '',
|
||||||
deadLine: '',
|
deadline: '',
|
||||||
taskContent: '',
|
content: '',
|
||||||
worker: []
|
worker: []
|
||||||
},
|
},
|
||||||
workers: [
|
workers: [
|
||||||
{
|
{
|
||||||
userID: '',
|
userId: '',
|
||||||
userName: ''
|
username: ''
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
@@ -64,14 +63,14 @@ export default {
|
|||||||
message: '请选择相应的工作人员'
|
message: '请选择相应的工作人员'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
deadLine: [
|
deadline: [
|
||||||
{
|
{
|
||||||
type: 'date',
|
type: 'date',
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入终止日期'
|
message: '请输入终止日期'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
taskContent: [
|
content: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入工作内容'
|
message: '请输入工作内容'
|
||||||
@@ -83,10 +82,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getFormData() {
|
getFormData() {
|
||||||
axios
|
axios
|
||||||
.get('http://localhost:8080/user')
|
.get('http://localhost:8621/user')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data.data)
|
||||||
this.workers = response.data
|
this.workers = response.data.data
|
||||||
console.log(this.workers)
|
console.log(this.workers)
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
@@ -96,7 +95,7 @@ export default {
|
|||||||
addWork(form) {
|
addWork(form) {
|
||||||
console.log(form)
|
console.log(form)
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:8080/work', form)
|
.post('http://localhost:8621/work', form)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data)
|
||||||
})
|
})
|
||||||
@@ -108,9 +107,9 @@ export default {
|
|||||||
//表单校验
|
//表单校验
|
||||||
this.$refs.ruleForm.validate((value) => {
|
this.$refs.ruleForm.validate((value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
form.createTime = new Date().getTime().toString()
|
console.log(form.deadline)
|
||||||
console.log(form)
|
form.createTime = new Date()
|
||||||
form.publisher_id = String(1)
|
form.publisherId = String(1)
|
||||||
this.addWork(form)
|
this.addWork(form)
|
||||||
this.$emit('setDialogVisible', false)
|
this.$emit('setDialogVisible', false)
|
||||||
console.log('submit!')
|
console.log('submit!')
|
||||||
|
|||||||
@@ -2,28 +2,30 @@
|
|||||||
<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 prop="content" label="内容" width="800" />
|
||||||
<el-table-column prop="publisher_id" label="发布者ID" width="120" />
|
<el-table-column prop="publisherName" label="发布者ID" width="120" />
|
||||||
<el-table-column prop="taskContent" label="内容" width="800" />
|
|
||||||
<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">
|
||||||
{{ item.userName }},
|
{{ item.username }},
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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 prop="taskStatus" label="状态" width="150" />
|
<el-table-column fixed="right" prop="progress" label="进度" width="200">
|
||||||
<el-table-column prop="progress" label="进度" width="250">
|
<template #default="scope">
|
||||||
<template #default>
|
<el-progress
|
||||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="70" />
|
:text-inside="true"
|
||||||
|
:stroke-width="15"
|
||||||
|
:percentage="scope.row.progress"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" width="240">
|
<el-table-column fixed="right" label="操作" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" size="large" @click="handleClick"
|
<el-button link type="primary" size="large" @click="handleClick"
|
||||||
>编辑</el-button
|
>编辑</el-button
|
||||||
@@ -42,20 +44,20 @@
|
|||||||
<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
|
<!-- <el-popconfirm-->
|
||||||
width="220"
|
<!-- width="220"-->
|
||||||
confirm-button-text="是"
|
<!-- confirm-button-text="是"-->
|
||||||
cancel-button-text="否"
|
<!-- cancel-button-text="否"-->
|
||||||
:icon="InfoFilled"
|
<!-- :icon="InfoFilled"-->
|
||||||
icon-color="#00d4ff"
|
<!-- icon-color="#00d4ff"-->
|
||||||
title="是否确认完成?"
|
<!-- title="是否确认完成?"-->
|
||||||
@confirm="completeConfirmEvent"
|
<!-- @confirm="completeConfirmEvent"-->
|
||||||
@cancel="completeCancelEvent"
|
<!-- @cancel="completeCancelEvent"-->
|
||||||
>
|
<!-- >-->
|
||||||
<template #reference>
|
<!-- <template #reference>-->
|
||||||
<el-button link type="primary" size="default">完成</el-button>
|
<!-- <el-button link type="primary" size="default">完成</el-button>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-popconfirm>
|
<!-- </el-popconfirm>-->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -84,9 +86,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(deadLine) {
|
formatDate(deadline) {
|
||||||
console.log(new Date(deadLine).toLocaleString())
|
console.log(new Date(deadline).toLocaleString())
|
||||||
return new Date(deadLine).toLocaleString()
|
return new Date(deadline).toLocaleString()
|
||||||
},
|
},
|
||||||
handleClick() {
|
handleClick() {
|
||||||
console.log('click')
|
console.log('click')
|
||||||
@@ -107,10 +109,10 @@ export default {
|
|||||||
},
|
},
|
||||||
getTableData() {
|
getTableData() {
|
||||||
axios
|
axios
|
||||||
.get('http://localhost:8080/work')
|
.get('http://localhost:8621/work')
|
||||||
.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) => {
|
||||||
@@ -119,9 +121,9 @@ export default {
|
|||||||
},
|
},
|
||||||
deleteTableData(row) {
|
deleteTableData(row) {
|
||||||
axios
|
axios
|
||||||
.delete('http://localhost:8080/work/' + row.id)
|
.delete('http://localhost:8621/work/' + row.id)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data.data)
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
console.log(reportError)
|
console.log(reportError)
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<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="id" label="工作事项ID" width="150" />
|
||||||
<el-table-column prop="publisher_id" label="发布者ID" width="120" />
|
<el-table-column prop="publisherId" label="发布者ID" width="120" />
|
||||||
<el-table-column prop="taskContent" label="内容" width="800" />
|
<el-table-column prop="content" label="内容" width="800" />
|
||||||
<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">
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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="240">
|
||||||
@@ -52,9 +52,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(deadLine) {
|
formatDate(deadline) {
|
||||||
console.log(new Date(deadLine).toLocaleString())
|
console.log(new Date(deadline).toLocaleString())
|
||||||
return new Date(deadLine).toLocaleString()
|
return new Date(deadline).toLocaleString()
|
||||||
},
|
},
|
||||||
todoConfirmEvent(row) {
|
todoConfirmEvent(row) {
|
||||||
console.log(row)
|
console.log(row)
|
||||||
@@ -80,7 +80,7 @@ export default {
|
|||||||
setTaskTodo(row) {
|
setTaskTodo(row) {
|
||||||
var workDo = new Object()
|
var workDo = new Object()
|
||||||
workDo.id = row.id
|
workDo.id = row.id
|
||||||
workDo.taskStatus = false
|
workDo.status = false
|
||||||
axios
|
axios
|
||||||
.put('http://localhost:8080/work', workDo)
|
.put('http://localhost:8080/work', workDo)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<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="id" label="工作事项ID" width="150" />
|
||||||
<el-table-column prop="publisher_id" label="发布者ID" width="120" />
|
<el-table-column prop="publisherId" label="发布者ID" width="120" />
|
||||||
<el-table-column prop="taskContent" label="内容" width="800" />
|
<el-table-column prop="content" label="内容" width="800" />
|
||||||
<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">
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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="240">
|
||||||
@@ -51,9 +51,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(deadLine) {
|
formatDate(deadline) {
|
||||||
console.log(new Date(deadLine).toLocaleString())
|
console.log(new Date(deadline).toLocaleString())
|
||||||
return new Date(deadLine).toLocaleString()
|
return new Date(deadline).toLocaleString()
|
||||||
},
|
},
|
||||||
completeConfirmEvent(row) {
|
completeConfirmEvent(row) {
|
||||||
console.log(row)
|
console.log(row)
|
||||||
@@ -79,7 +79,7 @@ export default {
|
|||||||
setTaskComplete(row) {
|
setTaskComplete(row) {
|
||||||
var workDo = new Object()
|
var workDo = new Object()
|
||||||
workDo.id = row.id
|
workDo.id = row.id
|
||||||
workDo.taskStatus = true
|
workDo.status = true
|
||||||
axios
|
axios
|
||||||
.put('http://localhost:8080/work', workDo)
|
.put('http://localhost:8080/work', workDo)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user