From 3453ba7e5243022ad4388da1515dc75ad8d81f94 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期日, 17 五月 2026 15:00:23 +0800
Subject: [PATCH] 近期调试
---
src/views/business/course/components/OrganAllocationStage.vue | 1686 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 1,306 insertions(+), 380 deletions(-)
diff --git a/src/views/business/course/components/OrganAllocationStage.vue b/src/views/business/course/components/OrganAllocationStage.vue
index a28a32d..41cbcf9 100644
--- a/src/views/business/course/components/OrganAllocationStage.vue
+++ b/src/views/business/course/components/OrganAllocationStage.vue
@@ -1,447 +1,1373 @@
<template>
- <base-stage :stage-data="stageData" :case-info="caseInfo">
- <template #header>
- <el-alert
- :title="`鍣ㄥ畼鍒嗛厤 - ${getStatusText()}`"
- :type="getAlertType()"
- :description="getAlertDescription()"
- show-icon
- :closable="false"
- />
- </template>
-
- <el-row :gutter="20" style="margin-top: 20px;">
- <el-col :span="8">
- <el-card>
- <div slot="header" class="card-header">
- <span>鍒嗛厤姒傚喌</span>
- </div>
- <div class="allocation-stats">
- <div class="stat-item">
- <span class="label">寰呭垎閰嶅櫒瀹�:</span>
- <span class="value">{{ allocationStats.totalOrgans }} 涓�</span>
- </div>
- <div class="stat-item">
- <span class="label">宸插垎閰嶅櫒瀹�:</span>
- <span class="value">{{ allocationStats.allocatedOrgans }} 涓�</span>
- </div>
- <div class="stat-item">
- <span class="label">鍒嗛厤绯荤粺:</span>
- <span class="value">{{ allocationStats.system }}</span>
- </div>
- <div class="stat-item">
- <span class="label">鍖归厤鎴愬姛鐜�:</span>
- <el-progress
- :percentage="allocationStats.matchRate"
- :status="allocationStats.matchRate > 80 ? 'success' : 'warning'"
- />
- </div>
- </div>
- </el-card>
- </el-col>
-
- <el-col :span="8">
- <el-card>
- <div slot="header" class="card-header">
- <span>鍒嗛厤鏃堕棿绐楀彛</span>
- </div>
- <div class="time-window">
- <div class="time-item">
- <span class="label">鍒嗛厤寮�濮�:</span>
- <span>{{ formatTime(allocationDetails.startTime) }}</span>
- </div>
- <div class="time-item">
- <span class="label">棰勮瀹屾垚:</span>
- <span>{{ formatTime(allocationDetails.estimatedEndTime) }}</span>
- </div>
- <div class="time-item">
- <span class="label">鍣ㄥ畼鑰愬彈鏃堕棿:</span>
- <span>{{ allocationDetails.toleranceTime }}</span>
- </div>
- <div class="time-item">
- <span class="label">鍓╀綑鏃堕棿:</span>
- <el-tag :type="getTimeRemainingType()">
- {{ allocationDetails.timeRemaining }}
- </el-tag>
- </div>
- </div>
- </el-card>
- </el-col>
-
- <el-col :span="8">
- <el-card>
- <div slot="header" class="card-header">
- <span>鍒嗛厤浼樺厛绾�</span>
- </div>
- <el-steps direction="vertical" :active="prioritySteps.active">
- <el-step
- v-for="step in prioritySteps.steps"
- :key="step.title"
- :title="step.title"
- :description="step.description"
- :status="step.status"
- />
- </el-steps>
- </el-card>
- </el-col>
- </el-row>
-
- <el-card style="margin-top: 20px;">
- <div slot="header" class="card-header">
- <span>鍣ㄥ畼鍒嗛厤璇︽儏</span>
- <el-button type="primary" size="small" @click="handleStartAllocation">
- 鍚姩鑷姩鍒嗛厤
- </el-button>
+ <div class="organ-allocation-detail">
+ <!-- 鍩烘湰淇℃伅閮ㄥ垎 -->
+ <el-card class="detail-card">
+ <div slot="header" class="clearfix">
+ <span class="detail-title">鍣ㄥ畼鍒嗛厤鍩烘湰淇℃伅</span>
</div>
- <el-table :data="organAllocationData" border>
- <el-table-column label="鍣ㄥ畼鍚嶇О" prop="organName" width="120" align="center" />
- <el-table-column label="鍣ㄥ畼鐘舵��" width="100" align="center">
- <template slot-scope="scope">
- <el-tag :type="getOrganStatusTag(scope.row.status)" size="small">
- {{ scope.row.status }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="鍖归厤鍙椾綋" prop="recipient" width="150" />
- <el-table-column label="琛�鍨嬪尮閰�" width="100" align="center">
- <template slot-scope="scope">
- <el-tag :type="scope.row.bloodMatch ? 'success' : 'warning'">
- {{ scope.row.bloodMatch ? '鍖归厤' : '寰呭尮閰�' }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="缁勭粐閰嶅瀷" width="100" align="center">
- <template slot-scope="scope">
- <el-tag :type="scope.row.tissueMatch ? 'success' : 'warning'">
- {{ scope.row.tissueMatch ? '鍚堟牸' : '寰呮娴�' }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="绉绘鍖婚櫌" prop="hospital" min-width="200" />
- <el-table-column label="鍒嗛厤鏃堕棿" width="160" align="center">
- <template slot-scope="scope">
- {{ scope.row.allocationTime || '寰呭垎閰�' }}
- </template>
- </el-table-column>
- <el-table-column label="鎿嶄綔" width="120" align="center">
- <template slot-scope="scope">
- <el-button type="text" size="small" @click="handleViewMatch(scope.row)">
- 鏌ョ湅鍖归厤
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- <el-card style="margin-top: 20px;">
- <div slot="header" class="card-header">
- <span>鍒嗛厤绠楁硶缁撴灉</span>
- </div>
- <div class="algorithm-results">
+ <el-form :model="form" ref="form" :rules="rules" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
- <div class="result-item">
- <h4>鍖归厤璇勫垎鎺掑悕</h4>
- <el-table :data="matchRanking" border size="small">
- <el-table-column label="鎺掑悕" width="60" align="center">
+ <el-form-item label="鍒嗛厤鐘舵��" prop="allocationStatus">
+ <el-select
+ v-model="form.allocationStatus"
+ placeholder="璇烽�夋嫨鍒嗛厤鐘舵��"
+ >
+ <el-option
+ v-for="dict in dict.type.organ_allocation_status || []"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ ></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍒嗛厤鏃堕棿" prop="allocationTime">
+ <el-date-picker
+ v-model="form.allocationTime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ :disabled="form.allocationStatus == '1'"
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鐧昏浜�" prop="registrationName">
+ <el-input v-model="form.registrationName" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鐧昏鏃堕棿" prop="registrationTime">
+ <el-date-picker
+ v-model="form.registrationTime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </el-card>
+
+ <!-- 鍣ㄥ畼鍒嗛厤璁板綍閮ㄥ垎 -->
+ <el-card class="allocation-card">
+ <div slot="header" class="clearfix">
+ <span class="detail-title">鍣ㄥ畼鍒嗛厤璁板綍</span>
+ <div style="float: right;">
+ <el-tag
+ :type="
+ form.allocationStatus == '1'
+ ? 'success'
+ : form.allocationStatus == '2'
+ ? 'danger'
+ : 'warning'
+ "
+ >
+ {{
+ form.allocationStatus == "1"
+ ? "宸插垎閰�"
+ : form.allocationStatus == "2"
+ ? "浣滃簾"
+ : "鏈垎閰�"
+ }}
+ </el-tag>
+ </div>
+ </div>
+
+ <el-form
+ ref="allocationForm"
+ :rules="allocationRules"
+ :model="allocationData"
+ label-position="right"
+ >
+ <el-row>
+ <el-col>
+ <el-form-item label-width="100px" label="鍒嗛厤鍣ㄥ畼">
+ <el-checkbox-group
+ v-model="selectedOrgans"
+ @change="handleOrganSelectionChange"
+ >
+ <el-checkbox
+ v-for="dict in dict.type.sys_Organ || []"
+ :key="dict.value"
+ :label="dict.value"
+ :disabled="form.allocationStatus == '1'"
+ >
+ {{ dict.label }}
+ </el-checkbox>
+ </el-checkbox-group>
+ <el-input
+ v-if="showOtherInput"
+ v-model="otherOrganInput"
+ placeholder="璇疯緭鍏ュ叾浠栧櫒瀹樺悕绉�"
+ style="margin-top: 10px; width: 300px;"
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ <el-row>
+ <el-col>
+ <el-form-item>
+ <el-table
+ :data="allocationData.serviceDonateorganList"
+ v-loading="loading"
+ border
+ style="width: 100%"
+ :row-class-name="getOrganRowClassName"
+ >
+ <el-table-column
+ label="鍣ㄥ畼鍚嶇О"
+ align="center"
+ width="120"
+ prop="organname"
+ >
<template slot-scope="scope">
- {{ scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column label="鍙椾綋缂栧彿" prop="recipientNo" width="100" />
- <el-table-column label="鍖归厤鍒嗘暟" prop="matchScore" width="100">
- <template slot-scope="scope">
- <el-rate
- v-model="scope.row.matchScore"
- disabled
- show-score
- text-color="#ff9900"
- score-template="{value} 鍒�"
+ <el-input
+ v-model="scope.row.organname"
+ placeholder="鍣ㄥ畼鍚嶇О"
+ :disabled="true"
/>
</template>
</el-table-column>
- <el-table-column label="鎺ㄨ崘鍣ㄥ畼" prop="recommendedOrgan" />
+
+ <el-table-column
+ label="鍒嗛厤绯荤粺缂栧彿"
+ align="center"
+ width="150"
+ prop="caseno"
+ >
+ <template slot-scope="scope">
+ <el-input
+ v-model="scope.row.caseno"
+ placeholder="鍒嗛厤绯荤粺缂栧彿"
+ :disabled="form.allocationStatus == '1'"
+ />
+ </template>
+ </el-table-column>
+
+ <el-table-column
+ label="鍒嗛厤鎺ユ敹鏃堕棿"
+ align="center"
+ width="180"
+ prop="applicanttime"
+ >
+ <template slot-scope="scope">
+ <el-date-picker
+ clearable
+ size="small"
+ style="width: 100%"
+ v-model="scope.row.applicanttime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ placeholder="閫夋嫨鍒嗛厤鎺ユ敹鏃堕棿"
+ :disabled="form.allocationStatus == '1'"
+ />
+ </template>
+ </el-table-column>
+
+ <el-table-column
+ label="鍙椾綋濮撴皬"
+ align="center"
+ width="120"
+ prop="name"
+ >
+ <template slot-scope="scope">
+ <el-input
+ v-model="scope.row.name"
+ placeholder="鍙椾綋濮撴皬"
+ :disabled="form.allocationStatus == '1'"
+ />
+ </template>
+ </el-table-column>
+
+ <el-table-column
+ label="绉绘鍖婚櫌"
+ align="center"
+ width="200"
+ prop="transplanthospitalno"
+ >
+ <template slot-scope="scope">
+ <div>
+ <org-selecter
+ ref="tranHosSelect"
+ :org-type="'4'"
+ :dataList="dataList"
+ v-model="scope.row.transplanthospitalno"
+ style="width: 100%"
+ />
+ </div>
+ </template>
+ </el-table-column>
+
+ <el-table-column
+ label="璇存槑"
+ align="center"
+ prop="reallocationreason"
+ min-width="200"
+ >
+ <template slot-scope="scope">
+ <el-input
+ type="textarea"
+ clearable
+ v-model="scope.row.reallocationreason"
+ placeholder="璇疯緭鍏ヨ鏄�"
+ :disabled="form.allocationStatus == '1'"
+ />
+ </template>
+ </el-table-column>
+
+ <el-table-column
+ label="鎿嶄綔"
+ align="center"
+ width="120"
+ class-name="small-padding fixed-width"
+ v-if="form.allocationStatus !== '1'"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-copy-document"
+ @click="handleRedistribution(scope.row)"
+ :disabled="!scope.row.caseno"
+ >
+ 閲嶅垎閰�
+ </el-button>
+ </template>
+ </el-table-column>
</el-table>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="result-item">
- <h4>鍒嗛厤鍥犵礌鏉冮噸</h4>
- <div class="weight-distribution">
- <div v-for="factor in allocationFactors" :key="factor.name" class="factor-item">
- <span class="factor-name">{{ factor.name }}</span>
- <el-progress
- :percentage="factor.weight"
- :show-text="false"
- :color="factor.color"
- />
- <span class="factor-percent">{{ factor.weight }}%</span>
- </div>
- </div>
- </div>
+ </el-form-item>
</el-col>
</el-row>
+
+ <!-- 鍒嗛厤缁熻淇℃伅 -->
+ <div
+ class="allocation-stats"
+ v-if="
+ allocationData.serviceDonateorganList &&
+ allocationData.serviceDonateorganList.length > 0
+ "
+ >
+ <el-row :gutter="20">
+ <el-col :span="6">
+ <div class="stat-item">
+ <span class="stat-label">宸插垎閰嶅櫒瀹�:</span>
+ <span class="stat-value"
+ >{{ allocationData.serviceDonateorganList.length }} 涓�</span
+ >
+ </div>
+ </el-col>
+ <el-col :span="6">
+ <div class="stat-item">
+ <span class="stat-label">寰呭畬鍠勪俊鎭�:</span>
+ <span class="stat-value">{{ incompleteRecords }} 涓�</span>
+ </div>
+ </el-col>
+ <el-col :span="6">
+ <div class="stat-item">
+ <span class="stat-label">娑夊強鍖婚櫌:</span>
+ <span class="stat-value">{{ uniqueHospitals }} 瀹�</span>
+ </div>
+ </el-col>
+ <el-col :span="6">
+ <div class="stat-item">
+ <span class="stat-label">鍒嗛厤鐘舵��:</span>
+ <span class="stat-value">
+ <el-tag
+ :type="
+ form.allocationStatus == '1'
+ ? 'success'
+ : form.allocationStatus == '2'
+ ? 'danger'
+ : 'warning'
+ "
+ >
+ {{
+ form.allocationStatus == "1"
+ ? "宸插垎閰�"
+ : form.allocationStatus == "2"
+ ? "浣滃簾"
+ : "鏈垎閰�"
+ }}
+ </el-tag>
+ </span>
+ </div>
+ </el-col>
+ </el-row>
+ </div>
+
+ <div v-else class="empty-allocation">
+ <el-empty description="鏆傛棤鍒嗛厤璁板綍" :image-size="80">
+ <span>璇峰厛閫夋嫨瑕佸垎閰嶇殑鍣ㄥ畼</span>
+ </el-empty>
+ </div>
+ </el-form>
+
+ <!-- <div class="dialog-footer" v-if="form.allocationStatus !== '1'">
+ <el-button
+ type="primary"
+ @click="handleSaveAllocation"
+ :loading="saveLoading"
+ :disabled="
+ !allocationData.serviceDonateorganList ||
+ allocationData.serviceDonateorganList.length == 0
+ "
+ >
+ 淇濆瓨鍒嗛厤璁板綍
+ </el-button>
+ <el-button
+ type="success"
+ @click="handleConfirmAllocation"
+ :loading="confirmLoading"
+ :disabled="incompleteRecords > 0"
+ >
+ 纭瀹屾垚鍒嗛厤
+ </el-button>
+ </div> -->
+ </el-card>
+
+ <!-- 闄勪欢绠$悊閮ㄥ垎浼樺寲 -->
+ <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>
+
+ <!-- 浣跨敤 UploadAttachment 缁勪欢 -->
+ <UploadAttachment
+ ref="uploadAttachment"
+ :file-list="attachmentFileList"
+ :limit="attachmentLimit"
+ :accept="attachmentAccept"
+ :multiple="true"
+ @change="handleAttachmentChange"
+ @upload-success="handleUploadSuccess"
+ @upload-error="handleUploadError"
+ @remove="handleAttachmentRemove"
+ />
+
+ <!-- 闄勪欢鍒楄〃灞曠ず -->
+ <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="160">
+ <template slot-scope="scope">
+ <span>{{ formatDateTime(scope.row.uploadTime) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏂囦欢澶у皬" width="100">
+ <template slot-scope="scope">
+ <span>{{ formatFileSize(scope.row.fileSize) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="200" 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>
</div>
</el-card>
- <template #footer>
- <div class="action-buttons" style="margin-top: 20px; text-align: center;">
- <el-button type="primary" @click="handleAutoAllocation">
- 鏅鸿兘鍒嗛厤
- </el-button>
- <el-button type="success" @click="handleConfirmAllocation">
- 纭鍒嗛厤缁撴灉
- </el-button>
- <el-button type="warning" @click="handleManualAdjust">
- 鎵嬪姩璋冩暣
- </el-button>
+ <!-- 閲嶅垎閰嶅璇濇 -->
+ <el-dialog
+ title="鍣ㄥ畼閲嶅垎閰�"
+ :visible.sync="redistributionDialogVisible"
+ width="500px"
+ >
+ <el-form :model="redistributionForm" label-width="100px">
+ <el-form-item label="鍘熷櫒瀹樹俊鎭�">
+ <el-input v-model="redistributionForm.organname" readonly />
+ </el-form-item>
+ <el-form-item label="閲嶅垎閰嶅師鍥�" prop="reason">
+ <el-input
+ type="textarea"
+ :rows="4"
+ v-model="redistributionForm.reason"
+ placeholder="璇疯緭鍏ラ噸鍒嗛厤鍘熷洜"
+ />
+ </el-form-item>
+ </el-form>
+ <div slot="footer">
+ <el-button @click="redistributionDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleRedistributionConfirm"
+ >纭閲嶅垎閰�</el-button
+ >
</div>
- </template>
- </base-stage>
+ </el-dialog>
+
+ <!-- 闄勪欢棰勮瀵硅瘽妗� -->
+ <FilePreviewDialog
+ :visible="filePreviewVisible"
+ :file="currentPreviewFile"
+ @close="filePreviewVisible = false"
+ @download="handleDownloadAttachment"
+ />
+ </div>
</template>
<script>
-import BaseStage from './BaseStage.vue';
+import {
+ allocationList,
+ allocationadd,
+ allocationedit,
+ donateorganBaseinfoInfo
+} from "@/api/businessApi";
+import UploadAttachment from "@/components/UploadAttachment";
+import FilePreviewDialog from "@/components/FilePreviewDialog";
+import OrgSelecter from "@/views/project/components/orgselect";
+import CaseBasicInfo from "@/components/CaseBasicInfo";
+import dayjs from "dayjs";
export default {
- name: 'OrganAllocationStage',
- components: { BaseStage },
+ name: "OrganAllocationDetail",
+ components: {
+ UploadAttachment,
+ OrgSelecter,
+ FilePreviewDialog,
+ CaseBasicInfo
+ },
+ dicts: [
+ "sys_BloodType",
+ "sys_DonationCategory",
+ "sys_RecordState",
+ "sys_Organ",
+ "organ_allocation_status"
+ ],
props: {
- stageData: {
- type: Object,
- default: () => ({})
- },
- caseInfo: {
- type: Object,
- default: () => ({})
+ infoid: {
+ type: String,
+ default: true
}
},
data() {
return {
- allocationStats: {
- totalOrgans: 3,
- allocatedOrgans: 0,
- system: '涓浗浜轰綋鍣ㄥ畼鍒嗛厤涓庡叡浜绠楁満绯荤粺',
- matchRate: 0
+ caseId: null,
+
+ // 琛ㄥ崟鏁版嵁
+ form: {
+ id: undefined,
+ infoid: undefined,
+ donationcategory: "",
+ caseNo: "",
+ donorno: "",
+ treatmenthospitalname: "",
+ treatmenthospitalno: "",
+ sex: "",
+ name: "",
+ age: "",
+ bloodtype: "",
+ idcardno: "",
+ diagnosisname: "",
+ allocationStatus: "0", // 0:鏈垎閰嶏紱1锛氬凡鍒嗛厤锛�2浣滃簾
+ allocationTime: "",
+ registrationCode: "",
+ registrationName: "",
+ registrationTime: "",
+ attachments: [] // 娣诲姞闄勪欢瀛楁
},
- allocationDetails: {
- startTime: '2025-12-04 10:00:00',
- estimatedEndTime: '2025-12-04 12:00:00',
- toleranceTime: '鑲濊剰:12灏忔椂,鑲捐剰:24灏忔椂,蹇冭剰:8灏忔椂,鑲鸿剰:12灏忔椂',
- timeRemaining: '2灏忔椂'
- },
- prioritySteps: {
- active: 3,
- steps: [
- {
- title: '鐥呮儏鍗遍噸浼樺厛',
- description: '鏍规嵁鎮h�呯梾鎯呭嵄閲嶇▼搴﹀垎閰峓1](@ref)',
- status: 'finish'
- },
- {
- title: '缁勭粐閰嶅瀷浼樺厛',
- description: '缁勭粐閰嶅瀷鍖归厤搴﹂珮鐨勬偅鑰呬紭鍏�',
- status: 'finish'
- },
- {
- title: '琛�鍨嬬浉鍚屼紭鍏�',
- description: '琛�鍨嬪尮閰嶇殑鎮h�呬紭鍏堣�冭檻',
- status: 'finish'
- },
- {
- title: '鍎跨鍖归厤浼樺厛',
- description: '鍎跨鎮h�呬韩鏈変紭鍏堝垎閰嶆潈',
- status: 'wait'
- }
+ // 闄勪欢棰勮鐩稿叧
+ attachmentPreviewVisible: false,
+ currentAttachmentList: [],
+ attachmentPreviewTitle: "",
+ dataList: [],
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ rules: {
+ name: [
+ { required: true, message: "鎹愮尞鑰呭鍚嶄笉鑳戒负绌�", trigger: "blur" }
+ ],
+ diagnosisname: [
+ { required: true, message: "鐤剧梾璇婃柇涓嶈兘涓虹┖", trigger: "blur" }
]
},
- organAllocationData: [
- {
- organName: '鑲濊剰',
- status: '寰呭垎閰�',
- recipient: '',
- bloodMatch: false,
- tissueMatch: false,
- hospital: '',
- allocationTime: ''
- },
- {
- organName: '鑲捐剰',
- status: '寰呭垎閰�',
- recipient: '',
- bloodMatch: false,
- tissueMatch: false,
- hospital: '',
- allocationTime: ''
- },
- {
- organName: '蹇冭剰',
- status: '寰呭垎閰�',
- recipient: '',
- bloodMatch: false,
- tissueMatch: false,
- hospital: '',
- allocationTime: ''
- }
- ],
- matchRanking: [
- {
- recipientNo: 'R202512001',
- matchScore: 4.8,
- recommendedOrgan: '鑲濊剰'
- },
- {
- recipientNo: 'R202512002',
- matchScore: 4.5,
- recommendedOrgan: '鑲捐剰'
- },
- {
- recipientNo: 'R202512003',
- matchScore: 4.3,
- recommendedOrgan: '蹇冭剰'
- }
- ],
- allocationFactors: [
- { name: '鐥呮儏鍗遍噸绋嬪害', weight: 35, color: '#f56c6c' },
- { name: '缁勭粐閰嶅瀷鍖归厤', weight: 25, color: '#e6a23c' },
- { name: '绛夊緟鏃堕棿', weight: 15, color: '#5cb87a' },
- { name: '鍦扮悊鍥犵礌', weight: 10, color: '#6f7ad3' },
- { name: '骞撮緞鍥犵礌', weight: 15, color: '#8e44ad' }
- ]
+ // 鍒嗛厤璁板綍楠岃瘉瑙勫垯
+ allocationRules: {},
+ // 淇濆瓨鍔犺浇鐘舵��
+ saveLoading: false,
+ confirmLoading: false,
+ // 鍔犺浇鐘舵��
+ loading: false,
+ // 閫変腑鐨勫櫒瀹橈紙瀛樺偍瀛楀吀value锛�
+ selectedOrgans: [],
+ // 鍏朵粬鍣ㄥ畼杈撳叆
+ otherOrganInput: "",
+ // 鍖婚櫌鍒楄〃
+ hospitalList: [],
+ // 鍒嗛厤璁板綍鏁版嵁
+ allocationData: {
+ serviceDonateorganList: []
+ },
+ // 闄勪欢鏁版嵁
+ attachments: [],
+ attachmentFileList: [],
+ // 闄勪欢鐩稿叧閰嶇疆
+ attachmentLimit: 10,
+ attachmentAccept:
+ ".pdf,.jpg,.jpeg,.png,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt",
+ // 閲嶅垎閰嶅璇濇
+ redistributionDialogVisible: false,
+ redistributionForm: {
+ organname: "",
+ reason: ""
+ },
+ currentRedistributeRecord: null,
+ // 鏂囦欢棰勮鐩稿叧
+ filePreviewVisible: false,
+ currentPreviewFile: null,
+ filePreviewTitle: ""
};
},
- methods: {
- getStatusText() {
- const status = this.stageData.status;
- return status === 'completed' ? '宸插畬鎴�' :
- status === 'in_progress' ? '杩涜涓�' : '鏈紑濮�';
+ computed: {
+ // 褰撳墠鐢ㄦ埛淇℃伅
+ currentUser() {
+ return JSON.parse(sessionStorage.getItem("user") || "{}");
},
- getAlertType() {
- const status = this.stageData.status;
- return status === 'completed' ? 'success' :
- status === 'in_progress' ? 'warning' : 'info';
+ // 涓嶅畬鏁寸殑璁板綍鏁伴噺
+ incompleteRecords() {
+ if (!this.allocationData.serviceDonateorganList) return 0;
+ return this.allocationData.serviceDonateorganList.filter(
+ record =>
+ !record.caseno ||
+ !record.applicanttime ||
+ !record.name ||
+ !record.transplanthospitalno
+ ).length;
},
- getAlertDescription() {
- const status = this.stageData.status;
- if (status === 'completed') {
- return '鍣ㄥ畼鍒嗛厤宸插畬鎴愶紝鎵�鏈夊櫒瀹樺潎宸叉垚鍔熷尮閰嶅彈浣�';
- } else if (status === 'in_progress') {
- return '鍣ㄥ畼鍒嗛厤杩涜涓紝绯荤粺姝e湪鑷姩鍖归厤鏈�浣冲彈浣�';
+ // 鍞竴鍖婚櫌鏁伴噺
+ uniqueHospitals() {
+ if (!this.allocationData.serviceDonateorganList) return 0;
+ const hospitals = this.allocationData.serviceDonateorganList
+ .map(record => record.transplanthospitalno)
+ .filter(Boolean);
+ return new Set(hospitals).size;
+ },
+ // 鑾峰彇鍣ㄥ畼瀛楀吀
+ organDict() {
+ return this.dict.type.sys_Organ || [];
+ },
+ // 鍒ゆ柇鏄惁闇�瑕佹樉绀哄叾浠栬緭鍏ユ
+ showOtherInput() {
+ return this.selectedOrgans.includes("C01"); // 鍋囪"鍏朵粬"鐨勫瓧鍏稿�兼槸C01
+ }
+ },
+ watch: {
+ // 鐩戝惉闄勪欢鏁版嵁鍙樺寲
+ attachments: {
+ handler(newAttachments) {
+ this.attachmentFileList = newAttachments.map(item => ({
+ uid: item.id || Math.random(),
+ name: item.fileName,
+ fileSize: item.fileSize,
+ url: item.path || item.fileUrl,
+ uploadTime: item.uploadTime,
+ status: "success"
+ }));
+ },
+ deep: true
+ },
+ // 鐩戝惉鍏朵粬鍣ㄥ畼杈撳叆鍙樺寲
+ otherOrganInput(newValue) {
+ if (newValue && this.selectedOrgans.includes("C01")) {
+ // 鏇存柊鍣ㄥ畼瀛楀吀涓殑"鍏朵粬"鏍囩鏄剧ず
+ const otherRecord = this.allocationData.serviceDonateorganList.find(
+ item => item.organname && item.organname.includes("鍏朵粬")
+ );
+ if (otherRecord) {
+ otherRecord.organname = `鍏朵粬(${newValue})`;
+ }
}
- return '绛夊緟寮�濮嬪櫒瀹樺垎閰嶆祦绋�';
+ }
+ },
+ created() {
+ this.caseId = this.infoid;
+ this.initData();
+ },
+ methods: {
+ // 鏍规嵁瀛楀吀value鑾峰彇label
+ getOrganLabel(organValue) {
+ const dictItem = this.organDict.find(item => item.value == organValue);
+ return dictItem ? dictItem.label : organValue;
},
- getOrganStatusTag(status) {
- const map = {
- '宸插垎閰�': 'success',
- '鍒嗛厤涓�': 'warning',
- '寰呭垎閰�': 'info'
+
+ // 鍒濆鍖栨暟鎹�
+ initData() {
+ const id = null;
+ const infoid = this.infoid;
+
+ if (!infoid) {
+ this.$message.error("缂哄皯蹇呰鐨勮矾鐢卞弬鏁� infoid");
+ this.$router.back();
+ return;
+ }
+
+ this.form.infoid = infoid;
+ this.form.registrationName =
+ this.currentUser.nickName || this.currentUser.username || "褰撳墠鐢ㄦ埛";
+ this.form.registrationTime = new Date()
+ .toISOString()
+ .replace("T", " ")
+ .substring(0, 19);
+
+ if (infoid) {
+ this.getDetail(infoid, id);
+ } else {
+ this.generateDonorNo();
+ }
+
+ this.getHospitalData();
+ },
+ // 鐢熸垚鎹愮尞鑰呯紪鍙�
+ generateDonorNo() {
+ const timestamp = Date.now().toString();
+ this.form.donorno = "D" + timestamp.slice(-8);
+ this.form.caseNo = "CASE" + timestamp.slice(-6);
+ },
+
+ // 瑙f瀽 filePatch 瀛楁
+ parseFilePatch(filePatch) {
+ if (!filePatch) {
+ this.form.attachments = [];
+ return;
+ }
+
+ try {
+ this.form.attachments = JSON.parse(filePatch);
+ } catch (error) {
+ console.error("瑙f瀽 filePatch 瀛楁澶辫触:", error);
+ this.form.attachments = [];
+ }
+ },
+ // 鑾峰彇璇︽儏
+ async getDetail(infoid, id) {
+ this.loading = true;
+ donateorganBaseinfoInfo(id);
+ try {
+ const response = await allocationList({ infoid });
+ if (response.code == 200 && response.data && response.data.length > 0) {
+ const data = response.data[0];
+
+ data.allocationStatus = JSON.stringify(data.allocationStatus);
+ // 濉厖琛ㄥ崟鏁版嵁
+ Object.assign(this.form, data);
+ // 杞崲闄勪欢涓洪泦鍚�
+ this.parseFilePatch(this.form.fileName);
+
+ // 鍒濆鍖栭檮浠�
+ if (this.form.attachments) {
+ this.attachments = Array.isArray(this.form.attachments)
+ ? [...this.form.attachments]
+ : [];
+ }
+
+ // 澶勭悊鍒嗛厤璁板綍
+ if (data.serviceDonateorganList) {
+ this.allocationData.serviceDonateorganList = Array.isArray(
+ data.serviceDonateorganList
+ )
+ ? data.serviceDonateorganList
+ : [];
+
+ // 鏇存柊閫変腑鐨勫櫒瀹�
+ this.selectedOrgans = this.allocationData.serviceDonateorganList
+ .map(item => {
+ // 浠庡悗绔暟鎹腑鑾峰彇鍣ㄥ畼鐨剉alue
+ if (item.organno) {
+ return item.organno;
+ }
+
+ // 濡傛灉鍚庣鍙湁鍣ㄥ畼鍚嶇О锛屽皾璇曚粠瀛楀吀涓尮閰�
+ if (item.organname) {
+ const dictItem = this.organDict.find(
+ org =>
+ org.label == item.organname ||
+ (item.organname && item.organname.includes(org.label))
+ );
+ return dictItem ? dictItem.value : null;
+ }
+
+ return null;
+ })
+ .filter(Boolean);
+
+ // 澶勭悊"鍏朵粬"鍣ㄥ畼
+ const otherRecord = this.allocationData.serviceDonateorganList.find(
+ item => item.organname && item.organname.includes("鍏朵粬(")
+ );
+ if (otherRecord) {
+ const match = otherRecord.organname.match(/鍏朵粬\((.*?)\)/);
+ if (match) {
+ this.otherOrganInput = match[1];
+ }
+ }
+ }
+
+ this.$message.success("鏁版嵁鍔犺浇鎴愬姛");
+ } else {
+ this.$message.warning("鏈壘鍒板搴旂殑鍣ㄥ畼鍒嗛厤鏁版嵁");
+ }
+ } catch (error) {
+ console.error("鑾峰彇鍣ㄥ畼鍒嗛厤璇︽儏澶辫触:", error);
+ this.$message.error("鑾峰彇璇︽儏澶辫触");
+ } finally {
+ this.loading = false;
+ }
+ },
+ // 鑾峰彇鍖婚櫌鏁版嵁
+ async getHospitalData() {
+ try {
+ // TODO: 鏇挎崲涓哄疄闄呯殑鍖婚櫌鍒楄〃鎺ュ彛
+ // 鏆傛椂浣跨敤妯℃嫙鏁版嵁
+ this.hospitalList = [
+ { hospitalNo: "H001", hospitalName: "鍖椾含鍗忓拰鍖婚櫌" },
+ { hospitalNo: "H002", hospitalName: "涓婃捣鍗庡北鍖婚櫌" },
+ { hospitalNo: "H003", hospitalName: "骞垮窞涓北鍖婚櫌" },
+ { hospitalNo: "H004", hospitalName: "姝︽眽鍚屾祹鍖婚櫌" },
+ { hospitalNo: "H005", hospitalName: "鎴愰兘鍗庤タ鍖婚櫌" }
+ ];
+ } catch (error) {
+ console.error("鑾峰彇鍖婚櫌鏁版嵁澶辫触:", error);
+ this.$message.error("鑾峰彇鍖婚櫌鏁版嵁澶辫触");
+ }
+ },
+ // 鍣ㄥ畼閫夋嫨鐘舵�佸彉鍖�
+ handleOrganSelectionChange(selectedValues) {
+ if (!this.allocationData.serviceDonateorganList) {
+ this.allocationData.serviceDonateorganList = [];
+ }
+
+ const currentOrganValues = this.allocationData.serviceDonateorganList.map(
+ item => item.organno
+ );
+
+ // 澶勭悊浜掓枼閫昏緫锛堝弬鑰冩崘鐚喅瀹氶〉闈級
+ this.handleExclusiveSelections(selectedValues);
+
+ // 鏂板閫夋嫨鐨勫櫒瀹�
+ selectedValues.forEach(organValue => {
+ if (!currentOrganValues.includes(organValue)) {
+ this.createOrganRecord(organValue);
+ }
+ });
+
+ // 绉婚櫎鍙栨秷閫夋嫨鐨勫櫒瀹�
+ this.allocationData.serviceDonateorganList = this.allocationData.serviceDonateorganList.filter(
+ record => {
+ if (selectedValues.includes(record.organno)) {
+ return true;
+ } else {
+ if (record.id) {
+ this.$confirm(
+ "鍒犻櫎鍣ㄥ畼鍒嗛厤鏁版嵁鍚庡皢鏃犳硶鎭㈠锛屾偍纭鍒犻櫎璇ユ潯璁板綍鍚楋紵",
+ "鎻愮ず",
+ {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }
+ )
+ .then(() => {
+ this.allocationData.serviceDonateorganList = this.allocationData.serviceDonateorganList.filter(
+ r => r.organno !== record.organno
+ );
+ this.$message.success("鍒犻櫎鎴愬姛");
+ })
+ .catch(() => {
+ this.selectedOrgans.push(record.organno);
+ });
+ return true; // 绛夊緟鐢ㄦ埛纭
+ } else {
+ return false; // 鐩存帴鍒犻櫎鏂拌褰�
+ }
+ }
+ }
+ );
+ },
+
+ // 澶勭悊浜掓枼閫夋嫨锛堝弬鑰冩崘鐚喅瀹氶〉闈級
+ handleExclusiveSelections(selectedValues) {
+ // 濡傛灉閫夋嫨浜�"鍙岃偩"(鍋囪瀛楀吀鍊间负C64)锛岃嚜鍔ㄥ彇娑堝崟鐙殑"宸﹁偩"(C64L)鍜�"鍙宠偩"(C64R)閫夋嫨
+ if (selectedValues.includes("C64")) {
+ this.selectedOrgans = selectedValues.filter(
+ item => item !== "C64L" && item !== "C64R"
+ );
+ }
+ // 濡傛灉閫夋嫨浜�"宸﹁偩"鎴�"鍙宠偩"锛屽彇娑�"鍙岃偩"閫夋嫨
+ else if (
+ selectedValues.includes("C64L") ||
+ selectedValues.includes("C64R")
+ ) {
+ this.selectedOrgans = selectedValues.filter(item => item !== "C64");
+ }
+
+ // 濡傛灉閫夋嫨浜�"鍏ㄨ偤"(鍋囪瀛楀吀鍊间负C34)锛岃嚜鍔ㄥ彇娑堝崟鐙殑"宸﹁偤"(C34L)鍜�"鍙宠偤"(C34R)閫夋嫨
+ if (selectedValues.includes("C34")) {
+ this.selectedOrgans = selectedValues.filter(
+ item => item !== "C34L" && item !== "C34R"
+ );
+ }
+ // 濡傛灉閫夋嫨浜�"宸﹁偤"鎴�"鍙宠偤"锛屽彇娑�"鍏ㄨ偤"閫夋嫨
+ else if (
+ selectedValues.includes("C34L") ||
+ selectedValues.includes("C34R")
+ ) {
+ this.selectedOrgans = selectedValues.filter(item => item !== "C34");
+ }
+ },
+
+ // 鍒涘缓鍣ㄥ畼璁板綍
+ createOrganRecord(organValue) {
+ let organName = this.getOrganLabel(organValue);
+
+ // 濡傛灉鏄�"鍏朵粬"鍣ㄥ畼涓旀湁杈撳叆鍊�
+ if (organValue == "C01" && this.otherOrganInput) {
+ organName = `鍏朵粬(${this.otherOrganInput})`;
+ }
+
+ this.allocationData.serviceDonateorganList.push({
+ id: null,
+ organname: organName,
+ organno: organValue,
+ caseno: "",
+ applicanttime: "",
+ name: "",
+ transplanthospitalno: "",
+ transplantHospitalName: "",
+ reallocationreason: "",
+ organState: 1
+ });
+ },
+
+ // 鍖婚櫌閫夋嫨鍙樺寲
+ handleHospitalChange(row, hospitalNo) {
+ const hospital = this.hospitalList.find(
+ item => item.hospitalNo == hospitalNo
+ );
+ if (hospital) {
+ row.transplantHospitalName = hospital.hospitalName;
+ }
+ },
+ // 閲嶅垎閰嶆搷浣�
+ handleRedistribution(row) {
+ this.currentRedistributeRecord = row;
+ this.redistributionForm.organname = row.organname;
+ this.redistributionForm.reason = row.reallocationreason || "";
+ this.redistributionDialogVisible = true;
+ },
+ // 纭閲嶅垎閰�
+ handleRedistributionConfirm() {
+ if (!this.redistributionForm.reason) {
+ this.$message.warning("璇疯緭鍏ラ噸鍒嗛厤鍘熷洜");
+ return;
+ }
+
+ if (this.currentRedistributeRecord) {
+ this.currentRedistributeRecord.reallocationreason = this.redistributionForm.reason;
+ this.$message.success("閲嶅垎閰嶅師鍥犲凡鏇存柊");
+ this.redistributionDialogVisible = false;
+ }
+ },
+ // 鍣ㄥ畼琛屾牱寮�
+ getOrganRowClassName({ row }) {
+ if (
+ !row.caseno ||
+ !row.applicanttime ||
+ !row.name ||
+ !row.transplanthospitalno
+ ) {
+ return "warning-row";
+ }
+ return "";
+ },
+ // 鏋勫缓 filePatch 瀛楁
+ buildFilePatch() {
+ if (!this.attachments || this.attachments.length == 0) {
+ return "";
+ }
+ return JSON.stringify(this.attachments);
+ },
+ // 淇濆瓨鍩烘湰淇℃伅
+ async handleSave() {
+ this.$refs.form.validate(async valid => {
+ if (!valid) {
+ this.$message.warning("璇峰畬鍠勮〃鍗曚俊鎭�");
+ return;
+ }
+
+ this.saveLoading = true;
+ try {
+ const saveData = {
+ ...this.form,
+ serviceDonateorganList:
+ this.allocationData.serviceDonateorganList || []
+ };
+ if (
+ submitData.allocationStatus == 1 ||
+ !submitData.allocationStatus
+ ) {
+ submitData.allocationStatus = 2;
+ }
+ saveData.fileName = this.buildFilePatch();
+ saveData.serviceDonateorganList.forEach(item => {
+ item.baseid = this.form.id;
+ item.infoid = this.form.infoid;
+ });
+ const apiMethod = this.form.id ? allocationedit : allocationadd;
+ const response = await apiMethod(saveData);
+
+ if (response.code == 200) {
+ this.$message.success("淇濆瓨鎴愬姛");
+ if (!this.form.id && response.data) {
+ this.form.id = response.data;
+ // this.$router.replace({
+ // query: { ...this.$route.query, id: this.form.id }
+ // });
+ }
+ } else {
+ this.$message.error("淇濆瓨澶辫触锛�" + (response.msg || "鏈煡閿欒"));
+ }
+ } catch (error) {
+ console.error("淇濆瓨澶辫触:", error);
+ this.$message.error("淇濆瓨澶辫触");
+ } finally {
+ this.saveLoading = false;
+ }
+ });
+ },
+ // 淇濆瓨鍒嗛厤璁板綍
+ async handleSaveAllocation() {
+ if (!this.form.id) {
+ this.$message.warning("璇峰厛淇濆瓨鍩烘湰淇℃伅");
+ return;
+ }
+
+ this.saveLoading = true;
+ try {
+ const saveData = {
+ ...this.form,
+ attachments: this.attachments,
+ serviceDonateorganList:
+ this.allocationData.serviceDonateorganList || []
+ };
+
+ const response = await allocationedit(saveData);
+
+ if (response.code == 200) {
+ this.$message.success("鍒嗛厤璁板綍淇濆瓨鎴愬姛");
+ } else {
+ this.$message.error(
+ "淇濆瓨鍒嗛厤璁板綍澶辫触锛�" + (response.msg || "鏈煡閿欒")
+ );
+ }
+ } catch (error) {
+ console.error("淇濆瓨鍒嗛厤璁板綍澶辫触:", error);
+ this.$message.error("淇濆瓨鍒嗛厤璁板綍澶辫触");
+ } finally {
+ this.saveLoading = false;
+ }
+ },
+ // 纭瀹屾垚鍒嗛厤
+ async handleConfirmAllocation() {
+ if (this.incompleteRecords > 0) {
+ this.$message.warning("璇峰厛瀹屽杽鎵�鏈夊垎閰嶈褰曠殑淇℃伅");
+ return;
+ }
+
+ this.$confirm("纭瀹屾垚鍣ㄥ畼鍒嗛厤鍚楋紵瀹屾垚鍚庡皢鏃犳硶淇敼鍒嗛厤淇℃伅銆�", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(async () => {
+ this.confirmLoading = true;
+ this.form.allocationStatus = "3";
+ this.form.allocationTime = new Date()
+ .toISOString()
+ .replace("T", " ")
+ .substring(0, 19);
+
+ try {
+ const saveData = {
+ ...this.form,
+ attachments: this.attachments,
+ serviceDonateorganList:
+ this.allocationData.serviceDonateorganList || []
+ };
+
+ const response = await allocationedit(saveData);
+
+ if (response.code == 200) {
+ this.$message.success("鍣ㄥ畼鍒嗛厤宸插畬鎴�");
+ } else {
+ this.$message.error(
+ "纭鍒嗛厤澶辫触锛�" + (response.msg || "鏈煡閿欒")
+ );
+ this.form.allocationStatus = "0";
+ this.form.allocationTime = "";
+ }
+ } catch (error) {
+ console.error("纭鍒嗛厤澶辫触:", error);
+ this.$message.error("纭鍒嗛厤澶辫触");
+ this.form.allocationStatus = "0";
+ this.form.allocationTime = "";
+ } finally {
+ this.confirmLoading = false;
+ }
+ })
+ .catch(() => {});
+ },
+
+ // 闄勪欢鐩稿叧鏂规硶
+ /** 闄勪欢鍙樺寲澶勭悊 */
+ handleAttachmentChange(fileList) {
+ this.attachmentFileList = fileList;
+ },
+
+ /** 闄勪欢绉婚櫎澶勭悊 */
+ handleAttachmentRemove(file) {
+ if (file.url) {
+ const index = this.attachments.findIndex(
+ item => item.path == file.url || item.fileUrl == file.url
+ );
+ if (index > -1) {
+ this.attachments.splice(index, 1);
+ this.$message.success("闄勪欢鍒犻櫎鎴愬姛");
+ }
+ }
+ },
+
+ /** 涓婁紶鎴愬姛澶勭悊 */
+ handleUploadSuccess({ file, fileList, response }) {
+ if (response.code == 200) {
+ const attachmentObj = {
+ fileName: file.name,
+ path: response.fileUrl || file.url,
+ fileUrl: response.fileUrl || file.url,
+ fileType: this.getFileExtension(file.name),
+ fileSize: file.size,
+ uploadTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
+ };
+
+ if (!Array.isArray(this.attachments)) {
+ this.attachments = [];
+ }
+
+ this.attachments.push(attachmentObj);
+ this.attachmentFileList = fileList;
+ this.$message.success("鏂囦欢涓婁紶鎴愬姛");
+ }
+ },
+
+ /** 涓婁紶閿欒澶勭悊 */
+ handleUploadError({ file, fileList, error }) {
+ console.error("闄勪欢涓婁紶澶辫触:", error);
+ this.$message.error("鏂囦欢涓婁紶澶辫触锛岃閲嶈瘯");
+ },
+
+ /** 鎵嬪姩鍒犻櫎闄勪欢 */
+ handleRemoveAttachment(index) {
+ this.attachments.splice(index, 1);
+ this.attachmentFileList.splice(index, 1);
+ this.$message.success("闄勪欢鍒犻櫎鎴愬姛");
+ },
+
+ /** 鏂囦欢棰勮 */
+ handlePreview(file) {
+ this.currentPreviewFile = {
+ fileName: file.fileName,
+ fileUrl: file.path || file.fileUrl,
+ fileType: this.getFileType(file.fileName)
};
- return map[status] || 'info';
+ // this.filePreviewTitle = file.fileName;
+ this.filePreviewVisible = true;
},
- getTimeRemainingType() {
- return this.allocationDetails.timeRemaining.includes('灏忔椂') ? 'success' : 'danger';
+ handleDownloadAttachment(file) {
+ const fileUrl = file.path || file.fileUrl;
+ const fileName = file.fileName;
+
+ if (fileUrl) {
+ const link = document.createElement("a");
+ link.href = fileUrl;
+ link.download = fileName;
+ link.style.display = "none";
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ this.$message.success("寮�濮嬩笅杞芥枃浠�");
+ } else {
+ this.$message.warning("鏂囦欢璺緞涓嶅瓨鍦紝鏃犳硶涓嬭浇");
+ }
},
- handleStartAllocation() {
- this.$confirm('纭鍚姩鑷姩鍣ㄥ畼鍒嗛厤鍚楋紵', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
- this.$message.success('宸插惎鍔ㄨ嚜鍔ㄥ垎閰嶇畻娉�');
- // 妯℃嫙鍒嗛厤杩囩▼
- this.allocationStats.allocatedOrgans = 3;
- this.allocationStats.matchRate = 95;
- this.organAllocationData.forEach(organ => {
- organ.status = '宸插垎閰�';
- organ.allocationTime = new Date().toISOString().replace('T', ' ').substring(0, 19);
- });
- });
+
+ /** 鑾峰彇鏂囦欢绫诲瀷 */
+ getFileType(fileName) {
+ if (!fileName) return "other";
+ const extension = fileName
+ .split(".")
+ .pop()
+ .toLowerCase();
+ const imageTypes = ["jpg", "jpeg", "png", "gif", "bmp", "webp"];
+ const pdfTypes = ["pdf"];
+ const officeTypes = ["doc", "docx", "xls", "xlsx", "ppt", "pptx"];
+ if (imageTypes.includes(extension)) return "image";
+ if (pdfTypes.includes(extension)) return "pdf";
+ if (officeTypes.includes(extension)) return "office";
+ return "other";
},
- handleAutoAllocation() {
- this.$message.info('鎵ц鏅鸿兘鍒嗛厤绠楁硶');
+
+ /** 鑾峰彇鏂囦欢鍥炬爣棰滆壊 */
+ getFileIconColor(fileName) {
+ const type = this.getFileType(fileName);
+ const colorMap = {
+ image: "#67C23A",
+ pdf: "#F56C6C",
+ office: "#409EFF",
+ other: "#909399"
+ };
+ return colorMap[type] || "#909399";
},
- handleConfirmAllocation() {
- this.$confirm('纭鏈�缁堝垎閰嶇粨鏋滃悧锛�', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'success'
- }).then(() => {
- this.$message.success('鍣ㄥ畼鍒嗛厤缁撴灉宸茬‘璁�');
- });
+
+ /** 鑾峰彇鏂囦欢鏍囩绫诲瀷 */
+ getFileTagType(fileName) {
+ const type = this.getFileType(fileName);
+ const typeMap = {
+ image: "success",
+ pdf: "danger",
+ office: "primary",
+ other: "info"
+ };
+ return typeMap[type] || "info";
},
- handleManualAdjust() {
- this.$message.info('杩涘叆鎵嬪姩璋冩暣妯″紡');
+
+ /** 鑾峰彇鏂囦欢绫诲瀷鏂囨湰 */
+ getFileTypeText(fileName) {
+ const type = this.getFileType(fileName);
+ const textMap = {
+ image: "鍥剧墖",
+ pdf: "PDF",
+ office: "鏂囨。",
+ other: "鍏朵粬"
+ };
+ return textMap[type] || "鏈煡";
},
- handleViewMatch(row) {
- this.$message.info(`鏌ョ湅${row.organName}鐨勫尮閰嶈鎯卄);
+
+ /** 妫�鏌ユ槸鍚﹀彲棰勮 */
+ isPreviewable(fileName) {
+ const type = this.getFileType(fileName);
+ return ["image", "pdf"].includes(type);
+ },
+
+ /** 鑾峰彇鏂囦欢鎵╁睍鍚� */
+ getFileExtension(filename) {
+ return filename
+ .split(".")
+ .pop()
+ .toLowerCase();
+ },
+
+ /** 鏍煎紡鍖栨枃浠跺ぇ灏� */
+ formatFileSize(bytes) {
+ if (!bytes || bytes == 0) return "0 B";
+ const k = 1024;
+ const sizes = ["B", "KB", "MB", "GB"];
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
+ },
+
+ /** 鏃ユ湡鏃堕棿鏍煎紡鍖� */
+ formatDateTime(dateTime) {
+ if (!dateTime) return "";
+ try {
+ const date = new Date(dateTime);
+ if (isNaN(date.getTime())) return dateTime;
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ const hours = String(date.getHours()).padStart(2, "0");
+ const minutes = String(date.getMinutes()).padStart(2, "0");
+ return `${year}-${month}-${day} ${hours}:${minutes}`;
+ } catch (error) {
+ return dateTime;
+ }
}
}
};
</script>
<style scoped>
-.allocation-stats, .time-window {
- padding: 10px 0;
+.organ-allocation-detail {
+ padding: 20px;
+ background-color: #f5f7fa;
}
-.stat-item, .time-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15px;
- padding: 8px 0;
- border-bottom: 1px solid #f0f0f0;
-}
-
-.stat-item .label, .time-item .label {
- color: #606266;
- font-weight: 500;
- min-width: 100px;
-}
-
-.stat-item .value {
- font-weight: 600;
- color: #409EFF;
-}
-
-.algorithm-results {
- padding: 15px 0;
-}
-
-.result-item {
+.detail-card {
margin-bottom: 20px;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
-.result-item h4 {
- margin-bottom: 15px;
+.allocation-card {
+ margin-bottom: 20px;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+}
+
+.attachment-card {
+ margin-bottom: 20px;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ padding: 20px;
+ background: #fafafa;
+}
+
+.attachment-header {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 16px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.attachment-title {
+ font-weight: 600;
color: #303133;
}
-.weight-distribution {
- padding: 10px 0;
+.attachment-tip {
+ font-size: 12px;
+ color: #909399;
+ margin-left: auto;
}
-.factor-item {
- display: flex;
- align-items: center;
+.attachment-list {
+ margin-top: 16px;
+}
+
+.list-title {
+ font-weight: bold;
margin-bottom: 12px;
-}
-
-.factor-name {
- width: 120px;
- color: #606266;
+ color: #303133;
font-size: 14px;
}
-.factor-item .el-progress {
- flex: 1;
- margin: 0 15px;
+.file-name {
+ font-size: 13px;
+ margin-left: 8px;
}
-.factor-percent {
- width: 40px;
- text-align: right;
+.detail-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #303133;
+}
+
+/* 缁熻淇℃伅鏍峰紡 */
+.allocation-stats {
+ margin-top: 20px;
+ padding: 15px;
+ background: linear-gradient(135deg, #9eb7e5 0%, #53519c 100%);
+ border-radius: 8px;
+ color: white;
+ font-size: 18px;
+}
+
+.stat-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 10px;
+}
+
+.stat-label {
+ opacity: 0.9;
+ margin-bottom: 5px;
+}
+
+.stat-value {
+ font-size: 20px;
+ font-weight: bold;
+}
+
+/* 绌虹姸鎬佹牱寮� */
+.empty-allocation {
+ text-align: center;
+ padding: 40px 0;
color: #909399;
- font-size: 12px;
+}
+
+/* 瀵硅瘽妗嗗簳閮ㄦ寜閽� */
+.dialog-footer {
+ margin-top: 20px;
+ text-align: center;
+ padding-top: 20px;
+ border-top: 1px solid #e4e7ed;
+}
+
+/* 琛ㄦ牸琛屾牱寮� */
+:deep(.warning-row) {
+ background-color: #fff7e6;
+}
+
+:deep(.warning-row:hover) {
+ background-color: #ffecc2;
+}
+
+/* 鍝嶅簲寮忚璁� */
+@media (max-width: 768px) {
+ .organ-allocation-detail {
+ padding: 10px;
+ }
+
+ .allocation-stats .el-col {
+ margin-bottom: 10px;
+ }
}
</style>
--
Gitblit v1.9.3