From 3036016928bd5977df0bda55d873fb3679e1dc46 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 23 Aug 2023 15:56:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8C=83=E5=9B=B4=E9=85=8D=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E5=86=B3=E7=AD=96=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/DecisionInfo.ts | 6 +-- src/components/rangeConfig.vue | 13 +++--- src/pages/DecisionInfoManage.vue | 73 ++++++++++++++++++++++---------- 3 files changed, 62 insertions(+), 30 deletions(-) diff --git a/src/api/DecisionInfo.ts b/src/api/DecisionInfo.ts index e6f4fee..e6df3e4 100644 --- a/src/api/DecisionInfo.ts +++ b/src/api/DecisionInfo.ts @@ -6,7 +6,7 @@ const DraftUriBase = '/api/alertTip'; export interface createParams { alertType: string; timeType: string; - locationType: string; + areaConfigId: number; drivingInfo: string; submissionInfo: string; } @@ -15,7 +15,7 @@ interface Item { id: number; alertType: string; timeType: string; - locationType: string; + areaConfigId: number; drivingInfo: string; submissionInfo: string; } @@ -23,7 +23,7 @@ interface Item { export class PagingQueryParams extends PageQueryDto { alertType?: string; timeType?: string; - locationType?: string; + areaConfigId?: number; } /** diff --git a/src/components/rangeConfig.vue b/src/components/rangeConfig.vue index 87cf8ed..524b03c 100644 --- a/src/components/rangeConfig.vue +++ b/src/components/rangeConfig.vue @@ -137,6 +137,7 @@ enum DeviceTypeShow { DEVICE_TYPE_PLATFORM = 'Platform', } +let selectGraphic: JlGraphic[] = []; watch( () => lineStore.selectedGraphics, (val) => { @@ -148,11 +149,11 @@ watch( (g as Section).datas.sectionType === SectionType.TurnoutPhysical && rangeConfig.deviceType == LogicSection.Type) ) as JlGraphic[]; - lineStore.getLineApp().updateSelected(...deviceFilter); - device.value.push(...(deviceFilter?.map((g) => g.code) as string[])); - device.value = Array.from(new Set(device.value)); - rangeConfig.device.push(...(deviceFilter?.map((g) => g.id) as string[])); - rangeConfig.device = Array.from(new Set(rangeConfig.device)); + selectGraphic.push(...deviceFilter); + selectGraphic = Array.from(new Set(selectGraphic)); + lineStore.getLineApp().updateSelected(...selectGraphic); + device.value = selectGraphic.map((g) => g.code) as string[]; + rangeConfig.device = selectGraphic.map((g) => g.id) as string[]; } } ); @@ -224,6 +225,8 @@ async function searchById(id: number) { function clearSelect() { device.value = []; + selectGraphic = []; + lineStore.getLineApp().updateSelected(); } function onReset() { diff --git a/src/pages/DecisionInfoManage.vue b/src/pages/DecisionInfoManage.vue index 60b312f..809b893 100644 --- a/src/pages/DecisionInfoManage.vue +++ b/src/pages/DecisionInfoManage.vue @@ -78,7 +78,7 @@ @@ -91,7 +91,7 @@ { onMounted(() => { tableRef.value.requestServerInteraction(); + searchLocationType(); }); const columnDefs: QTableColumn[] = [ @@ -176,11 +178,18 @@ const columnDefs: QTableColumn[] = [ align: 'center', }, { - name: 'locationType', + name: 'areaConfigId', label: '地点定义类型', field: (row) => { - if (row.locationType) { - return (showAlertTypeData as never)[row.locationType + '']; + if (row.areaConfigId) { + let areaConfigareaName; + for (let i = 0; i < optionsLocationList.length; i++) { + if (optionsLocationList[i].id == row.areaConfigId) { + areaConfigareaName = optionsLocationList[i].areaName; + break; + } + } + return areaConfigareaName; } }, align: 'center', @@ -256,11 +265,11 @@ const creatForm = reactive({ id: '', alertType: '', timeType: '', - locationType: '', + areaConfigId: '', drivingInfo: '', submissionInfo: '', }); -const alertType = ref(''); + const optionsAlertType = [ '蓝显', '列车延误2分钟', @@ -277,36 +286,50 @@ const optionsAlertType = [ '计轴大面积橙光带', ]; const optionsTimeType = ['CLOCK_7_9', 'CLOCK_7_9_AND_19_21', '无']; -const locationType = ref(''); -const optionsLocationType = [ - '全线', - '鱼化寨联锁区', - '胡家庙联锁区', - '北池头联锁区', - '保税区联锁区', - '无', -]; +let optionsLocationType = []; function onReset() { creatForm.id = ''; - alertType.value = ''; + creatForm.alertType = ''; creatForm.timeType = ''; - locationType.value = ''; + creatForm.areaConfigId = ''; creatForm.drivingInfo = ''; creatForm.submissionInfo = ''; myForm.value?.resetValidation(); } +let optionsLocationList: IAreaConfigListItem[] = []; +async function searchLocationType() { + try { + const resp = await getAllDeviceArea(); + optionsLocationList = resp.data.records; + optionsLocationType = optionsLocationList.map((item) => item.areaName); + optionsLocationType.push('无'); + } catch (err) { + $q.notify({ + type: 'negative', + message: '无法获取范围配置列表', + }); + } +} + function onCreate() { myForm.value?.validate().then(async (res) => { if (res) { operateDisabled.value = true; try { + let areaConfigId; + for (let i = 0; i < optionsLocationList.length; i++) { + if (optionsLocationList[i].areaName == creatForm.areaConfigId) { + areaConfigId = optionsLocationList[i].id; + break; + } + } const params = { id: +creatForm.id, - alertType: (saveAlertTypeData as never)[alertType.value], + alertType: (saveAlertTypeData as never)[creatForm.alertType], timeType: creatForm.timeType, - locationType: (saveAlertTypeData as never)[locationType.value], + areaConfigId: areaConfigId as number, drivingInfo: creatForm.drivingInfo, submissionInfo: creatForm.submissionInfo, }; @@ -338,9 +361,15 @@ function onCreate() { function editData(row: any) { creatForm.id = row.id; - alertType.value = (showAlertTypeData as never)[row.alertType + '']; + creatForm.alertType = (showAlertTypeData as never)[row.alertType + '']; creatForm.timeType = row.timeType || ''; - locationType.value = (showAlertTypeData as never)[row.locationType + '']; + creatForm.areaConfigId = (showAlertTypeData as never)[row.areaConfigId + '']; + for (let i = 0; i < optionsLocationList.length; i++) { + if (optionsLocationList[i].id == row.areaConfigId) { + creatForm.areaConfigId = optionsLocationList[i].areaName; + break; + } + } creatForm.drivingInfo = row.drivingInfo ? JSON.parse(row.drivingInfo) : ''; creatForm.submissionInfo = row.submissionInfo ? JSON.parse(row.submissionInfo)