From 5aa165156994b1b8a601063fa0a1107d1893ea57 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期四, 19 三月 2026 16:48:13 +0800
Subject: [PATCH] 更新
---
src/views/business/allocation/allocationInfo.vue | 1159 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 790 insertions(+), 369 deletions(-)
diff --git a/src/views/business/allocation/allocationInfo.vue b/src/views/business/allocation/allocationInfo.vue
index fcda788..fa02806 100644
--- a/src/views/business/allocation/allocationInfo.vue
+++ b/src/views/business/allocation/allocationInfo.vue
@@ -10,8 +10,9 @@
</el-button>
<el-button
type="success"
- @click="handleAllocate"
- :disabled="form.allocationStatus === 'allocated'"
+ @click="handleConfirmAllocation"
+ :disabled="form.allocationStatus === '1'"
+ :loading="confirmLoading"
>
纭鍒嗛厤
</el-button>
@@ -21,26 +22,26 @@
<el-form :model="form" ref="form" :rules="rules" label-width="120px">
<el-row :gutter="20">
<el-col :span="8">
- <el-form-item label="浣忛櫌鍙�" prop="hospitalNo">
- <el-input v-model="form.hospitalNo" readonly />
+ <el-form-item label="浣忛櫌鍙�" prop="donorno">
+ <el-input v-model="form.donorno" readonly />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="妗堜緥缂栧彿" prop="caseNo">
- <el-input v-model="form.caseNo" readonly />
+ <el-input v-model="form.caseNo" />
</el-form-item>
</el-col>
<el-col :span="8">
- <el-form-item label="鎹愮尞鑰呭鍚�" prop="donorName">
- <el-input v-model="form.donorName" />
+ <el-form-item label="鎹愮尞鑰呭鍚�" prop="name">
+ <el-input v-model="form.name" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
- <el-form-item label="鎬у埆" prop="gender">
- <el-select v-model="form.gender" style="width: 100%">
+ <el-form-item label="鎬у埆" prop="sex">
+ <el-select v-model="form.sex" style="width: 100%">
<el-option label="鐢�" value="0" />
<el-option label="濂�" value="1" />
</el-select>
@@ -51,25 +52,52 @@
<el-input v-model="form.age" />
</el-form-item>
</el-col>
+ <!-- <el-col :span="8">
+ <el-form-item label="鎹愮尞绫诲埆" prop="donationcategory">
+ <el-select v-model="form.donationcategory" style="width: 100%">
+ <el-option
+ v-for="dict in dict.type.sys_DonationCategory || []"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </el-form-item>
+ </el-col> -->
+ </el-row>
+
+ <el-row :gutter="20">
<el-col :span="8">
- <el-form-item label="鍑虹敓鏃ユ湡" prop="birthDate">
- <el-date-picker
- v-model="form.birthDate"
- type="date"
- value-format="yyyy-MM-dd"
- style="width: 100%"
- />
+ <el-form-item label="琛�鍨�" prop="bloodtype">
+ <el-select v-model="form.bloodtype" style="width: 100%">
+ <el-option
+ v-for="dict in dict.type.sys_BloodType || []"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="璇佷欢鍙风爜" prop="idcardno">
+ <el-input v-model="form.idcardno" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="璁板綍鐘舵��" prop="recordstate">
+ <el-input v-model="form.recordstate" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鐤剧梾璇婃柇" prop="diagnosis">
+ <el-form-item label="鐤剧梾璇婃柇" prop="diagnosisname">
<el-input
type="textarea"
:rows="2"
- v-model="form.diagnosis"
+ v-model="form.diagnosisname"
placeholder="璇疯緭鍏ョ柧鐥呰瘖鏂俊鎭�"
/>
</el-form-item>
@@ -81,7 +109,7 @@
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
- :disabled="form.allocationStatus !== 'allocated'"
+ :disabled="form.allocationStatus === '1'"
/>
</el-form-item>
</el-col>
@@ -89,8 +117,27 @@
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鐧昏浜�" prop="registrant">
- <el-input v-model="form.registrant" />
+ <el-form-item label="鎵�鍦ㄥ尰鐤楁満鏋�" prop="treatmenthospitalname">
+ <el-input
+ v-model="form.treatmenthospitalname"
+ placeholder="璇疯緭鍏ュ尰鐤楁満鏋勫悕绉�"
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍖荤枟鏈烘瀯缂栫爜" prop="treatmenthospitalno">
+ <el-input
+ v-model="form.treatmenthospitalno"
+ placeholder="璇疯緭鍏ュ尰鐤楁満鏋勭紪鐮�"
+ />
+ </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" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
@@ -115,10 +162,20 @@
<div style="float: right;">
<el-tag
:type="
- form.allocationStatus === 'allocated' ? 'success' : 'warning'
+ form.allocationStatus === '1'
+ ? 'success'
+ : form.allocationStatus === '2'
+ ? 'danger'
+ : 'warning'
"
>
- {{ form.allocationStatus === "allocated" ? "宸插垎閰�" : "寰呭垎閰�" }}
+ {{
+ form.allocationStatus === "1"
+ ? "宸插垎閰�"
+ : form.allocationStatus === "2"
+ ? "浣滃簾"
+ : "鏈垎閰�"
+ }}
</el-tag>
</div>
</div>
@@ -137,14 +194,20 @@
@change="handleOrganSelectionChange"
>
<el-checkbox
- v-for="organ in organDict"
- :key="organ.value"
- :label="organ.value"
- :disabled="form.allocationStatus === 'allocated'"
+ v-for="dict in dict.type.sys_Organ || []"
+ :key="dict.value"
+ :label="dict.value"
+ :disabled="form.allocationStatus === '1'"
>
- {{ organ.label }}
+ {{ 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>
@@ -153,7 +216,7 @@
<el-col>
<el-form-item>
<el-table
- :data="allocationData.records"
+ :data="allocationData.serviceDonateorganList"
v-loading="loading"
border
style="width: 100%"
@@ -163,11 +226,11 @@
label="鍣ㄥ畼鍚嶇О"
align="center"
width="120"
- prop="organName"
+ prop="organname"
>
<template slot-scope="scope">
<el-input
- v-model="scope.row.organName"
+ v-model="scope.row.organname"
placeholder="鍣ㄥ畼鍚嶇О"
:disabled="true"
/>
@@ -178,13 +241,13 @@
label="鍒嗛厤绯荤粺缂栧彿"
align="center"
width="150"
- prop="systemNo"
+ prop="caseno"
>
<template slot-scope="scope">
<el-input
- v-model="scope.row.systemNo"
+ v-model="scope.row.caseno"
placeholder="鍒嗛厤绯荤粺缂栧彿"
- :disabled="form.allocationStatus === 'allocated'"
+ :disabled="form.allocationStatus === '1'"
/>
</template>
</el-table-column>
@@ -193,18 +256,18 @@
label="鍒嗛厤鎺ユ敹鏃堕棿"
align="center"
width="180"
- prop="applicantTime"
+ prop="applicanttime"
>
<template slot-scope="scope">
<el-date-picker
clearable
size="small"
style="width: 100%"
- v-model="scope.row.applicantTime"
+ v-model="scope.row.applicanttime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="閫夋嫨鍒嗛厤鎺ユ敹鏃堕棿"
- :disabled="form.allocationStatus === 'allocated'"
+ :disabled="form.allocationStatus === '1'"
/>
</template>
</el-table-column>
@@ -213,13 +276,13 @@
label="鍙椾綋濮撴皬"
align="center"
width="120"
- prop="recipientName"
+ prop="name"
>
<template slot-scope="scope">
<el-input
- v-model="scope.row.recipientName"
+ v-model="scope.row.name"
placeholder="鍙椾綋濮撴皬"
- :disabled="form.allocationStatus === 'allocated'"
+ :disabled="form.allocationStatus === '1'"
/>
</template>
</el-table-column>
@@ -228,39 +291,34 @@
label="绉绘鍖婚櫌"
align="center"
width="200"
- prop="transplantHospitalNo"
+ prop="transplanthospitalno"
>
<template slot-scope="scope">
- <el-select
- v-model="scope.row.transplantHospitalNo"
- placeholder="璇烽�夋嫨绉绘鍖婚櫌"
- style="width: 100%"
- :disabled="form.allocationStatus === 'allocated'"
- @change="handleHospitalChange(scope.row, $event)"
- >
- <el-option
- v-for="hospital in hospitalList"
- :key="hospital.hospitalNo"
- :label="hospital.hospitalName"
- :value="hospital.hospitalNo"
+ <div>
+ <org-selecter
+ ref="tranHosSelect"
+ :org-type="'4'"
+ :dataList="dataList"
+ v-model="scope.row.transplanthospitalno"
+ style="width: 100%"
/>
- </el-select>
+ </div>
</template>
</el-table-column>
<el-table-column
label="璇存槑"
align="center"
- prop="reallocationReason"
+ prop="reallocationreason"
min-width="200"
>
<template slot-scope="scope">
<el-input
type="textarea"
clearable
- v-model="scope.row.reallocationReason"
+ v-model="scope.row.reallocationreason"
placeholder="璇疯緭鍏ヨ鏄�"
- :disabled="form.allocationStatus === 'allocated'"
+ :disabled="form.allocationStatus === '1'"
/>
</template>
</el-table-column>
@@ -270,7 +328,7 @@
align="center"
width="120"
class-name="small-padding fixed-width"
- v-if="form.allocationStatus !== 'allocated'"
+ v-if="form.allocationStatus !== '1'"
>
<template slot-scope="scope">
<el-button
@@ -278,7 +336,7 @@
type="text"
icon="el-icon-copy-document"
@click="handleRedistribution(scope.row)"
- :disabled="!scope.row.systemNo"
+ :disabled="!scope.row.caseno"
>
閲嶅垎閰�
</el-button>
@@ -290,13 +348,19 @@
</el-row>
<!-- 鍒嗛厤缁熻淇℃伅 -->
- <div class="allocation-stats" v-if="allocationData.records.length > 0">
+ <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.records.length }} 涓�</span
+ >{{ allocationData.serviceDonateorganList.length }} 涓�</span
>
</div>
</el-col>
@@ -318,15 +382,19 @@
<span class="stat-value">
<el-tag
:type="
- form.allocationStatus === 'allocated'
+ form.allocationStatus === '1'
? 'success'
+ : form.allocationStatus === '2'
+ ? 'danger'
: 'warning'
"
>
{{
- form.allocationStatus === "allocated"
- ? "宸插畬鎴�"
- : "杩涜涓�"
+ form.allocationStatus === "1"
+ ? "宸插垎閰�"
+ : form.allocationStatus === "2"
+ ? "浣滃簾"
+ : "鏈垎閰�"
}}
</el-tag>
</span>
@@ -342,12 +410,15 @@
</div>
</el-form>
- <div class="dialog-footer" v-if="form.allocationStatus !== 'allocated'">
+ <div class="dialog-footer" v-if="form.allocationStatus !== '1'">
<el-button
type="primary"
@click="handleSaveAllocation"
:loading="saveLoading"
- :disabled="allocationData.records.length === 0"
+ :disabled="
+ !allocationData.serviceDonateorganList ||
+ allocationData.serviceDonateorganList.length === 0
+ "
>
淇濆瓨鍒嗛厤璁板綍
</el-button>
@@ -362,88 +433,89 @@
</div>
</el-card>
- <!-- 闄勪欢绠$悊閮ㄥ垎 -->
+ <!-- 闄勪欢绠$悊閮ㄥ垎浼樺寲 -->
<el-card class="attachment-card">
- <div slot="header" class="clearfix">
- <span class="detail-title">鐩稿叧闄勪欢</span>
- <upload-attachment
- :file-list="attachments"
- @change="handleAttachmentChange"
- :limit="10"
- :accept="'.pdf,.jpg,.jpeg,.png,.doc,.docx'"
- />
+ <div class="attachment-header">
+ <i class="el-icon-paperclip"></i>
+ <span class="attachment-title">鐩稿叧闄勪欢</span>
+ <span class="attachment-tip"
+ >鏀寔涓婁紶鍣ㄥ畼鍒嗛厤鐩稿叧鏂囦欢 (鏈�澶歿{ attachmentLimit }}涓�)</span
+ >
</div>
- <div class="attachment-list">
- <el-table :data="attachments" style="width: 100%">
- <el-table-column label="鏂囦欢鍚嶇О" min-width="200">
+ <!-- 浣跨敤 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">
- <div class="file-info">
- <i
- :class="getFileIcon(scope.row.fileName)"
- style="margin-right: 8px; color: #409EFF;"
- ></i>
- <span>{{ scope.row.fileName }}</span>
- </div>
+ <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" align="center">
+ <el-table-column label="鏂囦欢绫诲瀷" width="100">
<template slot-scope="scope">
- <el-tag size="small">{{
- getFileType(scope.row.fileName)
- }}</el-tag>
+ <el-tag :type="getFileTagType(scope.row.fileName)" size="small">
+ {{ getFileTypeText(scope.row.fileName) }}
+ </el-tag>
</template>
</el-table-column>
-
- <el-table-column label="鏂囦欢澶у皬" width="100" align="center">
+ <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="160" align="center">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.uploadTime) }}</span>
- </template>
- </el-table-column>
-
- <el-table-column label="鎿嶄綔" width="150" align="center">
+ <el-table-column label="鎿嶄綔" width="200" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
- type="text"
- icon="el-icon-view"
- @click="handlePreviewAttachment(scope.row)"
- >棰勮</el-button
+ type="primary"
+ @click="handlePreview(scope.row)"
+ :disabled="!isPreviewable(scope.row.fileName)"
>
+ 棰勮
+ </el-button>
<el-button
size="mini"
- type="text"
- icon="el-icon-download"
+ type="success"
@click="handleDownloadAttachment(scope.row)"
- >涓嬭浇</el-button
>
+ 涓嬭浇
+ </el-button>
<el-button
size="mini"
- type="text"
- icon="el-icon-delete"
- style="color: #F56C6C;"
- @click="handleRemoveAttachment(scope.row)"
- >鍒犻櫎</el-button
+ type="danger"
+ @click="handleRemoveAttachment(scope.$index)"
>
+ 鍒犻櫎
+ </el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
- <!-- 闄勪欢棰勮瀵硅瘽妗� -->
- <attachment-preview
- :visible="attachmentPreviewVisible"
- :file-list="currentAttachmentList"
- :title="attachmentPreviewTitle"
- @close="attachmentPreviewVisible = false"
- />
+
<!-- 閲嶅垎閰嶅璇濇 -->
<el-dialog
title="鍣ㄥ畼閲嶅垎閰�"
@@ -452,7 +524,7 @@
>
<el-form :model="redistributionForm" label-width="100px">
<el-form-item label="鍘熷櫒瀹樹俊鎭�">
- <el-input v-model="redistributionForm.organName" readonly />
+ <el-input v-model="redistributionForm.organname" readonly />
</el-form-item>
<el-form-item label="閲嶅垎閰嶅師鍥�" prop="reason">
<el-input
@@ -470,49 +542,84 @@
>
</div>
</el-dialog>
+
+
+
+ <!-- 闄勪欢棰勮瀵硅瘽妗� -->
+ <FilePreviewDialog
+ :visible="filePreviewVisible"
+ :file="currentPreviewFile"
+ @close="filePreviewVisible = false"
+ @download="handleDownloadAttachment"
+ />
</div>
</template>
<script>
import {
- getOrganAllocationDetail,
- updateOrganAllocation,
- saveAllocationRecords,
- getHospitalList,
- getOrganDict
-} from "./organAllocation";
+ allocationList,
+ allocationadd,
+ allocationedit
+} from "@/api/businessApi";
import UploadAttachment from "@/components/UploadAttachment";
-import AttachmentPreview from "@/components/AttachmentPreview";
+import FilePreviewDialog from "@/components/FilePreviewDialog";
+import OrgSelecter from "@/views/project/components/orgselect";
+
+import dayjs from "dayjs";
+
export default {
name: "OrganAllocationDetail",
components: {
UploadAttachment,
- AttachmentPreview,
+ OrgSelecter,
+ FilePreviewDialog
},
+ dicts: [
+ "sys_BloodType",
+ "sys_DonationCategory",
+ "sys_RecordState",
+ "sys_Organ"
+ ],
data() {
return {
// 琛ㄥ崟鏁版嵁
form: {
id: undefined,
- hospitalNo: "",
+ infoid: undefined,
+ donationcategory: "",
+ recordstate: "",
caseNo: "",
- donorName: "",
- gender: "",
+ donorno: "",
+ treatmenthospitalname: "",
+ treatmenthospitalno: "",
+ sex: "",
+ name: "",
age: "",
- birthDate: "",
- diagnosis: "",
- allocationStatus: "pending",
+ bloodtype: "",
+ idcardno: "",
+ diagnosisname: "",
+ allocationStatus: "0", // 0:鏈垎閰嶏紱1锛氬凡鍒嗛厤锛�2浣滃簾
allocationTime: "",
- registrant: "",
- registrationTime: ""
+ registrationCode: "",
+ registrationName: "",
+ registrationTime: "",
+ attachments: [] // 娣诲姞闄勪欢瀛楁
},
+ // 闄勪欢棰勮鐩稿叧
+ attachmentPreviewVisible: false,
+ currentAttachmentList: [],
+ attachmentPreviewTitle: "",
+ dataList: [],
// 琛ㄥ崟楠岃瘉瑙勫垯
rules: {
- donorName: [
+ name: [
{ required: true, message: "鎹愮尞鑰呭鍚嶄笉鑳戒负绌�", trigger: "blur" }
],
- diagnosis: [
+ diagnosisname: [
{ required: true, message: "鐤剧梾璇婃柇涓嶈兘涓虹┖", trigger: "blur" }
+ ],
+ recordstate: [
+ { required: true, message: "璁板綍鐘舵�佷笉鑳戒负绌�", trigger: "change" }
]
},
// 鍒嗛厤璁板綍楠岃瘉瑙勫垯
@@ -522,25 +629,34 @@
confirmLoading: false,
// 鍔犺浇鐘舵��
loading: false,
- // 閫変腑鐨勫櫒瀹�
+ // 閫変腑鐨勫櫒瀹橈紙瀛樺偍瀛楀吀value锛�
selectedOrgans: [],
- // 鍣ㄥ畼瀛楀吀
- organDict: [],
+ // 鍏朵粬鍣ㄥ畼杈撳叆
+ otherOrganInput: "",
// 鍖婚櫌鍒楄〃
hospitalList: [],
// 鍒嗛厤璁板綍鏁版嵁
allocationData: {
- records: []
+ serviceDonateorganList: []
},
// 闄勪欢鏁版嵁
attachments: [],
+ attachmentFileList: [],
+ // 闄勪欢鐩稿叧閰嶇疆
+ attachmentLimit: 10,
+ attachmentAccept:
+ ".pdf,.jpg,.jpeg,.png,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt",
// 閲嶅垎閰嶅璇濇
redistributionDialogVisible: false,
redistributionForm: {
- organName: "",
+ organname: "",
reason: ""
},
- currentRedistributeRecord: null
+ currentRedistributeRecord: null,
+ // 鏂囦欢棰勮鐩稿叧
+ filePreviewVisible: false,
+ currentPreviewFile: null,
+ filePreviewTitle: ""
};
},
computed: {
@@ -550,120 +666,218 @@
},
// 涓嶅畬鏁寸殑璁板綍鏁伴噺
incompleteRecords() {
- return this.allocationData.records.filter(
+ if (!this.allocationData.serviceDonateorganList) return 0;
+ return this.allocationData.serviceDonateorganList.filter(
record =>
- !record.systemNo ||
- !record.applicantTime ||
- !record.recipientName ||
- !record.transplantHospitalNo
+ !record.caseno ||
+ !record.applicanttime ||
+ !record.name ||
+ !record.transplanthospitalno
).length;
},
// 鍞竴鍖婚櫌鏁伴噺
uniqueHospitals() {
- const hospitals = this.allocationData.records
- .map(record => record.transplantHospitalNo)
+ 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})`;
+ }
+ }
}
},
created() {
- const id = this.$route.query.id;
- if (id) {
- this.getDetail(id);
- } else {
- this.generateCaseNo();
- this.form.registrant = this.currentUser.username || "褰撳墠鐢ㄦ埛";
+ this.initData();
+ },
+ methods: {
+ // 鏍规嵁瀛楀吀value鑾峰彇label
+ getOrganLabel(organValue) {
+ const dictItem = this.organDict.find(item => item.value === organValue);
+ return dictItem ? dictItem.label : organValue;
+ },
+
+ // 鍒濆鍖栨暟鎹�
+ initData() {
+ const { id, infoid } = this.$route.query;
+
+ 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);
- }
- this.getOrganDictionary();
- this.getHospitalData();
- },
- methods: {
- // 鐢熸垚妗堜緥缂栧彿
- generateCaseNo() {
+
+ if (infoid) {
+ this.getDetail(infoid);
+ } else {
+ this.generateDonorNo();
+ }
+
+ this.getHospitalData();
+ },
+ // 鐢熸垚鎹愮尞鑰呯紪鍙�
+ generateDonorNo() {
const timestamp = Date.now().toString();
- this.form.hospitalNo = "D" + timestamp.slice(-6);
- this.form.caseNo = "C" + timestamp.slice(-6);
+ this.form.donorno = "D" + timestamp.slice(-8);
+ this.form.caseNo = "CASE" + timestamp.slice(-6);
},
// 鑾峰彇璇︽儏
- getDetail(id) {
+ async getDetail(infoid) {
this.loading = true;
- getOrganAllocationDetail(id)
- .then(response => {
- if (response.code === 200) {
- this.form = response.data;
- if (response.data.allocationRecords) {
- this.allocationData.records = response.data.allocationRecords;
- this.selectedOrgans = response.data.allocationRecords.map(
- item => item.organNo
- );
+ try {
+ const response = await allocationList({ infoid });
+ if (
+ response.code === 200 &&
+ response.data &&
+ response.data.length > 0
+ ) {
+ const data = response.data[0];
+
+ // 濉厖琛ㄥ崟鏁版嵁
+ Object.assign(this.form, data);
+
+ // 鍒濆鍖栭檮浠�
+ 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.loading = false;
- })
- .catch(error => {
- console.error("鑾峰彇鍣ㄥ畼鍒嗛厤璇︽儏澶辫触:", error);
- this.loading = false;
- this.$message.error("鑾峰彇璇︽儏澶辫触");
- });
- },
- // 鑾峰彇鍣ㄥ畼瀛楀吀
- getOrganDictionary() {
- getOrganDict().then(response => {
- if (response.code === 200) {
- this.organDict = response.data;
+
+ this.$message.success("鏁版嵁鍔犺浇鎴愬姛");
+ } else {
+ this.$message.warning("鏈壘鍒板搴旂殑鍣ㄥ畼鍒嗛厤鏁版嵁");
}
- });
+ } catch (error) {
+ console.error("鑾峰彇鍣ㄥ畼鍒嗛厤璇︽儏澶辫触:", error);
+ this.$message.error("鑾峰彇璇︽儏澶辫触");
+ } finally {
+ this.loading = false;
+ }
},
// 鑾峰彇鍖婚櫌鏁版嵁
- getHospitalData() {
- getHospitalList().then(response => {
- if (response.code === 200) {
- this.hospitalList = response.data;
- }
- });
- },
- handleAttachmentChange(fileList) {
-console.log(fileList,'娴嬭瘯');
-
+ 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) {
- const currentOrganNos = this.allocationData.records.map(
- item => item.organNo
+ if (!this.allocationData.serviceDonateorganList) {
+ this.allocationData.serviceDonateorganList = [];
+ }
+
+ const currentOrganValues = this.allocationData.serviceDonateorganList.map(
+ item => item.organno
);
+
+ // 澶勭悊浜掓枼閫昏緫锛堝弬鑰冩崘鐚喅瀹氶〉闈級
+ this.handleExclusiveSelections(selectedValues);
// 鏂板閫夋嫨鐨勫櫒瀹�
selectedValues.forEach(organValue => {
- if (!currentOrganNos.includes(organValue)) {
- const organInfo = this.organDict.find(
- item => item.value === organValue
- );
- if (organInfo) {
- this.allocationData.records.push({
- organName: organInfo.label,
- organNo: organValue,
- id: null,
- allocationId: this.form.id,
- systemNo: "",
- applicantTime: "",
- recipientName: "",
- transplantHospitalNo: "",
- transplantHospitalName: "",
- reallocationReason: "",
- organState: 1
- });
- }
+ if (!currentOrganValues.includes(organValue)) {
+ this.createOrganRecord(organValue);
}
});
// 绉婚櫎鍙栨秷閫夋嫨鐨勫櫒瀹�
- this.allocationData.records = this.allocationData.records.filter(
+ this.allocationData.serviceDonateorganList = this.allocationData.serviceDonateorganList.filter(
record => {
- if (selectedValues.includes(record.organNo)) {
+ if (selectedValues.includes(record.organno)) {
return true;
} else {
if (record.id) {
@@ -677,14 +891,13 @@
}
)
.then(() => {
- // 瀹為檯椤圭洰涓繖閲屽簲璇ヨ皟鐢ㄥ垹闄PI
- this.allocationData.records = this.allocationData.records.filter(
- r => r.organNo !== record.organNo
+ this.allocationData.serviceDonateorganList = this.allocationData.serviceDonateorganList.filter(
+ r => r.organno !== record.organno
);
this.$message.success("鍒犻櫎鎴愬姛");
})
.catch(() => {
- this.selectedOrgans.push(record.organNo);
+ this.selectedOrgans.push(record.organno);
});
return true; // 绛夊緟鐢ㄦ埛纭
} else {
@@ -694,6 +907,61 @@
}
);
},
+
+ // 澶勭悊浜掓枼閫夋嫨锛堝弬鑰冩崘鐚喅瀹氶〉闈級
+ 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(
@@ -706,8 +974,8 @@
// 閲嶅垎閰嶆搷浣�
handleRedistribution(row) {
this.currentRedistributeRecord = row;
- this.redistributionForm.organName = row.organName;
- this.redistributionForm.reason = row.reallocationReason || "";
+ this.redistributionForm.organname = row.organname;
+ this.redistributionForm.reason = row.reallocationreason || "";
this.redistributionDialogVisible = true;
},
// 纭閲嶅垎閰�
@@ -718,7 +986,7 @@
}
if (this.currentRedistributeRecord) {
- this.currentRedistributeRecord.reallocationReason = this.redistributionForm.reason;
+ this.currentRedistributeRecord.reallocationreason = this.redistributionForm.reason;
this.$message.success("閲嶅垎閰嶅師鍥犲凡鏇存柊");
this.redistributionDialogVisible = false;
}
@@ -726,70 +994,89 @@
// 鍣ㄥ畼琛屾牱寮�
getOrganRowClassName({ row }) {
if (
- !row.systemNo ||
- !row.applicantTime ||
- !row.recipientName ||
- !row.transplantHospitalNo
+ !row.caseno ||
+ !row.applicanttime ||
+ !row.name ||
+ !row.transplanthospitalno
) {
return "warning-row";
}
return "";
},
// 淇濆瓨鍩烘湰淇℃伅
- handleSave() {
- this.$refs.form.validate(valid => {
- if (valid) {
- this.saveLoading = true;
- const apiMethod = this.form.id
- ? updateOrganAllocation
- : addOrganAllocation;
+ async handleSave() {
+ this.$refs.form.validate(async valid => {
+ if (!valid) {
+ this.$message.warning("璇峰畬鍠勮〃鍗曚俊鎭�");
+ return;
+ }
- apiMethod(this.form)
- .then(response => {
- if (response.code === 200) {
- this.$message.success("淇濆瓨鎴愬姛");
- if (!this.form.id) {
- this.form.id = response.data.id;
- this.$router.replace({
- query: { ...this.$route.query, id: this.form.id }
- });
- }
- }
- })
- .catch(error => {
- console.error("淇濆瓨澶辫触:", error);
- this.$message.error("淇濆瓨澶辫触");
- })
- .finally(() => {
- this.saveLoading = false;
- });
+ this.saveLoading = true;
+ try {
+ const saveData = {
+ ...this.form,
+ attachments: this.attachments,
+ serviceDonateorganList:
+ this.allocationData.serviceDonateorganList || []
+ };
+ console.log(this.form.recordstate);
+ this.form.recordstate = 1;
+ 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 && response.data.id) {
+ this.form.id = response.data.id;
+ 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;
}
});
},
// 淇濆瓨鍒嗛厤璁板綍
- handleSaveAllocation() {
+ async handleSaveAllocation() {
if (!this.form.id) {
this.$message.warning("璇峰厛淇濆瓨鍩烘湰淇℃伅");
return;
}
this.saveLoading = true;
- saveAllocationRecords(this.form.id, this.allocationData.records)
- .then(response => {
- if (response.code === 200) {
- this.$message.success("鍒嗛厤璁板綍淇濆瓨鎴愬姛");
- }
- })
- .catch(error => {
- console.error("淇濆瓨鍒嗛厤璁板綍澶辫触:", error);
- this.$message.error("淇濆瓨鍒嗛厤璁板綍澶辫触");
- })
- .finally(() => {
- this.saveLoading = false;
- });
+ 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;
+ }
},
// 纭瀹屾垚鍒嗛厤
- handleConfirmAllocation() {
+ async handleConfirmAllocation() {
if (this.incompleteRecords > 0) {
this.$message.warning("璇峰厛瀹屽杽鎵�鏈夊垎閰嶈褰曠殑淇℃伅");
return;
@@ -800,117 +1087,217 @@
cancelButtonText: "鍙栨秷",
type: "warning"
})
- .then(() => {
+ .then(async () => {
this.confirmLoading = true;
- this.form.allocationStatus = "allocated";
+ this.form.allocationStatus = "1";
this.form.allocationTime = new Date()
.toISOString()
.replace("T", " ")
.substring(0, 19);
- updateOrganAllocation(this.form)
- .then(response => {
- if (response.code === 200) {
- this.$message.success("鍣ㄥ畼鍒嗛厤宸插畬鎴�");
- }
- })
- .catch(error => {
- console.error("纭鍒嗛厤澶辫触:", error);
- this.$message.error("纭鍒嗛厤澶辫触");
- })
- .finally(() => {
- this.confirmLoading = false;
- });
+ 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(() => {});
},
- // 涓婁紶闄勪欢
- handleUploadAttachment() {
- // 闄勪欢涓婁紶閫昏緫
- this.$message.info("闄勪欢涓婁紶鍔熻兘");
+
+ // 闄勪欢鐩稿叧鏂规硶
+ /** 闄勪欢鍙樺寲澶勭悊 */
+ handleAttachmentChange(fileList) {
+ this.attachmentFileList = fileList;
},
- // 棰勮闄勪欢
- handlePreviewAttachment(attachment) {
- // 闄勪欢棰勮閫昏緫
- this.$message.info("闄勪欢棰勮鍔熻兘");
- },
- // 涓嬭浇闄勪欢
- handleDownloadAttachment(attachment) {
- // 闄勪欢涓嬭浇閫昏緫
- this.$message.info("闄勪欢涓嬭浇鍔熻兘");
- },
- // 鍒犻櫎闄勪欢
- handleRemoveAttachment(attachment) {
- this.$confirm("纭畾瑕佸垹闄よ繖涓檮浠跺悧锛�", "鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- })
- .then(() => {
+
+ /** 闄勪欢绉婚櫎澶勭悊 */
+ 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("闄勪欢鍒犻櫎鎴愬姛");
- })
- .catch(() => {});
+ }
+ }
},
- // 鑾峰彇鏂囦欢鍥炬爣
- getFileIcon(fileName) {
- const ext = fileName
- .split(".")
- .pop()
- .toLowerCase();
- const iconMap = {
- pdf: "el-icon-document",
- doc: "el-icon-document",
- docx: "el-icon-document",
- xls: "el-icon-document",
- xlsx: "el-icon-document",
- jpg: "el-icon-picture",
- jpeg: "el-icon-picture",
- png: "el-icon-picture"
+
+ /** 涓婁紶鎴愬姛澶勭悊 */
+ 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 iconMap[ext] || "el-icon-document";
+ // this.filePreviewTitle = file.fileName;
+ this.filePreviewVisible = true;
},
- // 鑾峰彇鏂囦欢绫诲瀷
+ 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("鏂囦欢璺緞涓嶅瓨鍦紝鏃犳硶涓嬭浇");
+ }
+ },
+
+ /** 鑾峰彇鏂囦欢绫诲瀷 */
getFileType(fileName) {
- const ext = fileName
+ if (!fileName) return "other";
+ const extension = fileName
.split(".")
.pop()
.toLowerCase();
- const typeMap = {
- pdf: "PDF",
- doc: "DOC",
- docx: "DOCX",
- xls: "XLS",
- xlsx: "XLSX",
- jpg: "JPG",
- jpeg: "JPEG",
- png: "PNG"
- };
- return typeMap[ext] || ext.toUpperCase();
+ 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";
},
- // 鏂囦欢澶у皬鏍煎紡鍖�
- formatFileSize(size) {
- if (size === 0) return "0 B";
+
+ /** 鑾峰彇鏂囦欢鍥炬爣棰滆壊 */
+ getFileIconColor(fileName) {
+ const type = this.getFileType(fileName);
+ const colorMap = {
+ image: "#67C23A",
+ pdf: "#F56C6C",
+ office: "#409EFF",
+ other: "#909399"
+ };
+ return colorMap[type] || "#909399";
+ },
+
+ /** 鑾峰彇鏂囦欢鏍囩绫诲瀷 */
+ getFileTagType(fileName) {
+ const type = this.getFileType(fileName);
+ const typeMap = {
+ image: "success",
+ pdf: "danger",
+ office: "primary",
+ other: "info"
+ };
+ return typeMap[type] || "info";
+ },
+
+ /** 鑾峰彇鏂囦欢绫诲瀷鏂囨湰 */
+ getFileTypeText(fileName) {
+ const type = this.getFileType(fileName);
+ const textMap = {
+ image: "鍥剧墖",
+ pdf: "PDF",
+ office: "鏂囨。",
+ other: "鍏朵粬"
+ };
+ return textMap[type] || "鏈煡";
+ },
+
+ /** 妫�鏌ユ槸鍚﹀彲棰勮 */
+ 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(size) / Math.log(k));
- return parseFloat((size / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
},
- // 鏃堕棿鏍煎紡鍖�
- parseTime(time) {
- if (!time) return "";
- const date = new Date(time);
- return `${date.getFullYear()}-${(date.getMonth() + 1)
- .toString()
- .padStart(2, "0")}-${date
- .getDate()
- .toString()
- .padStart(2, "0")} ${date
- .getHours()
- .toString()
- .padStart(2, "0")}:${date
- .getMinutes()
- .toString()
- .padStart(2, "0")}`;
+
+ /** 鏃ユ湡鏃堕棿鏍煎紡鍖� */
+ 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;
+ }
}
}
};
@@ -938,6 +1325,44 @@
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;
+}
+
+.attachment-tip {
+ font-size: 12px;
+ color: #909399;
+ margin-left: auto;
+}
+
+.attachment-list {
+ margin-top: 16px;
+}
+
+.list-title {
+ font-weight: bold;
+ margin-bottom: 12px;
+ color: #303133;
+ font-size: 14px;
+}
+
+.file-name {
+ font-size: 13px;
+ margin-left: 8px;
}
.detail-title {
@@ -964,17 +1389,13 @@
}
.stat-label {
- /* font-size: 12px; */
opacity: 0.9;
-
- /* color: #606266; */
margin-bottom: 5px;
}
.stat-value {
font-size: 20px;
font-weight: bold;
- /* color: #303133; */
}
/* 绌虹姸鎬佹牱寮� */
--
Gitblit v1.9.3