From c8e9849cb5f24848df0174c13bfbbff37bb08a5a Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 21 七月 2026 15:45:30 +0800
Subject: [PATCH] 维护
---
src/views/business/OrganUtilization/OrganUtilizationInfo.vue | 582 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 378 insertions(+), 204 deletions(-)
diff --git a/src/views/business/OrganUtilization/OrganUtilizationInfo.vue b/src/views/business/OrganUtilization/OrganUtilizationInfo.vue
index d6a0daa..839a358 100644
--- a/src/views/business/OrganUtilization/OrganUtilizationInfo.vue
+++ b/src/views/business/OrganUtilization/OrganUtilizationInfo.vue
@@ -6,22 +6,6 @@
<el-card class="detail-card">
<div slot="header" class="clearfix">
<span class="detail-title">鍣ㄥ畼鍒╃敤鍩烘湰淇℃伅</span>
- <div style="float: right;">
- <el-button
- type="primary"
- @click="handleSave"
- :loading="saveLoading"
- >
- 淇濆瓨
- </el-button>
- <el-button
- type="success"
- @click="handleComplete"
- :loading="confirmLoading"
- >
- 瀹屾垚鍒╃敤
- </el-button>
- </div>
</div>
<el-row :gutter="20">
@@ -61,7 +45,7 @@
</el-col>
</el-row>
- <el-row :gutter="20">
+ <!-- <el-row :gutter="20">
<el-col :span="12">
<el-form-item label="鐧昏浜�" prop="createBy">
<el-input v-model="form.createBy" />
@@ -77,7 +61,7 @@
/>
</el-form-item>
</el-col>
- </el-row>
+ </el-row> -->
</el-card>
<el-card class="detail-card">
<div slot="header" class="clearfix">
@@ -164,7 +148,7 @@
<el-col>
<el-form-item>
<el-table
- :data="utilizationData.serviceDonatecomporganList"
+ :data="displayOrgans"
v-loading="loading"
border
style="width: 100%"
@@ -377,14 +361,14 @@
</template>
</el-table-column>
- <el-table-column label="绯荤粺缂栧彿" align="center" prop="caseNo">
+ <!-- <el-table-column label="绯荤粺缂栧彿" align="center" prop="caseNo">
<template slot-scope="scope">
<el-input
v-model="scope.row.caseNo"
placeholder="绯荤粺缂栧彿"
/>
</template>
- </el-table-column>
+ </el-table-column> -->
<el-table-column
label="绉绘鍖婚櫌"
@@ -393,22 +377,15 @@
prop="hospitalno"
>
<template slot-scope="scope">
- <el-select
- v-model="scope.row.hospitalno"
- placeholder="璇烽�夋嫨绉绘鍖婚櫌"
+ <el-autocomplete
+ v-model="scope.row.hospitalname"
+ :fetch-suggestions="queryHospitalSearch"
+ placeholder="璇烽�夋嫨鎴栬緭鍏ョЩ妞嶅尰闄�"
style="width: 100%"
- @change="handleHospitalChange(scope.row, $event)"
- >
- <el-option
- v-for="hospital in hospitalList"
- :key="hospital.hospitalNo"
- :label="hospital.hospitalName"
- :value="hospital.hospitalNo"
- />
- </el-select>
+ clearable
+ ></el-autocomplete>
</template>
</el-table-column>
-
<el-table-column
label="绉绘鐘舵��"
align="center"
@@ -490,89 +467,129 @@
</el-card>
<!-- 闄勪欢绠$悊閮ㄥ垎 -->
- <!-- 闄勪欢绠$悊閮ㄥ垎 - 浼樺寲涓哄畬鏁村姛鑳� -->
+ <!-- 闄勪欢绠$悊閮ㄥ垎 - 鍒嗙被Tab灞曠ず -->
<el-card class="attachment-card">
- <div class="attachment-header">
- <i class="el-icon-paperclip"></i>
- <span class="attachment-title">鐩稿叧闄勪欢</span>
- <span class="attachment-tip"
- >鏀寔涓婁紶鍣ㄥ畼鍒╃敤鐩稿叧鏂囦欢 (鏈�澶歿{ attachmentLimit }}涓�)</span
- >
+ <div slot="header" class="clearfix">
+ <span class="detail-title">鐩稿叧闄勪欢</span>
</div>
- <!-- 浣跨敤 UploadAttachment 缁勪欢 -->
- <UploadAttachment
- ref="uploadAttachment"
- :file-list="attachmentFileList"
- :limit="attachmentLimit"
- :accept="attachmentAccept"
- :multiple="true"
- @change="handleAttachmentChange"
- @upload-success="handleUploadSuccess"
- @upload-error="handleUploadError"
- @remove="handleAttachmentRemove"
- />
+ <!-- 涓婁紶鍖哄煙锛堟棤鍒嗙被閫夋嫨锛岀敱Tab鎺у埗锛� -->
+ <div class="upload-wrapper">
+ <UploadAttachment
+ ref="uploadAttachment"
+ :file-list="attachmentFileList"
+ :limit="attachmentLimit"
+ :accept="attachmentAccept"
+ :multiple="true"
+ @change="handleAttachmentChange"
+ @upload-success="handleUploadSuccess"
+ @upload-error="handleUploadError"
+ @remove="handleAttachmentRemove"
+ />
+ <div style="font-size:12px; color:#909399; margin-top:4px;">
+ 褰撳墠涓婁紶鍒嗙被锛�<el-tag size="small" type="info">{{
+ activeTab === "鏈垎绫�" ? "鏈垎绫�" : activeTab
+ }}</el-tag>
+ 锛堝垏鎹� Tab 鍙敼鍙樹笂浼犲垎绫伙級
+ </div>
+ </div>
- <!-- 闄勪欢鍒楄〃灞曠ず -->
+ <!-- 闄勪欢鍒楄〃 - 鍒嗙被Tab灞曠ず锛屾敮鎸佷慨鏀瑰垎绫� -->
<div class="attachment-list" v-if="attachments && attachments.length > 0">
- <div class="list-title">宸蹭笂浼犻檮浠� ({{ attachments.length }})</div>
- <el-table :data="attachments" style="width: 100%" size="small">
- <el-table-column label="鏂囦欢鍚�" min-width="200">
- <template slot-scope="scope">
- <i
- class="el-icon-document"
- :style="{ color: getFileIconColor(scope.row.fileName) }"
- ></i>
- <span class="file-name">{{ scope.row.fileName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="鏂囦欢绫诲瀷" width="100">
- <template slot-scope="scope">
- <el-tag :type="getFileTagType(scope.row.fileName)" size="small">
- {{ getFileTypeText(scope.row.fileName) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="涓婁紶鏃堕棿" width="200">
- <template slot-scope="scope">
- <span>{{ formatDateTime(scope.row.uploadTime) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="鏂囦欢澶у皬" width="180">
- <template slot-scope="scope">
- <span>{{ formatFileSize(scope.row.fileSize) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="鎿嶄綔" width="260" fixed="right">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="primary"
- @click="handlePreview(scope.row)"
- :disabled="!isPreviewable(scope.row.fileName)"
- >
- 棰勮
- </el-button>
- <el-button
- size="mini"
- type="success"
- @click="handleDownloadAttachment(scope.row)"
- >
- 涓嬭浇
- </el-button>
- <el-button
- size="mini"
- type="danger"
- @click="handleRemoveAttachment(scope.$index)"
- >
- 鍒犻櫎
- </el-button>
- </template>
- </el-table-column>
- </el-table>
+ <el-tabs v-model="activeTab" type="border-card">
+ <el-tab-pane
+ v-for="category in categories"
+ :key="category"
+ :label="category + '(' + getCategoryCount(category) + ')'"
+ :name="category"
+ >
+ <el-table
+ :data="getCategoryFiles(category)"
+ style="width: 100%"
+ size="small"
+ border
+ >
+ <el-table-column label="鏂囦欢鍚�" min-width="180">
+ <template #default="scope">
+ <i
+ class="el-icon-document"
+ style="margin-right: 8px; color: #409EFF;"
+ ></i>
+ <span class="file-name">{{ scope.row.fileName }}</span>
+ </template>
+ </el-table-column>
+ <!-- 鍙紪杈戝垎绫讳笅鎷� -->
+ <el-table-column label="鍒嗙被" width="150">
+ <template #default="scope">
+ <el-select
+ v-model="scope.row.fileType"
+ size="small"
+ @change="updateAttachmentCategory(scope.row, $event)"
+ placeholder="閫夋嫨鍒嗙被"
+ >
+ <el-option label="鍘熻〃鎷嶇収" value="鍘熻〃鎷嶇収" />
+ <el-option label="鎺ュ彈纭涔�" value="鎺ュ彈纭涔�" />
+ <el-option label="寮冪敤璇存槑" value="寮冪敤璇存槑" />
+ <el-option label="鎹愮尞璇佷功鐓х墖" value="鎹愮尞璇佷功鐓х墖" />
+ <el-option label="鏈垎绫�" value="" />
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏂囦欢绫诲瀷" width="100">
+ <template #default="scope">
+ <el-tag size="small">{{
+ getFileTypeText(scope.row.fileName)
+ }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="涓婁紶鏃堕棿" width="160">
+ <template #default="scope">
+ <span>{{ formatDateTime(scope.row.uploadTime) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏂囦欢澶у皬" width="120">
+ <template #default="scope">
+ <span>{{ formatFileSize(scope.row.fileSize) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="180" fixed="right">
+ <template #default="scope">
+ <el-button
+ size="mini"
+ type="primary"
+ @click="handlePreview(scope.row)"
+ >棰勮</el-button
+ >
+ <el-button
+ size="mini"
+ type="danger"
+ @click="handleRemoveAttachmentByFile(scope.row)"
+ >鍒犻櫎</el-button
+ >
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
+ </div>
+
+ <!-- 鏃犻檮浠舵椂鏄剧ず -->
+ <div v-else style="text-align:center; padding:20px; color:#909399;">
+ 鏆傛棤闄勪欢锛岃涓婁紶
</div>
</el-card>
-
+ <div style="text-align: center; margin: 30px 0;">
+ <el-button type="primary" @click="handleSave" :loading="saveLoading">
+ 淇濆瓨
+ </el-button>
+ <el-button
+ type="success"
+ @click="handleComplete"
+ :loading="confirmLoading"
+ >
+ 瀹屾垚鍒╃敤
+ </el-button>
+ </div>
<!-- 鏂囦欢棰勮瀵硅瘽妗� -->
<FilePreviewDialog
:visible="filePreviewVisible"
@@ -602,6 +619,7 @@
CaseBasicInfo
},
dicts: [
+ "Geta_hospital",
"sys_BloodType",
"sys_Organ",
"sys_FamilyRelation",
@@ -611,7 +629,8 @@
data() {
return {
caseId: null,
-
+ activeTab: "鍘熻〃鎷嶇収", // 褰撳墠婵�娲荤殑闄勪欢鍒嗙被Tab
+ presetCategories: ["鍘熻〃鎷嶇収", "鎺ュ彈纭涔�", "寮冪敤璇存槑", "鎹愮尞璇佷功鐓х墖"], // 棰勮鍒嗙被
// 琛ㄥ崟鏁版嵁 - 鏍规嵁鎺ュ彛鍙傛暟璋冩暣
form: {
id: undefined,
@@ -672,8 +691,13 @@
transplantStatusList: [
{ value: "1", label: "宸茬Щ妞�" },
{ value: "0", label: "鏈Щ妞�" },
- { value: "2", label: "绉绘涓�" }
+ { value: "2", label: "绉绘涓�" },
+ { value: "3", label: "搴撳瓨" }
],
+ organExpansionMap: {
+ C64: { subItems: ["C64L", "C64R"], subNames: ["宸﹁偩", "鍙宠偩"] },
+ C34: { subItems: ["C34L", "C34R"], subNames: ["宸﹁偤", "鍙宠偤"] }
+ },
// 鍒╃敤璁板綍鏁版嵁
utilizationData: {
serviceDonatecomporganList: []
@@ -708,6 +732,11 @@
currentUser() {
return JSON.parse(sessionStorage.getItem("user") || "{}");
},
+ categories() {
+ // 濮嬬粓杩斿洖鎵�鏈夐璁惧垎绫� + 鏈垎绫伙紝鍗充娇娌℃湁鏁版嵁涔熸樉绀�
+ const allCategories = ['鍘熻〃鎷嶇収', '鎺ュ彈纭涔�', '寮冪敤璇存槑', '鎹愮尞璇佷功鐓х墖', '鏈垎绫�'];
+ return allCategories;
+ },
// 宸茬Щ妞嶆暟閲�
transplantedCount() {
if (!this.utilizationData.serviceDonatecomporganList) return 0;
@@ -722,6 +751,22 @@
.map(record => record.hospitalno)
.filter(Boolean);
return new Set(hospitals).size;
+ },
+ organReverseMap() {
+ const map = {};
+ for (const key in this.organExpansionMap) {
+ const { subItems } = this.organExpansionMap[key];
+ subItems.forEach(item => {
+ map[item] = key;
+ });
+ }
+ return map;
+ },
+ // 杩囨护鎺� delFlag=1 鐨勮褰曪紙鐢ㄤ簬琛ㄦ牸灞曠ず锛�
+ displayOrgans() {
+ return (this.utilizationData.serviceDonatecomporganList || []).filter(
+ item => item.delFlag !== 1
+ );
},
// 鑾峰彇鍣ㄥ畼瀛楀吀
organDict() {
@@ -767,9 +812,32 @@
.substring(0, 19);
this.getDetail();
- this.getHospitalData();
},
+ syncOrgansFromSelection() {
+ const records = this.utilizationData.serviceDonatecomporganList || [];
+ const targetNos = [];
+ this.selectedOrgans.forEach(val => {
+ if (this.organExpansionMap[val]) {
+ targetNos.push(...this.organExpansionMap[val].subItems);
+ } else {
+ targetNos.push(val);
+ }
+ });
+ targetNos.forEach(no => {
+ const existing = records.find(r => r.organno === no);
+ if (existing) {
+ if (existing.delFlag === 1) existing.delFlag = 0;
+ } else {
+ // 浣跨敤鍒涘缓鏂规硶锛岃嚜鍔ㄥ寘鍚� delFlag:0
+ this.createOrganRecord(no);
+ }
+ });
+
+ // 寮哄埗鎵�鏈夎褰� delFlag=0锛堝姞杞芥椂搴旇鍏ㄩ儴鏈夋晥锛�
+ records.forEach(r => (r.delFlag = 0));
+ this.form.donateorgan = this.selectedOrgans.join(",");
+ },
// 鑾峰彇璇︽儏
async getDetail() {
this.loading = true;
@@ -813,14 +881,31 @@
console.log(this.utilizationData.serviceDonatecomporganList);
// 鍒濆鍖栭檮浠�
+ // 鏀逛负锛堢‘淇濇瘡涓檮浠堕兘鏈� fileType 瀛楁锛�
if (this.form.assessannex) {
- this.form.attachments = JSON.parse(this.form.assessannex);
- this.attachments = Array.isArray(this.form.attachments)
- ? [...this.form.attachments]
- : [];
+ const parsed = JSON.parse(this.form.assessannex);
+ this.attachments = parsed.map(item => ({
+ ...item,
+ fileType: item.fileType || "" // 榛樿绌哄瓧绗︿覆琛ㄧず鏈垎绫�
+ }));
+ this.form.attachments = this.attachments;
+ // 鍚屾 attachmentFileList
+ this.attachmentFileList = this.attachments.map(item => ({
+ uid: item.id || Math.random(),
+ name: item.fileName,
+ url: item.path || item.fileUrl,
+ fileSize: item.fileSize,
+ uploadTime: item.uploadTime,
+ status: "success",
+ raw: item
+ }));
+ } else {
+ this.attachments = [];
+ this.attachmentFileList = [];
}
this.$message.success("鏁版嵁鍔犺浇鎴愬姛");
+ this.syncOrgansFromSelection();
} else {
this.$message.warning("鏈壘鍒板搴旂殑鍣ㄥ畼鍒╃敤鏁版嵁");
}
@@ -833,81 +918,125 @@
},
// 鑾峰彇鍖婚櫌鏁版嵁
- async getHospitalData() {
- try {
- // TODO: 鏇挎崲涓哄疄闄呯殑鍖婚櫌鍒楄〃鎺ュ彛
- // 鏆傛椂浣跨敤妯℃嫙鏁版嵁
- this.hospitalList = [
- { hospitalNo: "H001", hospitalName: "鍖椾含鍗忓拰鍖婚櫌" },
- { hospitalNo: "H002", hospitalName: "涓婃捣鍗庡北鍖婚櫌" },
- { hospitalNo: "H003", hospitalName: "涓婃捣鐟為噾鍖婚櫌" },
- { hospitalNo: "H004", hospitalName: "骞垮窞涓北鍖婚櫌" },
- { hospitalNo: "H005", hospitalName: "姝︽眽鍚屾祹鍖婚櫌" },
- { hospitalNo: "H006", hospitalName: "鎴愰兘鍗庤タ鍖婚櫌" }
- ];
- } catch (error) {
- console.error("鑾峰彇鍖婚櫌鏁版嵁澶辫触:", error);
- this.$message.error("鑾峰彇鍖婚櫌鏁版嵁澶辫触");
- }
- },
+ // async getHospitalData() {
+ // try {
+ // // TODO: 鏇挎崲涓哄疄闄呯殑鍖婚櫌鍒楄〃鎺ュ彛
+ // // 鏆傛椂浣跨敤妯℃嫙鏁版嵁
+ // this.hospitalList = [
+ // { hospitalNo: "H001", hospitalName: "鍖椾含鍗忓拰鍖婚櫌" },
+ // { hospitalNo: "H002", hospitalName: "涓婃捣鍗庡北鍖婚櫌" },
+ // { hospitalNo: "H003", hospitalName: "涓婃捣鐟為噾鍖婚櫌" },
+ // { hospitalNo: "H004", hospitalName: "骞垮窞涓北鍖婚櫌" },
+ // { hospitalNo: "H005", hospitalName: "姝︽眽鍚屾祹鍖婚櫌" },
+ // { hospitalNo: "H006", hospitalName: "鎴愰兘鍗庤タ鍖婚櫌" }
+ // ];
+ // } catch (error) {
+ // console.error("鑾峰彇鍖婚櫌鏁版嵁澶辫触:", error);
+ // this.$message.error("鑾峰彇鍖婚櫌鏁版嵁澶辫触");
+ // }
+ // },
// 鍣ㄥ畼閫夋嫨鐘舵�佸彉鍖�
- handleOrganSelectionChange(selectedValues) {
- if (!this.utilizationData.serviceDonatecomporganList) {
- this.utilizationData.serviceDonatecomporganList = [];
- }
-
- const currentOrganValues = this.utilizationData.serviceDonatecomporganList.map(
- item => item.organno
- );
-
- // 澶勭悊浜掓枼閫昏緫
+ async handleOrganSelectionChange(selectedValues) {
+ // 1. 澶勭悊浜掓枼閫昏緫锛堜慨鏀� this.selectedOrgans锛�
this.handleExclusiveSelections(selectedValues);
- // 鏇存柊鎹愮尞鍣ㄥ畼瀛楁
- this.form.donateorgan = selectedValues.join(",");
+ const finalSelected = this.selectedOrgans;
+ const records = this.utilizationData.serviceDonatecomporganList || [];
- // 鏂板閫夋嫨鐨勫櫒瀹�
- selectedValues.forEach(organValue => {
- if (!currentOrganValues.includes(organValue)) {
- this.createOrganRecord(organValue);
+ // 2. 鏋勫缓鐩爣鍣ㄥ畼缂栧彿鍒楄〃锛堝睍寮�缁勫悎鍣ㄥ畼锛�
+ const targetOrganNos = [];
+ finalSelected.forEach(val => {
+ if (this.organExpansionMap[val]) {
+ targetOrganNos.push(...this.organExpansionMap[val].subItems);
+ } else {
+ targetOrganNos.push(val);
}
});
- // 绉婚櫎鍙栨秷閫夋嫨鐨勫櫒瀹�
- this.utilizationData.serviceDonatecomporganList = this.utilizationData.serviceDonatecomporganList.filter(
- record => {
- if (selectedValues.includes(record.organno)) {
- return true;
- } else {
- if (record.id) {
- this.$confirm(
- "鍒犻櫎鍣ㄥ畼鍒╃敤鏁版嵁鍚庡皢鏃犳硶鎭㈠锛屾偍纭鍒犻櫎璇ユ潯璁板綍鍚楋紵",
- "鎻愮ず",
- {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- }
- )
- .then(() => {
- this.utilizationData.serviceDonatecomporganList = this.utilizationData.serviceDonatecomporganList.filter(
- r => r.organno !== record.organno
- );
- this.$message.success("鍒犻櫎鎴愬姛");
- })
- .catch(() => {
- this.selectedOrgans.push(record.organno);
- });
- return true;
- } else {
- return false;
- }
+ // 3. 鏂板鎴栨仮澶嶈褰曪紙鏃犻渶寮圭獥锛�
+ targetOrganNos.forEach(no => {
+ const existing = records.find(r => r.organno === no);
+ if (existing) {
+ if (existing.delFlag === 1) {
+ existing.delFlag = 0; // 鎭㈠鏄剧ず
}
+ } else {
+ this.createOrganRecord(no); // 鏂板璁板綍锛堝寘鍚� delFlag:0锛�
}
- );
- },
+ });
+ // 4. 鎵惧嚭闇�瑕佸彇娑堢殑璁板綍锛堜笉鍦ㄧ洰鏍囬泦鍚堜腑鐨勶級
+ const toRemove = records.filter(r => !targetOrganNos.includes(r.organno));
+ const toRemoveSaved = toRemove.filter(r => r.id); // 宸蹭繚瀛橈紝闇�纭
+ const toRemoveUnsaved = toRemove.filter(r => !r.id); // 鏈繚瀛橈紝鐩存帴绉婚櫎
+
+ // 4.1 鐩存帴绉婚櫎鏈繚瀛樼殑璁板綍
+ toRemoveUnsaved.forEach(r => {
+ const idx = records.indexOf(r);
+ if (idx !== -1) records.splice(idx, 1);
+ });
+
+ // 4.2 澶勭悊宸蹭繚瀛樼殑璁板綍锛氬脊绐楃‘璁�
+ if (toRemoveSaved.length > 0) {
+ const organNames = toRemoveSaved.map(r => r.organname).join("銆�");
+ try {
+ await this.$confirm(
+ `鎮ㄧ‘瀹氳鍙栨秷浠ヤ笅宸蹭繚瀛樼殑鍣ㄥ畼鍒╃敤璁板綍鍚楋紵\n${organNames}\n鍙栨秷鍚庯紝杩欎簺璁板綍灏嗕粠鍒楄〃涓Щ闄わ紙鏁版嵁浠嶄繚鐣欙紝鍙仮澶嶏級銆俙,
+ "鎻愮ず",
+ {
+ confirmButtonText: "纭畾绉婚櫎",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }
+ );
+ // 鐢ㄦ埛纭锛氭爣璁� delFlag=1
+ toRemoveSaved.forEach(r => {
+ r.delFlag = 1;
+ });
+ } catch (error) {
+ // 鐢ㄦ埛鍙栨秷锛氭仮澶嶉�変腑鐘舵��
+ // 灏嗗彇娑堢殑鍣ㄥ畼閲嶆柊鍔犲叆 this.selectedOrgans
+ const parentToRestore = new Set();
+ toRemoveSaved.forEach(r => {
+ const parent = this.organReverseMap[r.organno];
+ if (parent) {
+ parentToRestore.add(parent);
+ } else {
+ parentToRestore.add(r.organno);
+ }
+ });
+ parentToRestore.forEach(val => {
+ if (!this.selectedOrgans.includes(val)) {
+ this.selectedOrgans.push(val);
+ }
+ });
+ // 鎻愮ず鐢ㄦ埛鎿嶄綔宸插彇娑�
+ this.$message.info("宸插彇娑堝垹闄ゆ搷浣�");
+ // 鏇存柊琛ㄥ崟瀛楁锛堜繚鎸佷竴鑷存�э級
+ this.form.donateorgan = this.selectedOrgans.join(",");
+ // 娉ㄦ剰锛氭鏃� records 涓凡鏂板浜嗙洰鏍囧櫒瀹橈紝骞朵笖涔嬪墠鐨勮褰曟湭琚爣璁板垹闄わ紝鐘舵�佷竴鑷淬��
+ // 浣嗘槸锛屾垜浠繕闇�瑕佺Щ闄や箣鍓嶆柊澧炰絾鐢ㄦ埛鍙兘涓嶆兂淇濈暀鐨勮褰曪紵涓嶄細锛屽洜涓烘柊澧炵殑鏄洰鏍囧櫒瀹橈紝鐢ㄦ埛鏄兂淇濈暀鐨勩��
+ // 鍥犳鐩存帴杩斿洖鍗冲彲銆�
+ return;
+ }
+ }
+
+ // 5. 鏇存柊琛ㄥ崟瀛楁
+ this.form.donateorgan = this.selectedOrgans.join(",");
+ },
+ // 绉绘鍖婚櫌妯$硦鎼滅储
+ queryHospitalSearch(queryString, cb) {
+ const hospitals = this.dict.type.Geta_hospital || [];
+ const results = queryString
+ ? hospitals.filter(item =>
+ item.label.toLowerCase().includes(queryString.toLowerCase())
+ )
+ : hospitals;
+
+ // el-autocomplete 闇�瑕� value 瀛楁
+ cb(results.map(item => ({ value: item.label })));
+ },
// 澶勭悊浜掓枼閫夋嫨
handleExclusiveSelections(selectedValues) {
// 濡傛灉閫夋嫨浜�"鍙岃偩"(鍋囪瀛楀吀鍊间负C64)锛岃嚜鍔ㄥ彇娑堝崟鐙殑"宸﹁偩"(C64L)鍜�"鍙宠偩"(C64R)閫夋嫨
@@ -954,6 +1083,7 @@
transplanttime: "",
transplantstate: "1",
abandonreason: "",
+ delFlag: 0, // 鏂板
sex: "",
age: "",
birthday: "",
@@ -979,16 +1109,6 @@
getOrganLabel(organValue) {
const dictItem = this.organDict.find(item => item.value === organValue);
return dictItem ? dictItem.label : organValue;
- },
-
- // 鍖婚櫌閫夋嫨鍙樺寲
- handleHospitalChange(row, hospitalNo) {
- const hospital = this.hospitalList.find(
- item => item.hospitalNo === hospitalNo
- );
- if (hospital) {
- row.hospitalname = hospital.hospitalName;
- }
},
// 绉绘鐘舵�佸彉鍖栧鐞�
@@ -1039,7 +1159,7 @@
getOrganRowClassName({ row }) {
if (
row.transplantstate === "1" &&
- (!row.caseNo || !row.hospitalno || !row.name || !row.transplanttime)
+ (!row.hospitalno || !row.name || !row.transplanttime)
) {
return "warning-row";
}
@@ -1170,12 +1290,7 @@
const incompleteRecords = this.utilizationData.serviceDonatecomporganList.filter(
record => {
if (record.transplantstate === "1") {
- return (
- !record.caseNo ||
- !record.hospitalno ||
- !record.name ||
- !record.transplanttime
- );
+ return !record.hospitalno || !record.name || !record.transplanttime;
} else if (record.transplantstate === "0") {
return !record.abandonreason;
}
@@ -1308,11 +1423,13 @@
/** 涓婁紶鎴愬姛澶勭悊 */
handleUploadSuccess({ file, fileList, response }) {
if (response.code === 200) {
+ // 鏍规嵁褰撳墠婵�娲荤殑 Tab 鍐冲畾鍒嗙被锛堟湭鍒嗙被 Tab 瀵瑰簲绌哄瓧绗︿覆锛�
+ const category = this.activeTab === "鏈垎绫�" ? "" : this.activeTab;
const attachmentObj = {
fileName: file.name,
path: response.fileUrl || file.url,
fileUrl: response.fileUrl || file.url,
- fileType: this.getFileExtension(file.name),
+ fileType: category, // 鍏抽敭锛氳褰曞垎绫�
fileSize: file.size,
uploadTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
};
@@ -1320,13 +1437,71 @@
if (!Array.isArray(this.attachments)) {
this.attachments = [];
}
-
this.attachments.push(attachmentObj);
- this.attachmentFileList = fileList;
+ this.attachmentFileList = fileList; // 淇濇寔鍚屾
this.$message.success("鏂囦欢涓婁紶鎴愬姛");
}
},
+ // 鑾峰彇鏌愬垎绫荤殑鏂囦欢鏁伴噺
+ getCategoryCount(category) {
+ return this.attachments.filter(item => {
+ const type = item.fileType || "";
+ if (category === "鏈垎绫�") {
+ return !this.presetCategories.includes(type);
+ }
+ return type === category;
+ }).length;
+ },
+ // 鑾峰彇鏌愬垎绫荤殑鏂囦欢鍒楄〃
+ getCategoryFiles(category) {
+ return this.attachments.filter(item => {
+ const type = item.fileType || "";
+ if (category === "鏈垎绫�") {
+ return !this.presetCategories.includes(type);
+ }
+ return type === category;
+ });
+ },
+
+ // 鏇存柊闄勪欢鍒嗙被锛堜笅鎷変慨鏀规椂瑙﹀彂锛�
+ updateAttachmentCategory(row, newVal) {
+ const target = this.attachments.find(item => item === row);
+ if (target) {
+ target.fileType = newVal; // 鍙兘涓虹┖瀛楃涓�
+ // 鍚屾鏇存柊 attachmentFileList
+ const fileItem = this.attachmentFileList.find(
+ f => f.raw === row || f.url === row.fileUrl
+ );
+ if (fileItem) {
+ fileItem.raw.fileType = newVal;
+ fileItem.fileType = newVal || "鏈垎绫�";
+ }
+ // 濡傛灉褰撳墠婵�娲荤殑tab娌℃湁鏂囦欢浜嗭紝鑷姩鍒囨崲鍒扮涓�涓湁鏂囦欢鐨則ab
+ const currentTabHasFiles =
+ this.getCategoryFiles(this.activeTab).length > 0;
+ if (!currentTabHasFiles) {
+ const firstCategory = this.categories[0];
+ if (firstCategory) this.activeTab = firstCategory;
+ }
+ }
+ },
+
+ // 鎸夋枃浠跺璞″垹闄わ紙鐢ㄤ簬琛ㄦ牸涓殑鍒犻櫎鎸夐挳锛�
+ handleRemoveAttachmentByFile(file) {
+ const index = this.attachments.findIndex(item => item === file);
+ if (index > -1) {
+ this.attachments.splice(index, 1);
+ // 鍚屾鍒犻櫎 attachmentFileList
+ const fileIndex = this.attachmentFileList.findIndex(
+ f => f.raw === file || f.url === file.fileUrl
+ );
+ if (fileIndex > -1) {
+ this.attachmentFileList.splice(fileIndex, 1);
+ }
+ this.$message.success("闄勪欢鍒犻櫎鎴愬姛");
+ }
+ },
/** 涓婁紶閿欒澶勭悊 */
handleUploadError({ file, fileList, error }) {
console.error("闄勪欢涓婁紶澶辫触:", error);
@@ -1335,9 +1510,8 @@
/** 鎵嬪姩鍒犻櫎闄勪欢 */
handleRemoveAttachment(index) {
- this.attachments.splice(index, 1);
- this.attachmentFileList.splice(index, 1);
- this.$message.success("闄勪欢鍒犻櫎鎴愬姛");
+ // 鐩存帴璋冪敤鏂扮殑鍒犻櫎鏂规硶
+ this.handleRemoveAttachmentByFile(file.raw || file);
},
/** 鏂囦欢棰勮 */
--
Gitblit v1.9.3