|
|
|
@ -6,8 +6,26 @@ |
|
|
|
<script lang='ts' setup> |
|
|
|
import $func from '@/utils/workflow/index' |
|
|
|
import { useStore } from '@/store/workflow/index' |
|
|
|
import { optTypes, opt1s } from '@/utils/workflow/const' |
|
|
|
import { optTypes, opt1s,flowFactor } from '@/utils/workflow/const' |
|
|
|
import { flowFactorCont } from '@/api/workflowapi/types' |
|
|
|
import { getConditions } from '@/api/workflowapi/index' |
|
|
|
|
|
|
|
import { gainNodeFactor } from '@/api/displayboardapi/indexapi' |
|
|
|
|
|
|
|
let props = defineProps({ |
|
|
|
isFormFlow:{ |
|
|
|
type:Boolean, |
|
|
|
default:true |
|
|
|
}, |
|
|
|
customerFormKey:{ |
|
|
|
type:String, |
|
|
|
default:"" |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const flowFactorList = ref<any[]>([]); |
|
|
|
|
|
|
|
let conditionVisible = ref(false) |
|
|
|
let conditionsConfig = ref({ |
|
|
|
conditionNodes: [], |
|
|
|
@ -33,7 +51,6 @@ let visible = computed({ |
|
|
|
} |
|
|
|
}) |
|
|
|
watch(conditionsConfig1, (val:any) => { |
|
|
|
// console.log("val.priorityLevel",val.priorityLevel) |
|
|
|
conditionsConfig.value = val.value; |
|
|
|
PriorityLevel.value = val.priorityLevel |
|
|
|
conditionConfig.value = val.priorityLevel |
|
|
|
@ -41,130 +58,175 @@ watch(conditionsConfig1, (val:any) => { |
|
|
|
: { nodeUserList: [], conditionList: [] } |
|
|
|
}) |
|
|
|
|
|
|
|
const changeOptType = (item) => { |
|
|
|
if (item.optType == 1) { |
|
|
|
item.zdy1 = 2; |
|
|
|
} else { |
|
|
|
item.zdy1 = 1; |
|
|
|
item.zdy2 = 2; |
|
|
|
watch(visible,(val:any)=>{ |
|
|
|
if(val){ |
|
|
|
if(flowFactor.length>0){ |
|
|
|
flowFactor.forEach(ites=>{ |
|
|
|
flowFactorList.value.push({ |
|
|
|
id:ites.id, |
|
|
|
name:ites.name, |
|
|
|
keyid:ites.keyid, |
|
|
|
type:ites.type, |
|
|
|
isok:ites.isok, |
|
|
|
isCheckbox:ites.isCheckbox, |
|
|
|
options:ites.options |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
if(props.isFormFlow){ |
|
|
|
let sendData ={ |
|
|
|
id:props.customerFormKey, |
|
|
|
types:2 |
|
|
|
} |
|
|
|
gainNodeFactor(sendData) |
|
|
|
.then(({data}) =>{ |
|
|
|
console.log("......>",data) |
|
|
|
if(data.length > 0){ |
|
|
|
data.forEach(item=>{ |
|
|
|
flowFactorList.value.push({ |
|
|
|
id:flowFactorList.value.length+1, |
|
|
|
name:item.name, |
|
|
|
keyid:item.id, |
|
|
|
type:3, |
|
|
|
isok:false, |
|
|
|
isCheckbox:item.isCheckbox, |
|
|
|
options:item.options |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
const toStrChecked = (item, key) => { |
|
|
|
let a = item.zdy1 ? item.zdy1.split(",") : [] |
|
|
|
var isIncludes = $func.toggleStrClass(item, key); |
|
|
|
if (!isIncludes) { |
|
|
|
a.push(key) |
|
|
|
item.zdy1 = a.toString() |
|
|
|
} else { |
|
|
|
removeStrEle(item, key); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
flowFactorList.value = [] |
|
|
|
} |
|
|
|
const removeStrEle = (item, key) => { |
|
|
|
let a = item.zdy1 ? item.zdy1.split(",") : [] |
|
|
|
var includesIndex; |
|
|
|
a.map((item, index) => { |
|
|
|
if (item == key) { |
|
|
|
includesIndex = index |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const closeDrawer = (val?:any) => { |
|
|
|
initFactor() |
|
|
|
setCondition(false) |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
a.splice(includesIndex, 1); |
|
|
|
item.zdy1 = a.toString() |
|
|
|
} |
|
|
|
const addCondition = async () => { |
|
|
|
conditionList.value = []; |
|
|
|
conditionVisible.value = true; |
|
|
|
let { data } = await getConditions({ tableId: tableId.value }) |
|
|
|
conditions.value = data; |
|
|
|
if (conditionConfig.value.conditionList) { |
|
|
|
for (var i = 0; i < conditionConfig.value.conditionList.length; i++) { |
|
|
|
var { columnId } = conditionConfig.value.conditionList[i] |
|
|
|
if (columnId == 0) { |
|
|
|
conditionList.value.push({ columnId: 0 }) |
|
|
|
|
|
|
|
const isDelField = ref(false) |
|
|
|
const tableList = ref<any[]>([]) |
|
|
|
const maxFactor = ref(false) |
|
|
|
|
|
|
|
const tiaoJianAry = ref<any>() |
|
|
|
//选择变化 |
|
|
|
const pickFactor = (val:any) => { |
|
|
|
let tableKeyAry = new Array |
|
|
|
tableList.value.forEach(item=>{ |
|
|
|
tableKeyAry.push(item.factorid) |
|
|
|
}) |
|
|
|
let types = 0 |
|
|
|
let options = new Array |
|
|
|
let isCheckbox = false |
|
|
|
flowFactorList.value.forEach(item=>{ |
|
|
|
if(item.keyid == val){ |
|
|
|
item.isok=true |
|
|
|
types = item.type |
|
|
|
options = item.options |
|
|
|
isCheckbox = item.isCheckbox |
|
|
|
}else{ |
|
|
|
conditionList.value.push(conditions.value.filter(item => { return item.columnId == columnId; })[0]) |
|
|
|
if(tableKeyAry.length>0){ |
|
|
|
if(tableKeyAry.includes(item.keyid)){ |
|
|
|
item.isok=true |
|
|
|
}else{ |
|
|
|
item.isok=false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
tableList.value.forEach(item=>{ |
|
|
|
if(item.factorid == val){ |
|
|
|
item.type = types |
|
|
|
item.options = options |
|
|
|
item.isCheckbox = isCheckbox |
|
|
|
} |
|
|
|
const sureCondition = () => { |
|
|
|
//1.弹窗有,外面无+ |
|
|
|
//2.弹窗有,外面有不变 |
|
|
|
for (var i = 0; i < conditionList.value.length; i++) { |
|
|
|
var { columnId, showName, columnName, showType, columnType, fixedDownBoxValue } = conditionList.value[i]; |
|
|
|
if ($func.toggleClass(conditionConfig.value.conditionList, conditionList.value[i], "columnId")) { |
|
|
|
continue; |
|
|
|
}) |
|
|
|
console.log("tableList--->",tableList.value,val,types); |
|
|
|
} |
|
|
|
//添加条件 |
|
|
|
const addFactorCondition = () => { |
|
|
|
let currLent = tableList.value.length |
|
|
|
if(currLent < flowFactorList.value.length){ |
|
|
|
tableList.value.push({id:currLent+1,factorid:"",type:0}) |
|
|
|
if(currLent+1 >= flowFactorList.value.length){ |
|
|
|
maxFactor.value = true |
|
|
|
}else{ |
|
|
|
maxFactor.value = false |
|
|
|
} |
|
|
|
if (columnId == 0) { |
|
|
|
conditionConfig.value.nodeUserList = []; |
|
|
|
conditionConfig.value.conditionList.push({ |
|
|
|
"type": 1, |
|
|
|
"columnId": columnId, |
|
|
|
"showName": '发起人' |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
if (columnType == "Double") { |
|
|
|
conditionConfig.value.conditionList.push({ |
|
|
|
"showType": showType, |
|
|
|
"columnId": columnId, |
|
|
|
"type": 2, |
|
|
|
"showName": showName, |
|
|
|
"optType": "1", |
|
|
|
"zdy1": "2", |
|
|
|
"opt1": "<", |
|
|
|
"zdy2": "", |
|
|
|
"opt2": "<", |
|
|
|
"columnDbname": columnName, |
|
|
|
"columnType": columnType, |
|
|
|
}) |
|
|
|
} else if (columnType == "String" && showType == "3") { |
|
|
|
conditionConfig.value.conditionList.push({ |
|
|
|
"showType": showType, |
|
|
|
"columnId": columnId, |
|
|
|
"type": 2, |
|
|
|
"showName": showName, |
|
|
|
"zdy1": "", |
|
|
|
"columnDbname": columnName, |
|
|
|
"columnType": columnType, |
|
|
|
"fixedDownBoxValue": fixedDownBoxValue |
|
|
|
}) |
|
|
|
maxFactor.value = true |
|
|
|
} |
|
|
|
if(tableList.value.length > 1){ |
|
|
|
isDelField.value = true |
|
|
|
}else{ |
|
|
|
isDelField.value = false |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//3.弹窗无,外面有- |
|
|
|
for (let i = conditionConfig.value.conditionList.length - 1; i >= 0; i--) { |
|
|
|
if (!$func.toggleClass(conditionList.value, conditionConfig.value.conditionList[i], "columnId")) { |
|
|
|
conditionConfig.value.conditionList.splice(i, 1); |
|
|
|
const initFactor = () => { |
|
|
|
maxFactor.value = false |
|
|
|
if(tableList.value.length>0){ |
|
|
|
tableList.value = [] |
|
|
|
} |
|
|
|
if(flowFactorList.value.length>0){ |
|
|
|
flowFactorList.value = [] |
|
|
|
} |
|
|
|
conditionConfig.value.conditionList.sort(function (a, b) { return a.columnId - b.columnId; }); |
|
|
|
conditionVisible.value = false; |
|
|
|
} |
|
|
|
const saveCondition = () => { |
|
|
|
closeDrawer() |
|
|
|
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 |
|
|
|
//删除条件 |
|
|
|
const delTiaoJian = (val:any) => { |
|
|
|
let currLent = tableList.value.length |
|
|
|
if(currLent>0){ |
|
|
|
let guoduTable = [] |
|
|
|
tableList.value.forEach(item=>{ |
|
|
|
if(item.factorid != val.factorid){ |
|
|
|
guoduTable.push(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
tableList.value = guoduTable |
|
|
|
} |
|
|
|
flowFactorList.value.forEach(item=>{ |
|
|
|
if(item.keyid == val.factorid){ |
|
|
|
item.isok=false |
|
|
|
} |
|
|
|
setConditionsConfig({ |
|
|
|
value: conditionsConfig.value, |
|
|
|
flag: true, |
|
|
|
id: conditionsConfig1.value.id |
|
|
|
}) |
|
|
|
|
|
|
|
if(currLent < flowFactorList.value.length){ |
|
|
|
maxFactor.value = false |
|
|
|
} |
|
|
|
const addConditionRole = () => { |
|
|
|
conditionRoleVisible.value = true; |
|
|
|
checkedList.value = conditionConfig.value.nodeUserList |
|
|
|
if(tableList.value.length > 1){ |
|
|
|
isDelField.value = true |
|
|
|
}else{ |
|
|
|
isDelField.value = false |
|
|
|
} |
|
|
|
const sureConditionRole = (data) => { |
|
|
|
conditionConfig.value.nodeUserList = data; |
|
|
|
conditionRoleVisible.value = false; |
|
|
|
} |
|
|
|
const closeDrawer = (val?:any) => { |
|
|
|
setCondition(false) |
|
|
|
const saveCondition = () => { |
|
|
|
|
|
|
|
conditionConfig.conditionList = tableList.value |
|
|
|
console.log("conditionConfig.conditionList--->",conditionConfig.conditionList,tableList); |
|
|
|
// 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() |
|
|
|
} |
|
|
|
</script> |
|
|
|
<template> |
|
|
|
@ -178,8 +240,69 @@ const closeDrawer = (val?:any) => { |
|
|
|
<div class="demo-drawer__content"> |
|
|
|
<div class="condition_content drawer_content"> |
|
|
|
<p class="tip">当审批单同时满足以下条件时进入此流程</p> |
|
|
|
|
|
|
|
<el-row v-for="itemw in tableList" :key="itemw.id" :gutter="10" class="condition_row"> |
|
|
|
<el-col :span="7"> |
|
|
|
<div class="left_right_cont"> |
|
|
|
<el-select v-model="itemw.factorid" placeholder="请选择" class="selectInfo" @change="pickFactor"> |
|
|
|
<el-option |
|
|
|
v-for="item in flowFactorList" |
|
|
|
:key="item.keyid" |
|
|
|
:label="item.name" |
|
|
|
:value="item.keyid" |
|
|
|
:disabled="item.isok" |
|
|
|
> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
<span>为</span> |
|
|
|
</div> |
|
|
|
<el-button type="primary" @click="addCondition">添加条件</el-button> |
|
|
|
</el-col> |
|
|
|
<el-col :span="16"> |
|
|
|
<template v-if="itemw.type==1"> |
|
|
|
<el-button type="primary" style="margin-bottom:0px" >添加/修改成员</el-button> |
|
|
|
<p class="selected_list"> |
|
|
|
<el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag><el-tag closable type="info" effect="plain" class="tag_us">演员1</el-tag> |
|
|
|
</p> |
|
|
|
|
|
|
|
</template> |
|
|
|
<template v-if="itemw.type==2"> |
|
|
|
<el-row v-for="(itemCustomFields,index) in itemw" :key="index" :gutter="5"> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-input v-model="itemCustomFields.wordfield" placeholder="判断关键字"></el-input> |
|
|
|
</el-col> |
|
|
|
<el-col :span="itemCustomFields.optType != 6?7:16"> |
|
|
|
<el-select v-model="itemCustomFields.optType" class="selectInfo" @change="myoptChhange($event,itemCustomFields)"> |
|
|
|
<el-option |
|
|
|
v-for="itemSel in optTypes" |
|
|
|
:key="itemSel.value" |
|
|
|
:label="itemSel.label" |
|
|
|
:value="itemSel.value" |
|
|
|
> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-col> |
|
|
|
<el-col v-if="itemCustomFields.optType != 6" :span="9"> |
|
|
|
<el-input v-model="itemCustomFields.leftval" placeholder="请输入值"></el-input> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-button type="warning" style="margin-top:10px" >添加条件</el-button> |
|
|
|
</template> |
|
|
|
<template v-if="itemw.type==3"> |
|
|
|
<el-radio-group v-if="!itemw.isCheckbox" v-model="itemw.answers"> |
|
|
|
<el-radio v-for="optVal in itemw.options" :key="optVal.value" :label="optVal.value">{{optVal.label}}</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
<el-checkbox-group v-if="itemw.isCheckbox" v-model="itemw.answers"> |
|
|
|
<el-checkbox v-for="optVal in itemw.options" :key="optVal.value" :label="optVal.value">{{ optVal.label }}</el-checkbox> |
|
|
|
</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-row> |
|
|
|
|
|
|
|
|
|
|
|
<el-button :disabled="maxFactor" type="primary" @click="addFactorCondition" >添加条件</el-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="demo-drawer__footer clear"> |
|
|
|
<el-button type="primary" @click="saveCondition">确 定</el-button> |
|
|
|
<el-button @click="closeDrawer">取 消</el-button> |
|
|
|
@ -203,7 +326,17 @@ const closeDrawer = (val?:any) => { |
|
|
|
|
|
|
|
.condition_content { |
|
|
|
padding: 20px 20px 0; |
|
|
|
|
|
|
|
.condition_row{ |
|
|
|
margin-bottom:15px; |
|
|
|
.left_right_cont{ |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
.selectInfo{ |
|
|
|
margin-right:5px; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
p.tip { |
|
|
|
margin: 20px 0; |
|
|
|
width: 510px; |
|
|
|
@ -301,4 +434,14 @@ const closeDrawer = (val?:any) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.delIcon{ |
|
|
|
margin-top:6px; |
|
|
|
} |
|
|
|
.selected_list{ |
|
|
|
margin: 0; |
|
|
|
|
|
|
|
span{ |
|
|
|
margin:5px 5px 4px 0px; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
|