|
@@ -82,16 +82,26 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
// @ts-ignore
|
|
|
return this._info
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @param data 修改信息点信息
|
|
|
+ */
|
|
|
set info(data) {
|
|
|
// @ts-ignore
|
|
|
- let { index, name } = data
|
|
|
+ let { index, Name, FontSize, Color } = data
|
|
|
// 更新信息点名称
|
|
|
if (this.epData && index < this.epData.InfoList.length) {
|
|
|
- this.textArr[index + 1].text = name
|
|
|
- this.epData.InfoList[index].Name = name
|
|
|
+ // this.textArr[index + 1].text = Name
|
|
|
+ // this.epData.InfoList[index].Name = Name
|
|
|
}
|
|
|
+ // item对象属性修改
|
|
|
+ this.textArr[index + 1].text = Name
|
|
|
+ this.textArr[index + 1].font.size = FontSize
|
|
|
+ this.textArr[index + 1].color = Color
|
|
|
+ // 数据修改
|
|
|
+ this.epData.InfoList[index].Name = Name
|
|
|
+ this.epData.InfoList[index].FontSize = FontSize
|
|
|
+ this.epData.InfoList[index].Color = Color
|
|
|
this.update();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -109,27 +119,7 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
this.textArr = [];
|
|
|
// 有信息点信息时,绘制信息点信息
|
|
|
// 加载设备
|
|
|
- if (epData && epData?.Pos) {
|
|
|
- this.loadEquipment(epData);
|
|
|
- } else if (epData) {
|
|
|
- //绘制设备
|
|
|
- this.img.url = `/serve/topology-wanda/Picture/query/14d978b7edd346f088d6cfb53ada4070`;
|
|
|
- this.img.width = 24;
|
|
|
- this.img.height = 24;
|
|
|
- //添加设备
|
|
|
- let index = 0;
|
|
|
- for (let key in epData) {
|
|
|
- let textItem = new STextItem(this);
|
|
|
- textItem.moveable = true;
|
|
|
- textItem.backgroundColor = SColor.White;
|
|
|
- textItem.font.size = 14;
|
|
|
- textItem.moveTo(17, index * 20 - 10);
|
|
|
- // @ts-ignore
|
|
|
- textItem.text = `${key} : ${epData[key]}`;
|
|
|
- this.textArr.push(textItem);
|
|
|
- index++;
|
|
|
- }
|
|
|
- }
|
|
|
+ this.loadEquipment(epData);
|
|
|
}
|
|
|
/**
|
|
|
* 加载设备
|
|
@@ -215,6 +205,9 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
}
|
|
|
return rect.adjusted(-5, -5, 10, 10);
|
|
|
} // Function boundingRect()
|
|
|
+ /**
|
|
|
+ * 转换成data
|
|
|
+ */
|
|
|
toData(): EquipmentData {
|
|
|
// 更新相关数据
|
|
|
this.epData.Name = this.name;
|
|
@@ -239,7 +232,6 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
*/
|
|
|
addEquipmentInfo() {
|
|
|
let { InfoList } = this.epData;
|
|
|
- console.log('::::::::::::::::', InfoList)
|
|
|
let textItem = new STextItem(this);
|
|
|
let Name, X, Y, Width, Height, FontSize, Background, Color, TextAlign
|
|
|
if (InfoList.length) {
|
|
@@ -268,7 +260,7 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
TextAlign = 'center'
|
|
|
Name = '请输入'
|
|
|
}
|
|
|
-
|
|
|
+ // 信息点对象 属性修改
|
|
|
textItem.backgroundColor = new SColor(Background);
|
|
|
textItem.width = Width;
|
|
|
textItem.height = Height;
|
|
@@ -292,6 +284,15 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
})
|
|
|
this.update()
|
|
|
}
|
|
|
+ // 删除信息点
|
|
|
+ deleteEquipmentInfo() {
|
|
|
+ this.epData.InfoList.pop()
|
|
|
+ if (this.textArr.length) {
|
|
|
+ this.textArr[this.textArr.length - 1].text = '';
|
|
|
+ this.textArr.pop()
|
|
|
+ }
|
|
|
+ this.update()
|
|
|
+ }
|
|
|
/**
|
|
|
* Item绘制操作
|
|
|
*
|