| | |
| | | import { useVbenModal } from '@vben/common-ui'; |
| | | import { downloadFileFromBlobPart } from '@vben/utils'; |
| | | |
| | | import { Button, message, Upload } from 'ant-design-vue'; |
| | | import { Button, Upload } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | |
| | | importMachineryTemplate, |
| | | } from '#/api/mes/dv/machinery'; |
| | | import { $t } from '#/locales'; |
| | | import { notifyImportResult } from '#/utils'; |
| | | |
| | | import { useImportFormSchema } from '../data'; |
| | | |
| | |
| | | try { |
| | | const result = await importMachinery(data.file, data.updateSupport); |
| | | const importData = result as MesDvMachineryApi.MachineryImportRespVO; |
| | | let text = `上传成功数量:${importData.createCodes?.length || 0};`; |
| | | text += `更新成功数量:${importData.updateCodes?.length || 0};`; |
| | | text += `更新失败数量:${Object.keys(importData.failureCodes || {}).length};`; |
| | | message.info(text); |
| | | // 关闭并提示 |
| | | const createCount = importData.createCodes?.length || 0; |
| | | const updateCount = importData.updateCodes?.length || 0; |
| | | |
| | | // 关闭并按导入结果提示:仅在确有数据写入时通知列表刷新 |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | if (createCount + updateCount > 0) { |
| | | emit('success'); |
| | | } |
| | | notifyImportResult({ |
| | | subject: '设备', |
| | | createCount, |
| | | updateCount, |
| | | failures: importData.failureCodes, |
| | | masterDataHint: '【设备类型】【车间】【工作站】中的对应编码', |
| | | }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |