Browse Source

选择编辑 添加type

xiebeibei 4 years ago
parent
commit
934d5e5359
2 changed files with 23 additions and 11 deletions
  1. 10 2
      src/components/edit/attr_select.vue
  2. 13 9
      src/components/edit/edit-dialog.vue

+ 10 - 2
src/components/edit/attr_select.vue

@@ -733,7 +733,11 @@ export default {
           if (res.data.result == "success") {
             console.log(res.data);
             if (res.data.data && res.data.data.length) {
-              this.attrCards = this.attrCards.concat(res.data.data);
+              let ZoneData = res.data.data
+              ZoneData.map(item=>{
+                item.type='Zone'
+              })
+              this.attrCards = this.attrCards.concat(ZoneData);
             }
           } else {
             // this.$message.error("工程信息化中的位置信息获取失败");
@@ -755,7 +759,11 @@ export default {
         if (res.data.result == "success") {
           console.log(res.data);
           if (res.data.data && res.data.data.length) {
-            this.attrCards = this.attrCards.concat(res.data.data);
+            let data =  res.data.data;
+            data.map(item=>{
+              item.type='Image'
+            })
+            this.attrCards = this.attrCards.concat(data);
           }
         } else {
           // this.$message.error("工程信息化中的设备信息获取失败");

+ 13 - 9
src/components/edit/edit-dialog.vue

@@ -232,14 +232,15 @@
                     const lists = [];
                     let arr = [];
                     arr = JSON.parse(JSON.stringify(this.arrList))
+                    console.log(arr);
                     arr.map(item => {
-                        if (item.wzjc) {
-                            lists.push({id: item.location || item.assetnum, name: item.wzjc || item.sbjc, type: 'Zone'})
+                        if (item.type=='Zone') {
+                            lists.push({id: item.location, name: item.wzjc , type: 'Zone'})
                         }
-                        if (item.sbjc) {
+                        if (item.type=='Image') {
                             lists.push({
-                                id: item.location || item.assetnum,
-                                name: item.wzjc || item.sbjc,
+                                id: item.assetnum,
+                                name: item.sbjc,
                                 type: 'Image'
                             })
                         }
@@ -256,11 +257,11 @@
                 console.log(this.selectList);
                 arr = JSON.parse(JSON.stringify(this.selectList))
                 arr.map(item => {
-                    if (item.wzjc) {
-                        lists.push({id: item.location || item.assetnum, name: item.wzjc || item.sbjc, type: 'Zone'})
+                    if (item.type=='Zone') {
+                        lists.push({id: item.location , name: item.wzjc , type: 'Zone'})
                     }
-                    if (item.sbjc) {
-                        lists.push({id: item.location || item.assetnum, name: item.wzjc || item.sbjc, type: 'Image'})
+                    if (item.type=='Image') {
+                        lists.push({id: item.assetnum, name: item.sbjc, type: 'Image'})
                     }
 
                 })
@@ -587,6 +588,7 @@
                                         item.children = item.data;
                                         item.open = false;
                                         item.checked = 'unchecked';
+                                        item.type='Image';
                                         if (item.children) {
                                             recursion(item.children);
                                         }
@@ -634,6 +636,7 @@
                                     newObj.map(item => {
                                         item.label = item.name;
                                         item.checked = 'unchecked';
+                                        item.type='Zone';
                                         if (item.children) {
                                             recursion(item.children);
                                         }
@@ -663,6 +666,7 @@
                     this.selectedRowKeys.push(item.location || item.assetnum)
                 })
                 this.arrList = JSON.parse(JSON.stringify(this.attrCards));
+                console.log(this.arrList);
                 this.selectList = JSON.parse(JSON.stringify(this.attrCards));
             } else {
                 this.selectedRowKeys = [];