From ed62678cd16042506bad5e5f75665a822f2d5717 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 30 十二月 2025 10:28:18 +0800
Subject: [PATCH] 数据更新推送
---
src/views/business/course/components/DeathJudgmentStage.vue | 789 +++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 613 insertions(+), 176 deletions(-)
diff --git a/src/views/business/course/components/DeathJudgmentStage.vue b/src/views/business/course/components/DeathJudgmentStage.vue
index f4d0e4b..b72f626 100644
--- a/src/views/business/course/components/DeathJudgmentStage.vue
+++ b/src/views/business/course/components/DeathJudgmentStage.vue
@@ -1,206 +1,643 @@
<template>
- <base-stage :stage-data="stageData" :case-info="caseInfo">
- <template #header>
- <el-alert
- title="姝讳骸鍒ゅ畾闃舵"
- :type="stageData.status === 'completed' ? 'success' : 'warning'"
- :description="getAlertDescription()"
- show-icon
- :closable="false"
- />
- </template>
-
- <el-row :gutter="20" style="margin-top: 20px;">
- <el-col :span="12">
- <el-card>
- <div slot="header" class="card-header">
- <span>鍒ゅ畾鍩烘湰淇℃伅</span>
- </div>
- <el-descriptions :column="1" border>
- <el-descriptions-item label="鍒ゅ畾绫诲瀷">
- <el-tag type="primary">鑴戞浜″垽瀹�</el-tag>
- </el-descriptions-item>
- <el-descriptions-item label="鍒ゅ畾鏃堕棿">
- {{ formatTime(judgmentDetails.judgmentTime) }}
- </el-descriptions-item>
- <el-descriptions-item label="鍒ゅ畾鍖荤敓涓�">
- {{ judgmentDetails.doctor1 }}
- </el-descriptions-item>
- <el-descriptions-item label="鍒ゅ畾鍖荤敓浜�">
- {{ judgmentDetails.doctor2 }}
- </el-descriptions-item>
- <el-descriptions-item label="鍒ゅ畾缁撴灉">
- <el-tag :type="judgmentDetails.result ? 'success' : 'warning'">
- {{ judgmentDetails.result ? '鑴戞浜$‘璁�' : '鍒ゅ畾涓�' }}
- </el-tag>
- </el-descriptions-item>
- </el-descriptions>
- </el-card>
- </el-col>
-
- <el-col :span="12">
- <el-card>
- <div slot="header" class="card-header">
- <span>鍒ゅ畾娴佺▼璁板綍</span>
- </div>
- <el-steps direction="vertical" :active="judgmentSteps.active" space="100px">
- <el-step
- v-for="step in judgmentSteps.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>
+ <div class="death-judgment-detail">
+ <el-card class="detail-card">
+ <!-- 鍩虹淇℃伅 -->
+ <div slot="header" class="clearfix">
+ <span class="detail-title">姝讳骸鍒ゅ畾鍩烘湰淇℃伅</span>
</div>
- <el-table :data="judgmentRecords" border>
- <el-table-column label="妫�鏌ラ」鐩�" prop="item" width="180" />
- <el-table-column label="妫�鏌ユ柟娉�" prop="method" width="150" />
- <el-table-column label="妫�鏌ョ粨鏋�" prop="result" width="120">
- <template slot-scope="scope">
- <el-tag :type="scope.row.result === '绗﹀悎' ? 'success' : 'warning'">
- {{ scope.row.result }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="妫�鏌ユ椂闂�" width="160">
- <template slot-scope="scope">
- {{ formatTime(scope.row.time) }}
- </template>
- </el-table-column>
- <el-table-column label="妫�鏌ュ尰鐢�" prop="doctor" width="120" />
- <el-table-column label="澶囨敞" prop="remark" min-width="200" />
- </el-table>
+
+ <el-form :model="form" ref="form" :rules="rules" label-width="120px">
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="姝讳骸鍘熷洜" prop="deathReason">
+ <el-select
+ v-model="form.deathReason"
+ :disabled="!isEdit"
+ style="width: 100%"
+ >
+ <el-option label="鑴戞浜�" value="brain_death" />
+ <el-option label="蹇冩浜�" value="heart_death" />
+ <el-option label="鍏朵粬" value="other" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="姝讳骸鏃堕棿" prop="deathTime">
+ <el-date-picker
+ v-model="form.deathTime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ :disabled="!isEdit"
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鍒ゅ畾鍖荤敓涓�" prop="judgmentDoctor">
+ <el-input v-model="form.judgmentDoctorone" :readonly="!isEdit" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鍒ゅ畾鍖荤敓浜�" prop="judgmentDoctor">
+ <el-input v-model="form.judgmentDoctortwo" :readonly="!isEdit" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="8">
+ <el-form-item label="鐧昏浜�" prop="registrant">
+ <el-input v-model="form.registrant" :readonly="!isEdit" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ <el-form-item label="姝讳骸鍒ゅ畾璇存槑" prop="judgmentDescription">
+ <el-input
+ type="textarea"
+ :rows="3"
+ v-model="form.judgmentDescription"
+ :readonly="!isEdit"
+ placeholder="璇︾粏璁板綍姝讳骸鍒ゅ畾杩囩▼鍜屼緷鎹�"
+ />
+ </el-form-item>
+ </el-form>
</el-card>
- <template #footer>
- <div class="action-buttons" style="margin-top: 20px; text-align: center;">
- <el-button type="primary" @click="handleViewCertificate">
- 鏌ョ湅姝讳骸璇佹槑
- </el-button>
- <el-button type="success" @click="handleConfirmJudgment">
- 纭鍒ゅ畾缁撴灉
+ <!-- 璇勪及琛ㄩ檮浠� -->
+ <el-card class="attachment-card">
+ <div slot="header" class="clearfix">
+ <span class="detail-title">姝讳骸鍒ゅ畾璇勪及琛ㄩ檮浠�</span>
+ <el-button
+ v-if="isEdit"
+ type="primary"
+ size="mini"
+ @click="openUploadDialog"
+ :loading="uploadLoading"
+ >
+ 涓婁紶闄勪欢
</el-button>
</div>
- </template>
- </base-stage>
+
+ <!-- 闄勪欢绫诲瀷閫夐」鍗� -->
+ <el-tabs v-model="activeAttachmentType" type="card">
+ <el-tab-pane
+ v-for="type in attachmentTypes"
+ :key="type.value"
+ :label="type.label"
+ :name="type.value"
+ >
+ <div class="attachment-upload-section">
+ <div class="upload-header">
+ <span class="upload-title">{{ type.label }}</span>
+ <el-tooltip content="鐐瑰嚮涓婁紶璇ョ被鍨嬭瘎浼拌〃" placement="top">
+ <el-button
+ size="mini"
+ type="primary"
+ icon="el-icon-plus"
+ @click="openUploadDialog(type.value)"
+ :disabled="!isEdit"
+ >
+ 娣诲姞璇勪及琛�
+ </el-button>
+ </el-tooltip>
+ </div>
+
+ <!-- 闄勪欢鍒楄〃 -->
+ <el-table
+ :data="getAttachmentsByType(type.value)"
+ v-loading="attachmentLoading"
+ style="width: 100%; margin-top: 15px;"
+ >
+ <el-table-column label="鏂囦欢鍚嶇О" min-width="200">
+ <template slot-scope="scope">
+ <div class="file-info">
+ <i
+ class="el-icon-document"
+ style="margin-right: 8px; color: #409EFF;"
+ ></i>
+ <span>{{ scope.row.fileName }}</span>
+ </div>
+ </template>
+ </el-table-column>
+
+ <el-table-column label="鏂囦欢绫诲瀷" width="100" align="center">
+ <template slot-scope="scope">
+ <el-tag size="small">{{
+ getFileType(scope.row.fileName)
+ }}</el-tag>
+ </template>
+ </el-table-column>
+
+ <el-table-column label="鏂囦欢澶у皬" width="100" align="center">
+ <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="100" align="center">
+ <template slot-scope="scope">
+ <span>{{ scope.row.uploader }}</span>
+ </template>
+ </el-table-column>
+
+ <el-table-column label="鎿嶄綔" width="180" align="center">
+ <template slot-scope="scope">
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-view"
+ @click="handlePreview(scope.row)"
+ >棰勮</el-button
+ >
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-download"
+ @click="handleDownload(scope.row)"
+ >涓嬭浇</el-button
+ >
+ <el-button
+ v-if="isEdit"
+ size="mini"
+ type="text"
+ icon="el-icon-delete"
+ style="color: #F56C6C;"
+ @click="handleRemoveAttachment(scope.row)"
+ >鍒犻櫎</el-button
+ >
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <div
+ v-if="getAttachmentsByType(type.value).length === 0"
+ class="empty-attachment"
+ >
+ <el-empty
+ description="鏆傛棤璇勪及琛ㄩ檮浠�"
+ :image-size="80"
+ ></el-empty>
+ </div>
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ </el-card>
+
+ <!-- 涓婁紶瀵硅瘽妗� -->
+ <el-dialog
+ :title="`涓婁紶${getCurrentTypeLabel}璇勪及琛╜"
+ :visible.sync="uploadDialogVisible"
+ width="500px"
+ :close-on-click-modal="false"
+ >
+ <el-upload
+ ref="uploadRef"
+ class="upload-demo"
+ drag
+ action="#"
+ multiple
+ :file-list="tempFileList"
+ :before-upload="beforeUpload"
+ :on-change="handleFileChange"
+ :on-remove="handleTempRemove"
+ :auto-upload="false"
+ >
+ <i class="el-icon-upload"></i>
+ <div class="el-upload__text">
+ 灏嗚瘎浼拌〃鏂囦欢鎷栧埌姝ゅ锛屾垨<em>鐐瑰嚮涓婁紶</em>
+ </div>
+ <div class="el-upload__tip" slot="tip">
+ 鏀寔涓婁紶pdf銆乯pg銆乸ng銆乨oc銆乨ocx銆亁ls銆亁lsx鏍煎紡鏂囦欢锛屽崟涓枃浠朵笉瓒呰繃10MB
+ </div>
+ </el-upload>
+
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="uploadDialogVisible = false">鍙栨秷</el-button>
+ <el-button
+ type="primary"
+ @click="submitUpload"
+ :loading="uploadLoading"
+ :disabled="tempFileList.length === 0"
+ >
+ 纭涓婁紶
+ </el-button>
+ </div>
+ </el-dialog>
+ </div>
</template>
<script>
-import BaseStage from './BaseStage.vue';
+import {
+ getDeathJudgmentDetail,
+ updateDeathJudgment
+} from "./api/mockDeathJudgmentApi";
export default {
- name: 'DeathJudgmentStage',
- components: { BaseStage },
- props: {
- stageData: {
- type: Object,
- default: () => ({})
- },
- caseInfo: {
- type: Object,
- default: () => ({})
- }
- },
+ name: "DeathJudgmentDetail",
data() {
return {
- judgmentDetails: {
- judgmentTime: '2023-12-03 09:15:00',
- doctor1: '寮犱富浠�',
- doctor2: '鐜嬪尰鐢�',
- result: true,
- certificateNo: 'SW20231203001'
+ // 鏄惁缂栬緫妯″紡
+ isEdit: false,
+ // 淇濆瓨鍔犺浇鐘舵��
+ saveLoading: false,
+ // 琛ㄥ崟鏁版嵁
+ form: {
+ id: undefined,
+ hospitalNo: "",
+ donorName: "",
+ gender: "",
+ age: "",
+ diagnosis: "",
+ deathReason: "",
+ deathTime: "",
+ judgmentDoctor: "",
+ judgmentDescription: "",
+ registrant: "",
+ registrationTime: ""
},
- judgmentSteps: {
- active: 4,
- steps: [
- {
- title: '鍒濇涓村簥妫�鏌�',
- description: '瀹屾垚鑷富鍛煎惛娴嬭瘯',
- status: 'finish'
- },
- {
- title: '鑴戝共鍙嶅皠娴嬭瘯',
- description: '鍚勯」鍙嶅皠娴嬭瘯瀹屾垚',
- status: 'finish'
- },
- {
- title: '纭鎬ф鏌�',
- description: '鑴戠數鍥炬鏌ュ畬鎴�',
- status: 'finish'
- },
- {
- title: '鏈�缁堝垽瀹�',
- description: '涓や綅鍖荤敓鐙珛鍒ゅ畾',
- status: 'finish'
- }
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ rules: {
+ donorName: [
+ { required: true, message: "鎹愮尞鑰呭鍚嶄笉鑳戒负绌�", trigger: "blur" }
+ ],
+ deathReason: [
+ { required: true, message: "姝讳骸鍘熷洜涓嶈兘涓虹┖", trigger: "change" }
+ ],
+ deathTime: [
+ { required: true, message: "姝讳骸鏃堕棿涓嶈兘涓虹┖", trigger: "change" }
+ ],
+ judgmentDoctor: [
+ { required: true, message: "鍒ゅ畾鍖荤敓涓嶈兘涓虹┖", trigger: "blur" }
]
},
- judgmentRecords: [
- {
- item: '鑷富鍛煎惛娴嬭瘯',
- method: '鍛煎惛鏆傚仠璇曢獙',
- result: '绗﹀悎',
- time: '2023-12-03 08:30:00',
- doctor: '寮犱富浠�',
- remark: '鏃犺嚜涓诲懠鍚�'
- },
- {
- item: '鐬冲瓟瀵瑰厜鍙嶅皠',
- method: '鍏夊埡婵�娴嬭瘯',
- result: '绗﹀悎',
- time: '2023-12-03 08:45:00',
- doctor: '鐜嬪尰鐢�',
- remark: '鐬冲瓟鍥哄畾锛屽鍏夊弽灏勬秷澶�'
- },
- {
- item: '鑴戝共鍚璇卞彂鐢典綅',
- method: 'BAEP妫�鏌�',
- result: '绗﹀悎',
- time: '2023-12-03 09:00:00',
- doctor: '鏉庡尰鐢�',
- remark: '鑴戝共鍔熻兘涓уけ'
- }
- ]
+ // 闄勪欢鐩稿叧鏁版嵁
+ activeAttachmentType: "1",
+ attachmentLoading: false,
+ uploadDialogVisible: false,
+ uploadLoading: false,
+ tempFileList: [],
+ currentUploadType: "",
+
+ // 璇勪及琛ㄧ被鍨嬪畾涔�
+ attachmentTypes: [
+ { value: "1", label: "鑴戞浜″垽瀹氳〃" },
+ { value: "2", label: "鑴戠數鍥捐瘎浼拌〃" },
+ { value: "3", label: "鐭綔浼忔湡浣撴劅璇卞彂鐢典綅璇勪及琛�" },
+ { value: "4", label: "缁忛澶氭櫘鍕掕秴澹拌瘎浼拌褰�" },
+ { value: "5", label: "鍗仴濮旇剳鎹熶激璐ㄦ帶涓績 - 涓村簥缁煎悎璇勪及琛�" },
+ { value: "6", label: "UW璇勫垎琛�" },
+ { value: "7", label: "蹇冩浜″垽瀹氳〃" }
+ ],
+
+ // 闄勪欢鍒楄〃鏁版嵁
+ attachmentList: []
};
},
+ computed: {
+ getCurrentTypeLabel() {
+ const type = this.attachmentTypes.find(
+ t => t.value === this.currentUploadType
+ );
+ return type ? type.label : "";
+ }
+ },
+ created() {
+ const id = this.$route.query.id;
+ this.isEdit =
+ this.$route.path.includes("/edit") || this.$route.path.includes("/add");
+ if (id && !this.$route.path.includes("/add")) {
+ this.getDetail(id);
+ } else if (this.$route.path.includes("/add")) {
+ this.generateHospitalNo();
+ }
+ this.getAttachmentList();
+ },
methods: {
- getAlertDescription() {
- if (this.stageData.status === 'completed') {
- return '鑴戞浜″垽瀹氬凡瀹屾垚锛岀鍚堝櫒瀹樻崘鐚潯浠�';
- } else if (this.stageData.status === 'in_progress') {
- return '姝讳骸鍒ゅ畾娴佺▼姝e湪杩涜涓�';
- }
- return '绛夊緟寮�濮嬫浜″垽瀹氭祦绋�';
+ // 鐢熸垚浣忛櫌鍙�
+ generateHospitalNo() {
+ // 妯℃嫙鐢熸垚浣忛櫌鍙凤細D + 鏃堕棿鎴冲悗6浣�
+ const timestamp = Date.now().toString();
+ this.form.hospitalNo = "D" + timestamp.slice(-6);
},
- handleViewCertificate() {
- this.$message.info('鏌ョ湅姝讳骸璇佹槑鍔熻兘');
- },
- handleConfirmJudgment() {
- this.$confirm('纭姝讳骸鍒ゅ畾缁撴灉鍚楋紵', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
- this.$message.success('姝讳骸鍒ゅ畾缁撴灉宸茬‘璁�');
+ // 鑾峰彇璇︽儏
+ getDetail(id) {
+ getDeathJudgmentDetail(id).then(response => {
+ if (response.code === 200) {
+ this.form = response.data;
+ }
});
+ },
+ // 鑾峰彇闄勪欢鍒楄〃
+ getAttachmentList() {
+ this.attachmentLoading = true;
+ // 妯℃嫙闄勪欢鏁版嵁 - 瀹為檯椤圭洰涓粠鎺ュ彛鑾峰彇
+ setTimeout(() => {
+ this.attachmentList = [
+ {
+ id: 1,
+ type: "1",
+ typeName: "鑴戞浜″垽瀹氳〃",
+ fileName: "鑴戞浜″垽瀹氳〃_202512001.pdf",
+ fileSize: 2548321,
+ uploadTime: "2025-12-01 10:30:00",
+ uploader: "寮犲尰鐢�",
+ fileUrl: "/attachments/brain_death_1.pdf"
+ },
+ {
+ id: 2,
+ type: "2",
+ typeName: "鑴戠數鍥捐瘎浼拌〃",
+ fileName: "鑴戠數鍥捐瘎浼拌〃_202512001.docx",
+ fileSize: 512345,
+ uploadTime: "2025-12-01 14:20:00",
+ uploader: "鏉庡尰鐢�",
+ fileUrl: "/attachments/eeg_1.docx"
+ }
+ ];
+ this.attachmentLoading = false;
+ }, 500);
+ },
+ // 鏍规嵁绫诲瀷鑾峰彇闄勪欢
+ getAttachmentsByType(type) {
+ return this.attachmentList.filter(item => item.type === type);
+ },
+ // 鑾峰彇鏂囦欢绫诲瀷
+ getFileType(fileName) {
+ const ext = 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();
+ },
+ // 鎵撳紑涓婁紶瀵硅瘽妗�
+ openUploadDialog(type = null) {
+ this.currentUploadType = type || this.activeAttachmentType;
+ this.tempFileList = [];
+ this.uploadDialogVisible = true;
+ this.$nextTick(() => {
+ if (this.$refs.uploadRef) {
+ this.$refs.uploadRef.clearFiles();
+ }
+ });
+ },
+ // 涓婁紶鍓嶆牎楠�
+ beforeUpload(file) {
+ const allowedTypes = [
+ "application/pdf",
+ "image/jpeg",
+ "image/png",
+ "application/msword",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ "application/vnd.ms-excel",
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+ ];
+
+ const maxSize = 10 * 1024 * 1024; // 10MB
+
+ // 鏍¢獙鏂囦欢绫诲瀷
+ const isTypeOk =
+ allowedTypes.includes(file.type) ||
+ file.name.endsWith(".pdf") ||
+ file.name.endsWith(".jpg") ||
+ file.name.endsWith(".jpeg") ||
+ file.name.endsWith(".png") ||
+ file.name.endsWith(".doc") ||
+ file.name.endsWith(".docx") ||
+ file.name.endsWith(".xls") ||
+ file.name.endsWith(".xlsx");
+
+ if (!isTypeOk) {
+ this.$message.error(
+ "鏂囦欢鏍煎紡涓嶆敮鎸侊紝璇蜂笂浼爌df銆乯pg銆乸ng銆乨oc銆乨ocx銆亁ls鎴杧lsx鏍煎紡鏂囦欢"
+ );
+ return false;
+ }
+
+ // 鏍¢獙鏂囦欢澶у皬
+ if (file.size > maxSize) {
+ this.$message.error("鏂囦欢澶у皬涓嶈兘瓒呰繃10MB");
+ return false;
+ }
+
+ return true;
+ },
+ // 鏂囦欢閫夋嫨鍙樺寲
+ handleFileChange(file, fileList) {
+ this.tempFileList = fileList;
+ },
+ // 绉婚櫎涓存椂鏂囦欢
+ handleTempRemove(file, fileList) {
+ this.tempFileList = fileList;
+ },
+ // 鎻愪氦涓婁紶
+ async submitUpload() {
+ if (this.tempFileList.length === 0) {
+ this.$message.warning("璇峰厛閫夋嫨瑕佷笂浼犵殑鏂囦欢");
+ return;
+ }
+
+ this.uploadLoading = true;
+
+ try {
+ // 妯℃嫙涓婁紶杩囩▼ - 瀹為檯椤圭洰涓皟鐢ㄤ笂浼犳帴鍙�
+ for (const file of this.tempFileList) {
+ const newAttachment = {
+ id: Date.now() + Math.random(),
+ type: this.currentUploadType,
+ typeName: this.getCurrentTypeLabel,
+ fileName: file.name,
+ fileSize: file.size,
+ uploadTime: new Date().toISOString(),
+ uploader: "褰撳墠鐢ㄦ埛",
+ fileUrl: URL.createObjectURL(file.raw)
+ };
+
+ this.attachmentList.push(newAttachment);
+ }
+
+ this.$message.success("鏂囦欢涓婁紶鎴愬姛");
+ this.uploadDialogVisible = false;
+ this.tempFileList = [];
+ } catch (error) {
+ this.$message.error("鏂囦欢涓婁紶澶辫触");
+ console.error("涓婁紶澶辫触:", error);
+ } finally {
+ this.uploadLoading = false;
+ }
+ },
+ // 鍒犻櫎闄勪欢
+ handleRemoveAttachment(attachment) {
+ this.$confirm("纭畾瑕佸垹闄よ繖涓瘎浼拌〃闄勪欢鍚楋紵", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ const index = this.attachmentList.findIndex(
+ item => item.id === attachment.id
+ );
+ if (index !== -1) {
+ this.attachmentList.splice(index, 1);
+ this.$message.success("璇勪及琛ㄥ垹闄ゆ垚鍔�");
+ }
+ })
+ .catch(() => {});
+ },
+ // 棰勮闄勪欢
+ handlePreview(attachment) {
+ if (attachment.fileName.endsWith(".pdf")) {
+ window.open(attachment.fileUrl, "_blank");
+ } else if (attachment.fileName.match(/\.(jpg|jpeg|png)$/i)) {
+ this.$alert(
+ `<img src="${attachment.fileUrl}" style="max-width: 100%;" alt="${attachment.fileName}">`,
+ "鍥剧墖棰勮",
+ {
+ dangerouslyUseHTMLString: true,
+ customClass: "image-preview-dialog"
+ }
+ );
+ } else {
+ this.$message.info("璇ユ枃浠剁被鍨嬫殏涓嶆敮鎸佸湪绾块瑙堬紝璇蜂笅杞藉悗鏌ョ湅");
+ }
+ },
+ // 涓嬭浇闄勪欢
+ handleDownload(attachment) {
+ // 瀹為檯椤圭洰涓皟鐢ㄤ笅杞芥帴鍙�
+ const link = document.createElement("a");
+ link.href = attachment.fileUrl;
+ link.download = attachment.fileName;
+ link.click();
+ this.$message.success(`寮�濮嬩笅杞�: ${attachment.fileName}`);
+ },
+ // 淇濆瓨淇℃伅
+ handleSave() {
+ this.$refs.form.validate(valid => {
+ if (valid) {
+ this.saveLoading = true;
+
+ // 妯℃嫙淇濆瓨杩囩▼
+ updateDeathJudgment(this.form)
+ .then(response => {
+ if (response.code === 200) {
+ this.$message.success("淇濆瓨鎴愬姛");
+ if (this.$route.path.includes("/add")) {
+ this.$router.push("/case/deathJudgment");
+ } else {
+ this.isEdit = false;
+ }
+ }
+ })
+ .catch(error => {
+ console.error("淇濆瓨澶辫触:", error);
+ this.$message.error("淇濆瓨澶辫触");
+ })
+ .finally(() => {
+ this.saveLoading = false;
+ });
+ }
+ });
+ },
+ // 鏂囦欢澶у皬鏍煎紡鍖�
+ formatFileSize(size) {
+ if (size === 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];
+ },
+ // 鏃堕棿鏍煎紡鍖�
+ 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")}`;
}
}
};
</script>
<style scoped>
-.action-buttons {
+.death-judgment-detail {
+ padding: 20px;
+}
+
+.detail-card {
+ margin-bottom: 20px;
+}
+
+.attachment-card {
+ margin-bottom: 20px;
+}
+
+.detail-title {
+ font-size: 16px;
+ font-weight: bold;
+}
+
+.attachment-upload-section {
+ padding: 10px;
+}
+
+.upload-header {
display: flex;
- justify-content: center;
- gap: 15px;
- margin-top: 20px;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 15px;
+}
+
+.upload-title {
+ font-size: 14px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.file-info {
+ display: flex;
+ align-items: center;
+}
+
+.empty-attachment {
+ text-align: center;
+ padding: 40px 0;
+ color: #909399;
+}
+
+/* 鍥剧墖棰勮瀵硅瘽妗嗘牱寮� */
+:deep(.image-preview-dialog) {
+ width: auto;
+ max-width: 90vw;
+}
+
+:deep(.image-preview-dialog .el-message-box__content) {
+ text-align: center;
}
</style>
--
Gitblit v1.9.3