From 59dd5c96e8bca3341d1166a9a350f0731436817b Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 24 七月 2025 10:27:41 +0800
Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb

---
 src/views/doctor/inspectCheck/index.vue |  508 ++++++++++++++++++++------------------------------------
 1 files changed, 181 insertions(+), 327 deletions(-)

diff --git a/src/views/doctor/inspectCheck/index.vue b/src/views/doctor/inspectCheck/index.vue
index 51c2dd6..baac4c6 100644
--- a/src/views/doctor/inspectCheck/index.vue
+++ b/src/views/doctor/inspectCheck/index.vue
@@ -1,35 +1,77 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px" @submit.native.prevent>
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      label-width="68px"
+      @submit.native.prevent
+    >
       <el-form-item label="浣撴鍙�" prop="reportDoctorCode">
-        <el-input ref="inputName" v-model="queryParams.tjNum" placeholder="璇疯緭鍏ヤ綋妫�鍙�" clearable
-          @keyup.enter.native="handleQuery" style="width: 170px" />
+        <el-input
+          ref="inputName"
+          v-model="queryParams.tjNum"
+          placeholder="璇疯緭鍏ヤ綋妫�鍙�"
+          clearable
+          @keyup.enter.native="handleQuery"
+          style="width: 170px"
+        />
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" style="margin-right: 15px">
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="handleQuery"
+          style="margin-right: 15px"
+        >
           鏌ヨ
         </el-button>
-        <el-button icon="el-icon-refresh" type="primary" size="mini" @click="resetQuery">
+        <el-button
+          icon="el-icon-refresh"
+          type="primary"
+          size="mini"
+          @click="resetQuery"
+        >
           閲嶇疆
         </el-button>
-        <el-button icon="el-icon-check" type="primary" size="mini" style="margin-right: 15px" @click="tongbu">
+        <el-button
+          icon="el-icon-check"
+          type="primary"
+          size="mini"
+          style="margin-right: 15px"
+          @click="tongbu"
+        >
           鍚屾
         </el-button>
       </el-form-item>
     </el-form>
+
     <div class="box">
-      <div class="table-header">
-        妫�楠岃褰�
-      </div>
+      <div class="table-header">妫�楠岃褰�</div>
       <div>
-        <el-table :data="exaLists" border style="width: 100%" @selection-change="handleSelectionChange"
-          :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }" height="350" ref="firstTable">
+        <el-table
+          :data="exaLists"
+          border
+          style="width: 100%"
+          @selection-change="handleSelectionChange"
+          :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }"
+          height="350"
+          ref="firstTable"
+        >
           <el-table-column fixed type="selection" align="center" label="閫夋嫨" width="50" />
           <el-table-column label="濮撳悕" align="center" prop="name" width="80" />
           <el-table-column label="鎬у埆" align="center" prop="gender" width="80" />
           <el-table-column label="骞撮緞" align="center" prop="patientAge" width="80" />
           <el-table-column label="閫佹绉戝" align="center" prop="deptName" width="100" />
-          <el-table-column label="妫�楠岄」鐩�" align="center" prop="checkParts" width="350" :show-overflow-tooltip="true" />
+          <el-table-column
+            label="妫�楠岄」鐩�"
+            align="center"
+            prop="checkParts"
+            width="350"
+            :show-overflow-tooltip="true"
+          />
           <el-table-column label="椤圭洰缂栧彿" align="center" prop="jcxmid" width="150" />
           <el-table-column label="瀹℃牳鍖诲笀" align="center" prop="shys" width="150" />
           <el-table-column label="鎶ュ憡鏃堕棿" align="center" prop="examinationDate" width="150" />
@@ -49,20 +91,44 @@
         </el-table>
       </div>
     </div>
+
     <div class="table-title">
