|
|
|
@ -8,9 +8,10 @@ import employeesDialog from "@/components/workflow/dialog/employeesDialog.vue"; |
|
|
|
import { AnalysisForm } from "@/components/workflow/drwer/analysisForm"; |
|
|
|
import $func from "@/utils/workflow/index"; |
|
|
|
import { useStore } from "@/store/workflow/index"; |
|
|
|
|
|
|
|
import { analysisForm, setFlowFormKeyPower } from "@/api/workflowapi/index"; |
|
|
|
import type { powerNoke,powerNokeInfo } from '@/api/workflowapi/types' |
|
|
|
import { analysisForm, setFlowFormKeyPower,analyFormJsonMap } from "@/api/workflowapi/index"; |
|
|
|
import AssociatedFormsTinyace from "@/widget/associatedforms/associatedFormsTinyace.vue"; |
|
|
|
import { formStruct } from "@/api/DesignForm/types"; |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
formData: { |
|
|
|
@ -58,7 +59,7 @@ let store = useStore(); |
|
|
|
let { setPromoter, setFlowPermission } = store; |
|
|
|
let approverConfig1 = computed((): any => store.approverConfig1); |
|
|
|
let promoterDrawer = computed(() => store.promoterDrawer); |
|
|
|
let flowPermission1 = computed(() => store.flowPermission1); |
|
|
|
let flowPermission1 = computed((): any => store.flowPermission1); |
|
|
|
let visible = computed({ |
|
|
|
get() { |
|
|
|
return promoterDrawer.value; |
|
|
|
@ -67,7 +68,7 @@ let visible = computed({ |
|
|
|
closeDrawer(); |
|
|
|
}, |
|
|
|
}); |
|
|
|
watch(flowPermission1, (val) => { |
|
|
|
watch(flowPermission1, (val:any) => { |
|
|
|
flowPermission.value = val.value; |
|
|
|
}); |
|
|
|
|
|
|
|
@ -86,7 +87,7 @@ const savePromoter = () => { |
|
|
|
id: flowPermission1.value.id, |
|
|
|
}); |
|
|
|
// console.log(1); |
|
|
|
let powerAry = []; |
|
|
|
let powerAry:any = []; |
|
|
|
if ( |
|
|
|
powerUnitAry.value.recUnitAry.masterUnitList && |
|
|
|
powerUnitAry.value.recUnitAry.masterUnitList.length > 0 |
|
|
|
@ -145,7 +146,7 @@ const savePromoter = () => { |
|
|
|
// console.log("formKey--->",props.formKey.toString()); |
|
|
|
// console.log("formVersion--->",props.formVersion.toString()); |
|
|
|
// console.log("value--->",formData.value); |
|
|
|
console.log("purview--->", formData.value.purview); |
|
|
|
// console.log("purview--->", formData.value.purview); |
|
|
|
|
|
|
|
let sendInfo: any = { |
|
|
|
formKey: props.formKey.toString(), |
|
|
|
@ -153,7 +154,7 @@ const savePromoter = () => { |
|
|
|
formData: JSON.stringify(formData.value), |
|
|
|
formPower: JSON.stringify(formData.value.purview), |
|
|
|
}; |
|
|
|
console.log("sendInfo", sendInfo); |
|
|
|
// console.log("sendInfo", sendInfo); |
|
|
|
setFlowFormKeyPower(sendInfo); |
|
|
|
// console.log("formDataAll",formData) |
|
|
|
// console.log("formData",formData.value.purview) |
|
|
|
@ -162,6 +163,79 @@ const savePromoter = () => { |
|
|
|
const closeDrawer = () => { |
|
|
|
setPromoter(false); |
|
|
|
}; |
|
|
|
//新的节点权限赋权 |
|
|
|
const powerNewUnitAry = ref<powerNoke>(); |
|
|
|
const activePickUnitGroupName = ref("") |
|
|
|
|
|
|
|
//保存节点设置 |
|
|
|
const saveNoderPower = () => { |
|
|
|
//保存节点设置 |
|
|
|
setFlowPermission({ |
|
|
|
value: flowPermission.value, |
|
|
|
flag: true, |
|
|
|
id: flowPermission1.value.id, |
|
|
|
}); |
|
|
|
let untiPwoerAry: { id: string; name: string; status: number; isLook: boolean; isEdit: boolean; }[] = [] |
|
|
|
//获取组件状态 |
|
|
|
if(powerNewUnitAry.value?.recUnitAry && Array.isArray(powerNewUnitAry.value?.recUnitAry) && powerNewUnitAry.value?.recUnitAry.length > 0){ |
|
|
|
powerNewUnitAry.value?.recUnitAry.forEach((item: any) => { |
|
|
|
untiPwoerAry.push({ |
|
|
|
id: item.id, |
|
|
|
name: item.name, |
|
|
|
status: item.status, |
|
|
|
isLook: item.isLook, |
|
|
|
isEdit: item.isEdit |
|
|
|
}); |
|
|
|
if(item.list && Array.isArray(item.list) && item.list.length > 0){ |
|
|
|
item.list.forEach((listItem: any) => { |
|
|
|
untiPwoerAry.push({ |
|
|
|
id: listItem.id, |
|
|
|
name: listItem.name, |
|
|
|
status: listItem.status, |
|
|
|
isLook: listItem.isLook, |
|
|
|
isEdit: listItem.isEdit |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// console.log("源节点是否有复制", formData.value.purview); |
|
|
|
if(formData.value.purview && Array.isArray(formData.value.purview) && formData.value.purview.length > 0){ |
|
|
|
let isNew = true; |
|
|
|
formData.value.purview.forEach((item: any) => { |
|
|
|
if (item.nodeKey == props.nodeConfig.nodeNumber) { //判断当前节点是否已经设置过了 |
|
|
|
item.powerAry = untiPwoerAry; |
|
|
|
isNew = false; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (isNew) { //此节点没有设置过;那么新增此节点 |
|
|
|
formData.value.purview.push({ |
|
|
|
nodeKey: props.nodeConfig.nodeNumber, |
|
|
|
powerAry: untiPwoerAry, |
|
|
|
}); |
|
|
|
} |
|
|
|
}else{ //从没有设置过权限配置 |
|
|
|
formData.value.purview = [ |
|
|
|
{ |
|
|
|
nodeKey: props.nodeConfig.nodeNumber, |
|
|
|
powerAry: untiPwoerAry, |
|
|
|
}, |
|
|
|
]; |
|
|
|
} |
|
|
|
let sendInfo: any = { |
|
|
|
formKey: props.formKey.toString(), |
|
|
|
formVersion: props.formVersion.toString(), |
|
|
|
formData: JSON.stringify(formData.value), |
|
|
|
formPower: JSON.stringify(formData.value.purview), |
|
|
|
}; |
|
|
|
// console.log("提交权限设置", sendInfo); |
|
|
|
setFlowFormKeyPower(sendInfo); |
|
|
|
closeDrawer(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const powerUnitAry = ref<any>({ |
|
|
|
nodeKey: "", |
|
|
|
@ -172,6 +246,7 @@ const powerUnitAry = ref<any>({ |
|
|
|
unitAllState: [], |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2024-03-13 08:24:54 |
|
|
|
@ -179,37 +254,65 @@ const powerUnitAry = ref<any>({ |
|
|
|
*/ |
|
|
|
const jieForm = () => { |
|
|
|
// console.log("nodeConfig",props.nodeConfig) |
|
|
|
analysisForm({ |
|
|
|
// analysisForm({ |
|
|
|
// nodeKey: props.nodeConfig.nodeNumber, |
|
|
|
// nodeJson: JSON.stringify(formData.value), |
|
|
|
// }).then((data:any) => { |
|
|
|
// if (data.code == 0) { |
|
|
|
// powerUnitAry.value = data.data; |
|
|
|
|
|
|
|
// if ( |
|
|
|
// powerUnitAry.value.recUnitAry.masterUnitList && |
|
|
|
// powerUnitAry.value.recUnitAry.masterUnitList.length > 0 |
|
|
|
// ) { |
|
|
|
// let allToal = powerUnitAry.value.recUnitAry.masterUnitList.length; |
|
|
|
// let isAll = 0; |
|
|
|
// let editAll = 0; |
|
|
|
// powerUnitAry.value.recUnitAry.masterUnitList.forEach((item: any) => { |
|
|
|
// if (item.isLook) { |
|
|
|
// isAll++; |
|
|
|
// } |
|
|
|
// if (item.isEdit) { |
|
|
|
// editAll++; |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// if (isAll == allToal) { |
|
|
|
// isLookAll.value = true; |
|
|
|
// } |
|
|
|
// if (editAll == allToal) { |
|
|
|
// isEditAll.value = true; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
//新授权模式 |
|
|
|
analyFormJsonMap({ |
|
|
|
nodeKey: props.nodeConfig.nodeNumber, |
|
|
|
nodeJson: JSON.stringify(formData.value), |
|
|
|
}).then((data) => { |
|
|
|
}).then((data:any) => { |
|
|
|
// console.log("新授权模式",data) |
|
|
|
if(data.code == 0){ |
|
|
|
powerUnitAry.value = data.data; |
|
|
|
powerNewUnitAry.value = data.data |
|
|
|
// powerNewUnitAry.value?.nodeKey = data.data.nodeKey |
|
|
|
// powerNewUnitAry.value?.recUnitAry = data.data.recUnitAry |
|
|
|
if(data.data.recUnitAry && Array.isArray(data.data.recUnitAry) && data.data.recUnitAry.length > 0){ |
|
|
|
data.data.recUnitAry.forEach((item:powerNokeInfo,i:number)=>{ |
|
|
|
// if(item.id != "masterid"){ |
|
|
|
// return activePickUnitGroupName.value = item.id; |
|
|
|
|
|
|
|
if ( |
|
|
|
powerUnitAry.value.recUnitAry.masterUnitList && |
|
|
|
powerUnitAry.value.recUnitAry.masterUnitList.length > 0 |
|
|
|
) { |
|
|
|
let allToal = powerUnitAry.value.recUnitAry.masterUnitList.length; |
|
|
|
let isAll = 0; |
|
|
|
let editAll = 0; |
|
|
|
powerUnitAry.value.recUnitAry.masterUnitList.forEach((item: any) => { |
|
|
|
if (item.isLook) { |
|
|
|
isAll++; |
|
|
|
} |
|
|
|
if (item.isEdit) { |
|
|
|
editAll++; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (isAll == allToal) { |
|
|
|
isLookAll.value = true; |
|
|
|
} |
|
|
|
if (editAll == allToal) { |
|
|
|
isEditAll.value = true; |
|
|
|
// } |
|
|
|
if(i == 1){ |
|
|
|
activePickUnitGroupName.value = item.id; |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
// console.log("新授权模式sadsadasdasd",powerNewUnitAry.value ) |
|
|
|
// powerNewUnitAry.value?.nodeKey = data |
|
|
|
}) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
watch( |
|
|
|
@ -290,6 +393,86 @@ const oneEditSet = (val: any) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//编辑主干可见 |
|
|
|
const editPowerLook = (val:powerNokeInfo) => { |
|
|
|
// console.log("编辑主干可见",val) |
|
|
|
if(val.list && Array.isArray(val.list) && val.list.length > 0){ |
|
|
|
val.list.forEach((item:any)=>{ |
|
|
|
if(val.isLook){ |
|
|
|
item.isLook = val.isLook |
|
|
|
}else{ |
|
|
|
val.isEdit = val.isLook |
|
|
|
item.isLook = val.isLook |
|
|
|
item.isEdit = val.isLook |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
//处理字段可见不可见 |
|
|
|
const editPowerWorkLook = (master:powerNokeInfo,word:powerNokeInfo) => { |
|
|
|
// console.log("处理字段可见不可见master",master) |
|
|
|
// console.log("处理字段可见不可见word",word) |
|
|
|
if(!word.isLook){ |
|
|
|
word.isEdit = word.isLook |
|
|
|
} |
|
|
|
isAllPick(master) |
|
|
|
} |
|
|
|
|
|
|
|
//编辑主干编辑 |
|
|
|
const editPowerSave = (val:powerNokeInfo) => { |
|
|
|
if(val.list && Array.isArray(val.list) && val.list.length > 0){ |
|
|
|
val.list.forEach((item:any)=>{ |
|
|
|
if(val.isEdit){ |
|
|
|
val.isLook = val.isEdit |
|
|
|
item.isEdit = val.isEdit |
|
|
|
item.isLook = val.isEdit |
|
|
|
}else{ |
|
|
|
val.isEdit = val.isEdit |
|
|
|
item.isEdit = val.isEdit |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//处理字段是否可编辑 |
|
|
|
const editPowerWorkSave = (master:powerNokeInfo,word:powerNokeInfo) => { |
|
|
|
if(word.isEdit){ |
|
|
|
word.isLook = word.isEdit |
|
|
|
} |
|
|
|
isAllPick(master) |
|
|
|
} |
|
|
|
|
|
|
|
//判断当前模块是否全选 |
|
|
|
const isAllPick = (val:powerNokeInfo) => { |
|
|
|
if(val.list && Array.isArray(val.list) && val.list.length > 0){ |
|
|
|
let lookNum = 0; |
|
|
|
let editNum = 0; |
|
|
|
val.list.forEach((item:any)=>{ |
|
|
|
if(item.isLook){ |
|
|
|
lookNum++; |
|
|
|
} |
|
|
|
if(item.isEdit){ |
|
|
|
editNum++; |
|
|
|
} |
|
|
|
}) |
|
|
|
if(lookNum > 0){ |
|
|
|
val.isLook = true |
|
|
|
}else{ |
|
|
|
val.isLook = false |
|
|
|
} |
|
|
|
if(editNum > 0){ |
|
|
|
val.isEdit = true |
|
|
|
}else{ |
|
|
|
val.isEdit = false |
|
|
|
} |
|
|
|
// console.log("判断当前模块是否全选master",val) |
|
|
|
// console.log("判断当前模块是否全选lookNum",lookNum) |
|
|
|
// console.log("判断当前模块是否全选editNum",editNum) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
<template> |
|
|
|
<el-drawer |
|
|
|
@ -322,9 +505,120 @@ const oneEditSet = (val: any) => { |
|
|
|
</template> |
|
|
|
<!-- <el-divider content-position="left">操作权限</el-divider> --> |
|
|
|
<div class="info_box"> |
|
|
|
|
|
|
|
<template v-for="item in powerNewUnitAry?.recUnitAry"> |
|
|
|
<template v-if="item.id=='masterid'"> |
|
|
|
<div class="table_name"> |
|
|
|
<el-text class="mx-1" type="primary">主表</el-text> |
|
|
|
</div> |
|
|
|
<el-table border :data="item.list"> |
|
|
|
<el-table-column prop="name" label="字段" /> |
|
|
|
<el-table-column align="center" width="80"> |
|
|
|
<template #header> |
|
|
|
<el-checkbox |
|
|
|
v-model="item.isLook" |
|
|
|
label="" |
|
|
|
@change="editPowerLook(item)" |
|
|
|
/>可见 |
|
|
|
</template> |
|
|
|
<template #default="scope"> |
|
|
|
<el-checkbox |
|
|
|
v-model="scope.row.isLook" |
|
|
|
label="" |
|
|
|
@change="editPowerWorkLook(item,scope.row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column align="center" width="120"> |
|
|
|
<template #header> |
|
|
|
<el-checkbox |
|
|
|
v-model="item.isEdit" |
|
|
|
label="" |
|
|
|
@change="editPowerSave(item)" |
|
|
|
/>可编辑 |
|
|
|
</template> |
|
|
|
<template #default="scope"> |
|
|
|
<el-checkbox |
|
|
|
v-model="scope.row.isEdit" |
|
|
|
label="" |
|
|
|
@change="editPowerWorkSave(item,scope.row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<div class="table_name"> |
|
|
|
<el-text class="mx-1" type="primary">其他</el-text> |
|
|
|
</div> |
|
|
|
<el-tabs v-model="activePickUnitGroupName" class="demo-tabs" type="border-card"> |
|
|
|
<template v-for="item in powerNewUnitAry?.recUnitAry"> |
|
|
|
<template v-if="item.id!='masterid'"> |
|
|
|
<el-tab-pane :label="item.name" :name="item.id" > |
|
|
|
|
|
|
|
<!-- <template #label> |
|
|
|
<div class="checkBoxClass"> |
|
|
|
<span>{{item.name}}</span> |
|
|
|
<div> |
|
|
|
<el-checkbox |
|
|
|
v-model="item.isLook" |
|
|
|
label="" |
|
|
|
/>可见 |
|
|
|
<el-checkbox |
|
|
|
v-model="item.isEdit" |
|
|
|
label="" |
|
|
|
@change="editOpenOrClose" |
|
|
|
/>可编辑 |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> --> |
|
|
|
|
|
|
|
<el-table border :data="item.list"> |
|
|
|
<el-table-column prop="name" label="字段" /> |
|
|
|
<el-table-column align="center" width="80"> |
|
|
|
<template #header> |
|
|
|
<el-checkbox |
|
|
|
v-model="item.isLook" |
|
|
|
label="" |
|
|
|
@change="editPowerLook(item)" |
|
|
|
/>可见 |
|
|
|
</template> |
|
|
|
<template #default="scope"> |
|
|
|
<el-checkbox |
|
|
|
v-model="scope.row.isLook" |
|
|
|
label="" |
|
|
|
@change="editPowerWorkLook(item,scope.row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column align="center" width="120"> |
|
|
|
<template #header> |
|
|
|
<el-checkbox |
|
|
|
v-model="item.isEdit" |
|
|
|
label="" |
|
|
|
@change="editPowerSave(item)" |
|
|
|
/>可编辑 |
|
|
|
</template> |
|
|
|
<template #default="scope"> |
|
|
|
<el-checkbox |
|
|
|
v-model="scope.row.isEdit" |
|
|
|
label="" |
|
|
|
@change="editPowerWorkSave(item,scope.row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
</el-tab-pane> |
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-tabs> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <div class="table_name"> |
|
|
|
<el-text class="mx-1" type="primary">主表</el-text> |
|
|
|
</div> |
|
|
|
<el-table |
|
|
|
v-if="powerUnitAry.recUnitAry.masterUnitList" |
|
|
|
:data="powerUnitAry.recUnitAry.masterUnitList" |
|
|
|
@ -397,7 +691,7 @@ const oneEditSet = (val: any) => { |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-row> --> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<el-tab-pane name="helpInstructions"> |
|
|
|
@ -412,7 +706,8 @@ const oneEditSet = (val: any) => { |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="demo-drawer__footer clear"> |
|
|
|
<el-button type="primary" @click="savePromoter">确 定</el-button> |
|
|
|
<!-- <el-button type="primary" @click="savePromoter">确 定</el-button> --> |
|
|
|
<el-button type="primary" @click="saveNoderPower">确 定</el-button> |
|
|
|
<el-button @click="closeDrawer">取 消</el-button> |
|
|
|
</div> |
|
|
|
<employees-dialog |
|
|
|
@ -445,4 +740,16 @@ const oneEditSet = (val: any) => { |
|
|
|
.table_name { |
|
|
|
padding: 10px 0; |
|
|
|
} |
|
|
|
.checkBoxClass{ |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
padding: 0 10px 0 0; |
|
|
|
span{ |
|
|
|
padding: 0 10px; |
|
|
|
} |
|
|
|
:deep .el-checkbox{ |
|
|
|
margin: 0px 0px 0px 10px; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
|