From c441e5f3cb734b5db5e893536f267b13814796f5 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 11 三月 2026 10:12:06 +0800
Subject: [PATCH] 青岛推送
---
src/views/business/decide/DecideInfo.vue | 280 +++++++++++++++++++++++++++++++++++---------------------
1 files changed, 175 insertions(+), 105 deletions(-)
diff --git a/src/views/business/decide/DecideInfo.vue b/src/views/business/decide/DecideInfo.vue
index 74ca8c9..32252de 100644
--- a/src/views/business/decide/DecideInfo.vue
+++ b/src/views/business/decide/DecideInfo.vue
@@ -6,8 +6,8 @@
<span class="detail-title">姝讳骸鍒ゅ畾鍩烘湰淇℃伅</span>
<el-button
v-if="isEdit"
- type="primary"
- style="float: right; padding: 3px 0"
+ type="success"
+ style="float: right"
@click="handleSave"
:loading="saveLoading"
>
@@ -16,7 +16,7 @@
<el-button
v-else
type="primary"
- style="float: right; padding: 3px 0"
+ style="float: right"
@click="handleEdit"
>
缂栬緫淇℃伅
@@ -138,7 +138,10 @@
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="璐熻矗浜�" prop="responsibleusername">
- <el-input v-model="form.responsibleusername" :readonly="!isEdit" />
+ <el-input
+ v-model="form.responsibleusername"
+ :readonly="!isEdit"
+ />
</el-form-item>
</el-col>
<el-col :span="8">
@@ -166,7 +169,7 @@
<el-card class="attachment-card">
<div slot="header" class="clearfix">
<span class="detail-title">姝讳骸鍒ゅ畾璇勪及琛ㄩ檮浠�</span>
- <el-button
+ <!-- <el-button
v-if="isEdit"
type="primary"
size="mini"
@@ -174,7 +177,7 @@
:loading="uploadLoading"
>
涓婁紶闄勪欢
- </el-button>
+ </el-button> -->
</div>
<!-- 闄勪欢绫诲瀷閫夐」鍗� -->
@@ -221,7 +224,9 @@
<el-table-column label="鏂囦欢绫诲瀷" width="100" align="center">
<template slot-scope="scope">
- <el-tag size="small">{{ getFileType(scope.row.fileName) }}</el-tag>
+ <el-tag size="small">{{
+ getFileType(scope.row.fileName)
+ }}</el-tag>
</template>
</el-table-column>
@@ -243,11 +248,7 @@
</template>
</el-table-column>
- <el-table-column
- label="鎿嶄綔"
- width="180"
- align="center"
- >
+ <el-table-column label="鎿嶄綔" width="180" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@@ -280,7 +281,10 @@
v-if="getAttachmentsByType(type.value).length === 0"
class="empty-attachment"
>
- <el-empty description="鏆傛棤璇勪及琛ㄩ檮浠�" :image-size="80"></el-empty>
+ <el-empty
+ description="鏆傛棤璇勪及琛ㄩ檮浠�"
+ :image-size="80"
+ ></el-empty>
</div>
</div>
</el-tab-pane>
@@ -298,16 +302,20 @@
ref="uploadRef"
class="upload-demo"
drag
- action="#"
+ :action="uploadAction"
+ :headers="headers"
multiple
:file-list="tempFileList"
:before-upload="beforeUpload"
:on-change="handleFileChange"
:on-remove="handleTempRemove"
+ :on-success="handleUploadSuccess"
:auto-upload="false"
>
<i class="el-icon-upload"></i>
- <div class="el-upload__text">灏嗚瘎浼拌〃鏂囦欢鎷栧埌姝ゅ锛屾垨<em>鐐瑰嚮涓婁紶</em></div>
+ <div class="el-upload__text">
+ 灏嗚瘎浼拌〃鏂囦欢鎷栧埌姝ゅ锛屾垨<em>鐐瑰嚮涓婁紶</em>
+ </div>
<div class="el-upload__tip" slot="tip">
鏀寔涓婁紶pdf銆乯pg銆乸ng銆乨oc銆乨ocx銆亁ls銆亁lsx鏍煎紡鏂囦欢锛屽崟涓枃浠朵笉瓒呰繃10MB
</div>
@@ -330,6 +338,7 @@
<script>
import { deathinfoedit, deathinfoInfo } from "@/api/businessApi";
+import { getToken } from "@/utils/auth";
export default {
name: "DeathJudgmentDetail",
@@ -384,7 +393,10 @@
uploadLoading: false,
tempFileList: [],
currentUploadType: "",
-
+ uploadAction: process.env.VUE_APP_BASE_API + "/common/upload",
+ headers: {
+ Authorization: "Bearer " + getToken()
+ },
// 璇勪及琛ㄧ被鍨嬪畾涔�
attachmentTypes: [
{ value: "1", label: "鑴戞浜″垽瀹氳〃" },
@@ -410,10 +422,10 @@
},
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.isEdit = this.$route.query.isEdit;
+ if (id && !this.$route.path.includes("/add")) {
this.getDetail(id);
- } else if (this.$route.path.includes('/add')) {
+ } else if (this.$route.path.includes("/add")) {
this.generateDonorNo();
}
this.getAttachmentList();
@@ -422,12 +434,12 @@
// 鐢熸垚鎹愮尞鑰呯紪鍙�
generateDonorNo() {
const timestamp = Date.now().toString();
- this.form.donorno = 'DONOR' + timestamp.slice(-8);
+ this.form.donorno = "DONOR" + timestamp.slice(-8);
},
// 鑾峰彇璇︽儏
async getDetail(id) {
try {
- const response = await deathinfoInfo({ id });
+ const response = await deathinfoInfo(id);
let realData = {};
if (response && response.data) {
@@ -441,18 +453,21 @@
...this.form,
...realData,
// 纭繚鏁板�肩被鍨嬪瓧娈垫纭浆鎹�
- isspendremember: realData.isspendremember ? parseInt(realData.isspendremember) : 0,
- isrestoreremains: realData.isrestoreremains ? parseInt(realData.isrestoreremains) : 0
+ isspendremember: realData.isspendremember
+ ? parseInt(realData.isspendremember)
+ : 0,
+ isrestoreremains: realData.isrestoreremains
+ ? parseInt(realData.isrestoreremains)
+ : 0
};
// 瑙f瀽闄勪欢淇℃伅
if (realData.rememberannex) {
this.parseAttachmentData(realData.rememberannex);
}
-
} catch (error) {
- console.error('鑾峰彇姝讳骸鍒ゅ畾璇︽儏澶辫触:', error);
- this.$message.error('鏁版嵁鍔犺浇澶辫触');
+ console.error("鑾峰彇姝讳骸鍒ゅ畾璇︽儏澶辫触:", error);
+ this.$message.error("鏁版嵁鍔犺浇澶辫触");
}
},
// 瑙f瀽闄勪欢鏁版嵁
@@ -465,7 +480,7 @@
}
}
} catch (error) {
- console.error('瑙f瀽闄勪欢鏁版嵁澶辫触:', error);
+ console.error("瑙f瀽闄勪欢鏁版嵁澶辫触:", error);
}
},
// 鏋勫缓闄勪欢JSON鏁版嵁
@@ -477,7 +492,7 @@
const statusMap = {
"0": "warning", // 缁存姢涓�
"1": "success", // 宸插畬鎴�
- "99": "danger" // 宸茬粓姝�
+ "99": "danger" // 宸茬粓姝�
};
return statusMap[status] || "info";
},
@@ -504,16 +519,19 @@
},
// 鑾峰彇鏂囦欢绫诲瀷
getFileType(fileName) {
- const ext = fileName.split('.').pop().toLowerCase();
+ const ext = fileName
+ .split(".")
+ .pop()
+ .toLowerCase();
const typeMap = {
- 'pdf': 'PDF',
- 'doc': 'DOC',
- 'docx': 'DOCX',
- 'xls': 'XLS',
- 'xlsx': 'XLSX',
- 'jpg': 'JPG',
- 'jpeg': 'JPEG',
- 'png': 'PNG'
+ pdf: "PDF",
+ doc: "DOC",
+ docx: "DOCX",
+ xls: "XLS",
+ xlsx: "XLSX",
+ jpg: "JPG",
+ jpeg: "JPEG",
+ png: "PNG"
};
return typeMap[ext] || ext.toUpperCase();
},
@@ -531,34 +549,37 @@
// 涓婁紶鍓嶆牎楠�
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'
+ "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');
+ 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鏍煎紡鏂囦欢');
+ this.$message.error(
+ "鏂囦欢鏍煎紡涓嶆敮鎸侊紝璇蜂笂浼爌df銆乯pg銆乸ng銆乨oc銆乨ocx銆亁ls鎴杧lsx鏍煎紡鏂囦欢"
+ );
return false;
}
if (file.size > maxSize) {
- this.$message.error('鏂囦欢澶у皬涓嶈兘瓒呰繃10MB');
+ this.$message.error("鏂囦欢澶у皬涓嶈兘瓒呰繃10MB");
return false;
}
@@ -572,16 +593,11 @@
handleTempRemove(file, fileList) {
this.tempFileList = fileList;
},
- // 鎻愪氦涓婁紶
- async submitUpload() {
- if (this.tempFileList.length === 0) {
- this.$message.warning('璇峰厛閫夋嫨瑕佷笂浼犵殑鏂囦欢');
- return;
- }
-
- this.uploadLoading = true;
-
- try {
+ /** 涓婁紶鎴愬姛澶勭悊 */
+ handleUploadSuccess(response, file, fileList) {
+ if (response.code === 200) {
+ file.url = response.data || response.url;
+ this.$message.success("鏂囦欢涓婁紶鎴愬姛");
for (const file of this.tempFileList) {
const newAttachment = {
id: Date.now() + Math.random(),
@@ -590,8 +606,8 @@
fileName: file.name,
fileSize: file.size,
uploadTime: new Date().toISOString(),
- uploader: '褰撳墠鐢ㄦ埛',
- fileUrl: URL.createObjectURL(file.raw)
+ uploader: "褰撳墠鐢ㄦ埛",
+ fileUrl: file.url
};
this.attachmentList.push(newAttachment);
@@ -600,49 +616,92 @@
// 鏇存柊闄勪欢JSON鏁版嵁鍒拌〃鍗�
this.form.rememberannex = this.buildAttachmentJson();
- this.$message.success('鏂囦欢涓婁紶鎴愬姛');
+ this.$message.success("鏂囦欢涓婁紶鎴愬姛");
this.uploadDialogVisible = false;
- this.tempFileList = [];
- } catch (error) {
- this.$message.error('鏂囦欢涓婁紶澶辫触');
- console.error('涓婁紶澶辫触:', error);
- } finally {
this.uploadLoading = false;
+ this.tempFileList = [];
+ } else {
+ this.$message.error(response.msg || "鏂囦欢涓婁紶澶辫触");
}
+ },
+ // 鎻愪氦涓婁紶
+ async submitUpload() {
+ if (this.tempFileList.length === 0) {
+ this.$message.warning("璇峰厛閫夋嫨瑕佷笂浼犵殑鏂囦欢");
+ return;
+ }
+ this.$refs.uploadRef.submit();
+ 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);
+ // }
+
+ // // 鏇存柊闄勪欢JSON鏁版嵁鍒拌〃鍗�
+ // this.form.rememberannex = this.buildAttachmentJson();
+
+ // 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);
- // 鏇存柊闄勪欢JSON鏁版嵁鍒拌〃鍗�
- this.form.rememberannex = this.buildAttachmentJson();
- this.$message.success('璇勪及琛ㄥ垹闄ゆ垚鍔�');
- }
- }).catch(() => {});
+ 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);
+ // 鏇存柊闄勪欢JSON鏁版嵁鍒拌〃鍗�
+ this.form.rememberannex = this.buildAttachmentJson();
+ this.$message.success("璇勪及琛ㄥ垹闄ゆ垚鍔�");
+ }
+ })
+ .catch(() => {});
},
// 棰勮闄勪欢
handlePreview(attachment) {
- if (attachment.fileName.endsWith('.pdf')) {
- window.open(attachment.fileUrl, '_blank');
+ 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}">`,
- '鍥剧墖棰勮', {
+ this.$alert(
+ `<img src="${attachment.fileUrl}" style="max-width: 100%;" alt="${attachment.fileName}">`,
+ "鍥剧墖棰勮",
+ {
dangerouslyUseHTMLString: true,
- customClass: 'image-preview-dialog'
- });
+ customClass: "image-preview-dialog"
+ }
+ );
} else {
- this.$message.info('璇ユ枃浠剁被鍨嬫殏涓嶆敮鎸佸湪绾块瑙堬紝璇蜂笅杞藉悗鏌ョ湅');
+ this.$message.info("璇ユ枃浠剁被鍨嬫殏涓嶆敮鎸佸湪绾块瑙堬紝璇蜂笅杞藉悗鏌ョ湅");
}
},
// 涓嬭浇闄勪欢
handleDownload(attachment) {
- const link = document.createElement('a');
+ const link = document.createElement("a");
link.href = attachment.fileUrl;
link.download = attachment.fileName;
link.click();
@@ -669,18 +728,18 @@
const response = await deathinfoedit(submitData);
if (response.code === 200) {
- this.$message.success('淇濆瓨鎴愬姛');
+ this.$message.success("淇濆瓨鎴愬姛");
this.isEdit = false;
- if (this.$route.path.includes('/add')) {
- this.$router.push('/case/deathJudgment');
+ if (this.$route.path.includes("/add")) {
+ this.$router.push("/case/deathJudgment");
}
} else {
- this.$message.error(response.message || '淇濆瓨澶辫触');
+ this.$message.error(response.message || "淇濆瓨澶辫触");
}
} catch (error) {
- console.error('淇濆瓨澶辫触:', error);
- this.$message.error('淇濆瓨澶辫触');
+ console.error("淇濆瓨澶辫触:", error);
+ this.$message.error("淇濆瓨澶辫触");
} finally {
this.saveLoading = false;
}
@@ -689,17 +748,28 @@
},
// 鏂囦欢澶у皬鏍煎紡鍖�
formatFileSize(size) {
- if (size === 0) return '0 B';
+ if (size === 0) return "0 B";
const k = 1024;
- const sizes = ['B', 'KB', 'MB', 'GB'];
+ 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];
+ return parseFloat((size / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
},
// 鏃堕棿鏍煎紡鍖�
parseTime(time) {
- if (!time) return '';
+ 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')}`;
+ 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")}`;
}
}
};
--
Gitblit v1.9.3