-  <h3>
-    浣撴璁板綍锛�
-    <span class="highlight">濮撳悕锛歿{ infoList.tjCustomerName || "鏆傛棤" }}</span>
-    <span class="highlight">鎬у埆锛歿{ infoList.tjCustomerSex == 0 ? "鐢�" : infoList.tjCustomerSex == 1 ? "濂�" : "鏆傛棤" }}</span>
-    <span class="highlight">骞撮緞锛歿{ infoList.tjCustomerAge || "鏆傛棤" }}</span>
-    <span class="highlight">闂ㄨ瘖鍙凤細{{ infoList.cardId || "鏆傛棤" }}</span>
-  </h3>
-</div>
-    <el-table border height="350" ref="tab1" :data="checkList" v-loading="loading" style="width: 100%"
+      <h3>
+        浣撴璁板綍锛�
+        <span class="highlight">濮撳悕锛歿{ infoList.tjCustomerName || "鏆傛棤" }}</span>
+        <span class="highlight">
+          鎬у埆锛�
+          {{
+            infoList.tjCustomerSex == 0
+              ? "鐢�"
+              : infoList.tjCustomerSex == 1
+              ? "濂�"
+              : "鏆傛棤"
+          }}
+        </span>
+        <span class="highlight">骞撮緞锛歿{ infoList.tjCustomerAge || "鏆傛棤" }}</span>
+        <span class="highlight">闂ㄨ瘖鍙凤細{{ infoList.cardId || "鏆傛棤" }}</span>
+      </h3>
+    </div>
+
+    <el-table
+      border
+      height="350"
+      ref="tab1"
+      :data="checkList"
+      v-loading="loading"
+      style="width: 100%"
       @selection-change="handleSelectionChangeSecond"
-      :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }">
+      :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }"
+    >
       <el-table-column type="selection" width="60" />
-      <el-table-column label="鐘舵��" align="center" prop="type" :show-overflow-tooltip="true" min-width="60">
+      <el-table-column
+        label="鐘舵��"
+        align="center"
+        prop="type"
+        :show-overflow-tooltip="true"
+        min-width="60"
+      >
         <template slot-scope="scope">
           <span v-if="scope.row.type == '0'">鏈</span>
           <span v-if="scope.row.type == '1'">宸叉</span>
@@ -79,347 +145,152 @@
     </el-table>
   </div>
 </template>
+
 <script>
 import { getlisList, getJyTjList, asyncPacs } from "@/api/doctor/pacsCheck";
 import { getOrderList } from "@/api/hosp/order";
-import moment from "moment";
 
 export default {
-  dicts: ["dict_tj_status"],
   data() {
     return {
-        isProcessing: false, // 闃叉姝诲惊鐜�
-    isDeselection: false, // 鏍囪鏄惁涓哄彇娑堥�変腑
-      infoList: {},
-      dis: false,
-      code: null,
-      createTimeList: "",
-      total: 0,
-      loading: false,
-      isSyncing: false,
-      isFetchingRightTableData: false,
       queryParams: {
-        name: null,
-        start: null,
-        end: null,
         tjNum: null,
       },
-      checkStatus: "0",
       exaLists: [],
-      selectedFirstTable: null,
-      selectedSecondTable: [],
-      form: {},
-      clearTimeSet: null,
-      tjNumbers: "",
-      multipleSelection: "",
-      tjnum: "",
-      xiangmuList: [],
       checkList: [],
-      tg: true,
-      bh: true,
-      pickerOptions: {
-        shortcuts: [
-          {
-            text: "鏈�杩戜竴鍛�",
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
-              picker.$emit("pick", [start, end]);
-            },
-          },
-          {
-            text: "鏈�杩戜竴涓湀",
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
-              picker.$emit("pick", [start, end]);
-            },
-          },
-          {
-            text: "鏈�杩戜笁涓湀",
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
-              picker.$emit("pick", [start, end]);
-            },
-          },
-        ],
-      },
+      infoList: {},
+      selectedFirstTable: [],
+      selectedSecondTable: [],
+      loading: false,
+      isProcessingSelection: false,
     };
   },
-
   mounted() {
     this.$nextTick(() => {
       this.$refs.inputName.focus();
     });
   },
