Browse Source

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

YaolongHan 4 years ago
parent
commit
ae4edd488c

+ 4 - 0
src/components/edit/attr_select.vue

@@ -476,6 +476,10 @@ export default {
     },
     // 修改设备数量
     changeImageNum() {
+      if (this.imageNum < this.attrCards.length) {
+        this.imageNum = this.attrCards.length;
+        return false;
+      }
       if (!this.imageNum) {
         this.imageNum = 1;
       }

+ 13 - 1
src/components/mapClass/EditScence.ts

@@ -437,7 +437,7 @@ export class EditScence extends SGraphScene {
         //获取信息工程化相关参数
         const LegendData: Legend = {
             ID: uuid(),
-            Name: this._legend.Name,
+            Name: "",
             GraphElementType: this._legend.Type,
             Num: 1,
             GraphElementId: this._legend.Id,
@@ -720,6 +720,18 @@ export class EditScence extends SGraphScene {
             const item = this.focusItem;
             this.selectContainer.clear();
             this.selectContainer.toggleItem(item);
+            if (
+                item instanceof SImageLegendItem ||
+                item instanceof SZoneLegendItem ||
+                item instanceof SSCPZZoneLegendItem ||
+                item instanceof SFHFQZoneLegendItem
+            ) {
+                let arr = item.data.AttachObjectIds;
+                if (arr && arr.length && arr[arr.length-1].name) {
+                    item.text = arr[arr.length-1].name;
+                    item.name = arr[arr.length-1].name;
+                }
+            }
 
             // 图标绑定工程信息化数据后设置状态
             if (item instanceof SImageLegendItem) {

+ 13 - 5
src/lib/items/SImageLegendItem.ts

@@ -26,7 +26,17 @@ export class SImageLegendItem extends SIconTextItem {
             this.data.Num = 1;
         }
         this.data.Properties.Num = this._num;
-        this.text = `${this.data.Name}${this.data.Num > 1 ? ` × ${this.data.Num}` : ''}`;
+        this.textItem.text = `${this.name}${this.num > 1 ? ` × ${this.num}` : ''}`;
+        this.update();
+    }
+
+    get text(): string {
+        return this.textItem.text;
+    }
+    set text(v: string) {
+        this.name = v;
+        this.data.Name = v;
+        this.textItem.text = `${this.name}${this.num > 1 ? ` × ${this.num}` : ''}`;
         this.update();
     }
 
@@ -56,17 +66,15 @@ export class SImageLegendItem extends SIconTextItem {
         this.data = data;
         this.id = data.ID;
         this.name = data.Name;
+        this.text = data.Name;
         this.moveTo(data.Pos.X, data.Pos.Y);
         if (data.Num) {
-            this._num = data.Num;
+            this.num = data.Num;
         }
         if (data.Size) {
             this.width = data.Size.Width;
             this.height = data.Size.Height;
         }
-        if (data.Num) {
-            this.text = `${data.Name}${data.Num > 1 ? ` × ${data.Num}` : ''}`;
-        }
         if (data.Properties && data.Properties.Url) {
             this.img.url = data.Properties.Url;
         }

+ 1 - 1
src/lib/types/Legend.ts

@@ -36,7 +36,7 @@ export interface Legend {
     /** 名称  */
     Name: string;
     /** 返回工程信息化对象 ID 列表 */
-    AttachObjectIds?: string[];
+    AttachObjectIds?: any[];
     /** 图标,区域类型  */
     GraphElementType: string;
     /** 对应的图例ID  */