ソースを参照

多边形修改

YaolongHan 5 年 前
コミット
d7e1d0bba7
2 ファイル変更87 行追加37 行削除
  1. 35 2
      src/components/edit/attr_select.vue
  2. 52 35
      src/components/edit/left_toolbar.vue

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

@@ -314,10 +314,29 @@
             </div>
           </div>
         </div>
-        <div v-if="!SubType">
+        <div v-show="!SubType">
           <!-- 普通分区 -->
           <div class="row">
+            <!-- 修改图例 -->
             <div class="row-tit">图例名称</div>
+            <div>
+              <a-dropdown :trigger="['click']">
+                <a class="ant-dropdown-link" @click="e => e.preventDefault()" >
+                 afdaf<a-icon type="down" />
+                </a>
+                <a-menu slot="overlay">
+                  <a-menu-item>
+                    <a href="javascript:;">1st menu item</a>
+                  </a-menu-item>
+                  <a-menu-item>
+                    <a href="javascript:;">2nd menu item</a>
+                  </a-menu-item>
+                  <a-menu-item>
+                    <a href="javascript:;">3rd menu item</a>
+                  </a-menu-item>
+                </a-menu>
+              </a-dropdown>
+            </div>
           </div>
           <div class="row">
             <div class="row-tit">显示名称</div>
@@ -544,7 +563,13 @@ export default {
       GraphElementId: "", //图例Id
       CUSTOMbgColor: "rgba(0,0,0,0.15)", // 自定义多边形背景色
       CUSTOMbdColor: "rgba(0,0,0,1)", // 自定义多边形线条色
-      keys: new Date().getTime()
+      keys: new Date().getTime(),
+      dataSelect: [
+        { id: "totalEnergy", name: "总量" },
+        { id: "singleParty", name: "单平米" }
+      ],
+      selVal: "totalEnergy",
+      selText: "总量"
     };
   },
   methods: {
@@ -669,6 +694,9 @@ export default {
     // 更改工程信息化数据
     changeAttachObjectIds(arr) {
       bus.$emit("changeAttachObjectIds", arr);
+    },
+    xxx(val){
+      alert(val)
     }
   },
   watch: {
@@ -849,6 +877,11 @@ export default {
         });
       // }
       console.log(this.attrCards);
+    },
+
+    selVal(n, o) {
+      if (n === o) return;
+      this.selText = this.dataSelect.find(d => d.id === n).name;
     }
   }
 };

+ 52 - 35
src/components/edit/left_toolbar.vue

@@ -312,27 +312,27 @@ export default {
       });
       items.isChoice = true;
       this.$emit("setCmdType", items.type);
-      if (items.name == "画多边形"){
-        bus.$emit('changeDrawType','draw')
+      if (items.name == "画多边形") {
+        bus.$emit("changeDrawType", "draw");
         const item = {
-            "Color":"#57C5FC",
-            "Deleted":false,
-            "FillColor":"#57c5fc0F",
-            "Id":"-10",
-            "InfoLocal":[],
-            "InfoTypeId":[],
-            "LineDash":"solid",
-            "LineWidth":2,
-            "Name":"",
-            "SubType":"CUSTOM",
-            "Type":"Zone",
-            "Unit":"",
-            "Url":"137ee878925448a699ec10c33e67fc95"
-        }
+          Color: "#57C5FC",
+          Deleted: false,
+          FillColor: "#57c5fc0F",
+          Id: "-10",
+          InfoLocal: [],
+          InfoTypeId: [],
+          LineDash: "solid",
+          LineWidth: 2,
+          Name: "",
+          SubType: "CUSTOM",
+          Type: "Zone",
+          Unit: "",
+          Url: "137ee878925448a699ec10c33e67fc95"
+        };
         this.$emit("toolActionClick", item);
       }
     },
-   async showDrawer(item) {
+    async showDrawer(item) {
       this.showDrawerItem = item;
       this.isExtract = false;
       if (item.isChoice) {
@@ -351,23 +351,24 @@ export default {
         // 接口请求
         this.itemList = [];
         this.spinning = true;
-      //   const data = {
-      //     GraphCategoryIds: this.categoryId,
-      //     Type: item.type
-      //   };
-      // await  queryGroup(data).then(res => {
-      //     this.itemList = res.Data;
-      //   });
+        //   const data = {
+        //     GraphCategoryIds: this.categoryId,
+        //     Type: item.type
+        //   };
+        // await  queryGroup(data).then(res => {
+        //     this.itemList = res.Data;
+        //   });
         const arr = {
           InfoSystems: this.categoryIdS,
           Type: item.type,
-          categoryId:this.categoryId
+          categoryId: this.categoryId
         };
-       await graphElementGroup(arr).then(res => {
+        await graphElementGroup(arr).then(res => {
           this.spinning = false;
           res.Data.map(item => {
             this.itemList.push(item);
           });
+          itemList;
         });
       }
       if (this.visible) {
@@ -442,7 +443,7 @@ export default {
       }
     },
     getBus() {
-      bus2.$off('exportItem');
+      bus2.$off("exportItem");
       bus2.$on("exportItem", data => {
         this.data = [];
         if (data.length) {
@@ -451,8 +452,8 @@ export default {
           for (let i = 0; i < this.GraphElement.length; i++) {
             const t = this.GraphElement[i];
             for (let j = 0; j < data.length; j++) {
-              if(t.Type == data[j].type){
-                if (t.InfoTypeId.indexOf(data[j].key) > -1){
+              if (t.Type == data[j].type) {
+                if (t.InfoTypeId.indexOf(data[j].key) > -1) {
                   const obj = {
                     key: data[j].key,
                     name: t.Name,
@@ -461,20 +462,20 @@ export default {
                     type: data[j].type,
                     address: data[j].address,
                     id: t.Id
-                  }
+                  };
                   if (!map[t.Id]) {
-                    map[t.Id] = obj
+                    map[t.Id] = obj;
                   } else {
-                    map[t.Id].number += obj.number
-                    map[t.Id].key += obj.key
+                    map[t.Id].number += obj.number;
+                    map[t.Id].key += obj.key;
                   }
                 }
               }
             }
           }
           try {
-            for(const k in map) {
-              this.data.push(map[k])
+            for (const k in map) {
+              this.data.push(map[k]);
             }
           } catch (err) {
             console.log(err);
@@ -502,6 +503,21 @@ export default {
     changeDrawType(v) {
       // bus.$emit("changeDrawType", v.target.value);
       bus.$emit("changeDrawType", v);
+    },
+    // 获取左侧图例数据(无交互)
+    xxx(types = "Zone") {
+      const arr = {
+        InfoSystems: this.categoryIdS,
+        Type: types,
+        categoryId: this.categoryId
+      };
+       await graphElementGroup(arr).then(res => {
+          this.spinning = false;
+          res.Data.map(item => {
+            this.itemList.push(item);
+          });
+          // itemList
+        });
     }
   },
   watch: {
@@ -518,6 +534,7 @@ export default {
     },
     drawerVisible(val) {
       if (this.visible) {
+        console.log("this.showDrawerItem", this.showDrawerItem);
         this.showDrawer(this.showDrawerItem);
       }
     },