lkk
2024-12-04 d747406e0eb22d47726916be55e85376c4aa2729
src/views/sampling/sampling/index.vue
@@ -96,23 +96,18 @@
        v-if="samplingList.length > 0 && tjStatus == 1"
      >
        <el-button type="primary" @click="Merging">合并项目</el-button>
        <el-button
        <!-- <el-button
          type="primary"
          icon="el-icon-thumb"
          style="margin: 0 15px"
          v-hasPermi="['hosp:detail:add']"
          @click="Confirmreceipt"
          >确认采样</el-button
        >
        > -->
        <el-button type="primary" :disabled="!disabled" @click="Cancellation"
          >撤销合并</el-button
        >
        <el-button
          type="primary"
          :disabled="!selectList.length"
          @click="Collection"
          >采样打码</el-button
        >
        <el-button type="primary" @click="Confirmreceipt">采样打码</el-button>
      </el-col>
      <el-col
        :span="12"
@@ -190,15 +185,21 @@
        </el-table>
      </div>
      <div style="width: 50%">
        <!-- :default-sort="{ prop: 'specimenType', order: 'ascending' }"  :default-sort="{ prop: 'specimenType', order: 'ascending' }"
          @sort-change="handleSortChange"
          :span-method="objectSpanMethod"
          @selection-change="handleChange" ref="tab1"
          :row-class-name="tableRowClassName"-->
        <el-table
          v-loading="loading"
          :data="tableList"
          :span-method="objectSpanMethod"
          @sort-change="handleSortChange"
          @selection-change="handleChange"
          border
          height="520px"
          :span-method="objectSpanMethod"
          ref="tab1"
          :row-class-name="tableRowClassName"
          border
          height="520px"
        >
          <el-table-column type="selection" width="40" align="center" />
          <!--  :selectable="selectEnable" -->
@@ -291,8 +292,9 @@
          </div>
          <div class="tj">
            <span>体检中心</span>
            <span>{{ item.cardId.substring(0, 14) }}</span>
            <!-- <span>{{ item.cardId ? item.cardId.substring(0, 14) : '' }}</span> -->
            <!-- <span>{{ item.cardId.slice(0, 14) }}</span> -->
            <!-- <span>{{ item.cardId }}</span> -->
            <span>{{ item.cardId ? item.cardId.substring(0, 14) : "" }}</span>
          </div>
          <div class="tj">
            <span>{{ item.jyxh }}</span>
@@ -477,17 +479,34 @@
  },
  methods: {
    handleSortChange({ prop, order }) {
      if (order === null) return; // 无排序时不处理
      this.tableList.sort((a, b) => {
        // 如果标本类型相同,继续按照采样编号排序
        if (a.jyxh !== b.jyxh) {
          return order === "ascending" ? a.jyxh - b.jyxh : b.jyxh - a.jyxh;
        }
        return 0;
      });
    },
    getTruncatedName(proName) {
      // 去掉所有空格
      const trimmedProName = proName.replace(/\s+/g, "");
      const number = this.msg;
      const truncated =
        trimmedProName.length > number
          ? trimmedProName.slice(0, number)
          : trimmedProName;
      const remaining =
      let remaining =
        trimmedProName.length > number ? trimmedProName.slice(number) : "";
      if (remaining.length > number) {
        remaining = remaining.slice(0, number) + "...";
      }
      return { truncated, remaining }; // 返回结果
    },
@@ -717,8 +736,9 @@
      getCusCyList(cusId, this.tjStatus) // 调用API获取数据
        .then((response) => {
          if (response.data) {
            console.log(response, 2525);
            this.tableList = response.data; // 确认 list 存在后再进行赋值
            // console.log(this.tableList, 123);
          } else {
            // 如果没有数据或 list 为空,清空表格并提示
            this.tableList = [];
@@ -963,24 +983,26 @@
    // 确认采样
    Confirmreceipt() {
      let data = this.ids;
      if (data.length === 0) {
        // 如果没有已合并的项目,给出提示信息
        this.$message.error("没有已合并的项目可以撤销!");
        return;
      }
      console.log(this.ids, 999);
      const loadingInstance = this.$loading({
        lock: true, // 锁定屏幕
        text: "加载中...", // 加载文本
        spinner: "el-icon-loading", // 自定义加载图标
        background: "rgba(255, 255, 255, 0.7)", // 背景颜色
      });
      confirmSampling(data)
      confirmSampling(this.ids)
        .then((res) => {
          this.$modal.msgSuccess("采样成功");
          this.getList();
          if (res.code === 200) {
            this.$modal.msgSuccess("采样成功");
            this.Collection();
          }else{
            this.$message.error(res.msg)
          }
          // this.getList();
        })
        .catch((error) => {
          this.$message.error("采样失败");
          this.$message.error(res.msg);
        })
        .finally(() => {
          loadingInstance.close();