|
@@ -17,6 +17,7 @@
|
|
|
:file-list="targetFileList"
|
|
|
:before-remove="beforeRemove"
|
|
|
:limit="filleNumber"
|
|
|
+ :before-upload="handlebeforeUplaod"
|
|
|
>
|
|
|
<el-button type="primary" v-if="type == '批量上传'">批量上传</el-button>
|
|
|
<el-button v-else>上传文件</el-button>
|
|
@@ -26,7 +27,7 @@
|
|
|
|
|
|
<script>
|
|
|
import Cookies from "js-cookie";
|
|
|
-import { getToken,removeToken } from "../utils/auth";
|
|
|
+import { getToken, removeToken } from "../utils/auth";
|
|
|
export default {
|
|
|
components: {},
|
|
|
props: ["fileList", "changeFillId", "type", "accept", "filleNumber"],
|
|
@@ -35,6 +36,7 @@ export default {
|
|
|
targetFileList: null,
|
|
|
targetAccept: null,
|
|
|
fileTypeName: "",
|
|
|
+ loading: null,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -61,19 +63,30 @@ export default {
|
|
|
},
|
|
|
//方法集合
|
|
|
methods: {
|
|
|
+ handlebeforeUplaod(file) {
|
|
|
+ this.loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: "Loading",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
|
+ });
|
|
|
+ },
|
|
|
handleSuccess(response, file, fileList) {
|
|
|
// console.log(response);
|
|
|
// console.log(file);
|
|
|
// console.log(fileList);
|
|
|
if (response.status == 1) {
|
|
|
this.$message.success("用户导入成功");
|
|
|
+ this.loading.close();
|
|
|
this.changeFillId(response.file_info_list[0], fileList, this.type);
|
|
|
} else if (response.status == -1) {
|
|
|
+ this.loading.close();
|
|
|
removeToken();
|
|
|
this.$message.warning(response.error);
|
|
|
this.$router.push("/login");
|
|
|
} else {
|
|
|
this.targetFileList = [];
|
|
|
+ this.loading.close();
|
|
|
// this.$message.warning(response.msg);
|
|
|
}
|
|
|
},
|