From 8318e4e06c9ac5a4d1c8aba7075155147540e4d9 Mon Sep 17 00:00:00 2001 From: sc Date: Thu, 21 Oct 2021 17:01:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=AE=A1=E6=89=B9=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E8=AE=BE=E8=AE=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 完善审批工作流设计器 --- src/components/scWorkflow/index.vue | 178 ++++++------ src/components/scWorkflow/nodes/addNode.vue | 42 ++- src/components/scWorkflow/nodes/approver.vue | 128 +++++++-- src/components/scWorkflow/nodes/branch.vue | 89 +++++- src/components/scWorkflow/nodes/promoter.vue | 47 +++- src/components/scWorkflow/nodes/send.vue | 41 ++- src/components/scWorkflow/select.vue | 269 +++++++++++++++++++ src/config/workflow.js | 69 +++++ src/views/vab/workflow.vue | 140 ++++++---- 9 files changed, 811 insertions(+), 192 deletions(-) create mode 100644 src/components/scWorkflow/select.vue create mode 100644 src/config/workflow.js diff --git a/src/components/scWorkflow/index.vue b/src/components/scWorkflow/index.vue index 4a6314ff..1fd4c025 100644 --- a/src/components/scWorkflow/index.vue +++ b/src/components/scWorkflow/index.vue @@ -1,131 +1,141 @@ diff --git a/src/components/scWorkflow/nodes/branch.vue b/src/components/scWorkflow/nodes/branch.vue index 3969c179..4ad7cc5a 100644 --- a/src/components/scWorkflow/nodes/branch.vue +++ b/src/components/scWorkflow/nodes/branch.vue @@ -31,19 +31,62 @@ - + + - - + + + + + - - {{ nodeConfig.conditionNodes[index].conditionList }} + + + + + + + + + + + + + + + + + + - -

增加条件

+

增加条件

