|
@@ -6,10 +6,11 @@
|
|
|
name="file"
|
|
|
:multiple="true"
|
|
|
:action="action"
|
|
|
+ @change="handleChange"
|
|
|
:beforeUpload="beforeUpload"
|
|
|
:data="data"
|
|
|
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
|
- :headers="{ Authorization: `Bearer ${getToken()}` }"
|
|
|
+ :headers="{ Authorization: `${getToken()}` }"
|
|
|
>
|
|
|
<img src="/src/assets/images/import.png" />
|
|
|
<span class="upload-tip">只能上传Excel文件,且不能超过1G</span>
|
|
@@ -72,7 +73,23 @@
|
|
|
return false;
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+ const handleChange = (e) => {
|
|
|
+ const fileList = e.fileList[0];
|
|
|
+ if (fileList.status === 'done') {
|
|
|
+ if (fileList.response !== 0) {
|
|
|
+ notification.error({
|
|
|
+ message: 'Tip',
|
|
|
+ description: fileList.response.msg,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ notification.success({
|
|
|
+ message: 'Tip',
|
|
|
+ description: '导入成功!',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(e);
|
|
|
+ };
|
|
|
const downLoadTemplate = async () => {
|
|
|
const method = importType.value || 'GET';
|
|
|
let res;
|