决策信息故障选择后指定范围配置

This commit is contained in:
joylink_zhaoerwei 2023-08-28 10:32:43 +08:00
parent e402fc8f6a
commit 041052113a
2 changed files with 40 additions and 5 deletions

View File

@ -89,3 +89,24 @@ export function updataAlarmInfo(id: number, data: AlarmInfoListItem) {
export interface AlarmInfo<T = unknown> {
data: T;
}
/**
*
* @param id 线id
* @param tipType
*/
export async function getDeviceAreaByAlarmType(
id: number,
alertType: string
): Promise<AreaConfigItem[]> {
const response = await api.post(
`${DraftUriBase}/find/type/${id}/${alertType}`,
{}
);
return response.data;
}
export interface AreaConfigItem {
id: number;
areaName: string;
}

View File

@ -81,6 +81,7 @@
v-model="creatForm.alertType"
:options="optionsAlertType"
:rules="[(val) => val.length > 0 || '请选择故障类型!']"
@blur="searchLocationType"
/>
<!-- <q-select
outlined
@ -129,6 +130,7 @@ import {
createAlarmInfo,
updataAlarmInfo,
AlarmInfoListItem,
getDeviceAreaByAlarmType,
} from '../api/DecisionInfo';
import {
showAlertTypeData,
@ -151,7 +153,7 @@ const tableHeight = computed(() => {
onMounted(() => {
tableRef.value.requestServerInteraction();
searchLocationType();
searchAllLocationType();
});
const columnDefs: QTableColumn[] = [
@ -290,7 +292,7 @@ const optionsAlertType = [
'列车信号故障',
];
const optionsTimeType = ['CLOCK_7_9', 'CLOCK_7_9_AND_19_21', '无'];
let optionsLocationType = [];
let optionsLocationType = ref<string[]>([]);
function onReset() {
creatForm.id = '';
@ -302,13 +304,25 @@ function onReset() {
myForm.value?.resetValidation();
}
let optionsLocationList: IAreaConfigListItem[] = [];
async function searchLocationType() {
try {
const alertType = (saveAlertTypeData as never)[creatForm.alertType];
const res = await getDeviceAreaByAlarmType(3, alertType);
optionsLocationType.value = res.map((item) => item.areaName);
optionsLocationType.value.push('无');
} catch (err) {
$q.notify({
type: 'negative',
message: '无法获取指定故障的范围配置列表',
});
}
}
let optionsLocationList: IAreaConfigListItem[] = [];
async function searchAllLocationType() {
try {
const resp = await getAllDeviceArea();
optionsLocationList = resp.data.records;
optionsLocationType = optionsLocationList.map((item) => item.areaName);
optionsLocationType.push('无');
} catch (err) {
$q.notify({
type: 'negative',