From 842cb6bd6b2ab53bedde440c68e6ee4e981189ba Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 14 Jan 2022 22:26:03 +0800 Subject: [PATCH] =?UTF-8?q?BPM=20=E6=A8=A1=E5=9E=8B=E9=87=8D=E6=9E=84=207?= =?UTF-8?q?=EF=BC=9A=E5=B0=86=E4=BB=BB=E5=8A=A1=E5=88=86=E9=85=8D=E8=A7=84?= =?UTF-8?q?=E5=88=99=EF=BC=8C=E5=88=86=E8=A3=85=E6=88=90=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/BpmTaskAssignRuleTypeEnum.java | 1 + yudao-admin-ui/src/views/bpm/model/index.vue | 199 +------------- .../taskAssignRule/taskAssignRuleDialog.vue | 242 ++++++++++++++++++ 3 files changed, 248 insertions(+), 194 deletions(-) create mode 100644 yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskAssignRuleTypeEnum.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskAssignRuleTypeEnum.java index 8af184448..8b3d8e48f 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskAssignRuleTypeEnum.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskAssignRuleTypeEnum.java @@ -16,6 +16,7 @@ public enum BpmTaskAssignRuleTypeEnum { DEPT_MEMBER(20, "部门的成员"), // 包括负责人 DEPT_LEADER(21, "部门的负责人"), + POST(22, "岗位"), USER(30, "用户"), diff --git a/yudao-admin-ui/src/views/bpm/model/index.vue b/yudao-admin-ui/src/views/bpm/model/index.vue index e0ac0aa73..ad5250f7e 100644 --- a/yudao-admin-ui/src/views/bpm/model/index.vue +++ b/yudao-admin-ui/src/views/bpm/model/index.vue @@ -200,61 +200,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -273,9 +219,7 @@ import {getForm, getSimpleForms} from "@/api/bpm/form"; import {decodeFields} from "@/utils/formGenerator"; import Parser from '@/components/parser/Parser' import {getBaseHeader} from "@/utils/request"; -import {createTaskAssignRule, getTaskAssignRuleList, updateTaskAssignRule} from "@/api/bpm/taskAssignRule"; -import {listSimpleRoles} from "@/api/system/role"; -import {listSimpleDepts} from "@/api/system/dept"; +import taskAssignRuleDialog from "../taskAssignRule/taskAssignRuleDialog"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; @@ -284,7 +228,8 @@ export default { name: "model", components: { Parser, - Treeselect + Treeselect, + taskAssignRuleDialog }, data() { return { @@ -329,25 +274,6 @@ export default { formCustomViewPath: [{ required: true, message: "表单查看路由不能为空", trigger: "blur" }], }, - // 任务分配规则表单 - taskAssignRule: { - row: undefined, // 选中的流程模型 - list: [], // 选中流程模型的任务分配规则们 - listOpen: false, // 列表是否打开 - loading: false, // 加载中 - open: false, // 是否打开 - form: {}, // 表单 - rules: { // 表单校验规则 - type: [{ required: true, message: "规则类型不能为空", trigger: "change" }], - roleIds: [{required: true, message: "指定角色不能为空", trigger: "change" }], - deptIds: [{required: true, message: "指定部门不能为空", trigger: "change" }], - }, - // 各种下拉框 - roleOptions: [], - deptOptions: [], - deptTreeOptions: [], - }, - // 流程导入参数 upload: { // 是否显示弹出层(用户导入) @@ -600,125 +526,10 @@ export default { this.$refs.upload.submit(); }) }, - // ========== ========== - doGetTaskAssignRuleList() { - this.taskAssignRule.loading = true; - getTaskAssignRuleList({ - modelId: this.taskAssignRule.row.id - }).then(response => { - this.taskAssignRule.loading = false; - this.taskAssignRule.list = response.data; - }) - }, /** 处理任务分配规则列表的按钮操作 */ handleAssignRule(row) { - this.taskAssignRule.row = row; - this.taskAssignRule.listOpen = true; - this.doGetTaskAssignRuleList(); - // 获得角色列表 - this.taskAssignRule.roleOptions = []; - listSimpleRoles().then(response => { - this.taskAssignRule.roleOptions.push(...response.data); - }); - // 获得部门列表 - this.taskAssignRule.deptOptions = []; - this.taskAssignRule.deptTreeOptions = []; - listSimpleDepts().then(response => { - // 处理 roleOptions 参数 - this.taskAssignRule.deptOptions.push(...response.data); - this.taskAssignRule.deptTreeOptions.push(...this.handleTree(response.data, "id")); - }); + this.$refs['taskAssignRuleDialog'].initModel(row.id); }, - /** 处理修改任务分配规则的按钮操作 */ - handleUpdateTaskAssignRule(row) { - // 先重置标识 - this.resetAssignRuleForm(); - // 设置表单 - this.taskAssignRule.form = { - ...row, - options: [], - roleIds: [], - deptIds: [], - }; - // 将 options 赋值到对应的 roleIds 等选项 - if (row.type === 10) { - this.taskAssignRule.form.roleIds.push(...row.options); - } else if (row.type === 20 || row.type === 21) { - this.taskAssignRule.form.deptIds.push(...row.options); - } - this.taskAssignRule.open = true; - }, - /** 提交任务分配规则的表单 */ - submitAssignRuleForm() { - this.$refs["taskAssignRuleForm"].validate(valid => { - if (valid) { - // 构建表单 - let form = { - ...this.taskAssignRule.form, - taskDefinitionName: undefined, - }; - // 将 roleIds 等选项赋值到 options 中 - if (form.type === 10) { - form.options = form.roleIds; - } else if (form.type === 20 || form.type === 21) { - form.options = form.deptIds; - } - form.roleIds = undefined; - form.deptIds = undefined; - // 新增 - if (!form.id) { - form.modelId = this.taskAssignRule.row.id // 模型编号 - createTaskAssignRule(form).then(response => { - this.msgSuccess("修改成功"); - this.taskAssignRule.open = false; - this.doGetTaskAssignRuleList(); - }); - // 修改 - } else { - form.taskDefinitionKey = undefined; // 无法修改 - updateTaskAssignRule(form).then(response => { - this.msgSuccess("修改成功"); - this.taskAssignRule.open = false; - this.doGetTaskAssignRuleList(); - }); - } - } - }); - }, - /** 取消任务分配规则的表单 */ - cancelAssignRuleForm() { - this.taskAssignRule.open = false; - this.resetAssignRuleForm(); - }, - /** 表单重置 */ - resetAssignRuleForm() { - this.taskAssignRule.form = {}; - this.resetForm("taskAssignRuleForm"); - }, - getAssignRuleOptionName(type, option) { - if (type === 10) { - for (const roleOption of this.taskAssignRule.roleOptions) { - if (roleOption.id === option) { - return roleOption.name; - } - } - } else if (type === 20 || type === 21) { - for (const deptOption of this.taskAssignRule.deptOptions) { - if (deptOption.id === option) { - return deptOption.name; - } - } - } - return '未知(' + option + ')'; - }, - // 格式化部门的下拉框 - normalizer(node) { - return { - id: node.id, - label: node.name, - children: node.children - } - } } }; diff --git a/yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue b/yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue new file mode 100644 index 000000000..94387f5df --- /dev/null +++ b/yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue @@ -0,0 +1,242 @@ + + +