diff --git a/src/api/inspection.js b/src/api/inspection.js index 683fe61..ec3bc76 100644 --- a/src/api/inspection.js +++ b/src/api/inspection.js @@ -30,4 +30,12 @@ export function getDeviceList() { url: '/Check/deviceList', method: 'get' }); +} + +// 导出excel +export function exportExcel(deviceId, inputTime, shift) { + return request({ + url: `/Check/Export/Juice?deviceId=${deviceId}&inputTime=${inputTime}&shift=${shift}`, + method: 'get' + }); } \ No newline at end of file diff --git a/src/assets/genetic-data.svg b/src/assets/genetic-data.svg new file mode 100644 index 0000000..0a12dc2 --- /dev/null +++ b/src/assets/genetic-data.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/views/Dashboard/index.vue b/src/views/Dashboard/index.vue index 2bcca32..cacddd2 100644 --- a/src/views/Dashboard/index.vue +++ b/src/views/Dashboard/index.vue @@ -77,16 +77,28 @@
- +   已碱洗 - +   已酸洗 - +  清洁状态 - +  无菌状态
@@ -447,6 +459,7 @@ const processDataFromAPI = (apiData) => { weight: item.data.weight || 0, capacity: item.data.capacity, deviceStatus: item.data.deviceStatus || '', + cleanStatus: item.data.cleanStatus || '', productFlowRate: item.data.productFlowRate || 0, name: item.data.name || '', formula: item.data.formula || '', @@ -562,7 +575,8 @@ const updateData = (processedData) => { deviceStatus: uhtData.value.data[0].deviceStatus, productFlowRate: uhtData.value.data[0].productFlowRate, mixerStep: uhtData.value.data[0].mixerStep, - temperature: uhtData.value.data[0].temperature + temperature: uhtData.value.data[0].temperature, + cleanStatus: uhtData.value.data[0].cleanStatus // 增加 cleanStatus 字段 }; } if (pulpUHTData.value.data.length > 0) { @@ -1153,4 +1167,4 @@ onUnmounted(() => { .btnStyle { pointer-events: none; } - + diff --git a/src/views/Inspection/index.vue b/src/views/Inspection/index.vue index cf08e37..89d519e 100644 --- a/src/views/Inspection/index.vue +++ b/src/views/Inspection/index.vue @@ -24,7 +24,7 @@ 查询 - 导出全部 + 导出全部
@@ -88,7 +88,7 @@ import momentTimezone from 'moment-timezone'; import { ref, computed, getCurrentInstance, onMounted, defineEmits, onUnmounted } from 'vue'; import { IxDatePicker, IxButton, IxDropdownItem, IxEventList, IxEventListItem, IxSelect, IxSelectItem, IxDateInput } from '@siemens/ix-vue'; import InspectionForm from './InspectionForm.vue'; -import { getInspectionCurrent, getInspectionData, getCheckParas, getDeviceList } from '@/api/inspection'; +import { getInspectionCurrent, getInspectionData, getCheckParas, getDeviceList, exportExcel } from '@/api/inspection'; const emit = defineEmits(['send-data']); @@ -321,6 +321,31 @@ const handleSearch = () => { fetchCurrentValues(); }; +const handleExport = () => { + showInfoMessage('导出全部'); + exportExcel(selectedDeviceId.value, selectedDate.value || currentDate, shift.value) + .then((response) => { + if (response.data) { + // 有数据的处理 + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'inspection_data.xlsx'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + showInfoMessage('导出成功'); + } else { + // 没有数据的处理 + showWarningMessage('没有可导出的数据'); + } + }) + .catch((error) => { + console.error('导出 Excel 失败:', error); + showDangerMessage('导出 Excel 失败,请稍后重试'); + }); +}; + // 通过设备ID获取设备名称 const getDeviceNameById = (id) => { const device = deviceList.value.find(device => device.id === id); diff --git a/src/views/layout/vueLayout.vue b/src/views/layout/vueLayout.vue index 663e95a..851d3b6 100644 --- a/src/views/layout/vueLayout.vue +++ b/src/views/layout/vueLayout.vue @@ -47,7 +47,7 @@ let appSwitchConfig = { { id: 'mis-app', name: 'MIS 1.0', - iconSrc: 'https://www.svgrepo.com/show/530661/genetic-data.svg', + iconSrc: '@/assets/genetic-data.svg', url: '/', description: '前处理系统', target: '_self', @@ -55,7 +55,7 @@ let appSwitchConfig = { { id: 'other-app', name: '点检系统', - iconSrc: 'https://www.svgrepo.com/show/530661/genetic-data.svg', + iconSrc: '@/assets/genetic-data.svg', url: '/#/inspection', description: '其他系统描述', target: '_self',