@@ -69,6 +112,7 @@ return { nodeConfig: {}, drawer: false, + isEditTitle: false, index: 0, form: {} } @@ -85,9 +129,18 @@ show(index){ this.index = index this.form = {} - this.form = {...this.nodeConfig.conditionNodes[index]} + this.form = JSON.parse(JSON.stringify(this.nodeConfig.conditionNodes[index])) this.drawer = true }, + editTitle(){ + this.isEditTitle = true + this.$nextTick(()=>{ + this.$refs.nodeTitle.focus() + }) + }, + saveTitle(){ + this.isEditTitle = false + }, save(){ this.nodeConfig.conditionNodes[this.index] = this.form this.$emit("update:modelValue", this.nodeConfig) @@ -98,7 +151,9 @@ this.nodeConfig.conditionNodes.push({ nodeName: "条件" + len, type: 3, - priorityLevel: len + priorityLevel: len, + conditionMode: 1, + conditionList: [] }) }, delTerm(index){ @@ -128,11 +183,25 @@ }) this.$emit("update:modelValue", this.nodeConfig) }, + addConditionList(){ + this.form.conditionList.push({ + label: '', + field: '', + operator: '=', + value: '' + }) + }, + deleteConditionList(index){ + this.form.conditionList.splice(index, 1) + }, toText(nodeConfig, index){ var { conditionList } = nodeConfig.conditionNodes[index] - if (conditionList && conditionList.length > 0) { + if (conditionList && conditionList.length == 1) { const text = conditionList.map(item => `${item.label}${item.operator}${item.value}`).join(" 和 ") return text + }else if(conditionList && conditionList.length > 1){ + const conditionModeText = nodeConfig.conditionNodes[index].conditionMode==1?'且行':'或行' + return conditionList.length + "个条件," + conditionModeText }else{ if(index == nodeConfig.conditionNodes.length - 1){ return "其他条件进入此流程" diff --git a/src/components/scWorkflow/nodes/promoter.vue b/src/components/scWorkflow/nodes/promoter.vue index 2d6bec5b..f021db75 100644 --- a/src/components/scWorkflow/nodes/promoter.vue +++ b/src/components/scWorkflow/nodes/promoter.vue @@ -5,16 +5,28 @@ {{ nodeConfig.nodeName }} -
所有人
+
+ {{ toText(nodeConfig) }} +
- + + - - + + 选择角色 +
+ {{role.name}} +
+
@@ -30,6 +42,7 @@ import addNode from './addNode' export default { + inject: ['select'], props: { modelValue: { type: Object, default: () => {} } }, @@ -40,6 +53,7 @@ return { nodeConfig: {}, drawer: false, + isEditTitle: false, form: {} } }, @@ -54,12 +68,35 @@ methods: { show(){ this.form = {} - this.form = {...this.nodeConfig} + this.form = JSON.parse(JSON.stringify(this.nodeConfig)) + this.isEditTitle = false this.drawer = true }, + editTitle(){ + this.isEditTitle = true + this.$nextTick(()=>{ + this.$refs.nodeTitle.focus() + }) + }, + saveTitle(){ + this.isEditTitle = false + }, + selectHandle(type, data){ + this.select(type, data) + }, + delRole(index){ + this.form.nodeRoleList.splice(index, 1) + }, save(){ this.$emit("update:modelValue", this.form) this.drawer = false + }, + toText(nodeConfig){ + if(nodeConfig.nodeRoleList && nodeConfig.nodeRoleList.length > 0){ + return nodeConfig.nodeRoleList.map(item=>item.name).join("、") + }else{ + return "所有人" + } } } } diff --git a/src/components/scWorkflow/nodes/send.vue b/src/components/scWorkflow/nodes/send.vue index 6b2c9b36..30bc97e1 100644 --- a/src/components/scWorkflow/nodes/send.vue +++ b/src/components/scWorkflow/nodes/send.vue @@ -12,16 +12,24 @@ - + + - - + + 选择人员 +
+ {{user.name}} +
- - +
@@ -38,6 +46,7 @@ import addNode from './addNode' export default { + inject: ['select'], props: { modelValue: { type: Object, default: () => {} } }, @@ -48,6 +57,7 @@ return { nodeConfig: {}, drawer: false, + isEditTitle: false, form: {} } }, @@ -62,9 +72,18 @@ methods: { show(){ this.form = {} - this.form = {...this.nodeConfig} + this.form = JSON.parse(JSON.stringify(this.nodeConfig)) this.drawer = true }, + editTitle(){ + this.isEditTitle = true + this.$nextTick(()=>{ + this.$refs.nodeTitle.focus() + }) + }, + saveTitle(){ + this.isEditTitle = false + }, save(){ this.$emit("update:modelValue", this.form) this.drawer = false @@ -72,12 +91,18 @@ delNode(){ this.$emit("update:modelValue", this.nodeConfig.childNode) }, + delUser(index){ + this.form.nodeUserList.splice(index, 1) + }, + selectHandle(type, data){ + this.select(type, data) + }, toText(nodeConfig){ if (nodeConfig.nodeUserList && nodeConfig.nodeUserList.length>0) { - const users = nodeConfig.nodeUserList.map(item=>item.name).join(" 或 ") + const users = nodeConfig.nodeUserList.map(item=>item.name).join("、") return users }else{ - if(nodeConfig.ccSelfSelectFlag){ + if(nodeConfig.userSelectFlag){ return "发起人自选" }else{ return false diff --git a/src/components/scWorkflow/select.vue b/src/components/scWorkflow/select.vue new file mode 100644 index 00000000..44d338ca --- /dev/null +++ b/src/components/scWorkflow/select.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/src/config/workflow.js b/src/config/workflow.js new file mode 100644 index 00000000..ceb1305d --- /dev/null +++ b/src/config/workflow.js @@ -0,0 +1,69 @@ +import API from "@/api"; + +//审批工作流人员/组织选择器配置 + +export default { + //配置接口正常返回代码 + successCode: 200, + //配置组织 + group: { + //请求接口对象 + apiObj: API.system.role.list, + //接受数据字段映射 + parseData: function (res) { + return { + rows: res.data, + msg: res.message, + code: res.code + } + }, + //显示数据字段映射 + props: { + key: 'id', + label: 'label', + children: 'children' + } + }, + //配置用户 + user: { + apiObj: API.demo.page, + pageSize: 20, + parseData: function (res) { + return { + rows: res.data.rows, + total: res.data.total, + msg: res.message, + code: res.code + } + }, + props: { + key: 'id', + label: 'user', + }, + request: { + page: 'page', + pageSize: 'pageSize', + groupId: 'groupId', + keyword: 'keyword' + } + }, + //配置角色 + role: { + //请求接口对象 + apiObj: API.system.role.list, + //接受数据字段映射 + parseData: function (res) { + return { + rows: res.data, + msg: res.message, + code: res.code + } + }, + //显示数据字段映射 + props: { + key: 'id', + label: 'label', + children: 'children' + } + } +} diff --git a/src/views/vab/workflow.vue b/src/views/vab/workflow.vue index 7c06fac2..4477701f 100644 --- a/src/views/vab/workflow.vue +++ b/src/views/vab/workflow.vue @@ -1,8 +1,15 @@ - +