From ae6f19e332b4de0e753aa464516879fc28ff9be8 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Mon, 16 Dec 2024 12:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=9E=E6=80=A7bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lessor/equipment/equipType/index.vue | 74 +++++++++++-------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/src/views/lessor/equipment/equipType/index.vue b/src/views/lessor/equipment/equipType/index.vue index 62e21191..b8f80b41 100644 --- a/src/views/lessor/equipment/equipType/index.vue +++ b/src/views/lessor/equipment/equipType/index.vue @@ -623,6 +623,7 @@ " > - - + + @@ -973,7 +974,9 @@ export default { editTypeIds: [], batchEdit: true, - maTypeProperties: [{'propertyName':'','mustHave': null}], + maTypeProperties: [{'propertyName':'','mustHave': "0"}], + visiableAttr:false, + allPass:true, }; }, watch: { @@ -1001,7 +1004,7 @@ export default { // }) // }, /** 查询新增页面-上级类型下拉树结构 */ - getTreeData() { + async getTreeData() { getMaTypeList().then((response) => { this.treeOptions = [ { @@ -1276,6 +1279,7 @@ export default { /* 树节点增加 */ appendTreeNode(data) { + this.visiableAttr = false; this.maTypeProperties = []; if (data.level === 3) { this.reset(); @@ -1306,18 +1310,23 @@ export default { .catch(() => {}); }, /* 树节点修改 */ - editTreeNode(data) { - console.log(data, "修改"); + async editTreeNode(data) { + await this.getTreeData() if(data.level!=2){ + this.visiableAttr = false; this.maTypeProperties= [] Object.assign(this.addFormParams, data); this.addTitle = "修改"; this.addFormParams.typeName = data.label; this.addTitleVisible = true; }else{ - this.maTypeProperties= [{'propertyName':'','mustHave':null}] - if(data.maTypeProperties!=null){ + this.maTypeProperties= [] + this.visiableAttr = true; + if(data.maTypeProperties!=null && data.maTypeProperties.length>0){ + console.log('1111111',data.maTypeProperties) this.maTypeProperties = data.maTypeProperties + }else{ + this.maTypeProperties= [{'propertyName':'','mustHave':"0"}] } Object.assign(this.addFormParams, data); this.addTitle = "修改"; @@ -1339,37 +1348,40 @@ export default { maTypeProperties:this.maTypeProperties, }; - this.$refs["addFormParamsRef"].validate( (valid) => { + this.$refs["addFormParamsRef"].validate( async(valid) => { if (valid) { - this.$refs["maTypeRef"].forEach((formRef)=>{ - formRef.validate(async(validTemp)=>{ - if(validTemp){ - if (this.addTitle === "新增") { - const res = await addMaType(addParams); - if (res.code === 200) { - this.$message.success("新增成功!"); - this.addTitleVisible = false; - this.getTreeData(); - } - } else { - const res = await updateMaType(editParams); - if (res.code === 200) { - this.$message.success("修改成功!"); - this.addTitleVisible = false; - this.getTreeData(); - } - this.maTypeProperties = []; - } + await this.$refs["maTypeRef"].forEach((formRef)=>{ + formRef.validate((validTemp)=>{ + if(!validTemp){ + this.allPass = false; } }) - }) + }) + if(this.allPass==true){ + if (this.addTitle === "新增") { + const res = await addMaType(addParams); + if (res.code === 200) { + this.$message.success("新增成功!"); + this.addTitleVisible = false; + this.getTreeData(); + } + } else { + const res = await updateMaType(editParams); + if (res.code === 200) { + this.$message.success("修改成功!"); + this.addTitleVisible = false; + this.getTreeData(); + } + this.maTypeProperties = []; + } + } } }); }, /* 取消 */ onCancel() { this.addTitleVisible = false; - this.maTypeProperties = [''] + this.maTypeProperties = [] }, getParentName(list, id) { try { @@ -1442,7 +1454,7 @@ export default { //新增属性 addPartItem() { - this.maTypeProperties.push({'propertyName':'','mustHave': null}); + this.maTypeProperties.push({'propertyName':'','mustHave': "0"}); }, removePartItem(index) { if (this.maTypeProperties.length > 1) {