1
lkk
2025-05-19 c0b8a21206c58a0161a179c15dfb73e4a8bbf55d
src/views/reservation/resercopy/index.vue
@@ -209,7 +209,8 @@
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :key="uploadKey"
        accept=".xls"
        :headers="upload.headers"
        :data="data"
        :action="upload.url"
@@ -222,18 +223,18 @@
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
          <!-- <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" />
            是否更新已经存在的用户数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link
          </div> -->
          <span>仅允许导入xls格式文件。</span>
          <!-- <el-link
            type="primary"
            :underline="false"
            style="font-size: 12px; vertical-align: baseline"
            @click="importTemplate"
            >下载模板</el-link
          >
          > -->
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
@@ -637,6 +638,7 @@
        ],
      },
      ListObj: {},
      uploadKey:0,
      // 遮罩层
      loading: true,
      pacStatus: "启用",
@@ -697,7 +699,7 @@
      });
    },
    idFn(value) {
      console.log(value);
      this.userList = []
      if (value) {
        this.data.dwId = value;
        Deptlist(value).then((response) => {
@@ -873,6 +875,8 @@
    /** 导入按钮操作 */
    handleImport() {
      if (this.objs.drugManufacturerId && this.objs.reservationTime) {
        this.$refs.upload?.clearFiles();
        this.uploadKey = Date.now(); // 改变 key 强制重新渲染组件
        this.upload.title = "用户导入";
        this.upload.open = true;
      } else {
@@ -893,24 +897,40 @@
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      console.log(response, 666666);
      if (response.code == 500) {
        console.log(22222222222);
        this.isdisabled = true;
        // Message.warning(response.msg);
        // this.$modal.msgError(response.msg);
        // this.$modal.msgError("人员"+ response.data.list + "信息错误");
        const errorList = response.data.list.join(", ");
        this.$confirm(`${errorList}`, `${response.msg}`, {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "error",
          center: true,
          dangerouslyUseHTMLString: true,
        });
      }
      this.ListObj = response.data;
      this.userList = response.data.list;
        if (response.data) {
          if (response.data.list) {
            const errorList = `
  <div style="max-height: 300px; overflow-y: auto;">
    ${response.data.list.join(", ")}
  </div>`
            this.$confirm(errorList, `${response.msg}`, {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "error",
              center: true,
              dangerouslyUseHTMLString: true,
            });
          }
        } else {
          this.$confirm(`${response.msg}`, {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "error",
            center: true,
            dangerouslyUseHTMLString: true,
          });
        }
      }else{
        this.isdisabled = false;
        this.ListObj = response.data;
      this.userList = response.data.list;
      this.userList.forEach((item) => {
        this.CompanyList.forEach((item1) => {
          if (item1.drugManufacturerId == this.objs.drugManufacturerId) {
@@ -918,11 +938,12 @@
          }
        });
      });
      }
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.leftList = response.msg;
      console.log(response.code);
      if (this.leftList == "操作失败") {
        this.isdisabled = true;
@@ -936,15 +957,17 @@
          "导入结果",
          { dangerouslyUseHTMLString: true }
        );
      } else {
        this.isdisabled = false;
        this.$alert(
          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
            response.msg,
          { dangerouslyUseHTMLString: true }
        );
        this.rightList = response;
      }
      }
      // else {
      //   console.log(11111)
      //   this.isdisabled = false;
      //   this.$alert(
      //     "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
      //       response.msg,
      //     { dangerouslyUseHTMLString: true }
      //   );
      //   this.rightList = response;
      // }
      for (let i = 0; i < fileList.length; i++) {
        if (file.name != fileList[i].name) {
          this.fileList.push({