From 362e398e62f7d06d5dfd9690c82bb4e56188df4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Tue, 18 Apr 2023 15:01:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E6=97=A0=E6=96=87=E4=BB=B6=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fe/PC/src/components/importFile/index.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fe/PC/src/components/importFile/index.vue b/fe/PC/src/components/importFile/index.vue index f3c940a36..d3a0218af 100644 --- a/fe/PC/src/components/importFile/index.vue +++ b/fe/PC/src/components/importFile/index.vue @@ -178,6 +178,8 @@ export default { // this.$emit("isAllowPartImportChange", this.isAllowPartImportValue); // 用 $emit 通知父组件去修改 // }, readerData(rawFile) { + console.log('11111111111',rawFile) + if (rawFile) { return new Promise((resolve, reject) => { const reader = new FileReader() reader.onload = e => { @@ -203,6 +205,7 @@ export default { } reader.readAsArrayBuffer(rawFile) }) + } }, getHeaderRow(sheet) { const headers = [] @@ -238,10 +241,15 @@ export default { this.submiData(val) } else { // 显示预览页 - this.previewShow = true - this.submitDataLS = val - // 文件数据展示 - this.readerData(val[1].fields[0].fieldValue[0]) + // 没上传文件时 不显示预览界面 + if (val[1].fields[0].fieldValue[0]) { + this.previewShow = true + this.submitDataLS = val + // 文件数据展示 + this.readerData(val[1].fields[0].fieldValue[0]) + } else { + this.$message.error('请上传文件!'); + } } }, // 提交数据