范围配置和决策信息修改

This commit is contained in:
joylink_zhaoerwei 2023-08-23 15:56:50 +08:00
parent c3d4c7cc12
commit 3036016928
3 changed files with 62 additions and 30 deletions

View File

@ -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;
}
/**

View File

@ -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() {

View File

@ -78,7 +78,7 @@
<q-select
outlined
label="故障类型"
v-model="alertType"
v-model="creatForm.alertType"
:options="optionsAlertType"
:rules="[(val) => val.length > 0 || '请选择故障类型!']"
/>
@ -91,7 +91,7 @@
<q-select
outlined
label="地点定义类型"
v-model="locationType"
v-model="creatForm.areaConfigId"
:options="optionsLocationType"
/>
<q-input
@ -133,6 +133,7 @@ import {
showAlertTypeData,
saveAlertTypeData,
} from 'src/components/alarm/alarmInfoEnum';
import { getAllDeviceArea, IAreaConfigListItem } from 'src/api/ConfigApi';
const $q = useQuasar();
@ -149,6 +150,7 @@ const tableHeight = computed(() => {
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)