From c3ef1eb784684c0029aa4ad0afd4371ce6f210ff Mon Sep 17 00:00:00 2001 From: icanci Date: Sun, 17 Sep 2023 16:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A0=E5=AF=9F=E5=9B=BE=E5=9B=BE=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E4=B8=8E=E5=9B=9E=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bic-config/components/ruleTreeNode.vue | 4 +- .../bic-config/dialog/unit-view-tree-form.vue | 58 +++++++++++++++++-- .../src/views/bic-config/unit-view-tree.vue | 23 ++------ 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/views/src/main/resources/vueboot/src/views/bic-config/components/ruleTreeNode.vue b/views/src/main/resources/vueboot/src/views/bic-config/components/ruleTreeNode.vue index 902f499..c0a6843 100644 --- a/views/src/main/resources/vueboot/src/views/bic-config/components/ruleTreeNode.vue +++ b/views/src/main/resources/vueboot/src/views/bic-config/components/ruleTreeNode.vue @@ -188,10 +188,10 @@ - + { if (valid) { - await vm.doSave(this.saveData) + // 遍历所有节点,进行数据验证 + let relationModel = vm.$refs.ruleTreeList.getRelationModel() + if (relationModel.length === 0) { + vm.$message({type: 'error', message: '请至少添加一个节点'}); + return + } + vm.loopFillUuid(relationModel) + + if (!vm.loopRelationModelValidate(relationModel)) { + return + } + + vm.saveData.relationModel = relationModel + await vm.doSave(vm.saveData) } }) }, + loopRelationModelValidate(relationModel) { + for (let i = 0; i < relationModel.length; i++) { + let relationModelItem = relationModel[i]; + if (relationModelItem.sourceNodeUuid === '') { + this.$message({type: 'error', message: '请设置节点【' + relationModelItem.label + '】的开始节点'}); + return false + } + if (relationModelItem.targetNodeUuid === '') { + this.$message({type: 'error', message: '请设置节点【' + relationModelItem.label + '】的结束节点'}); + return false + } + if (relationModelItem.edgeStyleUuid === '') { + this.$message({type: 'error', message: '请设置节点【' + relationModelItem.label + '】的边样式'}); + return false + } + if (relationModelItem.sourceNodeDataMode === '') { + this.$message({type: 'error', message: '请设置节点【' + relationModelItem.label + '】的开始节点数据模式'}); + return false + } + if (relationModelItem.targetNodeDataMode === '') { + this.$message({type: 'error', message: '请设置节点【' + relationModelItem.label + '】的结束节点数据模式'}); + return false + } + if (relationModelItem.sourceNodeDataKey === '') { + this.$message({type: 'error', message: '请设置节点【' + relationModelItem.label + '】的开始节点数据键'}); + return false + } + if (relationModelItem.targetNodeDataKey === '') { + this.$message({type: 'error', message: '请设置节点【' + relationModelItem.label + '】的结束节点数据键'}); + return false + } + if (relationModelItem.children) { + this.loopRelationModelValidate(relationModelItem.children) + } + } + return true; + }, async doSave(saveData) { let vm = this let ret = await unitViewTreeSave(saveData); diff --git a/views/src/main/resources/vueboot/src/views/bic-config/unit-view-tree.vue b/views/src/main/resources/vueboot/src/views/bic-config/unit-view-tree.vue index a6964b3..30b0842 100644 --- a/views/src/main/resources/vueboot/src/views/bic-config/unit-view-tree.vue +++ b/views/src/main/resources/vueboot/src/views/bic-config/unit-view-tree.vue @@ -52,24 +52,7 @@ align="center" label="用例名称"> - - - - - - -