فهرست منبع

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

YaolongHan 4 سال پیش
والد
کامیت
96a8d49cca
2فایلهای تغییر یافته به همراه42 افزوده شده و 10 حذف شده
  1. 2 2
      src/components/baseEditer.vue
  2. 40 8
      src/components/edit/left_toolbar.vue

+ 2 - 2
src/components/baseEditer.vue

@@ -413,7 +413,7 @@ export default {
         if (val.type == "Image") {
           const list = this.fParser.pList
             .map(t => {
-              if (t.data.Type == val.key && val.age.Url) {
+              if (val.key.indexOf(t.data.Type)>-1 && val.age.Url) {
                 if (!t.isExtracted) {
                   t.isExtracted = true;
                   const data = {
@@ -462,7 +462,7 @@ export default {
         } else if (val.type == "Zone") {
           const list = this.fParser.spaceList
             .map(t => {
-              if (t.data.Type == val.key && val.age.Url) {
+              if (val.key.indexOf(t.data.Type)>-1 && val.age.Url) {
                 if (!t.isExtracted) {
                   t.isExtracted = true;
                   return {

+ 40 - 8
src/components/edit/left_toolbar.vue

@@ -447,20 +447,52 @@ export default {
         this.data = [];
         if (data.length) {
           this.spinning = true;
+          const map = {};
           for (let i = 0; i < this.GraphElement.length; i++) {
-            const it = this.GraphElement[i];
+            const t = this.GraphElement[i];
             for (let j = 0; j < data.length; j++) {
-              if (
-                it.InfoTypeId.indexOf(data[j].key) > -1 &&
-                it.Type == data[j].type
-              ) {
-                data[j].age = it;
-                data[j].name = it.Name;
-                this.data.push(data[j]);
+              if(t.Type == data[j].type){
+                if (t.InfoTypeId.indexOf(data[j].key) > -1){
+                  const obj = {
+                    key: data[j].key,
+                    name: t.Name,
+                    age: t,
+                    number: data[j].number,
+                    type: data[j].type,
+                    address: data[j].address,
+                    id: t.Id
+                  }
+                  if (!map[t.Id]) {
+                    map[t.Id] = obj
+                  } else {
+                    map[t.Id].number += obj.number
+                    map[t.Id].key += obj.key
+                  }
+                }
               }
             }
           }
+          try {
+            for(const k in map) {
+              this.data.push(map[k])
+            }
+          } catch (err) {
+            console.log(err);
+          }
           this.spinning = false;
+          // for (let j = 0; j < data.length; j++) {
+          //   for (let i = 0; i < this.GraphElement.length; i++) {
+          //     const it = this.GraphElement[i];
+          //     if (
+          //       it.InfoTypeId.indexOf(data[j].key) > -1 &&
+          //       it.Type == data[j].type
+          //     ) {
+          //       data[j].age = it;
+          //       data[j].name = it.Name;
+          //       this.data.push(data[j]);
+          //     }
+          //   }
+          // }
         }
       });
     },