fujunling
2023-07-05 f9c5d6c45ccefd2e4a9926284e25c04586ed4dd3
Source/UBCS-WEB/src/components/BatchImport/index.vue
@@ -49,6 +49,7 @@
      :on-exceed="handleExceed"
      :headers="uploadHeaders"
      :on-success="onSuccess"
      :on-error="onError"
      :show-file-list="false"
      :on-change="uploadChange"
      :data="upParams"
@@ -168,6 +169,7 @@
      leftTree: [],
      redisOid: "",
      pageLoading: null,
      showCodeApply: false,
      currentTypeObj: {
        historyImport: {
          title: "历史数据导入",
@@ -208,18 +210,17 @@
  },
  methods: {
    async beforeUpload(file) {
      console.log(file, 'file');
      const fileType = file.name.split(".").pop();
      if (fileType !== "xlsx" && fileType !== "xls") {
        // 上传格式不符合要求,提示错误信息并取消上传
        this.$message.error("只允许上传xlsx、xls格式的文件");
        return Promise.reject(false);
      }
      if (this.type === "batchImportApply") {
        const flag = await this.$refs.CodeApply.validate();
        if (!flag) {
          return Promise.reject(false);
        }
      if (this.type === "batchImportApply" && this.showCodeApply) {
        // const flag = await this.$refs.CodeApply.validate();
        // if (!flag) {
        //   return Promise.reject(false);
        // }
      }
      this.pageLoading = this.$loading({
        lock: true,
@@ -249,8 +250,8 @@
        this.dialogVisible = false
        return
      }
      let fileName = res.data.filePath.split("/").pop();
      if (res.data.fileOid) {
        const fileName = res.data.filePath.split("/").pop();
        this.$message.error("请下载错误信息文件进行查看!");
        downloadErrorFile({ uuid: res.data.fileOid }).then((res2) => {
          this.$utilFunc.downloadFileByBlob(res2.data, fileName);
@@ -269,8 +270,11 @@
        });
      }
    },
    onError(err) {
      console.log(err, 'err');
      this.pageLoading.close();
    },
    uploadChange(file) {
      console.log(file, 'file', file.status === "success");
      if (file.status === "success" || file.status === "error") {
        this.pageLoading.close();
      }