perf: remove suffix of offline device count; optimize routes; optimize station Select option

This commit is contained in:
yangsy
2025-08-22 15:54:51 +08:00
parent 29ff837da8
commit 5d131ee1df
5 changed files with 240 additions and 27 deletions

View File

@@ -10,11 +10,27 @@ import dayjs from 'dayjs';
import type { DataTableColumns, DataTableRowData, PaginationProps, SelectOption } from 'naive-ui';
import { NForm, NInput, NButton, NSpace, NDataTable, NFormItemGi, NGrid, NSelect, NGridItem, NDatePicker } from 'naive-ui';
import { storeToRefs } from 'pinia';
import { ref, reactive, onBeforeMount, h } from 'vue';
import { ref, reactive, onBeforeMount, h, shallowRef, watch } from 'vue';
const stationStore = useStationStore();
const { stationList } = storeToRefs(stationStore);
const stationSelectOptions = shallowRef<SelectOption[]>([]);
watch(
stationList,
(list) => {
const next = list.map<SelectOption>((station) => ({
label: station.name,
value: station.deviceIdPrefix,
}));
stationSelectOptions.value.splice(0, stationSelectOptions.value.length, ...next);
},
{
immediate: true,
deep: true,
},
);
const searchFields = reactive({
stationCode_in: [] as string[],
deviceType_in: [] as string[],
@@ -174,17 +190,7 @@ onBeforeMount(() => getAlarmList());
<NForm>
<NGrid :cols="3" :x-gap="24">
<NFormItemGi :span="1" label="车站" label-placement="left">
<NSelect
v-model:value="searchFields.stationCode_in"
:options="[
...stationList.map<SelectOption>((station) => ({
label: station.name,
value: station.deviceIdPrefix,
})),
]"
multiple
clearable
/>
<NSelect v-model:value="searchFields.stationCode_in" :options="stationSelectOptions" multiple clearable />
</NFormItemGi>
<NFormItemGi :span="1" label="设备类型" label-placement="left">
<NSelect