From 05073cb244cb209c08ac94f598375fbbb1d25aea Mon Sep 17 00:00:00 2001 From: gmk Date: Thu, 2 Dec 2021 11:18:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E5=85=A5=E7=B1=BB=E5=88=AB=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../off-limits-main/off-limits-type/index.vue | 81 +++++++++++++++---- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue b/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue index c45b6f0..2d5879e 100644 --- a/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue +++ b/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue @@ -1,7 +1,7 @@ @@ -51,17 +51,31 @@ + + + + - - - 取 消 - 确 定 - + + + + 提交 + 重置 + 取 消 + + + + - + 提交 重置 取 消 - - - + @@ -152,6 +161,9 @@ export default { dialogVisibleM: false, currentData:{}, currentParentData:{}, + currentAddScenes:{ + inputNew:"", + }, currentAddType:{ typeLabel:"" }, @@ -160,6 +172,18 @@ export default { } }, methods: { + submitScenesForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + //alert('submit!'); + this.addScenes(); + + } else { + console.log('error submit!!'); + return false; + } + }); + }, submitForm(formName) { this.$refs[formName].validate((valid) => { if (valid) { @@ -192,6 +216,21 @@ export default { this.resetForm('currentAddType'); } + }, + + addScenes(){ + this.dialogVisible=false; + let no=this.data[this.data.length-1].no+1; + let id=this.data[this.data.length-1].id+1; + + this.data.push( { + id: id, + no:no, + label: this.currentAddScenes.inputNew, + children: [] + }); + + }, addType(){ @@ -202,9 +241,17 @@ export default { if(i.id==this.currentParentData.id) { - //console.log(i.children[i.children.length-1]); - let no=i.children[i.children.length-1].no+1; - let id=i.children[i.children.length-1].id+1; + + let no,id; + if(i.children && i.children.length>0){ + no=i.children[i.children.length-1].no+1; + id=i.children[i.children.length-1].id+1; + } + else{ + no=i.no+'001'; + id=i.id+'001'; + } + i.children.push({ id:id,