|
@@ -50,6 +50,7 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
}
|
|
|
set textArr(v) {
|
|
|
this._textArr = v
|
|
|
+ this.update();
|
|
|
}
|
|
|
// 将EquipmentData保存起来,以便修改status时,可以找到StatusImage
|
|
|
get epData(): EquipmentData {
|
|
@@ -57,7 +58,7 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
}
|
|
|
set epData(v: EquipmentData) {
|
|
|
this._epData = v;
|
|
|
-
|
|
|
+ this.update();
|
|
|
|
|
|
}
|
|
|
// 修改设备名称
|
|
@@ -69,21 +70,41 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
if (this.textArr && this.textArr.length) {
|
|
|
this.textArr[0].text = v
|
|
|
}
|
|
|
+ if (this.epData) {
|
|
|
+ this.epData.Name = v;
|
|
|
+ }
|
|
|
+ this.update();
|
|
|
}
|
|
|
_info: any[] = []
|
|
|
// 修改信息点名称
|
|
|
get info(): [] {
|
|
|
return this._info
|
|
|
}
|
|
|
- set info({ index, name }) {
|
|
|
- if (this.textArr && this.textArr.length > 1) {
|
|
|
- if (this.textArr[index + 1]){
|
|
|
-
|
|
|
- this.textArr[index + 1].text = name
|
|
|
- }else{
|
|
|
- this.textArr[index + 1] =
|
|
|
- }
|
|
|
+ set info(data) {
|
|
|
+ let { index, name } = data
|
|
|
+ // 更新信息点名称
|
|
|
+ // 新增
|
|
|
+ /* if (this.epData && index === this.textArr.length) {
|
|
|
+ let lastText = this.epData.InfoList[index - 1]
|
|
|
+ this.epData.InfoList.push(Object.assign({}, lastText, { Name: name }))
|
|
|
+ console.log(this.epData)
|
|
|
+ let textItem = new STextItem(this);
|
|
|
+ textItem.backgroundColor = new SColor(lastText.Background);
|
|
|
+ textItem.width = lastText.Width;
|
|
|
+ textItem.height = lastText.Height;
|
|
|
+ textItem.text = name;
|
|
|
+ textItem.font.size = lastText.FontSize;
|
|
|
+ textItem.color = new SColor(lastText.Color);
|
|
|
+ textItem.pos.x = lastText.X;
|
|
|
+ textItem.pos.y = lastText.Y + 20;
|
|
|
+ this.textArr.push(textItem)
|
|
|
+ } */
|
|
|
+ if (this.epData && index < this.epData.InfoList.length) {
|
|
|
+ this.textArr[index + 1].text = name
|
|
|
+ this.epData.InfoList[index + 1].Name = name
|
|
|
}
|
|
|
+ this.update();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -149,6 +170,11 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
this.textArr.push(nameItem);
|
|
|
// 信息点
|
|
|
let { InfoList } = epData;
|
|
|
+ console.log('===================')
|
|
|
+ console.log('===================')
|
|
|
+ console.log('===================')
|
|
|
+ console.log(InfoList)
|
|
|
+ console.log('===================')
|
|
|
InfoList.map(({ Name, X, Y, Width, Height, FontSize, Background, Color, TextAlign }) => {
|
|
|
let textItem = new STextItem(this);
|
|
|
textItem.backgroundColor = new SColor(Background);
|
|
@@ -209,19 +235,19 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
} // Function boundingRect()
|
|
|
toData(): EquipmentData {
|
|
|
// 更新相关数据
|
|
|
- let data = this.epData;
|
|
|
- data.Pos.X = this.x;
|
|
|
- data.Pos.Y = this.y;
|
|
|
- data.Size.Width = this.width;
|
|
|
- data.Size.Height = this.height;
|
|
|
+ this.epData.Name = this.name;
|
|
|
+ this.epData.Pos.X = this.x;
|
|
|
+ this.epData.Pos.Y = this.y;
|
|
|
+ this.epData.Size.Width = this.width;
|
|
|
+ this.epData.Size.Height = this.height;
|
|
|
// @ts-ignore
|
|
|
// infoList中坐标,名称处理
|
|
|
- data.InfoList.map((item, index, arr) => {
|
|
|
+ this.epData.InfoList.map((item, index, arr) => {
|
|
|
arr[index].X = this.textArr[index + 1].pos.x;
|
|
|
arr[index].Y = this.textArr[index + 1].pos.y;
|
|
|
arr[index].Name = this.textArr[index + 1].text;
|
|
|
});
|
|
|
- return data;
|
|
|
+ return this.epData;
|
|
|
}
|
|
|
|
|
|
/**
|