流程配置限制

This commit is contained in:
ChenXinXin committed 2024-05-09 11:27:00 +08:00
1 parent a41ced621b
commit 64fc0ea393
2 files changed
+21 -15

No files matched your search

+19 -13
View File
@@ -303,7 +303,7 @@ Vue.component("process-flow", {
this.activeMenuIndex = event?.target.dataset.menuIndex this.activeMenuIndex = event?.target.dataset.menuIndex
}, },
menuShown(index){ menuShown(index){
return event?.target.dataset.itemIndex == this.activeMenuIndex || false return event?.target.dataset?.itemIndex == this.activeMenuIndex || false
}, },
async addNodeBySimple({type, prevIndex = -1}){ async addNodeBySimple({type, prevIndex = -1}){
@@ -829,6 +829,12 @@ Vue.component("process-flow", {
this.disPassValidateText += "只允许存在1个开始节点或结束节点!\n" this.disPassValidateText += "只允许存在1个开始节点或结束节点!\n"
} }
// 不允许没有审核节点
if(!nodeList.some(node => node.properties.type == 'approvalTask')){
this.isPassValidate = false
this.disPassValidateText += "不允许存在无审批人的审批流程!\n"
}
// 不允许孤立节点 => 除了开始节点和结束节点外,每个节点都有入线和出线 // 不允许孤立节点 => 除了开始节点和结束节点外,每个节点都有入线和出线
var lineBySourceNodeId = _.groupBy(lineList, 'sourceNodeId'), var lineBySourceNodeId = _.groupBy(lineList, 'sourceNodeId'),
lineByTargetNodeId = _.groupBy(lineList, 'targetNodeId'), lineByTargetNodeId = _.groupBy(lineList, 'targetNodeId'),
@@ -844,12 +850,12 @@ Vue.component("process-flow", {
// 判断开始节点是否只含有出线sourceNodeId // 判断开始节点是否只含有出线sourceNodeId
if(_.some(Object.keys(lineByTargetNodeId), (i) => i.startsWith('start-'))){ if(_.some(Object.keys(lineByTargetNodeId), (i) => i.startsWith('start-'))){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "连线终点不能为开始节点!" this.disPassValidateText += "连线终点不能为开始节点!\n"
} }
// 结束节点是否是含有入线targetNodeId // 结束节点是否是含有入线targetNodeId
if(_.some(Object.keys(lineBySourceNodeId), (i) => i.startsWith('end-'))){ if(_.some(Object.keys(lineBySourceNodeId), (i) => i.startsWith('end-'))){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "连线起点不能为结束节点!" this.disPassValidateText += "连线起点不能为结束节点!\n"
} }
// 其他的节点必须至少有一个入线和出线 // 其他的节点必须至少有一个入线和出线
for (const key in mergeTemp) { for (const key in mergeTemp) {
@@ -859,7 +865,7 @@ Vue.component("process-flow", {
if(!_.some(element, i => i.sourceNodeId == key) || !_.some(element, i => i.targetNodeId == key)){ if(!_.some(element, i => i.sourceNodeId == key) || !_.some(element, i => i.targetNodeId == key)){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "不允许存在除了开始和结束节点以外的节点没有入线或出线!" this.disPassValidateText += "不允许存在除了开始和结束节点以外的节点没有入线或出线!\n"
break break
} }
} }
@@ -877,12 +883,12 @@ Vue.component("process-flow", {
if(_.some(node, i => i.properties.type == "conditionTask")){ if(_.some(node, i => i.properties.type == "conditionTask")){
if(_.some(node, i => i.properties.type != "conditionTask")){ if(_.some(node, i => i.properties.type != "conditionTask")){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "不允许条件节点和审批/通知节点存在同一层级!" this.disPassValidateText += "不允许条件节点和审批/通知节点存在同一层级!\n"
} }
}else{ }else{
if(node.length > 1){ if(node.length > 1){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "不允许同一层级多个审批/抄送节点同时存在!" this.disPassValidateText += "不允许同一层级多个审批/抄送节点同时存在!\n"
} }
} }
} }
@@ -898,7 +904,7 @@ Vue.component("process-flow", {
if(!_.some(conditionNode, i => i.properties.priority == -1)){ if(!_.some(conditionNode, i => i.properties.priority == -1)){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!" this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!\n"
} }
} }
} }
@@ -910,31 +916,31 @@ Vue.component("process-flow", {
if(['conditionTask'].includes(element.properties.type)){ if(['conditionTask'].includes(element.properties.type)){
if(!element.properties.priority){ if(!element.properties.priority){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += `${element.properties.label}节点没有设置优先级!` this.disPassValidateText += `${element.properties.label}节点没有设置优先级!\n`
}else{ }else{
if(element.properties.priority != -1 && element.properties.conditionList.length <= 0){ if(element.properties.priority != -1 && element.properties.conditionList.length <= 0){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += `${element.properties.label}节点没有设置条件组!` this.disPassValidateText += `${element.properties.label}节点没有设置条件组!\n`
} }
} }
}else if(['approvalTask'].includes(element.properties.type)){ }else if(['approvalTask'].includes(element.properties.type)){
if(!element.properties.approvalType || !element.properties.approverType){ if(!element.properties.approvalType || !element.properties.approverType){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += `${element.properties.label}节点没有完善信息!` this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
}else if(element.properties.approverType != '申请人自选'){ }else if(element.properties.approverType != '申请人自选'){
if(!(element.properties.user && element.properties.user?.length > 0)){ if(!(element.properties.user && element.properties.user?.length > 0)){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += `${element.properties.label}节点没有完善信息!` this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
} }
} }
}else if(['noticeTask'].includes(element.properties.type)){ }else if(['noticeTask'].includes(element.properties.type)){
if(!element.properties.noticerType){ if(!element.properties.noticerType){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += `${element.properties.label}节点没有完善信息!` this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
}else if(element.properties.noticerType != '申请人自选'){ }else if(element.properties.noticerType != '申请人自选'){
if(!(element.properties.user && element.properties.user?.length > 0)){ if(!(element.properties.user && element.properties.user?.length > 0)){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += `${element.properties.label}节点没有完善信息!` this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
} }
} }
} }
+2 -2
View File
@@ -56,8 +56,8 @@
<span role="button" class="success--text font-weight-medium font-size-2 mr-2" @click="doUiAction('openWorkflowEditorDrawer', item)"> <span role="button" class="success--text font-weight-medium font-size-2 mr-2" @click="doUiAction('openWorkflowEditorDrawer', item)">
<v-icon size="16" class="success--text">mdi-note-edit-outline</v-icon>编辑 <v-icon size="16" class="success--text">mdi-note-edit-outline</v-icon>编辑
</span> </span>
<span role="button" class="success--text font-weight-medium font-size-2" @click="doUiAction('deleteWorkflow', item)"> <span role="button" class="error--text font-weight-medium font-size-2" @click="doUiAction('deleteWorkflow', item)">
<v-icon size="16" class="success--text">mdi-note-edit-outline</v-icon>删除 <v-icon size="16" class="error--text">mdi-note-edit-outline</v-icon>删除
</span> </span>
</template> </template>
<!-- 手机端 --> <!-- 手机端 -->