diff --git a/src/api/mes/criticalComponent/index.ts b/src/api/mes/criticalComponent/index.ts index 0d8dfc44..9dd85ebe 100644 --- a/src/api/mes/criticalComponent/index.ts +++ b/src/api/mes/criticalComponent/index.ts @@ -28,6 +28,9 @@ export const CriticalComponentApi = { exportCriticalComponent: async (params: any) => { return await request.download({ url: `/mes/critical-component/export-excel`, params }) + }, + + exportDeviceComponent: async (params: any) => { + return await request.download({ url: `/mes/critical-component/export-device-component`, params }) } } - diff --git a/src/api/mes/deviceledger/index.ts b/src/api/mes/deviceledger/index.ts index 8294b8a2..9deeea06 100644 --- a/src/api/mes/deviceledger/index.ts +++ b/src/api/mes/deviceledger/index.ts @@ -73,5 +73,7 @@ export const DeviceLedgerApi = { exportDeviceLedger: async (params) => { return await request.download({ url: `/mes/device-ledger/export-excel`, params }) }, - + exportSpareBased: async (params) => { + return await request.download({ url: `/mes/device-ledger/export-spare-based`, params }) + } } diff --git a/src/views/mes/deviceledger/index.vue b/src/views/mes/deviceledger/index.vue index 5cd9885d..712bdaae 100644 --- a/src/views/mes/deviceledger/index.vue +++ b/src/views/mes/deviceledger/index.vue @@ -127,18 +127,18 @@ link type="danger" @click="handleDelete(scope.row.id)" - {{ detailData?.deviceBrand ?? '' }} + {{ detailData?.deviceModel ?? '' }} {{ detailData?.deviceSpec ?? '' }} {{ getDeviceTypeName(detailData?.deviceTypeName ?? detailData?.deviceType) }} - {{ detailData?.supplier ?? '' }} + {{ detailData?.workshop ?? '' }} - {{ detailData?.systemOrg ?? '' }} + {{ detailData?.deviceLocation ?? '' }} - {{ detailData?.deviceManager ?? '' }} + {{ detailData?.deviceManagerName ?? '' }} {{ formatDetailDate(detailData?.productionDate) }} {{ formatDetailDate(detailData?.factoryEntryDate) }} @@ -334,35 +334,66 @@ link type="danger" @click="handleDelete(scope.row.id)" - - - - - - - +
+ + 导出 + +
+ + + + + + +
- - - - - - - - - - +
+ + 导出 + +
+ + + + + + +
@@ -387,6 +418,7 @@ import { dateFormatter, dateFormatter2, formatDate } from '@/utils/formatTime' import download from '@/utils/download' import { DeviceLedgerApi, DeviceLedgerVO } from '@/api/mes/deviceledger' import { DeviceTypeApi, DeviceTypeTreeVO } from '@/api/mes/devicetype' +import { CriticalComponentApi } from '@/api/mes/criticalComponent' import DeviceLedgerForm from './DeviceLedgerForm.vue' import { getIntDictOptions } from '@/utils/dict' import { isHexColor } from '@/utils/color' @@ -411,6 +443,8 @@ const queryParams = reactive({ }) const queryFormRef = ref() // 搜索的表单 const exportLoading = ref(false) // 导出的加载中 +const criticalExportLoading = ref(false) +const spareExportLoading = ref(false) const tableRef = ref() const selectedIds = ref([]) @@ -775,6 +809,38 @@ const handleExport = async () => { } } +const handleExportCriticalComponent = async () => { + if (!selectedDetailId.value) { + message.error('请先选择设备') + return + } + try { + await message.exportConfirm() + criticalExportLoading.value = true + const data = await CriticalComponentApi.exportDeviceComponent({ id: selectedDetailId.value }) + download.excel(data, '关键件.xls') + } catch { + } finally { + criticalExportLoading.value = false + } +} + +const handleExportSpareBased = async () => { + if (!selectedDetailId.value) { + message.error('请先选择设备') + return + } + try { + await message.exportConfirm() + spareExportLoading.value = true + const data = await DeviceLedgerApi.exportSpareBased({ id: selectedDetailId.value }) + download.excel(data, '备件.xls') + } catch { + } finally { + spareExportLoading.value = false + } +} + /** 初始化 **/ onMounted(async () => { await dictStore.setDictMap() @@ -831,6 +897,11 @@ onMounted(async () => { color: var(--el-text-color-secondary); } +.device-ledger-tab-toolbar { + margin-bottom: 8px; + text-align: right; +} + .device-ledger-history-items { display: flex; flex-direction: column;