From 5efcdf6681b1c9d813c8ebecd332ccafe1a5c002 Mon Sep 17 00:00:00 2001
From: zhc077 <565291854>
Date: Mon, 26 Jun 2023 09:47:38 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=AE=A1=E7=90=86=20?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=206.25?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/mixins/JeecgListMixin.js | 7 +
.../src/views/projectx/ProjectxList.vue | 4 +-
.../views/projectx/modules/ProjectxForm.vue | 54 ++++----
.../src/views/task/TaskList.vue | 54 ++++++--
.../src/views/task/modules/TaskForm.vue | 127 +++++-------------
.../task/controller/TaskController.java | 17 +++
.../org/jeecg/modules/task/entity/Task.java | 4 +
7 files changed, 132 insertions(+), 135 deletions(-)
diff --git a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
index de07a8e..eb9e938 100644
--- a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
+++ b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
@@ -296,6 +296,13 @@ export const JeecgListMixin = {
this.$refs.modalForm.title = "复制";
this.$refs.modalForm.disableSubmit = false;
},
+ // 任务管理-任务-分解
+ fengjieRenwu: function (record) {
+ record.fuzhi = true;
+ this.$refs.modalForm.edit(record);
+ this.$refs.modalForm.title = "分解";
+ this.$refs.modalForm.disableSubmit = false;
+ },
handleAdd: function () {
this.$refs.modalForm.add();
this.$refs.modalForm.title = "新增";
diff --git a/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue b/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue
index 37af1a8..ed1018a 100644
--- a/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue
+++ b/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue
@@ -151,13 +151,13 @@ export default {
title: '项目中文名称',
align: "center",
dataIndex: 'projectName',
- customRender: (t) => ellipsis(t)
+ // customRender: (t) => ellipsis(t)
},
{
title: '项目英文名称',
align: "center",
dataIndex: 'projectEnName',
- customRender: (t) => ellipsis(t)
+ // customRender: (t) => ellipsis(t)
},
{
title: '项目编码',
diff --git a/ant-design-vue-jeecg/src/views/projectx/modules/ProjectxForm.vue b/ant-design-vue-jeecg/src/views/projectx/modules/ProjectxForm.vue
index 102b938..eabdf36 100644
--- a/ant-design-vue-jeecg/src/views/projectx/modules/ProjectxForm.vue
+++ b/ant-design-vue-jeecg/src/views/projectx/modules/ProjectxForm.vue
@@ -18,17 +18,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -70,22 +70,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -163,7 +161,7 @@ export default {
},
edit(record) {
this.model = Object.assign({}, record);
- if (this.model.fuzhi){
+ if (this.model.fuzhi) {
this.model.sourceProjectId = this.model.id;
this.model.id = null;
this.model.projectName = this.model.projectName + '+1';
diff --git a/ant-design-vue-jeecg/src/views/task/TaskList.vue b/ant-design-vue-jeecg/src/views/task/TaskList.vue
index 5ac2e1b..c23913d 100644
--- a/ant-design-vue-jeecg/src/views/task/TaskList.vue
+++ b/ant-design-vue-jeecg/src/views/task/TaskList.vue
@@ -69,30 +69,31 @@
-
-
-
-
@@ -105,8 +106,7 @@ import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import TaskModal from './modules/TaskModal'
// import {colAuthFilter} from "@/utils/authFilter"
-import {getAction} from "@api/manage";
-import {putAction} from "@api/manage";
+import {putAction, postAction} from "@api/manage";
export default {
@@ -133,7 +133,12 @@ export default {
{
title: '中文名称',
align: "center",
- dataIndex: 'taskName'
+ dataIndex: 'taskName',
+ },
+ {
+ title: '上级任务',
+ align: "center",
+ dataIndex: 'upperTaskName',
},
{
title: '任务层级',
@@ -252,11 +257,14 @@ export default {
delete: "/task/task/delete",
deleteBatch: "/task/task/deleteBatch",
updateWorkStatus: "/task/task/updateWorkStatus",
+ fengjie: "/task/task/fengjie",
exportXlsUrl: "/task/task/exportXls",
},
dictOptions: {},
superFieldList: [],
curryUserName: '',
+ mdl: {},
+
}
},
created() {
@@ -288,6 +296,30 @@ export default {
}
})
},
+ fengjie (record) {
+ this.mdl = Object.assign({}, record)
+ this.mdl.permissions.forEach(permission => {
+ permission.actionsOptions = permission.actionEntitySet.map(action => {
+ return { label: action.describe, value: action.action, defaultCheck: action.defaultCheck }
+ })
+ })
+
+ console.log(this.mdl)
+ this.visible = true
+ },
+ // fengjie(record) {
+ // let params = {
+ // id: record.id,
+ // }
+ // postAction(this.url.fengjie, params).then((res) => {
+ // if (res.success) {
+ // this.$message.success(res.result);
+ // this.loadData();
+ // } else {
+ // this.$message.warning(res.message);
+ // }
+ // })
+ // },
}
}
diff --git a/ant-design-vue-jeecg/src/views/task/modules/TaskForm.vue b/ant-design-vue-jeecg/src/views/task/modules/TaskForm.vue
index 820bf3f..f2212eb 100644
--- a/ant-design-vue-jeecg/src/views/task/modules/TaskForm.vue
+++ b/ant-design-vue-jeecg/src/views/task/modules/TaskForm.vue
@@ -12,30 +12,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -48,10 +31,15 @@
-
-
+
+
+
+
+
@@ -259,11 +247,13 @@ export default {
this.currentNodeData.id = data.id
this.$refs.treeList.setCheckedNodes([data.id])
}
- },
+ }
+ ,
changetree(data, lst) {
if (lst, checkedKeys.lenght == 0)
this.$refs.treeList.setCheckedNodes([data.id])
- },
+ }
+ ,
fillTaskName() {
let that = this;
let fillTaskName = "";
@@ -278,13 +268,18 @@ export default {
fillTaskName = res.result;
let projectNum = this.getProjectNum() + Math.floor(Math.random() * 10000) // 如果是6位或者8位随机数,相应的 *1000000或者 *100000000就行了
// console.log("------------projectNum,", projectNum)
- Object.assign(that.model, {'taskName': fillTaskName + "-" + projectNum});
- Object.assign(that.model, {'managerUsers': userInfo.id});
- this.$forceUpdate();
+ // Object.assign(that.model, {'taskName': fillTaskName + "-" + projectNum});
+ // Object.assign(that.model, {'managerUsers': userInfo.id});
+ // this.$forceUpdate();
+
+ //填充后可编辑
+ this.$set(that.model, 'taskName', fillTaskName + "-" + projectNum);
+ this.$set(that.model, 'managerUsers', userInfo.id);
}
});
}
- },
+ }
+ ,
// 获取当前日期的方法
getProjectNum() {
@@ -304,7 +299,8 @@ export default {
CurrentDate += '0' + Day
}
return CurrentDate
- },
+ }
+ ,
add() {
this.edit(this.modelDefault);
@@ -312,6 +308,13 @@ export default {
,
edit(record) {
this.model = Object.assign({}, record);
+ if (this.model.fuzhi) {
+ this.model.upperId = this.model.id;
+ this.model.id = '';
+ this.model.taskName = this.fillTaskName();
+ this.model.createTime = new Date(+new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
+ this.model.updateTime = new Date(+new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
+ }
console.log('this.model-------', this.model)
this.visible = true;
}
@@ -342,73 +345,9 @@ export default {
that.confirmLoading = false;
})
}
-
})
- },
- // currentTime() {
- // var date = new Date();
- // var year = date.getFullYear(); //月份从0~11,所以加一
- // let month = date.getMonth();
- // // console.log("month",month);
- // var dateArr = [
- // date.getMonth() + 1,
- // date.getDate(),
- // date.getHours(),
- // date.getMinutes(),
- // date.getSeconds(),
- // ];
- // //如果格式是MM则需要此步骤,如果是M格式则此循环注释掉
- // for (var i = 0; i < dateArr.length; i++) {
- // if (dateArr[i] >= 1 && dateArr[i] <= 9) {
- // dateArr[i] = "0" + dateArr[i];
- // }
- // }
- // var strDate =
- // year +
- // "-" +
- // dateArr[0] +
- // "-" +
- // dateArr[1] +
- // " " +
- // dateArr[2] +
- // ":" +
- // dateArr[3] +
- // ":" +
- // dateArr[4];
- // //此处可以拿外部的变量接收 strDate:2022-05-01 13:25:30
- // this.model.startTime = strDate;
- // this.model.expectedEndTime = strDate;
- // console.log("strDate", strDate);
- // },
- loadData2() {
- // if (!this.url.list) {
- // this.$message.error("请设置url.list属性!");
- // return
- // }
- // //加载数据 若传入参数1则加载第一页的内容
- // if (arg === 1) {
- // this.ipagination.current = 1;
- // }
- // this.loadParameter();
- // var params = this.getQueryParams();//查询条件
- this.loading = true;
- getAction(this.url.list, params).then((res) => {
- if (res.success) {
- //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
- this.dataSource = res.result.records || res.result;
- if (res.result.total) {
- this.ipagination.total = res.result.total;
- } else {
- this.ipagination.total = 0;
- }
- //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
- } else {
- this.$message.warning(res.message)
- }
- }).finally(() => {
- this.loading = false
- })
- },
+ }
+ ,
}
}
\ No newline at end of file
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
index 27e08ad..90e622d 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
@@ -8,10 +8,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
@@ -26,6 +28,7 @@ import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.projectx.service.IProjectxService;
import org.jeecg.modules.task.entity.Task;
import org.jeecg.modules.task.service.ITaskService;
+import org.jeecg.modules.taskType.entity.TaskType;
import org.jeecg.modules.taskType.service.ITaskTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -37,6 +40,7 @@ import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
+import java.util.Optional;
/**
* @Description: 任务管理
@@ -93,6 +97,7 @@ public class TaskController extends JeecgController {
if (!StringUtils.equals(ADMIN, user.getUsername())) {
queryWrapper.like("manager_users", user.getId());
}
+ queryWrapper.orderByDesc("create_time");
IPage pageList = taskService.page(page, queryWrapper);
pageList.getRecords().stream().forEach(e -> {
String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT));
@@ -113,6 +118,12 @@ public class TaskController extends JeecgController {
Rulex rulex = iRulexService.getById(e.getRuleId());
e.setUnion(e.getUnion() + "-" + rulex.getRuleCode());
}
+ if (StringUtils.isNotBlank(e.getUpperId())) {
+ Task taskUpper = taskService.getById(e.getUpperId());
+ if (ObjectUtils.isNotEmpty(taskUpper)) {
+ e.setUpperTaskName(taskUpper.getTaskName());
+ }
+ }
});
return Result.OK(pageList);
}
@@ -167,6 +178,12 @@ public class TaskController extends JeecgController {
@ApiOperation(value = "任务管理-通过id删除", notes = "任务管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result> delete(@RequestParam(name = "id", required = true) String id) {
+ Task task = taskService.getById(id);
+ Optional.ofNullable(task).orElseThrow(() -> new JeecgBootException(id + ":任务不存在"));
+ int count = taskService.count(new LambdaQueryWrapper().eq(Task::getUpperId, task.getId()));
+ if (count > 0) {
+ throw new JeecgBootException("存在子任务暂不可删除");
+ }
taskService.removeById(id);
return Result.OK("删除成功!");
}
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java
index 72f392a..ff02175 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java
@@ -72,6 +72,10 @@ public class Task implements Serializable {
@Excel(name = "中文名称", width = 15)
@ApiModelProperty(value = "中文名称")
private java.lang.String taskName;
+
+ @TableField(exist = false)
+ @ApiModelProperty(value = "上级任务名称")
+ private java.lang.String upperTaskName;
/**
* 任务层级
*/