-
   methods: {
-    handleDateChange(val) {
-      if (val && val.length === 2) {
-        this.queryParams.start = val[0];
-        this.queryParams.end = val[1];
-      } else {
-        this.queryParams.start = null;
-        this.queryParams.end = null;
-      }
-      console.log("Query Params:", this.queryParams);
-    },
-
-    tableRowClassName({ row }) {
-      return !row.brid ? "row-disabled" : "";
-    },
-
-handleSelectionChange(val) {
-  // 闃叉閲嶅瑙﹀彂
-  if (this.isProcessingSelection) {
-    console.log('姝e湪澶勭悊閫夋嫨锛岃烦杩囬噸澶嶈Е鍙�');
-    return;
-  }
-  this.isProcessingSelection = true;
-
-  // 濡傛灉娌℃湁閫変腑琛岋紝娓呯┖鎵�鏈夐�夋嫨骞惰烦杩囨帴鍙h皟鐢�
-  if (val.length === 0) {
-    console.log('妫�娴嬪埌鍙栨秷閫変腑锛屾竻绌烘墍鏈夐�夋嫨');
-    this.$refs.firstTable.clearSelection();
-    this.selectedFirstTable = null;
-    this.checkList = [];
-    this.isDeselection = true;
-    this.$nextTick(() => {
-      this.isProcessingSelection = false;
-      this.$refs.firstTable.$forceUpdate(); // 寮哄埗鍒锋柊琛ㄦ牸
-    });
-    return;
-  }
-
-  // 妫�鏌ユ槸鍚︾偣鍑讳簡鍏ㄩ�夋寜閽紙val 闀垮害绛変簬琛ㄦ牸鎬昏鏁帮級
-  if (val.length === this.exaLists.length) {
-    console.log('妫�娴嬪埌鍏ㄩ�夛紝閫変腑鎵�鏈夎');
-    this.selectedFirstTable = [...this.exaLists]; // 閫変腑鎵�鏈夎
-    this.$refs.firstTable.clearSelection();
-    this.exaLists.forEach(row => {
-      if (!row.brid) {
-        console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`);
-        return;
-      }
-      this.$refs.firstTable.toggleRowSelection(row, true, false);
-    });
-  } else {
-    // 鑾峰彇鏈�鏂伴�変腑鐨勮
-    const latestSelectedRow = val[val.length - 1];
-
-    // 妫�鏌ユ槸鍚︾偣鍑讳簡宸查�変腑鐨勮锛堝彇娑堟墍鏈夐�変腑锛�
-    const isTogglingSelectedRow = this.selectedFirstTable && this.selectedFirstTable.some(row => row.tempId === latestSelectedRow.tempId);
-    if (isTogglingSelectedRow) {
-      console.log('鐐瑰嚮宸查�変腑琛岋紝鍙栨秷鎵�鏈夐�変腑');
-      this.$refs.firstTable.clearSelection();
-      this.selectedFirstTable = null;
-      this.checkList = [];
-      this.isDeselection = true;
-      this.$nextTick(() => {
-        this.isProcessingSelection = false;
-        this.$refs.firstTable.$forceUpdate(); // 寮哄埗鍒锋柊琛ㄦ牸
-      });
-      return;
-    }
-
-    // 姝e父閫変腑閫昏緫锛氭牴鎹� brid 绛涢��
-    const filterKey = 'brid';
-    const filterValue = latestSelectedRow.brid;
-    console.log(`鎸� ${filterKey} 绛涢��: ${filterValue}`);
-
-    // 娓呯┖鎵�鏈夐�変腑鐘舵��
-    this.$refs.firstTable.clearSelection();
-
-    // 閫変腑涓� brid 鍖归厤鐨勮
-    const rowsToSelect = this.exaLists.filter(row => row.brid === filterValue);
-    rowsToSelect.forEach(row => {
-      if (!row.brid) {
-        console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`);
-        return;
-      }
-      this.$refs.firstTable.toggleRowSelection(row, true, false);
-    });
-
-    // 鏇存柊 selectedFirstTable 涓� brid 鍖归厤鐨勮
-    this.selectedFirstTable = rowsToSelect;
-  }
-
-  // 璋冪敤鍙充晶琛ㄦ牸鏁版嵁
-  if (!this.isFetchingRightTableData && this.selectedFirstTable.length > 0) {
-    this.isFetchingRightTableData = true;
-    this.fetchRightTableData().finally(() => {
-      this.isFetchingRightTableData = false;
-      this.$nextTick(() => {
-        // 浠呮洿鏂版牱寮忥紝涓嶈Е鍙戞柊浜嬩欢
-        this.$refs.firstTable.$forceUpdate();
-        this.isProcessingSelection = false;
-      });
-    });
-  } else {
-    this.isProcessingSelection = false;
-  }
-
-  // 閲嶇疆 isDeselection 鐘舵��
-  this.isDeselection = false;
-},
-    fetchRightTableData() {
-      const code = this.queryParams.tjNum;
-      if (!code) {
-        console.warn('鏈彁渚涗綋妫�鍙凤紝璺宠繃 fetchRightTableData');
-        this.checkList = [];
-        this.loading = false;
-        return Promise.resolve();
-      }
-      this.loading = true;
-      return getJyTjList(code)
-        .then((response) => {
-          this.checkList = response.data || [];
-          this.loading = false;
-        })
-        .catch((error) => {
-          console.error('鑾峰彇 checkList 澶辫触:', error);
-          this.checkList = [];
-          this.loading = false;
-          throw error;
-        });
-    },
-
-    handleSelectionChangeSecond(selectedRows) {
-      this.selectedSecondTable = selectedRows;
-      if (selectedRows.length > 1) {
-        let del_row = selectedRows.shift();
-        this.$refs.tab1.toggleRowSelection(del_row, false);
-      }
-      console.log("褰撳墠閫変腑鐨勮鏁版嵁:", this.selectedSecondTable);
-    },
-
     async handleQuery() {
       if (!this.queryParams.tjNum) {
         this.$message.error("浣撴鍙蜂笉鑳戒负绌�");
         return;
       }
-
       this.loading = true;
       try {
-        // 骞惰鎵ц涓や釜鏌ヨ
         const [orderResponse, lisResponse] = await Promise.all([
-          getOrderList(this.queryParams).catch((error) => {
-            console.error('鑾峰彇 orderList 澶辫触:', error);
-            return { data: { list: [] } }; // 杩斿洖绌烘暟鎹互缁х画鎵ц
-          }),
+          getOrderList(this.queryParams).catch(() => ({ data: { list: [] } })),
           getlisList(this.queryParams),
         ]);
-
-        // 澶勭悊 getOrderList 缁撴灉
-        if (orderResponse.data?.list?.length > 0) {
-          this.infoList = orderResponse.data.list[0];
-        } else {
-          this.infoList = {};
-          console.warn('getOrderList 杩斿洖绌哄垪琛�');
-        }
-
-        // 澶勭悊 getlisList 缁撴灉
-        if (lisResponse.code === 200) {
-          this.exaLists = lisResponse.data.map((item, index) => ({
-            ...item,
-            brid: item.brid?.trim(), // 娓呯悊绌烘牸
-            mzh: item.mzh?.trim(),
-            tempId: index,
-          }));
-          console.log('Loaded exaLists:', this.exaLists);
-
-          // 鑾峰彇鍙充晶琛ㄦ牸鏁版嵁
-          await this.fetchRightTableData();
-        } else {
-          this.exaLists = [];
-          this.$message.error(lisResponse.msg || "鏌ヨ妫�楠岃褰曞け璐�");
-        }
-      } catch (error) {
-        console.error('鏌ヨ澶辫触:', error);
-        this.$message.error(error?.msg || "鏌ヨ澶辫触锛岃绋嶅悗閲嶈瘯");
-        this.exaLists = [];
-        this.checkList = [];
-        this.infoList = {};
+        this.infoList = orderResponse.data.list?.[0] || {};
+        this.exaLists = lisResponse.data.map((item, index) => ({
+          ...item,
+          brid: item.brid?.trim(),
+          tempId: index,
+        }));
+        await this.fetchRightTableData();
+      } catch (e) {
+        console.error(e);
       } finally {
         this.loading = false;
-      }
-
-      // 澶勭悊鏃堕棿鑼冨洿
-      if (this.createTimeList) {
-        this.queryParams.start = this.createTimeList[0];
-        this.queryParams.end = this.createTimeList[1];
-      } else {
-        this.queryParams.start = null;
-        this.queryParams.end = null;
       }
     },
 
     resetQuery() {
-      this.createTimeList = [];
-      this.resetForm("queryForm");
-      this.queryParams = {
-        name: null,
-        start: null,
-        end: null,
-        tjNum: null,
-      };
-      this.checkList = [];
+      this.queryParams.tjNum = null;
       this.exaLists = [];
+      this.checkList = [];
       this.infoList = {};
     },
