From 9f16b5c553b479ea12fe368a7ecc748872ea8b98 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期四, 12 六月 2025 11:11:27 +0800 Subject: [PATCH] 修改配置文件 --- web_src/src/components/dialog/catalogEdit.vue | 101 +++++++++++++++++++++++++++----------------------- 1 files changed, 55 insertions(+), 46 deletions(-) diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue old mode 100644 new mode 100755 index e1cd8d2..9a5e3a3 --- a/web_src/src/components/dialog/catalogEdit.vue +++ b/web_src/src/components/dialog/catalogEdit.vue @@ -12,15 +12,6 @@ > <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> <el-form ref="form" :rules="rules" :model="form" label-width="140px" > -<!-- <el-form-item >--> -<!-- 寤鸿鐨勭被鍨嬶細--> -<!-- <br/>--> -<!--   琛屾斂鍖哄垝锛堝彲閫�2浣�/4浣�/6浣�/8浣�/10浣嶆暟瀛楋紝渚嬪锛�130432锛岃〃绀烘渤鍖楃渷閭兏甯傚箍骞冲幙锛�--> -<!-- <br/>--> -<!--   涓氬姟鍒嗙粍锛堢11銆�12銆�13浣�215锛屼緥濡傦細34020000002150000001锛�--> -<!-- <br/>--> -<!--   铏氭嫙缁勭粐锛堢11銆�12銆�13浣�216锛屼緥濡傦細34020000002160000001锛�--> -<!-- </el-form-item>--> <el-form-item label="鑺傜偣缂栧彿" prop="id" > <el-input v-model="form.id" :disabled="isEdit" clearable></el-input> </el-form-item> @@ -46,12 +37,11 @@ export default { name: "catalogEdit", computed: {}, - props: ['platformId'], + props: ['platformId', 'platformDeviceId'], created() {}, data() { let checkId = (rule, value, callback) => { console.log("checkId") - console.log(this.treeType) console.log(rule) console.log(value) console.log(value.length) @@ -59,21 +49,38 @@ if (!value) { return callback(new Error('缂栧彿涓嶈兘涓虹┖')); } - if (this.treeType === "BusinessGroup" && value.length !== 20) { - return callback(new Error('缂栧彿蹇呴』鐢�20浣嶆暟瀛楃粍鎴�')); - } - if (this.treeType === "CivilCode" && value.length <= 8 && value.length%2 !== 0) { - return callback(new Error('琛屾斂鍖哄垝蹇呴』鏄叓浣嶄互涓嬬殑鍋舵暟涓暟瀛楃粍鎴�')); - } - if (this.treeType === "BusinessGroup") { + if (value.trim().length <= 8) { + if (value.trim().length%2 !== 0) { + return callback(new Error('琛屾斂鍖哄垝缂栧彿蹇呴』涓�2/4/6/8浣�')); + } + if (this.form.parentId !== this.platformDeviceId && this.form.parentId.length >= value.trim().length) { + if (this.form.parentId.length === 20) { + return callback(new Error('涓氬姟鍒嗙粍/铏氭嫙缁勭粐涓嬩笉鍙垱寤鸿鏀垮尯鍒�')); + }else { + return callback(new Error('琛屾斂鍖哄垝缂栧彿闀垮害搴旇姣忔涓や綅閫掑')); + } + } + }else { + if (value.trim().length !== 20) { + return callback(new Error('缂栧彿蹇呴』涓�2/4/6/8浣嶇殑琛屾斂鍖哄垝鎴�20浣嶇殑铏氭嫙缁勭粐/涓氬姟鍒嗙粍')); + } let catalogType = value.substring(10, 13); console.log(catalogType) - // 216 涓鸿櫄鎷熺粍缁� 215 涓轰笟鍔″垎缁勶紱鐩綍绗竴绾у繀椤讳负涓氬姟鍒嗙粍锛� 涓氬姟鍒嗙粍涓嬩负铏氭嫙缁勭粐锛岃櫄鎷熺粍缁囦笅鍙互鏈夊叾浠栬櫄鎷熺粍缁� - if (this.level === 1 && catalogType !== "215") { - return callback(new Error('涓氬姟鍒嗙粍妯″紡涓嬬涓�灞傜洰褰曠殑缂栧彿11鍒�13浣嶅繀椤讳负215')); + if (catalogType !== "215" && catalogType !== "216") { + return callback(new Error('缂栧彿閿欒锛屼笟鍔″垎缁�11-13浣嶄负215锛岃櫄鎷熺粍缁�11-13浣嶄负216')); } - if (this.level > 1 && catalogType !== "216") { - return callback(new Error('涓氬姟鍒嗙粍妯″紡涓嬬涓�灞備互涓嬬洰褰曠殑缂栧彿11鍒�13浣嶅繀椤讳负216')); + if (catalogType === "216") { + + if (this.form.parentId !== this.platformDeviceId){ + if (this.form.parentId.length <= 8) { + return callback(new Error('缂栧彿閿欒锛屽缓绔嬭櫄鎷熺粍缁囧墠蹇呴』鍏堝缓绔嬩笟鍔″垎缁勶紙11-13浣嶄负215锛�')); + } + } + } + if (catalogType === "215") { + if (this.form.parentId.length === "215") { + return callback(new Error('缂栧彿閿欒锛屼笟鍔″垎缁勪笅鍙兘寤虹珛铏氭嫙缁勭粐锛�11-13浣嶄负216锛�')); + } } } callback(); @@ -83,7 +90,6 @@ showDialog: false, isLoging: false, isEdit: false, - treeType: null, level: 0, form: { id: null, @@ -98,7 +104,7 @@ }; }, methods: { - openDialog: function (isEdit, id, name, parentId, treeType, level, callback) { + openDialog: function (isEdit, id, name, parentId, level, callback) { console.log("parentId: " + parentId) console.log(this.form) this.isEdit = isEdit; @@ -108,31 +114,34 @@ this.form.parentId = parentId; this.showDialog = true; this.submitCallback = callback; - this.treeType = treeType; 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; -- Gitblit v1.8.0