同一层级只能存在一个审批节点或抄送节点
This commit is contained in:
1 parent
f8159254da
commit
84ac519499
1 file changed
+53
-22
@@ -104,6 +104,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- <<<<<<<<<<<<< 复杂右侧 -->
|
<!-- <<<<<<<<<<<<< 复杂右侧 -->
|
||||||
</template>
|
</template>
|
||||||
|
<template>
|
||||||
|
<v-snackbar v-model="isSnackerShown" top timeout="5000">
|
||||||
|
<span>{{disPassValidateText}}</span>
|
||||||
|
<template v-slot:action="{ attrs }">
|
||||||
|
<v-btn
|
||||||
|
color="red"
|
||||||
|
text
|
||||||
|
v-bind="attrs"
|
||||||
|
@click="isSnackerShown = false"
|
||||||
|
>
|
||||||
|
关闭
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
</v-snackbar>
|
||||||
|
</template>
|
||||||
|
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
@@ -211,6 +226,9 @@ Vue.component("process-flow", {
|
|||||||
displayMode: 'complex', // 'complex'、'simple'
|
displayMode: 'complex', // 'complex'、'simple'
|
||||||
isAddNodeMenuShown: false,
|
isAddNodeMenuShown: false,
|
||||||
activeMenuIndex: -1,
|
activeMenuIndex: -1,
|
||||||
|
isSnackerShown: false,
|
||||||
|
disPassValidateText:"",
|
||||||
|
isPassValidate: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -269,6 +287,9 @@ Vue.component("process-flow", {
|
|||||||
case 'dataValidate':
|
case 'dataValidate':
|
||||||
await this.dataValidate();
|
await this.dataValidate();
|
||||||
break;
|
break;
|
||||||
|
case 'closeEditNode':
|
||||||
|
await this.closeEditNode();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error("[doUiAction] uiActionId not find", {uiActionId});
|
console.error("[doUiAction] uiActionId not find", {uiActionId});
|
||||||
break;
|
break;
|
||||||
@@ -798,15 +819,14 @@ Vue.component("process-flow", {
|
|||||||
* 检验数据
|
* 检验数据
|
||||||
*/
|
*/
|
||||||
async dataValidate(){
|
async dataValidate(){
|
||||||
var isPassValidate = true,
|
this.disPassValidateText = ""
|
||||||
disPassValidateText = '';
|
this.isPassValidate = true
|
||||||
const { lineList, nodeList } = this.workflowConfig;
|
const { lineList, nodeList } = this.workflowConfig;
|
||||||
|
|
||||||
|
|
||||||
// 不允许多个开始节点或结束节点
|
// 不允许多个开始节点或结束节点
|
||||||
if(nodeList.filter(n=>n.properties.type == 'start').length != 1 || nodeList.filter(n=>n.properties.type == 'end').length != 1){
|
if(nodeList.filter(n=>n.properties.type == 'start').length != 1 || nodeList.filter(n=>n.properties.type == 'end').length != 1){
|
||||||
isPassValidate = false
|
this.isPassValidate = false
|
||||||
disPassValidateText += "只允许存在1个开始节点或结束节点!"
|
this.disPassValidateText += "只允许存在1个开始节点或结束节点!\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不允许孤立节点 => 除了开始节点和结束节点外,每个节点都有入线和出线
|
// 不允许孤立节点 => 除了开始节点和结束节点外,每个节点都有入线和出线
|
||||||
@@ -818,18 +838,18 @@ Vue.component("process-flow", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(Object.keys(mergeTemp).length < nodeList.length){
|
if(Object.keys(mergeTemp).length < nodeList.length){
|
||||||
isPassValidate = false
|
this.isPassValidate = false
|
||||||
disPassValidateText += '存在孤立节点!\n'
|
this.disPassValidateText += '不允许存在孤立节点!\n'
|
||||||
}else{
|
}else{
|
||||||
// 判断开始节点是否只含有出线sourceNodeId
|
// 判断开始节点是否只含有出线sourceNodeId
|
||||||
if(_.some(Object.keys(lineByTargetNodeId), (i) => i.startsWith('start-'))){
|
if(_.some(Object.keys(lineByTargetNodeId), (i) => i.startsWith('start-'))){
|
||||||
isPassValidate = false
|
this.isPassValidate = false
|
||||||
disPassValidateText += "连线终点不能为开始节点!\n"
|
this.disPassValidateText += "连线终点不能为开始节点!"
|
||||||
}
|
}
|
||||||
// 结束节点是否是含有入线targetNodeId
|
// 结束节点是否是含有入线targetNodeId
|
||||||
if(_.some(Object.keys(lineBySourceNodeId), (i) => i.startsWith('end-'))){
|
if(_.some(Object.keys(lineBySourceNodeId), (i) => i.startsWith('end-'))){
|
||||||
isPassValidate = false
|
this.isPassValidate = false
|
||||||
disPassValidateText += "连线起点不能为结束节点!\n"
|
this.disPassValidateText += "连线起点不能为结束节点!"
|
||||||
}
|
}
|
||||||
// 其他的节点必须至少有一个入线和出线
|
// 其他的节点必须至少有一个入线和出线
|
||||||
for (const key in mergeTemp) {
|
for (const key in mergeTemp) {
|
||||||
@@ -838,8 +858,8 @@ Vue.component("process-flow", {
|
|||||||
const element = mergeTemp[key];
|
const element = mergeTemp[key];
|
||||||
|
|
||||||
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)){
|
||||||
isPassValidate = false
|
this.isPassValidate = false
|
||||||
disPassValidateText += "存在除了开始和结束节点以外的节点没有入线或出线!"
|
this.disPassValidateText += "不允许存在除了开始和结束节点以外的节点没有入线或出线!"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -847,16 +867,23 @@ Vue.component("process-flow", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不允许条件节点和审批/通知节点存在同一层级
|
// 不允许条件节点和审批/通知节点存在同一层级 以及 不允许无条件层级,多个审批/抄送节点同时存在
|
||||||
for (const key in lineBySourceNodeId) {
|
for (const key in lineBySourceNodeId) {
|
||||||
if (Object.hasOwnProperty.call(lineBySourceNodeId, key)) {
|
if (Object.hasOwnProperty.call(lineBySourceNodeId, key)) {
|
||||||
const element = lineBySourceNodeId[key];
|
const element = lineBySourceNodeId[key];
|
||||||
// 拿到同一层的节点
|
// 拿到同一层的节点
|
||||||
var node = element.map(l => nodeList.find(n => n.id === l.targetNodeId))
|
var node = element.map(l => nodeList.find(n => n.id === l.targetNodeId))
|
||||||
|
|
||||||
if(_.some(node, i => i.properties.type == "conditionTask") && _.some(node, i => i.properties.type != "conditionTask")){
|
if(_.some(node, i => i.properties.type == "conditionTask")){
|
||||||
isPassValidate = false
|
if(_.some(node, i => i.properties.type != "conditionTask")){
|
||||||
disPassValidateText += "不允许条件节点和审批/通知节点存在同一层级!"
|
this.isPassValidate = false
|
||||||
|
this.disPassValidateText += "不允许条件节点和审批/通知节点存在同一层级!"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(node.length > 1){
|
||||||
|
this.isPassValidate = false
|
||||||
|
this.disPassValidateText += "不允许同一层级多个审批/抄送节点同时存在!"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -870,16 +897,20 @@ Vue.component("process-flow", {
|
|||||||
var conditionNode = element.map(l => nodeList.find(n => n.id === l.targetNodeId))
|
var conditionNode = element.map(l => nodeList.find(n => n.id === l.targetNodeId))
|
||||||
|
|
||||||
if(!_.some(conditionNode, i => i.properties.priority == -1)){
|
if(!_.some(conditionNode, i => i.properties.priority == -1)){
|
||||||
isPassValidate = false
|
this.isPassValidate = false
|
||||||
disPassValidateText += "存在某层条件节点没有默认条件优先级!"
|
this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPassValidate){
|
if(!this.isPassValidate){
|
||||||
await window.vtoast.fail(disPassValidateText);
|
// await window.vtoast.fail(this.disPassValidateText);
|
||||||
throw new Error(disPassValidateText)
|
this.isSnackerShown = true
|
||||||
|
throw new Error(this.disPassValidateText)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
closeEditNode(){
|
||||||
|
this.editType = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user