diff --git a/src/views/materialManagement/productionMaterial/MmMaterial.vue b/src/views/materialManagement/productionMaterial/MmMaterial.vue index bcd2837..e06e63b 100644 --- a/src/views/materialManagement/productionMaterial/MmMaterial.vue +++ b/src/views/materialManagement/productionMaterial/MmMaterial.vue @@ -284,18 +284,18 @@ const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, /*** 用户导入参数 */ const upload = reactive({ - // 是否显示弹出层(用户导入) - open: false, - // 弹出层标题(用户导入) - title: '', - // 是否禁用上传 - isUploading: false, - // 是否更新已经存在的用户数据 - updateSupport: 0, - // 设置上传的请求头部 - headers: { Authorization: 'Bearer ' + getToken() }, - // 上传的地址 - url: import.meta.env.VITE_APP_BASE_API + '/mes/productionMaterial/MmMaterial/importData' + // 是否显示弹出层(用户导入) + open: false, + // 弹出层标题(用户导入) + title: '', + // 是否禁用上传 + isUploading: false, + // 是否更新已经存在的用户数据 + updateSupport: 0, + // 设置上传的请求头部 + headers: { Authorization: 'Bearer ' + getToken() }, + // 上传的地址 + url: import.meta.env.VITE_APP_BASE_API + '/mes/productionMaterial/MmMaterial/importData' }) var dictParams = [] @@ -512,45 +512,61 @@ function handleCategoryChange(val) { /** 导入按钮操作 */ function handleImport() { - upload.title = '物料表导入' - upload.open = true + upload.title = '物料表导入' + upload.open = true } /** 下载模板操作 */ function importTemplate() { - proxy.download('/mes/productionMaterial/MmMaterial/importTemplate', '物料表数据导入模板') + proxy.download('/mes/productionMaterial/MmMaterial/importTemplate', '物料表数据导入模板') } /**文件上传中处理 */ const handleFileUploadProgress = (event, file, fileList) => { - upload.isUploading = true + upload.isUploading = true } /** 文件上传成功处理 */ const handleFileSuccess = (response, file, fileList) => { - const { code, msg, data } = response - upload.open = false - upload.isUploading = false - proxy.$refs['uploadRef'].clearFiles() - proxy.$alert("
" + data.item1 + '
', '导入结果', { - dangerouslyUseHTMLString: true - }) - getList() + const { code, msg, data } = response + upload.open = false + upload.isUploading = false + proxy.$refs['uploadRef'].clearFiles() + + // 构建导入结果提示信息 + const resultHtml = ` +
+

导入结果:${data.message}

+

总记录数:${data.total}

+

新增记录:${data.inserted}

+

更新记录:${data.updated}

+

删除记录:${data.deleted}

+

错误记录:${data.errorCount}

+

忽略记录:${data.ignoredCount}

+ ${data.errorCount > 0 ? `

错误信息:

` : ''} + ${data.ignoredCount > 0 ? `

忽略信息:

` : ''} +
+ ` + + proxy.$alert(resultHtml, '导入结果', { + dangerouslyUseHTMLString: true + }) + getList() } /** 提交上传文件 */ function submitFileForm() { - proxy.$refs['uploadRef'].submit() + proxy.$refs['uploadRef'].submit() } /** 导出按钮操作 */ function handleExport() { - proxy.$modal - .confirm('是否确认导出所有物料表数据项?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(async () => { - await exportMmMaterial(queryParams.value) - }) + proxy.$modal + .confirm('是否确认导出所有物料表数据项?', '警告', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }) + .then(async () => { + await exportMmMaterial(queryParams.value) + }) } handleGetMmMaterialCategoryOptions()