From 9a0b39ca0996dee411b80366c3a48ce2343119b1 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Tue, 24 Oct 2023 14:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflow/dialog/employeesRoleDialog.vue | 1 + src/components/workflow/dialog/roleDialog.vue | 1 + .../workflow/drwer/conditionDrawer.vue | 133 +++++++++++++++--- src/components/workflow/nodeWrap.vue | 4 +- src/components/workflow/selectBoxs.vue | 7 +- src/utils/workflow/index.ts | 117 ++++++++++++--- 6 files changed, 214 insertions(+), 49 deletions(-) diff --git a/src/components/workflow/dialog/employeesRoleDialog.vue b/src/components/workflow/dialog/employeesRoleDialog.vue index 41ff9e0ee..fabf3d7c5 100644 --- a/src/components/workflow/dialog/employeesRoleDialog.vue +++ b/src/components/workflow/dialog/employeesRoleDialog.vue @@ -46,6 +46,7 @@ let list = computed(()=> { type: 'role', not: false, data: roles.value, + isDepartment: props.isDepartment, isActive: (item)=> $func.toggleClass(checkedRoleList.value, item, 'roleId'), change: (item)=> $func.toChecked(checkedRoleList.value, item, 'roleId') }] diff --git a/src/components/workflow/dialog/roleDialog.vue b/src/components/workflow/dialog/roleDialog.vue index 83fa98fe2..f83a25a0e 100644 --- a/src/components/workflow/dialog/roleDialog.vue +++ b/src/components/workflow/dialog/roleDialog.vue @@ -28,6 +28,7 @@ let list = computed(() => { return [{ type: 'role', not: true, + isDepartment:false, data: roles.value, isActive: (item) => $func.toggleClass(checkedRoleList.value, item, 'roleId'), change: (item) => { diff --git a/src/components/workflow/drwer/conditionDrawer.vue b/src/components/workflow/drwer/conditionDrawer.vue index 191f8edde..acdd1e367 100644 --- a/src/components/workflow/drwer/conditionDrawer.vue +++ b/src/components/workflow/drwer/conditionDrawer.vue @@ -56,6 +56,11 @@ watch(conditionsConfig1, (val:any) => { conditionConfig.value = val.priorityLevel ? conditionsConfig.value.conditionNodes[val.priorityLevel - 1] : { nodeUserList: [], conditionList: [] } + if(conditionConfig.value.conditionList){ + // tableList.value = conditionsConfig.conditionList + tableList.value = conditionConfig.value.conditionList + } + }) watch(visible,(val:any)=>{ @@ -80,7 +85,7 @@ watch(visible,(val:any)=>{ } gainNodeFactor(sendData) .then(({data}) =>{ - console.log("......>",data) + // console.log("......>",data) if(data.length > 0){ data.forEach(item=>{ flowFactorList.value.push({ @@ -120,11 +125,13 @@ const pickFactor = (val:any) => { tableList.value.forEach(item=>{ tableKeyAry.push(item.factorid) }) + let filefName = 0 let types = 0 let options = new Array let isCheckbox = false flowFactorList.value.forEach(item=>{ if(item.keyid == val){ + filefName=item.name item.isok=true types = item.type options = item.options @@ -144,15 +151,22 @@ const pickFactor = (val:any) => { item.type = types item.options = options item.isCheckbox = isCheckbox + item.name=filefName } }) - console.log("tableList--->",tableList.value,val,types); + // console.log("tableList--->",tableList.value,val,types); } //添加条件 const addFactorCondition = () => { let currLent = tableList.value.length + let tableKeyAry = new Array + if(currLent > 0){ + tableList.value.forEach(item=>{ + tableKeyAry.push(item.factorid) + }) + } if(currLent < flowFactorList.value.length){ - tableList.value.push({id:currLent+1,factorid:"",type:0,isok:false,isCheckbox:true,options:[],answers:[],customFields:[]}) + tableList.value.push({id:currLent+1,name:"",factorid:"",type:0,isok:false,isCheckbox:true,options:[],answers:[],customFields:[]}) if(currLent+1 >= flowFactorList.value.length){ maxFactor.value = true }else{ @@ -167,6 +181,15 @@ const addFactorCondition = () => { isDelField.value = false } + if(tableKeyAry.length>0){ + flowFactorList.value.forEach(item=>{ + if(tableKeyAry.includes(item.keyid)){ + item.isok=true + }else{ + item.isok=false + } + }) + } } const initFactor = () => { maxFactor.value = false @@ -205,23 +228,79 @@ const delTiaoJian = (val:any) => { } } const saveCondition = () => { - - conditionConfig.conditionList.value = tableList.value - console.log("conditionConfig.conditionList--->",conditionConfig.conditionList.value,tableList.value); - // var a = conditionsConfig.value.conditionNodes.splice(PriorityLevel.value - 1, 1)//截取旧下标 - // conditionsConfig.value.conditionNodes.splice(conditionConfig.value.priorityLevel - 1, 0, a[0])//填充新下标 - // conditionsConfig.value.conditionNodes.map((item, index) => { - // item.priorityLevel = index + 1 - // }); - // for (var i = 0; i < conditionsConfig.value.conditionNodes.length; i++) { - // conditionsConfig.value.conditionNodes[i].error = $func.conditionStr(conditionsConfig.value, i) == "请设置条件" && i != conditionsConfig.value.conditionNodes.length - 1 - // } - // setConditionsConfig({ - // value: conditionsConfig.value, - // flag: true, - // id: conditionsConfig1.value.id - // }) - closeDrawer() + let isError = false + if(tableList.value.length>0){ + for (var i = 0; i < tableList.value.length; i++) { + var {name,type,options,nodeUserList,answers,isCheckbox,customFields} = tableList.value[i] + console.log("conditionConfig.conditionList--1->",name); + console.log("conditionConfig.conditionList--2->",type); + console.log("conditionConfig.conditionList--3->",options); + console.log("conditionConfig.conditionList--4->",nodeUserList); + console.log("conditionConfig.conditionList--5->",answers); + console.log("conditionConfig.conditionList--6->",isCheckbox); + console.log("conditionConfig.conditionList--7->",customFields); + switch(type){ + case 1: + if(nodeUserList){ + if(nodeUserList.length <= 0){ + isError = true + } + }else{ + isError = true + } + + break; + case 2: + if(customFields.length <= 0){ + isError = true + }else{ + customFields.forEach((item:any)=>{ + if(item.wordfield == "" || item.wordfield == null){ + isError = true + } + }) + } + break; + case 3: + if(answers.length > 0){ + if(!Array.isArray(answers)){ + tableList.value[i].answers=[answers] + } + }else{ + isError = true + } + break; + default: + isError = true + } + } + } + if(isError){ + ElNotification({ + title: '温馨提示!', + message: '判断条件未赋值!', + type: 'error', + }) + }else{ + conditionConfig.value.conditionList = tableList.value + // console.log("conditionConfig.conditionList--1->",conditionConfig.value); + // console.log("conditionConfig.conditionList--2->",conditionConfig.value.conditionList); + // console.log("conditionConfig.conditionList--3->",conditionsConfig1); + var a = conditionsConfig.value.conditionNodes.splice(PriorityLevel.value - 1, 1)//截取旧下标 + conditionsConfig.value.conditionNodes.splice(conditionConfig.value.priorityLevel - 1, 0, a[0])//填充新下标 + conditionsConfig.value.conditionNodes.map((item, index) => { + item.priorityLevel = index + 1 + }); + for (var i = 0; i < conditionsConfig.value.conditionNodes.length; i++) { + conditionsConfig.value.conditionNodes[i].error = $func.conditionStr(conditionsConfig.value, i) == "请设置条件" && i != conditionsConfig.value.conditionNodes.length - 1 + } + setConditionsConfig({ + value: conditionsConfig.value, + flag: true, + id: conditionsConfig1.value.id + }) + closeDrawer() + } } //选择成员或角色 const addOrEditUser = (val:any) => { @@ -260,6 +339,12 @@ const addCustomFields = () =>{ const myoptChhange = (val:any) =>{ console.log("添加自定义条件",val) } +//删除自定义字段条件 +const delCuresTiaoJian = (val:any,old:any) => { + if(old.length>0){ + old.splice(val,1) + } +} - + @@ -377,6 +465,7 @@ const myoptChhange = (val:any) =>{ diff --git a/src/components/workflow/nodeWrap.vue b/src/components/workflow/nodeWrap.vue index aeadca261..b650fa269 100644 --- a/src/components/workflow/nodeWrap.vue +++ b/src/components/workflow/nodeWrap.vue @@ -232,7 +232,7 @@ onMounted(() => {
请选择{{defaultText}} - {{showText}}{{ nodeConfig.nodeNumber }} + {{showText}}
@@ -270,7 +270,7 @@ onMounted(() => {
>
-
{{ $func.conditionStr(nodeConfig, index) }}{{ item.nodeNumber }}
+
{{ $func.conditionStr(nodeConfig, index) }}
diff --git a/src/components/workflow/selectBoxs.vue b/src/components/workflow/selectBoxs.vue index 8a63c3475..4a963bba7 100644 --- a/src/components/workflow/selectBoxs.vue +++ b/src/components/workflow/selectBoxs.vue @@ -18,8 +18,11 @@ defineProps({