diff --git a/src/views/project/projectJinDu/monthReport.vue b/src/views/project/projectJinDu/monthReport.vue index 19caddc..56fac25 100644 --- a/src/views/project/projectJinDu/monthReport.vue +++ b/src/views/project/projectJinDu/monthReport.vue @@ -86,6 +86,7 @@ :on-change="uploadFile" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" + :on-remove="handleRemove" :auto-upload="false" drag > @@ -314,14 +315,22 @@ function submitFormExport() { proxy.$refs['formRefDR'].validate(valid => { if (valid) { - console.log(formExportData.value, 'formExportData.value'); + if (typeof formExportData.value.get == 'function') { + if (formExportData.value.get('file') == null) { + proxy.$modal.msgError('请上传导入的文件'); + return false; + } + } else { + proxy.$modal.msgError('请上传导入的文件'); + return false; + } MonthReportImport(formExportData.value).then(res => { if (res.code == 200) { proxy.$modal.msgSuccess('导入成功'); getDataList(); dialogShowDR.value = false; } else { - proxy.$modal.msgError('导入失败请重试'); + proxy.$modal.msgError('导入失败请重试,请先删除表格中的图片,需单独上传'); } }); } @@ -337,12 +346,14 @@ proxy.$refs['uploadRef'].handleRemove(file); }; function uploadFile(file) { - console.log(file.raw, 'file.raw'); formExport.value.file = ''; formExportData.value = new FormData(); formExportData.value.append('file', file.raw); formExportData.value.append('reportMonth', formExport.value.reportMonth); } +function handleRemove(uploadFile, uploadFiles) { + formExportData.value.delete('file'); +} /** 通知提醒操作 */ function handleNotice(row) { diff --git a/src/views/project/projectJinDu/monthReport.vue b/src/views/project/projectJinDu/monthReport.vue index 19caddc..56fac25 100644 --- a/src/views/project/projectJinDu/monthReport.vue +++ b/src/views/project/projectJinDu/monthReport.vue @@ -86,6 +86,7 @@ :on-change="uploadFile" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" + :on-remove="handleRemove" :auto-upload="false" drag > @@ -314,14 +315,22 @@ function submitFormExport() { proxy.$refs['formRefDR'].validate(valid => { if (valid) { - console.log(formExportData.value, 'formExportData.value'); + if (typeof formExportData.value.get == 'function') { + if (formExportData.value.get('file') == null) { + proxy.$modal.msgError('请上传导入的文件'); + return false; + } + } else { + proxy.$modal.msgError('请上传导入的文件'); + return false; + } MonthReportImport(formExportData.value).then(res => { if (res.code == 200) { proxy.$modal.msgSuccess('导入成功'); getDataList(); dialogShowDR.value = false; } else { - proxy.$modal.msgError('导入失败请重试'); + proxy.$modal.msgError('导入失败请重试,请先删除表格中的图片,需单独上传'); } }); } @@ -337,12 +346,14 @@ proxy.$refs['uploadRef'].handleRemove(file); }; function uploadFile(file) { - console.log(file.raw, 'file.raw'); formExport.value.file = ''; formExportData.value = new FormData(); formExportData.value.append('file', file.raw); formExportData.value.append('reportMonth', formExport.value.reportMonth); } +function handleRemove(uploadFile, uploadFiles) { + formExportData.value.delete('file'); +} /** 通知提醒操作 */ function handleNotice(row) { diff --git a/vite.config.js b/vite.config.js index 24dcf41..ea36ec6 100644 --- a/vite.config.js +++ b/vite.config.js @@ -7,8 +7,8 @@ const Timestamp = new Date().getTime(); //随机时间戳 // const targetUrl = 'http://192.168.16.254:7200'; //孙逢时 -const targetUrl = 'http://192.168.20.52:7300'; //杨辉 -// const targetUrl = 'https://server2.wh-nf.cn:8082/prod-api'; //线上 +// const targetUrl = 'http://192.168.20.52:7300'; //杨辉 +const targetUrl = 'https://server2.wh-nf.cn:8082/prod-api'; //线上 // https://vitejs.dev/config/ export default defineConfig(({ mode, command }) => {