qx
qx
2025-04-17 6d2f5a43b9bf2922c137e18e3fb4ba91fcfce459
src/views/reservation/resercopy/index.vue
@@ -130,6 +130,13 @@
          width="200"
        >
        </el-table-column>
        <el-table-column
          label="单位部门"
          align="center"
          prop="department"
          width="200"
        >
        </el-table-column>
        <!-- <el-table-column label="工号" align="center" prop="jobNo" width="80" /> -->
        <el-table-column label="姓名" align="center" prop="name" width="75" />
        <el-table-column label="性别" align="center" prop="sex" width="75">
@@ -201,7 +208,8 @@
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :key="uploadKey"
        accept=".xls"
        :headers="upload.headers"
        :data="data"
        :action="upload.url"
@@ -218,7 +226,7 @@
            <el-checkbox v-model="upload.updateSupport" />
            是否更新已经存在的用户数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <span>仅允许导入xls格式文件。</span>
          <el-link
            type="primary"
            :underline="false"
@@ -390,6 +398,7 @@
</template>
<script>
import Cookies from "js-cookie"
import {
  addDept,
  addComp,
@@ -429,7 +438,7 @@
      }
    };
    return {
      uploadKey: 0,
      leftList: "",
      isdisabled: true,
      setDisabled: {
@@ -505,7 +514,7 @@
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        headers: { Authorization: "Bearer " + getToken(),hospId: Cookies.get("hospId") },
        // 上传的地址
        url:
          process.env.VUE_APP_BASE_API +
@@ -848,7 +857,6 @@
      this.objs.drugManufacturerId = "";
      this.objs.dwDeptName = "";
      this.objs.reservationTime = "";
      this.objs.yxts = "";
      this.TotalPrice = "";
      this.tableData[0] = [];
      this.TotalPrice1 = "";
@@ -864,6 +872,10 @@
    /** 导入按钮操作 */
    handleImport() {
      if (this.objs.drugManufacturerId && this.objs.reservationTime) {
          // 清空组件内部状态(含已上传文件)
      this.$refs.upload?.clearFiles();
      this.uploadKey = Date.now(); // 改变 key 强制重新渲染组件
      // 同步数据源(Vue2 需用 $set 确保响应式)
        this.upload.title = "用户导入";
        this.upload.open = true;
      } else {
@@ -883,25 +895,29 @@
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      console.log(response, 666666);
      console.log(response, file, fileList)
      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}`, "以下人员信息有误,请核对后导入:", {
        // const errorList = response.data.list.join(", ");
        this.$confirm( `${response.msg}`, {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "error",
          center: true,
          dangerouslyUseHTMLString: true,
        });
      }
      this.ListObj = response.data;
      }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) {
@@ -909,11 +925,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;
@@ -927,15 +944,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({
@@ -958,6 +977,7 @@
    },
    // 提交上传文件
    submitFileForm() {
      console.log(9999)
      this.$refs.upload.submit();
      this.isShow = false;
    },