diff --git a/package.json b/package.json index a6cd46f..3198a09 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "test": "echo \"No test specified\" && exit 0", "dev": "quasar dev", "build": "quasar build", + "build:test": "set NODE_ENV=test&&quasar build", + "build:publish": "set NODE_ENV=publish&&quasar build", "protoc": "node scripts/proto.cjs", "sync": "node scripts/sync.cjs" }, diff --git a/quasar.config.js b/quasar.config.js index 3f02c23..7973526 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -52,6 +52,10 @@ module.exports = configure(function (/* ctx */) { // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#build build: { + env: { + // test:测试服务器;publish:正式服务器;其他本地 + ENV_MODE: process.env.NODE_ENV, + }, target: { browser: ['es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1'], node: 'node16', diff --git a/src/api/Simulation.ts b/src/api/Simulation.ts index d6c694a..d8458bc 100644 --- a/src/api/Simulation.ts +++ b/src/api/Simulation.ts @@ -60,6 +60,7 @@ export async function setSignalState(data: { simulationId: string; mapId: number; id: string; + operation: number; aspect: number; }) { return await api.post(`${UriBase}/signal/operation`, data); @@ -158,3 +159,34 @@ export async function setRelayState(data: { }) { return await api.post(`${UriBase}/relay/operation`, data); } + +interface KilometerRange { + Coordinate: string; + MinCoordinate: number; + MaxCoordinate: number; +} + +/** + * 获取地图公里标范围 + * @param + * @returns + */ +export async function getMapKilometerRange( + id: string +): Promise { + const response = await api.get(`${UriBase}/${id}/getMapKilometerRange`); + return response.data; +} + +/** + * PSL操作 + */ +export async function pslOperate(data: { + simulationId: string; + mapId: number; + gateBoxId: string; + buttonCode: string; + down: boolean; +}) { + return await api.post(`${UriBase}/psl/operation`, data); +} diff --git a/src/components/draw-app/DrawRelayCabinetProperties.vue b/src/components/draw-app/DrawRelayCabinetProperties.vue index 678f791..8316497 100644 --- a/src/components/draw-app/DrawRelayCabinetProperties.vue +++ b/src/components/draw-app/DrawRelayCabinetProperties.vue @@ -27,6 +27,11 @@ PhaseFailureProtector.Type " > + @@ -41,6 +46,8 @@ import RelayProperty from './properties/RelayProperty.vue'; import { Relay } from 'src/graphics/relay/Relay'; import PhaseFailureProtectorProperty from './properties/PhaseFailureProtectorProperty.vue'; import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; +import SignalFaultAlarmProperty from './properties/SignalFaultAlarmProperty.vue'; +import { SignalFaultAlarm } from 'src/graphics/signalFaultAlarm/SignalFaultAlarm'; import { useRelayCabinetStore } from 'src/stores/relayCabinet-store'; const relayCabinetStore = useRelayCabinetStore(); diff --git a/src/components/draw-app/dialogs/DeviceRelateRelayList.vue b/src/components/draw-app/dialogs/DeviceRelateRelayList.vue index f5ccdc2..c6d787b 100644 --- a/src/components/draw-app/dialogs/DeviceRelateRelayList.vue +++ b/src/components/draw-app/dialogs/DeviceRelateRelayList.vue @@ -63,6 +63,7 @@ const deviceTypeMap = { 5: '信号机', 6: '车站', 7: '屏蔽门', + 8: '信号机故障报警仪', }; const columns: QTable['columns'] = [ { diff --git a/src/components/draw-app/properties/RelateRelayConfig.vue b/src/components/draw-app/properties/RelateRelayConfig.vue index a1ac778..d43992b 100644 --- a/src/components/draw-app/properties/RelateRelayConfig.vue +++ b/src/components/draw-app/properties/RelateRelayConfig.vue @@ -133,6 +133,10 @@ const optionsType = [ { label: '信号机', value: graphicData.RelatedRef.DeviceType.signal }, { label: '车站', value: graphicData.RelatedRef.DeviceType.station }, { label: '屏蔽门', value: graphicData.RelatedRef.DeviceType.ScreenDoor }, + { + label: '信号机故障报警仪', + value: graphicData.RelatedRef.DeviceType.SignalFaultAlarm, + }, ]; let selectGraphic: JlGraphic[] = []; diff --git a/src/components/draw-app/properties/SignalFaultAlarmProperty.vue b/src/components/draw-app/properties/SignalFaultAlarmProperty.vue new file mode 100644 index 0000000..c152078 --- /dev/null +++ b/src/components/draw-app/properties/SignalFaultAlarmProperty.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/components/draw-app/properties/SignalProperty.vue b/src/components/draw-app/properties/SignalProperty.vue index 1826786..9705182 100644 --- a/src/components/draw-app/properties/SignalProperty.vue +++ b/src/components/draw-app/properties/SignalProperty.vue @@ -15,6 +15,16 @@ @blur="onUpdate" label="索引" /> +
公里标配置
@@ -48,7 +58,7 @@ @@ -128,6 +138,14 @@ const DeviceTypeOptions = [ { label: '区段', value: graphicData.RelatedRef.DeviceType.Section }, { label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout }, ]; +const SignalTypeOptions = [ + { label: '红绿黄', value: graphicData.Signal.Model.HLU }, + { label: '红绿', value: graphicData.Signal.Model.HL }, + { label: '红绿黄,封黄灯', value: graphicData.Signal.Model.HLU_FU }, + { label: '红绿黄,封绿灯', value: graphicData.Signal.Model.HLU_FL }, + { label: '蓝白', value: graphicData.Signal.Model.AB }, + { label: '红白黄', value: graphicData.Signal.Model.HBU }, +]; const DevicePortOptions = [ { label: 'A端', value: graphicData.RelatedRef.DevicePort.A }, { label: 'B端', value: graphicData.RelatedRef.DevicePort.B }, diff --git a/src/components/draw-app/properties/StationProperty.vue b/src/components/draw-app/properties/StationProperty.vue index d131b70..454d2ed 100644 --- a/src/components/draw-app/properties/StationProperty.vue +++ b/src/components/draw-app/properties/StationProperty.vue @@ -3,13 +3,22 @@ + -
+
+ + + + +
diff --git a/src/components/line-app/states/SignalState.vue b/src/components/line-app/states/SignalState.vue index 85851bb..181247d 100644 --- a/src/components/line-app/states/SignalState.vue +++ b/src/components/line-app/states/SignalState.vue @@ -1,7 +1,22 @@ - 关联设备列表 + + + 公里标转换 + + @@ -152,6 +151,14 @@ v-model="UniqueIdPrefix.lineId" :rules="[(val) => val.trim() != '' || '集中站名称不能为空']" /> + diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index 5b2998d..a831121 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -37,11 +37,18 @@
- - -
-
-
+ +
+
{ } lineStore.addAllScene(projectInfo.mapInfoLinks || []); } + lineStore.setSceneName(sceneName); + scene = lineApp.getScene(sceneName); + scene.bindDom(dom); + scene.reload(); + onResize(); } catch (e) { const error = e as ApiError; $q.notify({ @@ -177,19 +187,11 @@ onMounted(async () => { message: error.title, }); } - lineStore.setSceneName(sceneName); - scene = lineApp.getScene(sceneName); - scene.bindDom(dom); - scene.reload(); - onResize(); } else { lineStore.setMapId(null); lineStore.setSimulationId(null); } drawerRight.value = false; - // setTimeout(() => { - // pslShow(); - // }, 5000); }); onUnmounted(() => { if (dialogInstance.value && lineStore.showLayerDialog) { @@ -216,16 +218,34 @@ watch( } ); +const pslCanvasWidth = ref(500); +const pslCanvasHeight = ref(600); watch( - () => lineStore.gatedBoxCount, - () => { - if (lineStore.selectedGraphics) { - const gatedBox = lineStore.selectedGraphics[0] as GatedBox; - pslShow(gatedBox); + () => pslStore.isPslDialogOpen, + (val: boolean) => { + if (val === true) { + nextTick(async () => { + const container = document.getElementById('psl-app-container'); + if (!container) return; + const pslScene = pslStore.getPslScene(); + pslScene?.bindDom(container); + await pslScene?.reload(); + if (pslScene) { + pslCanvasWidth.value = pslScene.canvas.width; + pslCanvasHeight.value = pslScene.canvas.height; + container.style.width = pslCanvasWidth.value + 'px'; + container.style.height = pslCanvasHeight.value + 'px'; + } + }); } } ); +function pslHide() { + pslStore.clearPslParam(); + lineApp.getScene('psl').unbindDom(); +} + const dialogInstance = ref(); watch( @@ -302,46 +322,6 @@ function switchScene(val: MapInfo) { } } -function pslShow(gatedBox: GatedBox) { - pslDialog.value = true; - const pslApp = usePslStore().initLineApp(); - if (gatedBox.datas.refGatedBoxMapCode) { - const params = { - name: gatedBox.datas.refGatedBoxMapCode, - detail: false, - }; - lineStore.setPslId(gatedBox.datas.id); - getPublishMapInfoByName(params).then(async (mapInfo) => { - const dom = document.getElementById('psl-app-container'); - if (dom) { - usePslStore().addAllScene([mapInfo]); - usePslStore().setMapId(mapInfo.id); - usePslStore().setSimulationId(simulationId); - sceneName = getSceneNameFn(mapInfo); - usePslStore().setSceneName(sceneName); - scene = pslApp.getScene(sceneName); - scene.bindDom(dom); - await scene.reload(); - dom.style.width = scene.canvas.width + 'px'; - dom.style.height = scene.canvas.height + 'px'; - } - }); - } else { - $q.notify({ - type: 'negative', - message: '未获取到关联门控箱地图数据', - }); - } -} - -function pslHide() { - const pslApp = usePslStore().initLineApp(); - lineStore.setPslId(''); - pslApp.unbindDom(); - pslApp.destroy(); - pslDialog.value = false; -} - function ibpHide() { ibpStore.destory(); } diff --git a/src/layouts/RelayCabinetLayout.vue b/src/layouts/RelayCabinetLayout.vue index fb0da20..507b222 100644 --- a/src/layouts/RelayCabinetLayout.vue +++ b/src/layouts/RelayCabinetLayout.vue @@ -198,6 +198,7 @@ import { DialogChainObject, useQuasar } from 'quasar'; import { Relay } from 'src/graphics/relay/Relay'; import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet'; import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; +import { SignalFaultAlarm } from 'src/graphics/signalFaultAlarm/SignalFaultAlarm'; import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; const $q = useQuasar(); @@ -291,6 +292,7 @@ onMounted(() => { RelayCabinet.Type, Relay.Type, PhaseFailureProtector.Type, + SignalFaultAlarm.Type, ]; drawAssistantsTypes.forEach((type) => { const drawAssistant = getDrawApp()?.getDrawAssistant(type); diff --git a/src/stores/line-store.ts b/src/stores/line-store.ts index 9dbad96..f776f77 100644 --- a/src/stores/line-store.ts +++ b/src/stores/line-store.ts @@ -33,8 +33,6 @@ export const useLineStore = defineStore('line', { categoryType: null as CategoryType | null, echartsTrainId: '', trainStateMap: new Map() as Map, - gatedBoxCount: 0, - pslId: '', }), getters: { selectedGraphicType: (state) => { @@ -64,7 +62,6 @@ export const useLineStore = defineStore('line', { ); }); this.selectedGraphics = []; - this.gatedBoxCount = 0; return app; }, addAllScene(list: MapInfo[]) { @@ -135,11 +132,5 @@ export const useLineStore = defineStore('line', { setCategoryType(type: CategoryType | null) { this.categoryType = type; }, - increaseGatedBoxCount() { - this.gatedBoxCount++; - }, - setPslId(id: string) { - this.pslId = id; - }, }, }); diff --git a/src/stores/psl-store.ts b/src/stores/psl-store.ts index 045ea49..aee55e8 100644 --- a/src/stores/psl-store.ts +++ b/src/stores/psl-store.ts @@ -1,102 +1,32 @@ import { defineStore } from 'pinia'; -import { - IJlCanvas, - JlGraphic, - IGraphicApp, - GraphicState, -} from 'src/jl-graphic'; -import { - initLineApp, - getLineApp, - destroyLineApp, - addSceneList, - ISceneName, -} from 'src/drawApp/lineApp'; -import { markRaw } from 'vue'; -import { MapInfo } from 'src/api/ProjectLinkApi'; +import { initPslScene } from 'src/drawApp/pslScene'; +import { getLineApp } from 'src/drawApp/lineApp'; +import { GraphicApp } from 'src/jl-graphic/app/JlGraphicApp'; export const usePslStore = defineStore('psl', { state: () => ({ - selectedGraphics: null as JlGraphic[] | null, - lineId: null as number | null, - lineName: null as string | null, - simulationId: null as string | null, - socketStates: null as GraphicState[] | null, - stateProCount: 0, - showLayer: [] as string[], // 显示的图层(草稿和发布图公用) - showLayerDialog: false, // 显示图层控制弹窗(草稿和发布图公用) - mapId: null as number | null, - sceneName: '', // 场景名称 + pslMapCode: '', + gatedBoxId: '', + isPslDialogOpen: false, }), - getters: { - selectedGraphicType: (state) => { - if (state.selectedGraphics) { - if (state.selectedGraphics.length === 1) { - return state.selectedGraphics[0].type; - } - } - }, - }, actions: { - getLineApp(): IGraphicApp { - const app = getLineApp(); - if (app == null) { - throw new Error('未初始化app'); + getPslScene() { + const lineApp = getLineApp() as GraphicApp; + if (!lineApp) return; + if (lineApp.scenes.get('psl')) { + return lineApp.getScene('psl'); } - return app; + return initPslScene(lineApp, 'psl'); }, - getJlCanvas(): IJlCanvas { - return this.getLineApp().canvas; + setPslParam(gatedBoxId: string, pslMapCode: string) { + this.gatedBoxId = gatedBoxId; + this.pslMapCode = pslMapCode; + this.isPslDialogOpen = true; }, - initLineApp() { - const app = initLineApp(); - app.on('graphicselected', () => { - this.selectedGraphics = markRaw( - app.getScene(this.sceneName).selectedGraphics - ); - }); - this.selectedGraphics = []; - return app; - }, - addAllScene(list: MapInfo[]) { - const arr: ISceneName[] = list.map((item) => { - return { type: item.type, id: item.id }; - }); - addSceneList(arr); - }, - appCurrentScene() { - return this.getLineApp().getScene(this.sceneName); - }, - destroy() { - this.selectedGraphics = null; - destroyLineApp(); - }, - setLineId(id: number | null) { - this.lineId = id; - }, - setLineName(name: string | null) { - this.lineName = name; - }, - setSimulationId(id: string | null) { - this.simulationId = id; - }, - setSocketStates(v: GraphicState[] | null) { - this.socketStates = v; - }, - stateProCountIncrease() { - this.stateProCount++; - }, - setShowLayer(v: string[]) { - this.showLayer = v; - }, - setShowLayerDialog(v: boolean) { - this.showLayerDialog = v; - }, - setMapId(id: number | null) { - this.mapId = id; - }, - setSceneName(sceneName: string) { - this.sceneName = sceneName; + clearPslParam() { + this.gatedBoxId = ''; + this.pslMapCode = ''; + this.isPslDialogOpen = false; }, }, });