feat: 增加导出接口

This commit is contained in:
Zhao Zhao Shen 2025-03-05 11:37:37 +08:00
parent 06a9d4541c
commit 0af30f2e0a
5 changed files with 60 additions and 10 deletions

View File

@ -31,3 +31,11 @@ export function getDeviceList() {
method: 'get' method: 'get'
}); });
} }
// 导出excel
export function exportExcel(deviceId, inputTime, shift) {
return request({
url: `/Check/Export/Juice?deviceId=${deviceId}&inputTime=${inputTime}&shift=${shift}`,
method: 'get'
});
}

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M512 960c-92.8 0-160-200-160-448S419.2 64 512 64s160 200 160 448-67.2 448-160 448z m0-32c65.6 0 128-185.6 128-416S577.6 96 512 96s-128 185.6-128 416 62.4 416 128 416z" fill="#050D42" /><path d="M124.8 736c-48-80 92.8-238.4 307.2-363.2S852.8 208 899.2 288 806.4 526.4 592 651.2 171.2 816 124.8 736z m27.2-16c33.6 57.6 225.6 17.6 424-97.6S905.6 361.6 872 304 646.4 286.4 448 401.6 118.4 662.4 152 720z" fill="#050D42" /><path d="M899.2 736c-46.4 80-254.4 38.4-467.2-84.8S76.8 368 124.8 288s254.4-38.4 467.2 84.8S947.2 656 899.2 736z m-27.2-16c33.6-57.6-97.6-203.2-296-318.4S184 246.4 152 304 249.6 507.2 448 622.4s392 155.2 424 97.6z" fill="#050D42" /><path d="M512 592c-44.8 0-80-35.2-80-80s35.2-80 80-80 80 35.2 80 80-35.2 80-80 80zM272 312c-27.2 0-48-20.8-48-48s20.8-48 48-48 48 20.8 48 48-20.8 48-48 48zM416 880c-27.2 0-48-20.8-48-48s20.8-48 48-48 48 20.8 48 48-20.8 48-48 48z m448-432c-27.2 0-48-20.8-48-48s20.8-48 48-48 48 20.8 48 48-20.8 48-48 48z" fill="#2F4BFF" /></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -77,16 +77,28 @@
</div> </div>
</div> </div>
<div class="tag-panel"> <div class="tag-panel">
<IxChip class="left-chip" background="#00BEDC" chip-color="#000028" variant="custom"> <IxChip class="left-chip"
:background="processForm_uht.cleanStatus === '已碱洗' ? '#00BEDC' : '#6B6B7E'"
chip-color="#000028"
variant="custom">
&emsp;&nbsp;已碱洗 &emsp;&nbsp;已碱洗
</IxChip> </IxChip>
<IxChip class="left-chip" background="#00FFB9" chip-color="#000028" variant="custom"> <IxChip class="left-chip"
:background="processForm_uht.cleanStatus === '已酸洗' ? '#00FFB9' : '#6B6B7E'"
chip-color="#000028"
variant="custom">
&emsp;&nbsp;已酸洗 &emsp;&nbsp;已酸洗
</IxChip> </IxChip>
<IxChip class="left-chip" background="#00BEDC" chip-color="#000028" variant="custom"> <IxChip class="left-chip"
:background="processForm_uht.cleanStatus === '清洁状态' ? '#00BEDC' : '#6B6B7E'"
chip-color="#000028"
variant="custom">
&emsp;清洁状态 &emsp;清洁状态
</IxChip> </IxChip>
<IxChip class="left-chip" background="#6B6B7E" chip-color="#000028" variant="custom"> <IxChip class="left-chip"
:background="processForm_uht.cleanStatus === '无菌状态' ? '#6B6B7E' : '#00BEDC'"
chip-color="#000028"
variant="custom">
&emsp;无菌状态 &emsp;无菌状态
</IxChip> </IxChip>
</div> </div>
@ -447,6 +459,7 @@ const processDataFromAPI = (apiData) => {
weight: item.data.weight || 0, weight: item.data.weight || 0,
capacity: item.data.capacity, capacity: item.data.capacity,
deviceStatus: item.data.deviceStatus || '', deviceStatus: item.data.deviceStatus || '',
cleanStatus: item.data.cleanStatus || '',
productFlowRate: item.data.productFlowRate || 0, productFlowRate: item.data.productFlowRate || 0,
name: item.data.name || '', name: item.data.name || '',
formula: item.data.formula || '', formula: item.data.formula || '',
@ -562,7 +575,8 @@ const updateData = (processedData) => {
deviceStatus: uhtData.value.data[0].deviceStatus, deviceStatus: uhtData.value.data[0].deviceStatus,
productFlowRate: uhtData.value.data[0].productFlowRate, productFlowRate: uhtData.value.data[0].productFlowRate,
mixerStep: uhtData.value.data[0].mixerStep, 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) { if (pulpUHTData.value.data.length > 0) {

View File

@ -24,7 +24,7 @@
<!-- 查询按钮 --> <!-- 查询按钮 -->
<IxButton @click="handleSearch" class="input-spacing"> 查询 </IxButton> <IxButton @click="handleSearch" class="input-spacing"> 查询 </IxButton>
<!-- 导出按钮 --> <!-- 导出按钮 -->
<IxButton class="input-spacing"> 导出全部 </IxButton> <IxButton class="input-spacing" @click="handleExport"> 导出全部 </IxButton>
</div> </div>
<div class="header_right"> <div class="header_right">
<!-- 设备列表按钮 --> <!-- 设备列表按钮 -->
@ -88,7 +88,7 @@ import momentTimezone from 'moment-timezone';
import { ref, computed, getCurrentInstance, onMounted, defineEmits, onUnmounted } from 'vue'; import { ref, computed, getCurrentInstance, onMounted, defineEmits, onUnmounted } from 'vue';
import { IxDatePicker, IxButton, IxDropdownItem, IxEventList, IxEventListItem, IxSelect, IxSelectItem, IxDateInput } from '@siemens/ix-vue'; import { IxDatePicker, IxButton, IxDropdownItem, IxEventList, IxEventListItem, IxSelect, IxSelectItem, IxDateInput } from '@siemens/ix-vue';
import InspectionForm from './InspectionForm.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']); const emit = defineEmits(['send-data']);
@ -321,6 +321,31 @@ const handleSearch = () => {
fetchCurrentValues(); 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 // ID
const getDeviceNameById = (id) => { const getDeviceNameById = (id) => {
const device = deviceList.value.find(device => device.id === id); const device = deviceList.value.find(device => device.id === id);

View File

@ -47,7 +47,7 @@ let appSwitchConfig = {
{ {
id: 'mis-app', id: 'mis-app',
name: 'MIS 1.0', name: 'MIS 1.0',
iconSrc: 'https://www.svgrepo.com/show/530661/genetic-data.svg', iconSrc: '@/assets/genetic-data.svg',
url: '/', url: '/',
description: '前处理系统', description: '前处理系统',
target: '_self', target: '_self',
@ -55,7 +55,7 @@ let appSwitchConfig = {
{ {
id: 'other-app', id: 'other-app',
name: '点检系统', name: '点检系统',
iconSrc: 'https://www.svgrepo.com/show/530661/genetic-data.svg', iconSrc: '@/assets/genetic-data.svg',
url: '/#/inspection', url: '/#/inspection',
description: '其他系统描述', description: '其他系统描述',
target: '_self', target: '_self',