From 7f0be280c3b5e028be8ca0c333e67decd607370b Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 29 Jun 2023 11:09:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AA=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=9A=84=E8=A1=A8=E5=8D=95=E8=A2=AB=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_src/src/components/dialog/catalogEdit.vue | 59 +++++++++---------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue index e2fe59bc..9a5e3a36 100644 --- a/web_src/src/components/dialog/catalogEdit.vue +++ b/web_src/src/components/dialog/catalogEdit.vue @@ -12,15 +12,6 @@ >
- - - - - - - - - @@ -63,7 +54,11 @@ export default { return callback(new Error('行政区划编号必须为2/4/6/8位')); } if (this.form.parentId !== this.platformDeviceId && this.form.parentId.length >= value.trim().length) { - return callback(new Error('行政区划编号长度应该每次两位递增')); + if (this.form.parentId.length === 20) { + return callback(new Error('业务分组/虚拟组织下不可创建行政区划')); + }else { + return callback(new Error('行政区划编号长度应该每次两位递增')); + } } }else { if (value.trim().length !== 20) { @@ -122,27 +117,31 @@ export default { this.level = level; }, onSubmit: function () { - console.log("onSubmit"); - console.log(this.form); - this.$axios({ - method:"post", - url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, - data: this.form - }).then((res)=> { - if (res.data.code === 0) { - if (this.submitCallback)this.submitCallback(this.form) - }else { - this.$message({ - showClose: true, - message: res.data.msg, - type: "error", + this.$refs["form"].validate((valid) => { + if (valid) { + this.$axios({ + method:"post", + url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, + data: this.form + }).then((res)=> { + if (res.data.code === 0) { + if (this.submitCallback)this.submitCallback(this.form) + }else { + this.$message({ + showClose: true, + message: res.data.msg, + type: "error", + }); + } + this.close(); + }) + .catch((error)=> { + console.log(error); }); - } - this.close(); - }) - .catch((error)=> { - console.log(error); - }); + } else { + return false; + } + }); }, close: function () { this.isEdit = false;