一级联锁集中站多选

This commit is contained in:
joylink_zhaoerwei 2023-12-22 16:10:04 +08:00
parent 3b6da014ed
commit 0cec0db90a
2 changed files with 5 additions and 9 deletions

View File

@ -45,7 +45,7 @@ export interface IAreaConfigItem {
areaName: string; areaName: string;
deviceType: string; deviceType: string;
alertTypes: string[]; alertTypes: string[];
data: string[]; data: number[];
} }
export function deviceRangeSet(data: IAreaConfigItem) { export function deviceRangeSet(data: IAreaConfigItem) {
return api.post('/api/config/device/area/save', data); return api.post('/api/config/device/area/save', data);

View File

@ -94,7 +94,7 @@ const showRangeConfig = ref(true);
const rangeConfig = reactive<{ const rangeConfig = reactive<{
areaName: string; areaName: string;
deviceType: `${DeviceType}` | ''; deviceType: `${DeviceType}` | '';
device: string[]; device: number[];
alertTypes: string[]; alertTypes: string[];
}>({ }>({
areaName: '', areaName: '',
@ -184,15 +184,11 @@ watch(
} }
return select; return select;
}) as JlGraphic[]; }) as JlGraphic[];
if (rangeConfig.alertTypes[0] !== '一级联锁') { selectGraphic.push(...deviceFilter);
selectGraphic.push(...deviceFilter);
} else if (deviceFilter.length) {
selectGraphic = [deviceFilter[0]];
}
selectGraphic = Array.from(new Set(selectGraphic)); selectGraphic = Array.from(new Set(selectGraphic));
getRangeConfigApp().updateSelected(...selectGraphic); getRangeConfigApp().updateSelected(...selectGraphic);
device.value = selectGraphic.map((g) => g.code) as string[]; device.value = selectGraphic.map((g) => g.code) as string[];
rangeConfig.device = selectGraphic.map((g) => g.id) as string[]; rangeConfig.device = selectGraphic.map((g) => g.id) as number[];
} }
} }
); );
@ -267,7 +263,7 @@ async function searchById(id: number) {
(type) => (showAlertTypeData as never)[type + ''] (type) => (showAlertTypeData as never)[type + '']
); );
const select: JlGraphic[] = []; const select: JlGraphic[] = [];
response.data.data.forEach((id: string) => { response.data.data.forEach((id: number) => {
const g = getRangeConfigApp().queryStore.queryById(id); const g = getRangeConfigApp().queryStore.queryById(id);
select.push(g); select.push(g);
device.value.push(g.code); device.value.push(g.code);