Browse Source

矩阵多选完成

han_v1
herenshan112 7 months ago
parent
commit
7cf049c4c5
  1. 90
      src/components/workflow/dialog/matrix.vue
  2. 1
      src/components/workflow/drwer/approverDrawer.vue
  3. 31
      src/utils/workflow/index.ts

90
src/components/workflow/dialog/matrix.vue

@ -9,7 +9,6 @@ import {
matrixCont, matrixCont,
martixFieldStruct, martixFieldStruct,
matrixInfo, matrixInfo,
martOpter,
} from "@/api/matrixapi/type"; } from "@/api/matrixapi/type";
import { getMatrixList, getMatrixField } from "@/api/matrixapi/index"; import { getMatrixList, getMatrixField } from "@/api/matrixapi/index";
@ -28,7 +27,6 @@ const props = defineProps({
factorName: "", factorName: "",
outcomeid: 0, outcomeid: 0,
outcomeName: "", outcomeName: "",
list: [],
}; };
}, },
}, },
@ -53,36 +51,20 @@ const matrixIsClick = reactive<matrixInfo>({
list: [], list: [],
}); });
// //
watch(
() => props.isshow,
(val: any) => {
if (val) {
// console.log("")
searchMatrixList();
matrixIsClick.matrixid = props.data.matrixid;
matrixIsClick.matrixName = props.data.matrixName;
matrixIsClick.factorid = props.data.factorid;
matrixIsClick.factorName = props.data.factorName;
matrixIsClick.outcomeid = props.data.outcomeid;
matrixIsClick.outcomeName = props.data.outcomeName;
matrixIsClick.list = props.data.list ? props.data.list : [];
}
}
);
watch( watch(
() => props.data, () => props.data,
(val: any) => { (val: any) => {
matrixIsClick.matrixid = val.matrixid; // console.log("")
matrixIsClick.matrixName = val.matrixName;
matrixIsClick.factorid = val.factorid;
matrixIsClick.factorName = val.factorName;
matrixIsClick.outcomeid = val.outcomeid;
matrixIsClick.outcomeName = val.outcomeName;
matrixIsClick.list = val.list ? val.list : [];
console.log("数据变换---->", val);
searchMatrixList(); searchMatrixList();
},
(deep) => true matrixIsClick.matrixid = props.data.matrixid;
matrixIsClick.matrixName = props.data.matrixName;
matrixIsClick.factorid = props.data.factorid;
matrixIsClick.factorName = props.data.factorName;
matrixIsClick.outcomeid = props.data.outcomeid;
matrixIsClick.outcomeName = props.data.outcomeName;
matrixIsClick.list = props.data.list ? props.data.list : [];
}
); );
// //
const searchArchiveQuery = reactive<searchMatrix>({ const searchArchiveQuery = reactive<searchMatrix>({
@ -120,7 +102,7 @@ const gainMatrixNeed = (val: any) => {
loadingVal.value = true; loadingVal.value = true;
getMatrixField({ id: val * 1 }) getMatrixField({ id: val * 1 })
.then(({ data }) => { .then(({ data }) => {
console.log("监听数据---->", data); // console.log("---->",data)
factorList.value = data.factor; factorList.value = data.factor;
outcomeList.value = data.outcome; outcomeList.value = data.outcome;
if (data.factor.length > 0) { if (data.factor.length > 0) {
@ -146,24 +128,19 @@ const pickmatirval = (val: matrixCont) => {
const pickval = (val: martixFieldStruct) => { const pickval = (val: martixFieldStruct) => {
matrixIsClick.outcomeid = val.id * 1; matrixIsClick.outcomeid = val.id * 1;
matrixIsClick.outcomeName = val.name; matrixIsClick.outcomeName = val.name;
console.log("监听数据--123-->", matrixIsClick); let isAdd = true;
var isAdd = true; matrixIsClick.list.forEach((item: any, index: number) => {
if (matrixIsClick.list && matrixIsClick.list.length > 0) { if (item.outcomeid == val.id * 1) {
matrixIsClick.list.forEach((item: martOpter, index: number) => { isAdd = false;
console.log("监听数据--1-->", item.outcomeid == val.id * 1); matrixIsClick.list.splice(index, 1);
if (item.outcomeid == val.id * 1) { }
matrixIsClick.list.splice(index, 1); });
isAdd = false;
}
});
}
if (isAdd) { if (isAdd) {
matrixIsClick.list.push({ matrixIsClick.list.push({
outcomeid: val.id * 1, outcomeid: val.id * 1,
outcomeName: val.name, outcomeName: val.name,
}); });
} }
console.log("监听数据---->", matrixIsClick);
}; };
// //
const pickSelect = (val: any) => { const pickSelect = (val: any) => {
@ -174,10 +151,10 @@ const pickSelect = (val: any) => {
} }
}); });
}; };
watch(matrixIsClick, (val: any) => { // watch(matrixIsClick, (val: any) => {
// console.log("---->",val) // console.log("---->", val);
emits("change", val); // emits("change", val);
}); // });
onMounted(() => { onMounted(() => {
matrixIsClick.matrixid = props.data.matrixid; matrixIsClick.matrixid = props.data.matrixid;
matrixIsClick.matrixName = props.data.matrixName; matrixIsClick.matrixName = props.data.matrixName;
@ -190,26 +167,25 @@ onMounted(() => {
}); });
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2025-04-23 09:46:10 @ 时间: 2025-04-23 13:22:57
@ 功能: 判断是否已经选中 @ 功能: 判断当前选择的内容
*/ */
const jugdeIsTrue = (id: number) => { const judgeIsTrue = (val: number) => {
var isAdd = false; let isTrue = false;
if (matrixIsClick.list && matrixIsClick.list.length > 0) { if (matrixIsClick.list && matrixIsClick.list.length > 0) {
matrixIsClick.list.forEach((item: martOpter) => { matrixIsClick.list.forEach((item: any) => {
console.log("数据变换--111111-->", item.outcomeid == id, item.outcomeid, id); if (item.outcomeid == val) {
if (item.outcomeid == id) { isTrue = true;
isAdd = true;
} }
}); });
} }
console.log("判断--111111111-->", id); return isTrue;
return isAdd;
}; };
</script> </script>
<template> <template>
<div> <div>
<el-divider content-position="left">矩阵选项</el-divider> <el-divider content-position="left">矩阵选项</el-divider>
<el-descriptions <el-descriptions
v-if="isShow" v-if="isShow"
title="" title=""
@ -271,11 +247,11 @@ const jugdeIsTrue = (id: number) => {
<li <li
v-for="item in outcomeList" v-for="item in outcomeList"
:key="item.id" :key="item.id"
:class="jugdeIsTrue(item.id) ? 'active' : ''" :class="judgeIsTrue(item.id) ? 'active' : ''"
@click="pickval(item)" @click="pickval(item)"
> >
<el-text class="mx-1">{{ item.name }}</el-text> <el-text class="mx-1">{{ item.name }}</el-text>
<el-text class="mx-1">{{ item.pinyin }}</el-text> <el-text class="mx-1">{{}}{{item.pinyin}}</el-text>
</li> </li>
</ul> </ul>
</el-col> </el-col>

1
src/components/workflow/drwer/approverDrawer.vue

@ -320,6 +320,7 @@ const sureFormTableApprover = (data: any) => {
// //
const updateMatrix = (val: any) => { const updateMatrix = (val: any) => {
approverConfig.value.matrix = val; approverConfig.value.matrix = val;
console.log("值改变-222--->", approverConfig.value.matrix);
}; };
const formTableFielding = reactive<formTableField>({}); const formTableFielding = reactive<formTableField>({});

31
src/utils/workflow/index.ts

@ -59,7 +59,7 @@ All.prototype = {
arr.splice(includesIndex, 1); arr.splice(includesIndex, 1);
}, },
setApproverStr(nodeConfig:any) { setApproverStr(nodeConfig:any) {
// console.log("setApproverStr",nodeConfig); console.log("setApproverStr---签字解析--->",nodeConfig);
if (nodeConfig.settype == 1) { if (nodeConfig.settype == 1) {
if (nodeConfig.nodeUserList.length == 1) { if (nodeConfig.nodeUserList.length == 1) {
return nodeConfig.nodeUserList[0].name return nodeConfig.nodeUserList[0].name
@ -126,8 +126,19 @@ All.prototype = {
} }
}else if (nodeConfig.settype == 9){ }else if (nodeConfig.settype == 9){
if(nodeConfig.matrix && nodeConfig.matrix.outcomeName){ console.log("setApproverStr---签字解析--9->",nodeConfig.matrix.list);
let strVal = nodeConfig.matrix.outcomeName if(nodeConfig.matrix && nodeConfig.matrix.list){
let strVal = ""
if(nodeConfig.matrix.list.length > 0){
nodeConfig.matrix.list.forEach((item:any,inx:number)=>{
if (inx > 0) {
strVal += '/';
}
strVal += item.outcomeName;
})
}
if (nodeConfig.examineMode == 1) { if (nodeConfig.examineMode == 1) {
return strVal + "依次审批" return strVal + "依次审批"
} else if (nodeConfig.examineMode == 2) { } else if (nodeConfig.examineMode == 2) {
@ -135,7 +146,19 @@ All.prototype = {
}else if (nodeConfig.examineMode == 3) { }else if (nodeConfig.examineMode == 3) {
return strVal + "或签" return strVal + "或签"
} }
} }else{
if(nodeConfig.matrix && nodeConfig.matrix.outcomeName){
let strVal = nodeConfig.matrix.outcomeName
if (nodeConfig.examineMode == 1) {
return strVal + "依次审批"
} else if (nodeConfig.examineMode == 2) {
return strVal + "会签"
}else if (nodeConfig.examineMode == 3) {
return strVal + "或签"
}
}
}
}else if (nodeConfig.settype == 10){ }else if (nodeConfig.settype == 10){
return "指定部门负责人" return "指定部门负责人"

Loading…
Cancel
Save