refactor: 修复告警记录导出未添加条件筛选
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { exportDeviceAlarmLogApi, pageDeviceAlarmLogApi, type NdmDeviceAlarmLog, type NdmDeviceAlarmLogResultVO, type PageQueryExtra, type Station } from '@/apis';
|
import { exportDeviceAlarmLogApi, pageDeviceAlarmLogApi, type NdmDeviceAlarmLog, type NdmDeviceAlarmLogPageQuery, type NdmDeviceAlarmLogResultVO, type PageQueryExtra, type Station } from '@/apis';
|
||||||
import { useAlarmActionColumn, useCameraSnapColumn } from '@/composables';
|
import { useAlarmActionColumn, useCameraSnapColumn } from '@/composables';
|
||||||
import { ALARM_TYPES, DEVICE_TYPE_CODES, DEVICE_TYPE_LITERALS, DEVICE_TYPE_NAMES, FAULT_LEVELS, tryGetDeviceType, type DeviceType } from '@/enums';
|
import { ALARM_TYPES, DEVICE_TYPE_CODES, DEVICE_TYPE_LITERALS, DEVICE_TYPE_NAMES, FAULT_LEVELS, tryGetDeviceType, type DeviceType } from '@/enums';
|
||||||
import { renderAlarmDateCell, renderAlarmTypeCell, renderDeviceTypeCell, renderFaultLevelCell } from '@/helpers';
|
import { renderAlarmDateCell, renderAlarmTypeCell, renderDeviceTypeCell, renderFaultLevelCell } from '@/helpers';
|
||||||
@@ -132,6 +132,12 @@ const resetSearchFields = () => {
|
|||||||
alarmConfirm: '',
|
alarmConfirm: '',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
const getModelFields = (): NdmDeviceAlarmLogPageQuery => {
|
||||||
|
return {
|
||||||
|
alarmCategory: searchFields.value.alarmCategory || undefined,
|
||||||
|
alarmConfirm: searchFields.value.alarmConfirm || undefined,
|
||||||
|
};
|
||||||
|
};
|
||||||
const getExtraFields = (): PageQueryExtra<NdmDeviceAlarmLog> => {
|
const getExtraFields = (): PageQueryExtra<NdmDeviceAlarmLog> => {
|
||||||
const stationCodeIn = searchFields.value.stationCode_in;
|
const stationCodeIn = searchFields.value.stationCode_in;
|
||||||
const deviceTypeIn = searchFields.value.deviceType_in.flatMap((deviceType) => DEVICE_TYPE_CODES[deviceType as DeviceType]);
|
const deviceTypeIn = searchFields.value.deviceType_in.flatMap((deviceType) => DEVICE_TYPE_CODES[deviceType as DeviceType]);
|
||||||
@@ -244,10 +250,7 @@ const { mutate: getTableData, isPending: tableLoading } = useMutation({
|
|||||||
|
|
||||||
const res = await pageDeviceAlarmLogApi(
|
const res = await pageDeviceAlarmLogApi(
|
||||||
{
|
{
|
||||||
model: {
|
model: getModelFields(),
|
||||||
alarmCategory: searchFields.value.alarmCategory || undefined,
|
|
||||||
alarmConfirm: searchFields.value.alarmConfirm || undefined,
|
|
||||||
},
|
|
||||||
extra: getExtraFields(),
|
extra: getExtraFields(),
|
||||||
current: pagination.page ?? 1,
|
current: pagination.page ?? 1,
|
||||||
size: pagination.pageSize ?? DEFAULT_PAGE_SIZE,
|
size: pagination.pageSize ?? DEFAULT_PAGE_SIZE,
|
||||||
@@ -302,7 +305,7 @@ const { mutate: exportTableData, isPending: exporting } = useMutation({
|
|||||||
|
|
||||||
const data = await exportDeviceAlarmLogApi(
|
const data = await exportDeviceAlarmLogApi(
|
||||||
{
|
{
|
||||||
model: {},
|
model: getModelFields(),
|
||||||
extra: getExtraFields(),
|
extra: getExtraFields(),
|
||||||
current: pagination.page ?? 1,
|
current: pagination.page ?? 1,
|
||||||
size: pagination.pageSize ?? 10,
|
size: pagination.pageSize ?? 10,
|
||||||
|
|||||||
Reference in New Issue
Block a user