继电器相关调整
This commit is contained in:
parent
6075ba474f
commit
decd348c04
@ -109,7 +109,7 @@ export function initDrawApp(): IDrawApp {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
app.on('postdataloaded', async () => {
|
app.on('postdataloaded', () => {
|
||||||
const map = new Map<string, string>();
|
const map = new Map<string, string>();
|
||||||
refRelaysList.forEach((device) => {
|
refRelaysList.forEach((device) => {
|
||||||
device.combinationtypes.forEach((combinationtype) => {
|
device.combinationtypes.forEach((combinationtype) => {
|
||||||
@ -132,7 +132,7 @@ export function initDrawApp(): IDrawApp {
|
|||||||
) as string;
|
) as string;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
app.on('destroy', async () => {
|
app.on('destroy', () => {
|
||||||
refRelaysList = [];
|
refRelaysList = [];
|
||||||
combinationTypeList = [];
|
combinationTypeList = [];
|
||||||
});
|
});
|
||||||
@ -211,12 +211,10 @@ export function saveDrawDatas(app: IDrawApp) {
|
|||||||
storage.UniqueIdPrefix = UniqueIdPrefix;
|
storage.UniqueIdPrefix = UniqueIdPrefix;
|
||||||
const base64 = fromUint8Array(storage.serialize());
|
const base64 = fromUint8Array(storage.serialize());
|
||||||
console.log('保存数据', storage);
|
console.log('保存数据', storage);
|
||||||
// localStorage.setItem(StorageKey, base64);
|
|
||||||
return base64;
|
return base64;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadDrawDatas(): Promise<IGraphicStorage> {
|
export async function loadDrawDatas(): Promise<IGraphicStorage> {
|
||||||
// const base64 = localStorage.getItem(StorageKey);
|
|
||||||
const relayCabinetStore = useRelayCabinetStore();
|
const relayCabinetStore = useRelayCabinetStore();
|
||||||
const id = relayCabinetStore.draftId;
|
const id = relayCabinetStore.draftId;
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
@ -58,7 +58,7 @@ export function initRelayScene(lineApp: IGraphicApp, sceneName: string) {
|
|||||||
relay.refDevice.text = map.get(relay.id) as string;
|
relay.refDevice.text = map.get(relay.id) as string;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
relayScene.on('destroy', async () => {
|
relayScene.on('destroy', () => {
|
||||||
refRelaysList = [];
|
refRelaysList = [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,7 @@ export class PhaseFailureProtector extends JlGraphic {
|
|||||||
}
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
this.labelGraphic.text = this.datas.code;
|
this.labelGraphic.text = this.datas.code;
|
||||||
const labelPosition = this.datas.childTransforms?.find(
|
this.labelGraphic.position.set(0, 20);
|
||||||
(t) => t.name === this.labelGraphic.name
|
|
||||||
)?.transform.position;
|
|
||||||
if (labelPosition) {
|
|
||||||
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
|
||||||
} else {
|
|
||||||
this.labelGraphic.position.set(0, 20);
|
|
||||||
}
|
|
||||||
this.refDevice.position.set(0, -20);
|
this.refDevice.position.set(0, -20);
|
||||||
const phaseFailureProtectorGraphic = this.phaseFailureProtectorGraphic;
|
const phaseFailureProtectorGraphic = this.phaseFailureProtectorGraphic;
|
||||||
phaseFailureProtectorGraphic
|
phaseFailureProtectorGraphic
|
||||||
@ -56,23 +49,22 @@ export class PhaseFailureProtector extends JlGraphic {
|
|||||||
.lineStyle(
|
.lineStyle(
|
||||||
phaseFailureProtectorConsts.lineWidth,
|
phaseFailureProtectorConsts.lineWidth,
|
||||||
new Color(phaseFailureProtectorConsts.lineColor)
|
new Color(phaseFailureProtectorConsts.lineColor)
|
||||||
|
)
|
||||||
|
.beginFill(phaseFailureProtectorConsts.lineColor)
|
||||||
|
.drawRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
phaseFailureProtectorConsts.width,
|
||||||
|
phaseFailureProtectorConsts.height
|
||||||
);
|
);
|
||||||
phaseFailureProtectorGraphic.beginFill(
|
phaseFailureProtectorGraphic.pivot = getRectangleCenter(
|
||||||
phaseFailureProtectorConsts.lineColor
|
new Rectangle(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
phaseFailureProtectorConsts.width,
|
||||||
|
phaseFailureProtectorConsts.height
|
||||||
|
)
|
||||||
);
|
);
|
||||||
phaseFailureProtectorGraphic.drawRect(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
phaseFailureProtectorConsts.width,
|
|
||||||
phaseFailureProtectorConsts.height
|
|
||||||
);
|
|
||||||
const rectP = new Rectangle(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
phaseFailureProtectorConsts.width,
|
|
||||||
phaseFailureProtectorConsts.height
|
|
||||||
);
|
|
||||||
phaseFailureProtectorGraphic.pivot = getRectangleCenter(rectP);
|
|
||||||
phaseFailureProtectorGraphic.endFill;
|
phaseFailureProtectorGraphic.endFill;
|
||||||
}
|
}
|
||||||
setTextGraphic(g: VectorText, name: string) {
|
setTextGraphic(g: VectorText, name: string) {
|
||||||
|
@ -37,9 +37,6 @@ export class PhaseFailureProtectorDraw extends GraphicDrawAssistant<
|
|||||||
this.phaseFailureProtectorGraphic.doRepaint();
|
this.phaseFailureProtectorGraphic.doRepaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache(): void {
|
|
||||||
//this.phaseFailureProtectorGraphic.clear();
|
|
||||||
}
|
|
||||||
onLeftDown(e: FederatedPointerEvent): void {
|
onLeftDown(e: FederatedPointerEvent): void {
|
||||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||||
this.createAndStore(true);
|
this.createAndStore(true);
|
||||||
@ -105,16 +102,10 @@ export class phaseFailureProtectorInteraction extends GraphicInteractionPlugin<P
|
|||||||
bind(g: PhaseFailureProtector): void {
|
bind(g: PhaseFailureProtector): void {
|
||||||
g.eventMode = 'static';
|
g.eventMode = 'static';
|
||||||
g.cursor = 'pointer';
|
g.cursor = 'pointer';
|
||||||
g.labelGraphic.eventMode = 'static';
|
|
||||||
g.labelGraphic.selectable = true;
|
|
||||||
g.labelGraphic.draggable = true;
|
|
||||||
g.on('transformstart', this.move, this);
|
g.on('transformstart', this.move, this);
|
||||||
}
|
}
|
||||||
unbind(g: PhaseFailureProtector): void {
|
unbind(g: PhaseFailureProtector): void {
|
||||||
g.eventMode = 'none';
|
g.eventMode = 'none';
|
||||||
g.labelGraphic.eventMode = 'none';
|
|
||||||
g.labelGraphic.selectable = false;
|
|
||||||
g.labelGraphic.draggable = false;
|
|
||||||
g.off('transformstart', this.move, this);
|
g.off('transformstart', this.move, this);
|
||||||
}
|
}
|
||||||
move(): void {
|
move(): void {
|
||||||
|
@ -53,14 +53,7 @@ export class Relay extends JlGraphic {
|
|||||||
|
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
this.labelGraphic.text = this.datas.code;
|
this.labelGraphic.text = this.datas.code;
|
||||||
const labelPosition = this.datas.childTransforms?.find(
|
this.labelGraphic.position.set(0, 20);
|
||||||
(t) => t.name === this.labelGraphic.name
|
|
||||||
)?.transform.position;
|
|
||||||
if (labelPosition) {
|
|
||||||
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
|
||||||
} else {
|
|
||||||
this.labelGraphic.position.set(0, 20);
|
|
||||||
}
|
|
||||||
this.refDevice.position.set(0, -20);
|
this.refDevice.position.set(0, -20);
|
||||||
const relayGraphic = this.relayGraphic;
|
const relayGraphic = this.relayGraphic;
|
||||||
let relayColor;
|
let relayColor;
|
||||||
@ -71,10 +64,9 @@ export class Relay extends JlGraphic {
|
|||||||
}
|
}
|
||||||
relayGraphic
|
relayGraphic
|
||||||
.clear()
|
.clear()
|
||||||
.lineStyle(relayConsts.lineWidth, new Color(relayColor));
|
.lineStyle(relayConsts.lineWidth, new Color(relayColor))
|
||||||
relayGraphic.beginFill(relayColor);
|
.beginFill(relayColor)
|
||||||
relayGraphic.drawCircle(0, 0, relayConsts.radius);
|
.drawCircle(0, 0, relayConsts.radius).endFill;
|
||||||
relayGraphic.endFill;
|
|
||||||
}
|
}
|
||||||
setTextGraphic(g: VectorText, name: string) {
|
setTextGraphic(g: VectorText, name: string) {
|
||||||
g.setVectorFontSize(10);
|
g.setVectorFontSize(10);
|
||||||
|
@ -29,9 +29,6 @@ export class RelayDraw extends GraphicDrawAssistant<RelayTemplate, IRelayData> {
|
|||||||
this.relayGraphic.doRepaint();
|
this.relayGraphic.doRepaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache(): void {
|
|
||||||
//this.relayGraphic.clear();
|
|
||||||
}
|
|
||||||
onLeftDown(e: FederatedPointerEvent): void {
|
onLeftDown(e: FederatedPointerEvent): void {
|
||||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||||
this.createAndStore(true);
|
this.createAndStore(true);
|
||||||
@ -81,16 +78,10 @@ export class relayInteraction extends GraphicInteractionPlugin<Relay> {
|
|||||||
bind(g: Relay): void {
|
bind(g: Relay): void {
|
||||||
g.eventMode = 'static';
|
g.eventMode = 'static';
|
||||||
g.cursor = 'pointer';
|
g.cursor = 'pointer';
|
||||||
g.labelGraphic.eventMode = 'static';
|
|
||||||
g.labelGraphic.selectable = true;
|
|
||||||
g.labelGraphic.draggable = true;
|
|
||||||
g.on('transformstart', this.move, this);
|
g.on('transformstart', this.move, this);
|
||||||
}
|
}
|
||||||
unbind(g: Relay): void {
|
unbind(g: Relay): void {
|
||||||
g.eventMode = 'none';
|
g.eventMode = 'none';
|
||||||
g.labelGraphic.eventMode = 'none';
|
|
||||||
g.labelGraphic.selectable = false;
|
|
||||||
g.labelGraphic.draggable = false;
|
|
||||||
g.off('transformstart', this.move, this);
|
g.off('transformstart', this.move, this);
|
||||||
}
|
}
|
||||||
move(): void {
|
move(): void {
|
||||||
|
@ -45,34 +45,18 @@ export class RelayCabinet extends JlGraphic {
|
|||||||
}
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
this.labelGraphic.text = this.datas.code;
|
this.labelGraphic.text = this.datas.code;
|
||||||
const labelPosition = this.datas.childTransforms?.find(
|
this.labelGraphic.position.set(0, -relayCabinetConsts.height / 2 - 15);
|
||||||
(t) => t.name === this.labelGraphic.name
|
|
||||||
)?.transform.position;
|
|
||||||
if (labelPosition) {
|
|
||||||
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
|
||||||
} else {
|
|
||||||
this.labelGraphic.position.set(0, -relayCabinetConsts.height / 2 - 15);
|
|
||||||
}
|
|
||||||
const relayCabinetGraphic = this.relayCabinetGraphic;
|
const relayCabinetGraphic = this.relayCabinetGraphic;
|
||||||
relayCabinetGraphic
|
relayCabinetGraphic
|
||||||
.clear()
|
.clear()
|
||||||
.lineStyle(
|
.lineStyle(
|
||||||
relayCabinetConsts.lineWidth,
|
relayCabinetConsts.lineWidth,
|
||||||
new Color(relayCabinetConsts.lineColor)
|
new Color(relayCabinetConsts.lineColor)
|
||||||
);
|
)
|
||||||
relayCabinetGraphic.drawRect(
|
.drawRect(0, 0, relayCabinetConsts.width, relayCabinetConsts.height);
|
||||||
0,
|
relayCabinetGraphic.pivot = getRectangleCenter(
|
||||||
0,
|
new Rectangle(0, 0, relayCabinetConsts.width, relayCabinetConsts.height)
|
||||||
relayCabinetConsts.width,
|
|
||||||
relayCabinetConsts.height
|
|
||||||
);
|
);
|
||||||
const rectP = new Rectangle(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
relayCabinetConsts.width,
|
|
||||||
relayCabinetConsts.height
|
|
||||||
);
|
|
||||||
relayCabinetGraphic.pivot = getRectangleCenter(rectP);
|
|
||||||
this.batchBuild();
|
this.batchBuild();
|
||||||
}
|
}
|
||||||
batchBuild() {
|
batchBuild() {
|
||||||
@ -109,13 +93,13 @@ export class RelayCabinet extends JlGraphic {
|
|||||||
.lineStyle(
|
.lineStyle(
|
||||||
relayCabinetConsts.cellLineWidth,
|
relayCabinetConsts.cellLineWidth,
|
||||||
new Color(relayCabinetConsts.lineColor)
|
new Color(relayCabinetConsts.lineColor)
|
||||||
|
)
|
||||||
|
.drawRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
relayCabinetConsts.cellWidth,
|
||||||
|
relayCabinetConsts.cellHeight
|
||||||
);
|
);
|
||||||
relay.drawRect(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
relayCabinetConsts.cellWidth,
|
|
||||||
relayCabinetConsts.cellHeight
|
|
||||||
);
|
|
||||||
relay.position.set(
|
relay.position.set(
|
||||||
-relayCabinetConsts.width / 2 + i * relayCabinetConsts.cellWidth,
|
-relayCabinetConsts.width / 2 + i * relayCabinetConsts.cellWidth,
|
||||||
-relayCabinetConsts.height / 2 + j * relayCabinetConsts.cellHeight
|
-relayCabinetConsts.height / 2 + j * relayCabinetConsts.cellHeight
|
||||||
|
@ -54,9 +54,6 @@ export class RelayCabinetDraw extends GraphicDrawAssistant<
|
|||||||
this.relayCabinetGraphic.doRepaint();
|
this.relayCabinetGraphic.doRepaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache(): void {
|
|
||||||
//this.relayCabinetGraphic.clear();
|
|
||||||
}
|
|
||||||
onLeftDown(e: FederatedPointerEvent): void {
|
onLeftDown(e: FederatedPointerEvent): void {
|
||||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||||
this.createAndStore(true);
|
this.createAndStore(true);
|
||||||
@ -139,9 +136,6 @@ export class relayCabinetInteraction extends GraphicInteractionPlugin<RelayCabin
|
|||||||
bind(g: RelayCabinet): void {
|
bind(g: RelayCabinet): void {
|
||||||
g.eventMode = 'static';
|
g.eventMode = 'static';
|
||||||
g.cursor = 'pointer';
|
g.cursor = 'pointer';
|
||||||
g.labelGraphic.eventMode = 'static';
|
|
||||||
g.labelGraphic.selectable = true;
|
|
||||||
g.labelGraphic.draggable = true;
|
|
||||||
g.relayCabinetGraphic.hitArea = new RectGraphicHitArea(g);
|
g.relayCabinetGraphic.hitArea = new RectGraphicHitArea(g);
|
||||||
g.on('transformstart', this.move, this);
|
g.on('transformstart', this.move, this);
|
||||||
g.on('transforming', this.dragTogether, this);
|
g.on('transforming', this.dragTogether, this);
|
||||||
@ -149,9 +143,6 @@ export class relayCabinetInteraction extends GraphicInteractionPlugin<RelayCabin
|
|||||||
}
|
}
|
||||||
unbind(g: RelayCabinet): void {
|
unbind(g: RelayCabinet): void {
|
||||||
g.eventMode = 'none';
|
g.eventMode = 'none';
|
||||||
g.labelGraphic.eventMode = 'none';
|
|
||||||
g.labelGraphic.selectable = false;
|
|
||||||
g.labelGraphic.draggable = false;
|
|
||||||
g.off('transformstart', this.move, this);
|
g.off('transformstart', this.move, this);
|
||||||
g.off('transforming', this.dragTogether, this);
|
g.off('transforming', this.dragTogether, this);
|
||||||
g.off('transformend', this.recordGraphicMove, this);
|
g.off('transformend', this.recordGraphicMove, this);
|
||||||
|
@ -6,24 +6,14 @@
|
|||||||
<q-btn color="accent" label="功能菜单">
|
<q-btn color="accent" label="功能菜单">
|
||||||
<q-menu>
|
<q-menu>
|
||||||
<q-list style="min-width: 100px">
|
<q-list style="min-width: 100px">
|
||||||
<q-item clickable v-close-popup @click="saveAllDrawDatas">
|
|
||||||
<q-item-section>保存</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
<q-item clickable v-close-popup @click="saveAsDialog = true">
|
|
||||||
<q-item-section>另存为</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
<q-item clickable v-close-popup @click="handleCheckData">
|
|
||||||
<q-item-section>数据校验</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
<q-item
|
<q-item
|
||||||
|
v-for="item in leftMenuConfig"
|
||||||
|
:key="item.label"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="openUniqueIdPrefixDialog"
|
@click="item.click"
|
||||||
>
|
>
|
||||||
<q-item-section>UniqueId配置</q-item-section>
|
<q-item-section>{{ item.label }}</q-item-section>
|
||||||
</q-item>
|
|
||||||
<q-item clickable v-close-popup @click="batchBuild">
|
|
||||||
<q-item-section>批量生成继电器或继电器柜</q-item-section>
|
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
@ -246,6 +236,15 @@ class ControlItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//左侧功能按钮
|
||||||
|
const leftMenuConfig = [
|
||||||
|
{ label: '保存', click: saveAllDrawDatas },
|
||||||
|
{ label: '另存为', click: () => (saveAsDialog.value = true) },
|
||||||
|
{ label: '数据校验', click: handleCheckData },
|
||||||
|
{ label: 'UniqueId配置', click: openUniqueIdPrefixDialog },
|
||||||
|
{ label: '批量生成继电器或继电器柜', click: batchBuild },
|
||||||
|
];
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => relayCabinetStore.drawMode,
|
() => relayCabinetStore.drawMode,
|
||||||
(drawMode) => {
|
(drawMode) => {
|
||||||
@ -254,6 +253,7 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => searchId.value,
|
() => searchId.value,
|
||||||
() => {
|
() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user