| | |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | let shouldClose = false; |
| | | if (fileList.value.length === 0) { |
| | | message.warning('请选择要导入的文件'); |
| | | return; |
| | |
| | | // 完成:进度条走满 |
| | | stopMockProgress(); |
| | | progressPercent.value = 100; |
| | | await delay(500); |
| | | message.success('导入完成'); |
| | | await delay(300); |
| | | emit('success'); |
| | | const failedCount = Object.keys(importResult.value?.failureNames ?? {}).length; |
| | | if (failedCount > 0) { |
| | | message.warning( |
| | | `导入完成:成功 ${createCount.value} 条、覆盖 ${updateCount.value} 条,失败 ${failedCount} 条,请查看下方失败明细`, |
| | | ); |
| | | } else { |
| | | message.success('导入完成'); |
| | | shouldClose = true; |
| | | } |
| | | } finally { |
| | | stopMockProgress(); |
| | | importing.value = false; |
| | | modalApi.unlock(); |
| | | if (shouldClose) { |
| | | await modalApi.close(); |
| | | } |
| | | } |
| | | }, |
| | | }); |