From 09abeae851f72a25f105030e37c6a0c9f3189378 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 07 七月 2026 14:54:57 +0800
Subject: [PATCH] 测试完成
---
src/views/followvisit/discharge/index.vue | 221 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 202 insertions(+), 19 deletions(-)
diff --git a/src/views/followvisit/discharge/index.vue b/src/views/followvisit/discharge/index.vue
index 8725d92..d5dbb08 100644
--- a/src/views/followvisit/discharge/index.vue
+++ b/src/views/followvisit/discharge/index.vue
@@ -243,12 +243,27 @@
</div>
</el-col>
</el-row>
+ <div class="selected-info">
+ 宸查�変腑
+ <span style="color: #409eff; font-weight: bold">{{
+ getSelectedCount()
+ }}</span>
+ 鏉℃暟鎹�
+ <el-button
+ v-if="getSelectedCount() > 0"
+ type="text"
+ @click="clearAllSelection"
+ >
+ 娓呴櫎閫変腑
+ </el-button>
+ </div>
<el-table
v-loading="loading"
ref="userform"
:data="userList"
:row-class-name="tableRowClassName"
@selection-change="handleSelectionChange"
+ @select-all="handleSelectAll"
>
<el-table-column type="selection" width="50" align="center" />
<el-table-column
@@ -358,6 +373,15 @@
</template>
</el-table-column>
<el-table-column
+ label="褰撳墠鎵ц鏂瑰紡"
+ align="center"
+ key="currentPreachform"
+ prop="currentPreachform"
+ width="160"
+ :show-overflow-tooltip="true"
+ >
+ </el-table-column>
+ <el-table-column
label="闅忚瀹屾垚鏃堕棿"
sortable
align="center"
@@ -380,16 +404,30 @@
</template></el-table-column
>
<el-table-column
+ label="寮�濮嬮殢璁挎椂闂�"
+ width="146"
+ align="center"
+ key="longSendTime"
+ prop="longSendTime"
+ :render-header="Tooltipks"
+ >
+ <template slot-scope="scope">
+ <span>{{ formatTime(scope.row.longSendTime) }}</span>
+ </template></el-table-column
+ >
+ <el-table-column
label="搴旈殢璁挎棩鏈�"
width="146"
align="center"
key="visitTime"
prop="visitTime"
+ :render-header="Tooltipy"
>
<template slot-scope="scope">
<span>{{ formatTime(scope.row.visitTime) }}</span>
</template></el-table-column
>
+
<!-- 鍘� -->
<el-table-column
label="涓绘不鍖荤敓"
@@ -1103,6 +1141,7 @@
inputValue: "",
preachform: "",
previewVisible: false, //褰卞儚闅忚棰勮寮规
+ isRestoring: false,
radio: "",
radios: [],
previewtype: 2, //棰勮褰卞儚闅忚绫诲瀷
@@ -1110,6 +1149,8 @@
// 婊℃剰搴﹁皟鏌ユ暟鎹�
scoreDialogVisible: false,
selectedRows: [],
+ selectedRowMap: new Map(), // key: row.id, value: row 鏁版嵁
+
// 绾ц仈閫夋嫨鍣ㄧ粦瀹氬��
serviceStatusValue: 10,
cascaderProps: {
@@ -1435,7 +1476,7 @@
},
methods: {
/** 鏌ヨ闅忚鏈嶅姟鍒楄〃 */
- getList(refresh) {
+ async getList(refresh) {
// 榛樿鍏ㄩ儴
if (this.topqueryParams.searchscope == 3) {
this.topqueryParams.leaveldeptcodes = store.getters.belongDepts.map(
@@ -1448,16 +1489,17 @@
this.topqueryParams.endSendDateTime = this.formatDateToYYYYMMDDHHMMSS(
this.getEndOfDay()
);
- } else {
- // this.topqueryParams.endSendDateTime = null;
}
+
// 鎺ュ彈寮傚父璺宠浆
if (this.errtype) {
this.topqueryParams.leavehospitaldistrictcodes.push(
this.leavehospitaldistrictcode
);
}
+
this.loading = true;
+
if (
this.topqueryParams.leavehospitaldistrictcodes[0] &&
this.topqueryParams.leaveldeptcodes[0]
@@ -1466,18 +1508,33 @@
} else {
this.topqueryParams.deptOrDistrict = 1;
}
+
if (!this.followupAuthority()) {
this.$message.warning("鏈厤缃瀹�/鐥呭尯鐩稿叧鏉冮檺涓嶅彲鏌ヨ");
+ this.loading = false;
return Promise.reject(new Error("鏃犳潈闄愭煡璇�"));
}
- getTaskservelist(this.topqueryParams).then((response) => {
+ try {
+ const response = await getTaskservelist(this.topqueryParams);
+
+ // 鉁� 绗竴姝ワ細鍏堥攣瀹氭仮澶嶇姸鎬�
+ this.isRestoring = true;
+
+ // 鉁� 绗簩姝ワ細鍐嶆洿鏂版暟鎹紙杩欎細瑙﹀彂 selection-change锛屼絾琚攣浣忎簡锛�
this.userList = response.rows[0].serviceSubtaskList;
this.total = response.total;
+
+ // 鉁� 绗笁姝ワ細鎭㈠閫変腑鐘舵��
+ // this.restoreSelection();
+ this.$nextTick(() => {
+ this.restoreSelection();
+ });
+
+ // 鉁� 绗洓姝ワ細澶勭悊鍏朵粬鏁版嵁
if (refresh) {
this.cardlist[0].value =
Number(response.rows[0].wxsf) + Number(response.rows[0].xsf) || 0;
- // this.cardlist[1].value = response.rows[0].wzx;
this.cardlist[1].value = response.rows[0].wxsf || 0;
this.ycvalue = Number(response.rows[0].yc) || 0;
this.jgvalue = response.rows[0].jg;
@@ -1486,7 +1543,8 @@
this.cardlist[4].value = response.rows[0].ywc || 0;
this.yfsvalue = response.rows[0].yfs;
}
- this.loading = false;
+
+ // 鉁� 绗簲姝ワ細澶勭悊 preachform 绛夊叾浠栨暟鎹�
this.userList.forEach((item) => {
let idArray = null;
if (item.endtime) {
@@ -1500,17 +1558,32 @@
}
item.preachform = idArray.map((value) => {
- // 鏌ユ壘id瀵瑰簲鐨勫璞�
const item = this.checkboxlist.find(
(item) => item.value == value
);
- // 濡傛灉鎵惧埌瀵瑰簲鐨刬d锛岃繑鍥瀕abel鍊硷紝鍚﹀垯杩斿洖null
return item ? item.label : null;
});
}
+ if (item.currentPreachform) {
+ item.currentPreachform = this.checkboxlist.find(
+ (item) => item.value == item.currentPreachform
+ )?.value;
+ console.log(item.currentPreachform, "mi");
+ }
});
+
this.total = response.total;
- });
+ this.loading = false;
+
+ // 鉁� 绗叚姝ワ細瑙i攣
+ this.$nextTick(() => {
+ this.isRestoring = false;
+ });
+ } catch (error) {
+ console.error("鑾峰彇鍒楄〃澶辫触:", error);
+ this.loading = false;
+ this.isRestoring = false;
+ }
},
loadData() {
this.errtype = this.$route.query.errtype;
@@ -1531,6 +1604,32 @@
} else {
this.getList(1);
}
+ },
+ Tooltipy(h, { column }) {
+ return h(
+ "el-tooltip",
+ {
+ props: {
+ content: "浠诲姟閰嶇疆澶氱琛ュ伩绫诲瀷鏃讹紝鏈�鏂版墽琛岀被鍨嬬殑搴旈殢璁挎椂闂�",
+ placement: "top",
+ effect: "dark",
+ },
+ },
+ [h("span", column.label)]
+ );
+ },
+ Tooltipks(h, { column }) {
+ return h(
+ "el-tooltip",
+ {
+ props: {
+ content: "浠诲姟瀛樺湪澶氱琛ュ伩绫诲瀷鏃剁殑棣栨搴旈殢璁挎椂闂�",
+ placement: "top",
+ effect: "dark",
+ },
+ },
+ [h("span", column.label)]
+ );
},
// 鏃堕棿
getEndOfDay() {
@@ -1772,11 +1871,17 @@
this.handleQuery(1);
},
handleSelectionChange(rows) {
- console.log(rows, 911);
+ // 鉁� 濡傛灉鏄仮澶嶉�変腑鐘舵�佽Е鍙戠殑锛岀洿鎺ヨ繑鍥�
+ if (this.isRestoring) {
+ console.log("姝e湪鎭㈠閫変腑鐘舵�侊紝璺宠繃 handleSelectionChange");
+ return;
+ }
- this.selectedRows = rows.map((row) => {
- // 鍒濆鍖栬瘎鍒嗗瓧娈�
- return {
+ console.log("handleSelectionChange 琚Е鍙戯紝閫変腑琛屾暟:", rows.length);
+
+ // 鍙仛娣诲姞鎿嶄綔
+ rows.forEach((row) => {
+ this.selectedRowMap.set(row.id, {
...row,
authenticity: row.authenticity || 0,
weekFinish: row.weekFinish || 0,
@@ -1786,14 +1891,11 @@
environment: row.environment || 0,
doctorSatisfaction: row.doctorSatisfaction || 0,
nurseSatisfaction: row.nurseSatisfaction || 0,
- };
+ });
});
- if (this.selectedRows.length > 0) {
- this.multiple = false;
- } else {
- this.multiple = true;
- }
+ this.selectedRows = Array.from(this.selectedRowMap.values());
+ this.multiple = this.selectedRows.length === 0;
},
// 璁$畻鎬诲垎
@@ -2116,6 +2218,76 @@
}
return "";
},
+ restoreSelection() {
+ if (!this.$refs.userform) {
+ console.log("琛ㄦ牸寮曠敤涓嶅瓨鍦�");
+ return;
+ }
+
+ console.log("鎵ц restoreSelection");
+
+ // 娓呴櫎褰撳墠椤电殑鎵�鏈夐�変腑鐘舵��
+ this.$refs.userform.clearSelection();
+
+ // 鎵惧嚭褰撳墠椤典腑鍝簺琛屾槸琚�変腑鐨�
+ const toBeSelected = this.userList.filter((row) =>
+ this.selectedRowMap.has(row.id)
+ );
+
+ console.log("闇�瑕佹仮澶嶇殑琛屾暟:", toBeSelected.length);
+
+ // 閲嶆柊閫変腑杩欎簺琛�
+ toBeSelected.forEach((row) => {
+ this.$refs.userform.toggleRowSelection(row, true);
+ });
+ },
+ // 鉁� 澶勭悊琛ㄥご鍏ㄩ�変簨浠�
+ handleSelectAll(selection) {
+ console.log("鍏ㄩ�変簨浠惰Е鍙戯紝閫変腑琛屾暟:", selection.length);
+
+ // 濡傛灉 selection 闀垮害绛変簬褰撳墠椤佃鏁帮紝璇存槑鏄叏閫�
+ if (selection.length === this.userList.length) {
+ // 鍏ㄩ�夊綋鍓嶉〉
+ this.userList.forEach((row) => {
+ this.selectedRowMap.set(row.id, {
+ ...row,
+ authenticity: row.authenticity || 0,
+ weekFinish: row.weekFinish || 0,
+ standard: row.standard || 0,
+ timeliness: row.timeliness || 0,
+ library: row.library || 0,
+ environment: row.environment || 0,
+ doctorSatisfaction: row.doctorSatisfaction || 0,
+ nurseSatisfaction: row.nurseSatisfaction || 0,
+ });
+ });
+ } else {
+ // 鍙栨秷鍏ㄩ�夛細娓呴櫎褰撳墠椤电殑閫変腑鐘舵��
+ this.userList.forEach((row) => {
+ this.selectedRowMap.delete(row.id);
+ });
+ }
+
+ // 鏇存柊 selectedRows
+ this.selectedRows = Array.from(this.selectedRowMap.values());
+ this.multiple = this.selectedRows.length === 0;
+ },
+
+ // 娓呴櫎鎵�鏈夐�変腑
+ clearAllSelection() {
+ this.selectedRowMap.clear();
+ this.selectedRows = [];
+ this.multiple = true;
+
+ if (this.$refs.userform) {
+ this.$refs.userform.clearSelection();
+ }
+ },
+
+ // 鑾峰彇閫変腑鏁伴噺
+ getSelectedCount() {
+ return this.selectedRowMap.size;
+ },
// 鍒涘缓鍐嶆闅忚鏈嶅姟
setupsubtask() {
this.$refs["zcform"].validate((valid) => {
@@ -2385,4 +2557,15 @@
flex-shrink: 0;
margin-top: 2px;
}
+
+::v-deep .el-table__row.selected-row:hover > td {
+ background-color: #e6f7ff !important;
+}
+
+/* 閫変腑淇℃伅鏄剧ず */
+.selected-info {
+ padding: 10px 0;
+ font-size: 14px;
+ color: #666;
+}
</style>
--
Gitblit v1.9.3