|
@@ -3,6 +3,7 @@ import { ItemOrder } from "@saga-web/big/lib";
|
|
|
import { SColor, SPainter, SRect } from "@saga-web/draw/lib";
|
|
|
import { SMouseEvent } from "@saga-web/base/lib";
|
|
|
import { EquipmentData } from "../types/EquipmentData";
|
|
|
+import { uuid } from '@/components/mapClass/until';
|
|
|
enum StatusType {
|
|
|
/** 普通态 */
|
|
|
Normal,
|
|
@@ -99,7 +100,7 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
textItem.pos.y = lastText.Y + 20;
|
|
|
this.textArr.push(textItem)
|
|
|
} */
|
|
|
- if (this.epData && index < this.epData.InfoList.length) {
|
|
|
+ if (this.epData && index < this.epData.InfoList.length) {
|
|
|
this.textArr[index + 1].text = name
|
|
|
this.epData.InfoList[index + 1].Name = name
|
|
|
}
|
|
@@ -149,6 +150,7 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
* @param epData 设备信息
|
|
|
*/
|
|
|
loadEquipment(epData: EquipmentData): void {
|
|
|
+ console.log('============loadEquipment')
|
|
|
// 位置
|
|
|
this.x = epData.Pos.X;
|
|
|
this.y = epData.Pos.Y;
|
|
@@ -170,11 +172,7 @@ 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);
|
|
@@ -247,9 +245,68 @@ export class SEquipmentItem extends SObjectItem {
|
|
|
arr[index].Y = this.textArr[index + 1].pos.y;
|
|
|
arr[index].Name = this.textArr[index + 1].text;
|
|
|
});
|
|
|
+ this.epData.GraphElementType = 'Equipment'
|
|
|
+ // @ts-ignore
|
|
|
+ this.epData.Type = 'equipment'
|
|
|
return this.epData;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 添加信息点
|
|
|
+ */
|
|
|
+ addEquipmentInfo() {
|
|
|
+ let { InfoList } = this.epData;
|
|
|
+ let textItem = new STextItem(this);
|
|
|
+ let Name, X, Y, Width, Height, FontSize, Background, Color, TextAlign
|
|
|
+ if (InfoList.length > 1) {
|
|
|
+ let info = InfoList[InfoList.length - 1]
|
|
|
+ Background = info.Background
|
|
|
+ X = info.X
|
|
|
+ Y = info.Y
|
|
|
+ Width = info.Width
|
|
|
+ Height = info.Height
|
|
|
+ FontSize = info.FontSize
|
|
|
+ Background = info.Background
|
|
|
+ Color = info.Color
|
|
|
+ TextAlign = info.TextAlign
|
|
|
+ Name = info.Name
|
|
|
+ // { Name, X, Y, Width, Height, FontSize, Background, Color, TextAlign } = InfoList[InfoList.length - 1]
|
|
|
+ } else {
|
|
|
+ // 默认设置
|
|
|
+ Background = '#ffffff'
|
|
|
+ X = this.img.width + 10
|
|
|
+ Y = this.img.height / 2 - 6
|
|
|
+ Width = 100
|
|
|
+ Height = 25
|
|
|
+ FontSize = 12
|
|
|
+ Background = '#ffffff'
|
|
|
+ Color = '#000000'
|
|
|
+ TextAlign = 'center'
|
|
|
+ Name = '请输入'
|
|
|
+ }
|
|
|
|
|
|
+ textItem.backgroundColor = new SColor(Background);
|
|
|
+ textItem.width = Width;
|
|
|
+ textItem.height = Height;
|
|
|
+ textItem.text = '请输入';
|
|
|
+ textItem.font.size = FontSize;
|
|
|
+ textItem.color = new SColor(Color);
|
|
|
+ textItem.pos.x = X;
|
|
|
+ textItem.pos.y = Y + 20;
|
|
|
+ this.textArr.push(textItem);
|
|
|
+ InfoList.push({
|
|
|
+ Code: uuid(),
|
|
|
+ Name: '请输入',
|
|
|
+ X,
|
|
|
+ Y: Y + 20,
|
|
|
+ Width,
|
|
|
+ Height,
|
|
|
+ FontSize,
|
|
|
+ Background,
|
|
|
+ TextAlign,
|
|
|
+ Color,
|
|
|
+ })
|
|
|
+ this.update()
|
|
|
+ }
|
|
|
/**
|
|
|
* Item绘制操作
|
|
|
*
|