Browse Source

工作流判断节点相关页面逻辑完成

local_v3_liwenxuan
超级管理员 2 years ago
parent
commit
9a0b39ca09
  1. 1
      src/components/workflow/dialog/employeesRoleDialog.vue
  2. 1
      src/components/workflow/dialog/roleDialog.vue
  3. 129
      src/components/workflow/drwer/conditionDrawer.vue
  4. 4
      src/components/workflow/nodeWrap.vue
  5. 7
      src/components/workflow/selectBoxs.vue
  6. 97
      src/utils/workflow/index.ts

1
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')
}]

1
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) => {

129
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 = () => {
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
}
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
// })
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)
}
}
</script>
<template>
<el-drawer v-model="visible" :append-to-body="true" title="条件设置" class="condition_copyer" :show-close="false" :size="550" :before-close="saveCondition">
@ -302,7 +387,7 @@ const myoptChhange = (val:any) =>{
<el-col :span="7">
<el-input v-model="itemCustomFields.wordfield" placeholder="判断关键字"></el-input>
</el-col>
<el-col :span="itemCustomFields.optType != 6?8:17">
<el-col :span="itemCustomFields.optType != 6?7:16">
<el-select v-model="itemCustomFields.optType" class="selectInfo" style="width:100%">
<el-option
v-for="itemSel in optTypes"
@ -316,6 +401,9 @@ const myoptChhange = (val:any) =>{
<el-col v-if="itemCustomFields.optType != 6" :span="9">
<el-input v-model="itemCustomFields.leftval" type="text" placeholder="请输入" />
</el-col>
<el-col :span="1">
<el-icon color="#E6A23C" size="20px" class="delIcon" @click="delCuresTiaoJian(index,itemw.customFields)"><CircleClose /></el-icon>
</el-col>
<el-col v-if="itemCustomFields.optType == 6" :span="24">
<el-row :gutter="5" style="margin-top:10px">
<el-col :span="5">
@ -361,7 +449,7 @@ const myoptChhange = (val:any) =>{
</el-checkbox-group>
</template>
</el-col>
<el-col :span="1"><el-icon v-if="isDelField" color="#FF0000" size="20px" class="delIcon" @click="delTiaoJian(itemw)"><CircleClose /></el-icon></el-col>
<el-col :span="1"><el-icon color="#FF0000" size="20px" class="delIcon" @click="delTiaoJian(itemw)"><CircleClose /></el-icon></el-col>
</el-row>
@ -377,6 +465,7 @@ const myoptChhange = (val:any) =>{
<employees-role-dialog
v-model:visible="copyerVisible"
:data="checkedList"
:is-department="true"
@change="sureCopyer"
/>

4
src/components/workflow/nodeWrap.vue

@ -232,7 +232,7 @@ onMounted(() => {
<div class="content" @click="setPerson">
<div class="text">
<span v-if="!showText" class="placeholder">请选择{{defaultText}}</span>
{{showText}}{{ nodeConfig.nodeNumber }}
{{showText}}
</div>
<i class="anticon anticon-right arrow"></i>
</div>
@ -270,7 +270,7 @@ onMounted(() => {
<i class="anticon anticon-close close" @click="delTerm(index)"></i>
</div>
<div v-if="index != nodeConfig.conditionNodes.length - 1" class="sort-right" @click="arrTransfer(index)">&gt;</div>
<div class="content" @click="setPerson(item.priorityLevel)">{{ $func.conditionStr(nodeConfig, index) }}{{ item.nodeNumber }}</div>
<div class="content" @click="setPerson(item.priorityLevel)">{{ $func.conditionStr(nodeConfig, index) }}</div>
<div v-if="isTried && item.error" class="error_tip" >
<i class="anticon anticon-exclamation-circle"></i>
</div>

7
src/components/workflow/selectBoxs.vue

@ -18,8 +18,11 @@ defineProps({
<template v-if="elem.type === 'role'">
<li v-for="item in elem.data" :key="item.roleId" class="check_box" :class="{not: !elem.isDepartment}">
<div :class="elem.isActive(item) && 'active'">
<a :title="item.departmentNames" @click="elem.change(item)">
<a v-if="elem.isDepartment" :title="item.departmentNames" @click="elem.change(item)">
<span></span><img src="@/assets/images/icon_file.png">{{item.departmentName}}
<img src="@/assets/images/icon_role.png">{{item.roleName}}
</a>
<a v-else :title="item.departmentNames" @click="elem.change(item)">
<img src="@/assets/images/icon_role.png">{{item.roleName}}
</a>
</div>

97
src/utils/workflow/index.ts

@ -139,32 +139,103 @@ All.prototype = {
},
conditionStr(nodeConfig:any, index:any) {
var { conditionList, nodeUserList } = nodeConfig.conditionNodes[index];
// console.log("判断调教--1->",nodeConfig)
// console.log("判断调教--2->",index)
// console.log("判断调教--3->",conditionList)
// console.log("判断调教--4->",nodeUserList)
// console.log("判断调教--5->",nodeConfig.conditionNodes[index])
// if(conditionList[0].nodeUserList){
// console.log("判断调教--6->",conditionList[0].nodeUserList)
// }
// conditionList.forEach((ites:any)=>{
// console.log("判断调教--6->",nodeConfig.conditionNodes.length - 1)
// })
// console.log("判断调教--7->",nodeConfig.conditionNodes[0].conditionList)
// console.log("判断调教--8->",(index == nodeConfig.conditionNodes.length - 1) && nodeConfig.conditionNodes[0].conditionList.length != 0)
if (conditionList.length == 0) {
return (index == nodeConfig.conditionNodes.length - 1) && nodeConfig.conditionNodes[0].conditionList.length != 0 ? '其他条件进入此流程' : '请设置条件'
return (index == nodeConfig.conditionNodes.length - 1) && nodeConfig.conditionNodes[0].conditionList.length != 0 ? '未满足其他条件分支的情况,将使用此流程!' : '请设置条件'
} else {
let str = ""
for (var i = 0; i < conditionList.length; i++) {
var { columnId, columnType, showType, showName, optType, zdy1, opt1, zdy2, opt2, fixedDownBoxValue } = conditionList[i];
if (columnId == 0) {
if (nodeUserList.length != 0) {
// console.log("判断调教分支形同--6->",conditionList[i])
var {name,type,options,nodeUserList,answers,isCheckbox,customFields} = conditionList[i]
switch(type){
case 1:
if(nodeUserList.length > 0){
str += '发起人属于:'
str += nodeUserList.map((item: { name: any; }) => { return item.name }).join("或") + " 并且 "
}
break;
case 2:
if(customFields.length > 0){
customFields.forEach((item:any) =>{
if (item.optType != 6 && item.leftval) {
var optTypeStr = ["", "<", ">", "≤", "=", "≥"][item.optType]
str += `${item.wordfield} ${optTypeStr} ${item.leftval} 并且 `
}else if (item.optType == 6 && item.leftval && item.rightval) {
let opt1 = ["", "<", ">", "≤", "=", "≥"][item.leftoptType]
let opt2 = ["", "<", ">", "≤", "=", "≥"][item.rightoptType]
str += `${item.leftval} ${opt1} ${item.wordfield} ${opt2} ${item.rightval} 并且 `
}
if (columnType == "String" && showType == "3") {
if (zdy1) {
str += showName + '属于:' + this.dealStr(zdy1, JSON.parse(fixedDownBoxValue)) + " 并且 "
})
}
break;
case 3:
if(answers.length > 0){
str += name + "为"
if(Array.isArray(answers)){
let valStr = ""
options.forEach((item:any)=>{
if(answers.includes(item.value)){
valStr += `${item.label}`
}
if (columnType == "Double") {
if (optType != 6 && zdy1) {
var optTypeStr = ["", "<", ">", "≤", "=", "≥"][optType]
str += `${showName} ${optTypeStr} ${zdy1} 并且 `
} else if (optType == 6 && zdy1 && zdy2) {
str += `${zdy1} ${opt1} ${showName} ${opt2} ${zdy2} 并且 `
// console.log("answers.includes(item.value)",answers.includes(item.value),answers,item.value,valStr)
})
// str += valStr+` 并且 `
str += valStr ? valStr.substring(0, valStr.length - 2)+` 并且 `:"";
}else{
options.forEach((item:any)=>{
if(item.value == answers){
str += item.label+` 并且 `
}
})
}
}
break;
default:
}
}
// for (var i = 0; i < conditionList.length; i++) {
// var { columnId, columnType, showType, showName, optType, zdy1, opt1, zdy2, opt2, fixedDownBoxValue } = conditionList[i];
// if (columnId == 0) {
// if (nodeUserList.length != 0) {
// str += '发起人属于:'
// str += nodeUserList.map((item: { name: any; }) => { return item.name }).join("或") + " 并且 "
// }
// }
// if (columnType == "String" && showType == "3") {
// if (zdy1) {
// str += showName + '属于:' + this.dealStr(zdy1, JSON.parse(fixedDownBoxValue)) + " 并且 "
// }
// }
// if (columnType == "Double") {
// if (optType != 6 && zdy1) {
// var optTypeStr = ["", "<", ">", "≤", "=", "≥"][optType]
// str += `${showName} ${optTypeStr} ${zdy1} 并且 `
// } else if (optType == 6 && zdy1 && zdy2) {
// str += `${zdy1} ${opt1} ${showName} ${opt2} ${zdy2} 并且 `
// }
// }
// }
return str ? str.substring(0, str.length - 4) : '请设置条件'
}
},

Loading…
Cancel
Save