+handleSelectionChange(selected) {
+  if (this.isProcessingSelection) return;
+  this.isProcessingSelection = true;
 
-    handleCurrentChange(row) {
-      this.currentRow = row;
+  // 鎵惧埌鐢ㄦ埛鍒氭搷浣滅殑閭d竴鏉★紙瀵规瘮涔嬪墠鍜岀幇鍦ㄧ殑宸紓锛�
+  const old = this.selectedFirstTable;
+  let changedRow = null;
+
+  if (selected.length > old.length) {
+    // 鏂板锛氭壘鍑烘柊澧炵殑
+    changedRow = selected.find(row => !old.includes(row));
+  } else {
+    // 鍒犻櫎锛氭壘鍑哄垹闄ょ殑
+    changedRow = old.find(row => !selected.includes(row));
+  }
+
+  if (changedRow) {
+    const group = this.exaLists.filter(r => r.brid === changedRow.brid);
+    const isAdding = selected.length > old.length;
+
+    this.$refs.firstTable.clearSelection();
+    if (isAdding) {
+      // 娣诲姞锛屾暣涓粍閫変笂 + 鍘熸湁閫夌殑 brid 涔熼�変笂
+      const allBrids = new Set();
+      selected.forEach(row => allBrids.add(row.brid));
+      allBrids.add(changedRow.brid);
+      const newSelection = this.exaLists.filter(row => allBrids.has(row.brid));
+      newSelection.forEach(row => {
+        this.$refs.firstTable.toggleRowSelection(row, true);
+      });
+      this.selectedFirstTable = newSelection;
+    } else {
+      // 鍒犻櫎锛屾暣涓粍鍙栨秷锛屽啀鎶婂墿涓� brid 鍒嗙粍琛ュ洖鍘�
+      const remaining = old.filter(row => row.brid !== changedRow.brid);
+      const remainBrids = [...new Set(remaining.map(r => r.brid))];
+      const newSelection = this.exaLists.filter(row => remainBrids.includes(row.brid));
+      newSelection.forEach(row => {
+        this.$refs.firstTable.toggleRowSelection(row, true);
+      });
+      this.selectedFirstTable = newSelection;
+    }
+  } else {
+    this.selectedFirstTable = selected;
+  }
+
+  this.fetchRightTableData();
+  this.isProcessingSelection = false;
+},
+
+
+    handleSelectionChangeSecond(selected) {
+      this.selectedSecondTable = selected.slice(0, 1);
     },
 
-    setTime() {
-      this.clearTimeSet = setInterval(() => {
-        this.$modal.closeLoading();
-      }, 300000);
+    fetchRightTableData() {
+      if (!this.queryParams.tjNum) return;
+      this.loading = true;
+      return getJyTjList(this.queryParams.tjNum)
+        .then(res => {
+          this.checkList = res.data || [];
+        })
+        .finally(() => {
+          this.loading = false;
+        });
     },
 
     tongbu() {
-      this.$modal.loading("姝e湪鍚屾锛岃绋嶅��...");
-      this.setTime();
       const requestData = {
-        lis: this.selectedFirstTable ? this.selectedFirstTable.map((item) => ({
-          ...item,
-          tjNum: this.queryParams.tjNum,
-        })) : [],
-        jcxmid: this.selectedFirstTable && this.selectedFirstTable.length > 0 ? this.selectedFirstTable[0].jcxmid : null,
-        shys: this.selectedFirstTable && this.selectedFirstTable.length > 0 ? this.selectedFirstTable[0].shys : null,
+        lis: this.selectedFirstTable,
         tj: this.selectedSecondTable[0],
       };
-      asyncPacs(requestData)
-        .then((res) => {
-          if (res.code === 200) {
-            this.fetchRightTableData();
-            clearInterval(this.clearTimeSet);
-            this.clearTimeSet = null;
-            this.$modal.closeLoading();
-            this.$modal.msgSuccess("鍚屾鎴愬姛锛�");
-          } else {
-            this.$message.error(res.message || "鍚屾澶辫触锛岃绋嶅悗閲嶈瘯");
-          }
-        })
-        .catch((error) => {
-          clearInterval(this.clearTimeSet);
-          this.clearTimeSet = null;
-          this.$modal.closeLoading();
-        });
+      asyncPacs(requestData).then(res => {
+        if (res.code === 200) {
+          this.$message.success("鍚屾鎴愬姛锛�");
+          this.fetchRightTableData();
+        } else {
+          this.$message.error(res.message || "鍚屾澶辫触");
+        }
+      });
     },
   },
-};</script>
+};
+</script>
+
 <style lang="scss" scoped>
 .app-container {
   padding: 20px;
   background: #f5f7fa;
 }
-
 .table-header {
   text-align: center;
   background-color: #aad8df;
@@ -430,13 +301,11 @@
   margin-top: 10px;
   border-radius: 4px 4px 0 0;
 }
-
 .table-title {
   text-align: left;
   margin: 20px 0;
   padding: 10px 0;
 }
-
 .table-title h3 {
   font-size: 16px;
   color: #333;
@@ -447,27 +316,12 @@
   flex-wrap: wrap;
   gap: 20px;
 }
-
 .table-title .highlight {
   font-weight: bold;
   color: #2c3e50;
 }
-
 .el-table {
   border-radius: 4px;
   font-size: 14px;
 }
-
-.el-table .warning-row {
-  background: #e5f3ff !important;
-}
-
-::v-deep .el-table__body tr.current-row > td {
-  background: #edf2fa !important;
-}
-
-.row-disabled {
-  color: #999;
-  background-color: #f5f5f5;
-}
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0