模版配置限制

This commit is contained in:
ChenXinXin committed 2024-05-14 16:41:38 +08:00
1 parent 391aea1034
commit c06d8f1fff
3 files changed
+23 -29

No files matched your search

+9 -25
View File
@@ -104,21 +104,6 @@
</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>
@@ -226,7 +211,6 @@ Vue.component("process-flow", {
displayMode: 'complex', // 'complex'、'simple' displayMode: 'complex', // 'complex'、'simple'
isAddNodeMenuShown: false, isAddNodeMenuShown: false,
activeMenuIndex: -1, activeMenuIndex: -1,
isSnackerShown: false,
disPassValidateText:"", disPassValidateText:"",
isPassValidate: true isPassValidate: true
}; };
@@ -823,10 +807,10 @@ Vue.component("process-flow", {
this.isPassValidate = true 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(lineList.filter(l => l.sourceNodeId == l.targetNodeId).length > 0){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "只允许存在1个开始节点或结束节点!\n" this.disPassValidateText += "不允许单节点回环!\n"
} }
// 不允许没有审核节点 // 不允许没有审核节点
@@ -902,7 +886,7 @@ 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)){
this.isPassValidate = false this.isPassValidate = false
this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!\n" this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!\n"
} }
@@ -914,11 +898,11 @@ Vue.component("process-flow", {
const element = nodeList[index]; const element = nodeList[index];
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}节点没有设置优先级!\n` 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}节点没有设置条件组!\n` this.disPassValidateText += `${element.properties.label}节点没有设置条件组!\n`
} }
@@ -947,9 +931,8 @@ Vue.component("process-flow", {
} }
if(!this.isPassValidate){ if(!this.isPassValidate){
// await window.vtoast.fail(this.disPassValidateText); await window.vtoast.fail('流程设置:' + this.disPassValidateText);
this.isSnackerShown = true throw new Error('流程设置:' + this.disPassValidateText)
throw new Error(this.disPassValidateText)
} }
}, },
closeEditNode(){ closeEditNode(){
@@ -1091,5 +1074,6 @@ Vue.component("process-flow", {
white-space: nowrap; white-space: nowrap;
overflow-x: hidden; overflow-x: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
word-wrap: break-word;
} }
</style> </style>
@@ -295,8 +295,8 @@ Vue.component("form-item-list-generator", {
// 检查单选多选是否还有选项 // 检查单选多选是否还有选项
this.formItemList.forEach(element => { this.formItemList.forEach(element => {
if(['single', 'multiple'].includes(element.type) && !(element.optionList && element.optionList.length)){ if(['single', 'multiple'].includes(element.type) && !(element.optionList && element.optionList.length)){
window.vtoast.fail("存在选择题没有选项!"); window.vtoast.fail("表单设置:存在选择题没有选项!");
throw new Error("存在选择题没有选项!") throw new Error("表单设置:存在选择题没有选项!")
} }
}); });
+12 -2
View File
@@ -45,7 +45,7 @@
<v-card-text class="pa-0"> <v-card-text class="pa-0">
<div class="mt-1"> <div class="mt-1">
<!-- <div class="text-subtitle-2 mb-2">基础信息</div> --> <!-- <div class="text-subtitle-2 mb-2">基础信息</div> -->
<workflow-basic-info ref="basicInfo" :workflow-info="formObj.workflowInfo"></workflow-basic-info> <workflow-basic-info ref="basicInfo" :workflow-info="formObj.workflowInfo" :user="constantObj.userList"></workflow-basic-info>
</div> </div>
</v-card-text> </v-card-text>
</v-card> </v-card>
@@ -194,7 +194,16 @@ Vue.component("workflow-editor-drawer", {
this.formObj = formObj; this.formObj = formObj;
} else { } else {
this.submitUiActionId = 'createItem'; this.submitUiActionId = 'createItem';
this.formObj = {workflowInfo: {}, workflowForm: [], workflowConfig: {lineList: [], nodeList: []}}; this.formObj = {workflowInfo: {
taskTemplateIcon: '/images/task-template-icon/10001.png',
addAuthority: false,
modifyAuthority: false,
abnormalType: '-1',
autoApprovel: '1',
},
workflowForm: [],
workflowConfig: {lineList: [], nodeList: []}
};
} }
this.$refs.form.resetValidation(); this.$refs.form.resetValidation();
this.loading = false; this.loading = false;
@@ -312,6 +321,7 @@ Vue.component("workflow-editor-drawer", {
prepareFormSubmitData() { prepareFormSubmitData() {
const {id, workflowId, workflowInfo, workflowForm} = this.formObj; const {id, workflowId, workflowInfo, workflowForm} = this.formObj;
const { workflowName, ...data } = workflowInfo const { workflowName, ...data } = workflowInfo
if( data.abnormalType == -1 ) data.abnormalUser && delete data.abnormalUser
const workflowConfig = this.$refs.processFlow.getBusinessData(); const workflowConfig = this.$refs.processFlow.getBusinessData();
workflowConfig.nodeList.forEach(node => { workflowConfig.nodeList.forEach(node => {
if (node.type === 'userTask') { if (node.type === 'userTask') {