diff --git a/src/components/common/SelectConfigUtils.vue b/src/components/common/SelectConfigUtils.vue new file mode 100644 index 0000000..1c1ada4 --- /dev/null +++ b/src/components/common/SelectConfigUtils.vue @@ -0,0 +1,186 @@ + + + diff --git a/src/components/draw-app/properties/AxleCountingConfig.vue b/src/components/draw-app/properties/AxleCountingConfig.vue new file mode 100644 index 0000000..eeb6ccc --- /dev/null +++ b/src/components/draw-app/properties/AxleCountingConfig.vue @@ -0,0 +1,183 @@ + + + diff --git a/src/drawApp/index.ts b/src/drawApp/index.ts index ec8da1a..335ae57 100644 --- a/src/drawApp/index.ts +++ b/src/drawApp/index.ts @@ -289,6 +289,9 @@ export function initDrawApp(): IDrawApp { if (app.drawing) return; handleRIghtClick(e); }); + app.on('destroy', () => { + generateAxleCountingConfig = new graphicData.GenerateAxleCountingConfig(); + }); app.addKeyboardListener( new KeyListener({ value: 'KeyS', @@ -299,99 +302,99 @@ export function initDrawApp(): IDrawApp { }, }) ); - // KeyA 用于区段复制--控制生成的区段位置 - const graphicCopyPlugin = app.app.graphicCopyPlugin; - const copySectionListener = new KeyListener({ - value: 'KeyA', - global: true, - onPress: () => { - graphicCopyPlugin.updateMoveLimit('sectionPointLimit'); + // KeyA 用于区段复制--控制生成的区段位置 + const graphicCopyPlugin = app.app.graphicCopyPlugin; + const copySectionListener = new KeyListener({ + value: 'KeyA', + global: true, + onPress: () => { + graphicCopyPlugin.updateMoveLimit('sectionPointLimit'); + }, + }); + graphicCopyPlugin.addGraphicControlers([ + { + controlerList: [copySectionListener], + check: () => { + if ( + graphicCopyPlugin.copys.length == 1 && + graphicCopyPlugin.copys[0].type == Section.Type + ) + return true; + return false; }, - }); - graphicCopyPlugin.addGraphicControlers([ - { - controlerList: [copySectionListener], - check: () => { - if ( - graphicCopyPlugin.copys.length == 1 && - graphicCopyPlugin.copys[0].type == Section.Type - ) - return true; - return false; - }, - moveLimitOption: { - moveLimitName: 'sectionPointLimit', - moveLimit: (e) => { - const mousePos = app.toCanvasCoordinates(e.global); - const selectSection = app.selectedGraphics[0] as Section; - let selectSectionLeft = selectSection.localToCanvasPoint( - selectSection.getStartPoint() + moveLimitOption: { + moveLimitName: 'sectionPointLimit', + moveLimit: (e) => { + const mousePos = app.toCanvasCoordinates(e.global); + const selectSection = app.selectedGraphics[0] as Section; + let selectSectionLeft = selectSection.localToCanvasPoint( + selectSection.getStartPoint() + ); + let selectSectionRight = selectSection.localToCanvasPoint( + selectSection.getEndPoint() + ); + [selectSectionLeft, selectSectionRight] = + selectSectionLeft.x < selectSectionRight.x + ? [selectSectionLeft, selectSectionRight] + : [selectSectionRight, selectSectionLeft]; + //要移动到目标位的区段 + const sections = app.queryStore.queryByType
(Section.Type); + const minDistanceSection = sections.reduce((prev, cur) => { + const prevDistance = calculateDistanceFromPointToLine( + prev.localToCanvasPoint(prev.getStartPoint()), + prev.localToCanvasPoint(prev.getEndPoint()), + mousePos ); - let selectSectionRight = selectSection.localToCanvasPoint( - selectSection.getEndPoint() + const curDistance = calculateDistanceFromPointToLine( + cur.localToCanvasPoint(cur.getStartPoint()), + cur.localToCanvasPoint(cur.getEndPoint()), + mousePos ); - [selectSectionLeft, selectSectionRight] = - selectSectionLeft.x < selectSectionRight.x - ? [selectSectionLeft, selectSectionRight] - : [selectSectionRight, selectSectionLeft]; - //要移动到目标位的区段 - const sections = app.queryStore.queryByType
(Section.Type); - const minDistanceSection = sections.reduce((prev, cur) => { - const prevDistance = calculateDistanceFromPointToLine( - prev.localToCanvasPoint(prev.getStartPoint()), - prev.localToCanvasPoint(prev.getEndPoint()), - mousePos - ); - const curDistance = calculateDistanceFromPointToLine( - cur.localToCanvasPoint(cur.getStartPoint()), - cur.localToCanvasPoint(cur.getEndPoint()), - mousePos - ); - return prevDistance > curDistance || - (prevDistance == curDistance && - distance2( - prev.localToCanvasPoint(prev.getStartPoint()), - mousePos - ) > + return prevDistance > curDistance || + (prevDistance == curDistance && + distance2( + prev.localToCanvasPoint(prev.getStartPoint()), + mousePos + ) > distance2( cur.localToCanvasPoint(cur.getStartPoint()), mousePos )) - ? cur - : prev; - }); - const minDistanceRefSectionsPos = - minDistanceSection.localToCanvasPoint( - getRectangleCenter( - minDistanceSection.lineGraphic.getLocalBounds() - ) - ); - let minDistanceSectionLeft = minDistanceSection.localToCanvasPoint( - minDistanceSection.getStartPoint() + ? cur + : prev; + }); + const minDistanceRefSectionsPos = + minDistanceSection.localToCanvasPoint( + getRectangleCenter( + minDistanceSection.lineGraphic.getLocalBounds() + ) ); - let minDistanceSectionRight = minDistanceSection.localToCanvasPoint( - minDistanceSection.getEndPoint() - ); - [minDistanceSectionLeft, minDistanceSectionRight] = - minDistanceSectionLeft.x < minDistanceSectionRight.x - ? [minDistanceSectionLeft, minDistanceSectionRight] - : [minDistanceSectionRight, minDistanceSectionLeft]; + let minDistanceSectionLeft = minDistanceSection.localToCanvasPoint( + minDistanceSection.getStartPoint() + ); + let minDistanceSectionRight = minDistanceSection.localToCanvasPoint( + minDistanceSection.getEndPoint() + ); + [minDistanceSectionLeft, minDistanceSectionRight] = + minDistanceSectionLeft.x < minDistanceSectionRight.x + ? [minDistanceSectionLeft, minDistanceSectionRight] + : [minDistanceSectionRight, minDistanceSectionLeft]; - if (mousePos.x > minDistanceRefSectionsPos.x) { - graphicCopyPlugin.container.position.x = - minDistanceSectionRight.x - selectSectionLeft.x; - graphicCopyPlugin.container.position.y = - minDistanceSectionRight.y - selectSectionLeft.y; - } else { - graphicCopyPlugin.container.position.x = - minDistanceSectionLeft.x - selectSectionRight.x; - graphicCopyPlugin.container.position.y = - minDistanceSectionLeft.y - selectSectionRight.y; - } - }, + if (mousePos.x > minDistanceRefSectionsPos.x) { + graphicCopyPlugin.container.position.x = + minDistanceSectionRight.x - selectSectionLeft.x; + graphicCopyPlugin.container.position.y = + minDistanceSectionRight.y - selectSectionLeft.y; + } else { + graphicCopyPlugin.container.position.x = + minDistanceSectionLeft.x - selectSectionRight.x; + graphicCopyPlugin.container.position.y = + minDistanceSectionLeft.y - selectSectionRight.y; + } }, }, - ]); + }, + ]); return drawApp; } @@ -557,6 +560,7 @@ export function saveDrawDatas(app: IDrawApp) { // item.pcRef.nid = +item.pcRef.id; // } // }); + storage.generateAxleCountingConfig = generateAxleCountingConfig; const base64 = fromUint8Array(storage.serialize()); console.log('保存数据', storage); // localStorage.setItem(StorageKey, base64); @@ -579,6 +583,7 @@ export async function loadDrawDatas(): Promise { ); console.log('加载数据', storage); const datas: GraphicData[] = []; + generateAxleCountingConfig = storage.generateAxleCountingConfig; storage.links.forEach((link) => { datas.push(new LinkData(link)); }); @@ -642,3 +647,15 @@ export async function loadDrawDatas(): Promise { datas: [], }); } + +//一键生成计轴配置 +let generateAxleCountingConfig = new graphicData.GenerateAxleCountingConfig(); +export function loadGenerateAxleCountingConfig() { + return generateAxleCountingConfig; +} + +export function setGenerateAxleCountingConfig( + newScreenDoorConfig: graphicData.GenerateAxleCountingConfig +) { + generateAxleCountingConfig = newScreenDoorConfig; +} diff --git a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts index b1dbfe7..c2d16a8 100644 --- a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts +++ b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts @@ -20,6 +20,7 @@ import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics'; import { Signal } from '../signal/Signal'; import { graphicData } from 'src/protos/stationLayoutGraphics'; +import { loadGenerateAxleCountingConfig } from 'src/drawApp'; export interface IAxleCountingDrawOptions { newData: () => IAxleCountingData; @@ -80,6 +81,21 @@ export class AxleCountingDraw extends GraphicDrawAssistant< refGraphic: Section | Turnout, refPort: TurnoutPort | SectionPort ) { + const generateAxleCountingConfig = loadGenerateAxleCountingConfig(); + if (generateAxleCountingConfig?.noGenerateGroup !== undefined) { + const noGenerateGroup = generateAxleCountingConfig.noGenerateGroup; + for (let i = 0; i < noGenerateGroup.length; i++) { + if ( + noGenerateGroup[i] == graphic.id && + ((i % 2 == 0 && refGraphic.id == noGenerateGroup[i + 1]) || + (i % 2 == 1 && refGraphic.id == noGenerateGroup[i - 1])) + ) { + map.set(`${graphic.id}-${port}`, 1); + map.set(`${refGraphic.id}-${refPort}`, 1); + return; + } + } + } if ( graphic.type == 'Turnout' && reftype == 'Turnout' && @@ -163,7 +179,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant< } return true; }); - this.app.deleteGraphics(...needDelete); + this.app.deleteGraphics(...needDelete); const axleCountingRefs: IRelatedRefData[] = []; axleCountings.forEach((axleCounting) => { axleCountingRefs.push(...axleCounting.datas.axleCountingRef); diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index 4419146..32e0940 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -122,8 +122,11 @@ - - + + @@ -189,6 +192,7 @@ import { findContainDevice, handleCentralizedStationsData, } from 'src/graphics/concentrationDividingLine/ConcentrationDividingLineUtils'; +import AxleCountingConfig from 'src/components/draw-app/properties/AxleCountingConfig.vue'; const route = useRoute(); const router = useRouter(); @@ -358,10 +362,14 @@ function oneClickSeparator() { .getDrawAssistant(Separator.Type) as SeparatorDraw; separatorDraw.oneGenerates(); } + +const showGenerateAxleCountingConfig = ref(false); +const closeGenerateAxleCountingConfig = () => { + showGenerateAxleCountingConfig.value = false; +}; function oneClickAxleCounting() { //一键生成计轴 - drawStore.oneClickType = 'AxleCounting'; - drawStore.getDrawApp().interactionPlugin(OneClickGenerate.Type).resume(); + showGenerateAxleCountingConfig.value = true; } function oneClickTurnoutSection() { diff --git a/src/pages/AlarmInfoList.vue b/src/pages/AlarmInfoList.vue index 842e31c..3d125ca 100644 --- a/src/pages/AlarmInfoList.vue +++ b/src/pages/AlarmInfoList.vue @@ -44,6 +44,13 @@ lazy-rules :rules="[(val) => val >= 0 || '请选择线路ID!']" /> + ([ { label: '全部', value: 0 }, ]); +const searchOptionsLineType = ['全部', 'NCC', 'OCC']; async function queryLineInfo() { try { let response = await pageQuery({ diff --git a/src/pages/DecisionInfoManage.vue b/src/pages/DecisionInfoManage.vue index b9896a1..3f72365 100644 --- a/src/pages/DecisionInfoManage.vue +++ b/src/pages/DecisionInfoManage.vue @@ -27,13 +27,48 @@ @@ -287,16 +290,42 @@ const pagination = ref({ rowsNumber: 10, }); +const filter = ref({ + alertType: '全部', + areaConfigName: '', + lineId: 0, + lineType: '全部', +}); + const onRequest: QTable['onRequest'] = async (props) => { const { page, rowsPerPage, sortBy, descending } = props.pagination; loading.value = true; try { - let response = await alarmInfoPageQuery({ + const params = { current: page, size: rowsPerPage, - alertType: (saveAlertTypeData as never)[filter.value.alertType], - areaConfigName: filter.value.areaConfigName, - }); + }; + if (filter.value.lineId !== 0) { + Object.assign(params, { + lineId: filter.value.lineId, + }); + } + if (filter.value.lineType !== '全部') { + Object.assign(params, { + lineType: filter.value.lineType, + }); + } + if (filter.value.alertType !== '全部') { + Object.assign(params, { + alertType: (saveAlertTypeData as never)[filter.value.alertType], + }); + } + if (filter.value.areaConfigName) { + Object.assign(params, { + areaConfigName: filter.value.areaConfigName, + }); + } + let response = await alarmInfoPageQuery(params); const pageData = response; pagination.value.rowsNumber = pageData.total; pagination.value.page = page; @@ -321,17 +350,7 @@ onMounted(() => { }); }); -const searchDialog = ref(false); -const filter = ref({ - alertType: '', - areaConfigName: '', -}); -function openSearchDialog() { - filter.value = { alertType: '', areaConfigName: '' }; - searchDialog.value = true; -} function searchDecisionInfo() { - searchDialog.value = false; tableRef.value.requestServerInteraction(); } @@ -349,6 +368,9 @@ const creatForm = reactive({ }); const optionsLineId = ref<{ label: string; value: number }[]>([]); +const searchOptionsLineId = ref<{ label: string; value: number }[]>([ + { label: '全部', value: 0 }, +]); async function queryLineInfo() { try { let response = await pageQuery({ @@ -357,6 +379,7 @@ async function queryLineInfo() { }); response.records.forEach((info) => { optionsLineId.value.push({ label: info.name, value: info.lineId }); + searchOptionsLineId.value.push({ label: info.name, value: info.lineId }); }); } catch (err) { const error = err as ApiError; @@ -367,6 +390,7 @@ async function queryLineInfo() { } } const optionsLineType = ['NCC', 'OCC']; +const searchOptionsLineType = ['全部', ...optionsLineType]; const optionsAlertType = [ '蓝显', '全线蓝显', @@ -388,6 +412,7 @@ const optionsAlertType = [ '联锁区橙光带', '联锁区失表', ]; +const searchOptionsAlertType = ['全部', ...optionsAlertType]; let optionsLocationType = ref([]); let optionsLocationList: AreaConfigItem[] = []; async function searchLocationType() { diff --git a/src/pages/DraftManage.vue b/src/pages/DraftManage.vue index a157213..8e7065e 100644 --- a/src/pages/DraftManage.vue +++ b/src/pages/DraftManage.vue @@ -21,7 +21,7 @@ v-model="filter.name" label="名称" > - + @@ -362,4 +362,7 @@ async function deleteData(row: any) { operateDisabled.value = false; }); } +function searchQuery() { + tableRef.value.requestServerInteraction(); +} diff --git a/src/pages/LineInfoManage.vue b/src/pages/LineInfoManage.vue index a348f11..3da7728 100644 --- a/src/pages/LineInfoManage.vue +++ b/src/pages/LineInfoManage.vue @@ -21,7 +21,7 @@ v-model="filter.name" label="名称" > - + @@ -267,4 +267,7 @@ function editData(row: any) { editInfo.config = row.config || ''; createFormShow.value = true; } +function searchQuery() { + tableRef.value.requestServerInteraction(); +} diff --git a/src/pages/LoginRecord.vue b/src/pages/LoginRecord.vue index 4381bf6..ecaeefa 100644 --- a/src/pages/LoginRecord.vue +++ b/src/pages/LoginRecord.vue @@ -11,7 +11,6 @@ v-model:pagination="pagination" :rows-per-page-options="[10, 20, 50, 100]" :loading="loading" - :filter="filter" binary-state-sort @request="onRequest" > @@ -104,13 +103,14 @@ with-seconds >
- +
+ +