From 8237cd25af7b7d1ac437cf2e04be36add6b8c12c Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期六, 01 七月 2023 22:50:24 +0800 Subject: [PATCH] 修复添加拉流代理提交错误 --- web_src/src/components/dialog/catalogEdit.vue | 76 +++++++++++++++++++++++++++++++++---- 1 files changed, 67 insertions(+), 9 deletions(-) diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue index 5b59494..e2fe59b 100644 --- a/web_src/src/components/dialog/catalogEdit.vue +++ b/web_src/src/components/dialog/catalogEdit.vue @@ -12,12 +12,22 @@ > <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"></el-input> + <el-input v-model="form.id" :disabled="isEdit" clearable></el-input> </el-form-item> <el-form-item label="鑺傜偣鍚嶇О" prop="name"> <el-input v-model="form.name" clearable></el-input> </el-form-item> + <el-form-item> <div style="float: right;"> <el-button type="primary" @click="onSubmit" >纭</el-button> @@ -36,14 +46,56 @@ export default { name: "catalogEdit", computed: {}, - props: ['platformId'], + props: ['platformId', 'platformDeviceId'], created() {}, data() { + let checkId = (rule, value, callback) => { + console.log("checkId") + console.log(rule) + console.log(value) + console.log(value.length) + console.log(this.level) + if (!value) { + return callback(new Error('缂栧彿涓嶈兘涓虹┖')); + } + 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) { + 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) + if (catalogType !== "215" && catalogType !== "216") { + return callback(new Error('缂栧彿閿欒锛屼笟鍔″垎缁�11-13浣嶄负215锛岃櫄鎷熺粍缁�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(); + } return { submitCallback: null, showDialog: false, isLoging: false, isEdit: false, + level: 0, form: { id: null, name: null, @@ -52,13 +104,14 @@ }, rules: { name: [{ required: true, message: "璇疯緭鍏ュ悕绉�", trigger: "blur" }], - id: [{ required: true, message: "璇疯緭鍏d", trigger: "blur" }] + id: [{ required: true, trigger: "blur",validator: checkId }] }, }; }, methods: { - openDialog: function (isEdit, id, name, parentId, callback) { + openDialog: function (isEdit, id, name, parentId, level, callback) { console.log("parentId: " + parentId) + console.log(this.form) this.isEdit = isEdit; this.form.id = id; this.form.name = name; @@ -66,6 +119,7 @@ this.form.parentId = parentId; this.showDialog = true; this.submitCallback = callback; + this.level = level; }, onSubmit: function () { console.log("onSubmit"); @@ -74,11 +128,9 @@ method:"post", url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, data: this.form - }) - .then((res)=> { + }).then((res)=> { if (res.data.code === 0) { - console.log("娣诲姞/淇敼鎴愬姛") - if (this.submitCallback)this.submitCallback() + if (this.submitCallback)this.submitCallback(this.form) }else { this.$message({ showClose: true, @@ -93,8 +145,14 @@ }); }, close: function () { + this.isEdit = false; + this.form.id = null; + this.form.name = null; + this.form.platformId = null; + this.form.parentId = null; + this.callback = null; this.showDialog = false; - this.$refs.form.resetFields(); + console.log(this.form) }, }, }; -- Gitblit v1.8.0