From c4599aa279fd2f90b741608392e056fbae2282d5 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期四, 20 八月 2026 17:16:54 +0800
Subject: [PATCH] 各表单布局调整
---
src/views/business/GetWitness/GetWitnessInfo.vue | 776 +++++++++++++++++++++++++++++++---------------------------
1 files changed, 414 insertions(+), 362 deletions(-)
diff --git a/src/views/business/GetWitness/GetWitnessInfo.vue b/src/views/business/GetWitness/GetWitnessInfo.vue
index d42c8bd..48c1e5e 100644
--- a/src/views/business/GetWitness/GetWitnessInfo.vue
+++ b/src/views/business/GetWitness/GetWitnessInfo.vue
@@ -1,129 +1,113 @@
<template>
<div class="organ-procurement-detail">
- <case-basic-info :case-id="caseId" :show-attachment="true" />
+ <case-basic-info :case-id="caseId" :show-attachment="true":column="3" />
<!-- 鍩烘湰淇℃伅 -->
- <el-card class="detail-card">
+ <el-card class="detail-card paper-card">
<div slot="header" class="clearfix">
<span class="detail-title">鍣ㄥ畼鑾峰彇鍩烘湰淇℃伅</span>
</div>
- <el-form :model="form" ref="form" :rules="rules" label-width="120px">
+ <el-form :model="form" ref="form" :rules="rules" label-width="120px" class="paper-form">
<!-- 鎵嬫湳鐩稿叧淇℃伅 -->
<el-divider content-position="left">鎵嬫湳淇℃伅</el-divider>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="鎵嬫湳鍖荤敓" prop="operationdoctor">
- <el-input v-model="form.operationdoctor" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="鎵嬫湳寮�濮嬫椂闂�" prop="operationbegtime">
- <el-date-picker
- v-model="form.operationbegtime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="鎵嬫湳缁撴潫鏃堕棿" prop="operationendtime">
- <el-date-picker
- v-model="form.operationendtime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- </el-row>
+ <div class="form-row">
+ <el-form-item label="鎵嬫湳鍖荤敓" prop="operationdoctor" class="col-1-3">
+ <el-input v-model="form.operationdoctor" />
+ </el-form-item>
+ <el-form-item label="鎵嬫湳寮�濮嬫椂闂�" prop="operationbegtime" class="col-1-3">
+ <el-date-picker
+ v-model="form.operationbegtime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ <el-form-item label="鎵嬫湳缁撴潫鏃堕棿" prop="operationendtime" class="col-1-3">
+ <el-date-picker
+ v-model="form.operationendtime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ </div>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item
- label="鑵逛富鍔ㄨ剦鎻掔鏃堕棿"
- prop="abdominalaortacannulatime"
- >
- <el-date-picker
- v-model="form.abdominalaortacannulatime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item
- label="鑵逛富鍔ㄨ剦鐏屾敞鏃堕棿"
- prop="abdominalaortaperfusiontime"
- >
- <el-date-picker
- v-model="form.abdominalaortaperfusiontime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- </el-row>
+ <div class="form-row">
+ <el-form-item
+ label="鑵逛富鍔ㄨ剦鎻掔鏃堕棿"
+ prop="abdominalaortacannulatime"
+ class="col-1-3"
+ >
+ <el-date-picker
+ v-model="form.abdominalaortacannulatime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ <el-form-item
+ label="鑵逛富鍔ㄨ剦鐏屾敞鏃堕棿"
+ prop="abdominalaortaperfusiontime"
+ class="col-1-3"
+ >
+ <el-date-picker
+ v-model="form.abdominalaortaperfusiontime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ </div>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="闂ㄩ潤鑴夋彃绠℃椂闂�" prop="portalveincannulatime">
- <el-date-picker
- v-model="form.portalveincannulatime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="闂ㄩ潤鑴夌亴娉ㄦ椂闂�" prop="portalveinperfusiontime">
- <el-date-picker
- v-model="form.portalveinperfusiontime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- </el-row>
+ <div class="form-row">
+ <el-form-item label="闂ㄩ潤鑴夋彃绠℃椂闂�" prop="portalveincannulatime" class="col-1-3">
+ <el-date-picker
+ v-model="form.portalveincannulatime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ <el-form-item label="闂ㄩ潤鑴夌亴娉ㄦ椂闂�" prop="portalveinperfusiontime" class="col-1-3">
+ <el-date-picker
+ v-model="form.portalveinperfusiontime"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ </div>
<!-- 鍗忚皟鍛樹俊鎭� -->
<el-divider content-position="left">鍗忚皟鍛樹俊鎭�</el-divider>
- <el-row :gutter="20">
+ <div class="form-row">
<!-- <el-col :span="8">
<el-form-item label="鍗忚皟鍛樺鍚�" prop="coordinatorName">
<el-input v-model="form.coordinatorName" />
</el-form-item>
</el-col> -->
- <el-col :span="8">
- <el-form-item label="杩涙墜鏈鏃堕棿" prop="coordinatorInOperating">
- <el-date-picker
- v-model="form.coordinatorInOperating"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="鍑烘墜鏈鏃堕棿" prop="coordinatorOutOperating">
- <el-date-picker
- v-model="form.coordinatorOutOperating"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- </el-row>
+ <el-form-item label="杩涙墜鏈鏃堕棿" prop="coordinatorInOperating" class="col-1-3">
+ <el-date-picker
+ v-model="form.coordinatorInOperating"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ <el-form-item label="鍑烘墜鏈鏃堕棿" prop="coordinatorOutOperating" class="col-1-3">
+ <el-date-picker
+ v-model="form.coordinatorOutOperating"
+ type="datetime"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 100%"
+ />
+ </el-form-item>
+ </div>
- <el-row :gutter="20">
+ <div class="form-row">
<!-- <el-col :span="8">
<el-form-item label="鍗忚皟鍛樼瀛�" prop="coordinatorSign">
<el-input v-model="form.coordinatorSign" />
@@ -139,57 +123,45 @@
/>
</el-form-item>
</el-col> -->
- <el-col :span="8">
- <el-form-item label="鏄惁榛樺搥缂呮��" prop="isspendremember">
- <el-select v-model="form.isspendremember" style="width: 100%">
- <el-option label="鏄�" :value="1" />
- <el-option label="鍚�" :value="0" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="鎭㈠閬椾綋浠" prop="isrestoreremains">
- <el-select v-model="form.isrestoreremains" style="width: 100%">
- <el-option label="鏄�" :value="1" />
- <el-option label="鍚�" :value="0" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
+ <el-form-item label="鏄惁榛樺搥缂呮��" prop="isspendremember" class="col-1-3">
+ <el-select v-model="form.isspendremember" style="width: 100%">
+ <el-option label="鏄�" :value="1" />
+ <el-option label="鍚�" :value="0" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鎭㈠閬椾綋浠" prop="isrestoreremains" class="col-1-3">
+ <el-select v-model="form.isrestoreremains" style="width: 100%">
+ <el-option label="鏄�" :value="1" />
+ <el-option label="鍚�" :value="0" />
+ </el-select>
+ </el-form-item>
+ </div>
<!-- 璐熻矗浜轰俊鎭� -->
<el-divider content-position="left">璐熻矗浜轰俊鎭�</el-divider>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="璐熻矗浜哄鍚�" prop="responsibleusername">
- <el-input v-model="form.responsibleusername" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="鍗忚皟鍛樹竴" prop="coordinatedusernameo">
- <el-input v-model="form.coordinatedusernameo" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="鍗忚皟鍛樹簩" prop="coordinatedusernamet">
- <el-input v-model="form.coordinatedusernamet" />
- </el-form-item>
- </el-col>
- </el-row>
+ <div class="form-row">
+ <el-form-item label="璐熻矗浜哄鍚�" prop="responsibleusername" class="col-1-3">
+ <el-input v-model="form.responsibleusername" />
+ </el-form-item>
+ <el-form-item label="鍗忚皟鍛樹竴" prop="coordinatedusernameo" class="col-1-3">
+ <el-input v-model="form.coordinatedusernameo" />
+ </el-form-item>
+ <el-form-item label="鍗忚皟鍛樹簩" prop="coordinatedusernamet" class="col-1-3">
+ <el-input v-model="form.coordinatedusernamet" />
+ </el-form-item>
+ </div>
<!-- 鑾峰彇鏈烘瀯淇℃伅 -->
<el-divider content-position="left">鑾峰彇鏈烘瀯淇℃伅</el-divider>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="鑾峰彇鏈烘瀯鍚嶇О" prop="gainhospitalname">
- <el-input
- v-model="form.gainhospitalname"
- placeholder="璇疯緭鍏ヨ幏鍙栨満鏋勫悕绉�"
- />
- </el-form-item>
- </el-col>
+ <div class="form-row">
+ <el-form-item label="鑾峰彇鏈烘瀯鍚嶇О" prop="gainhospitalname" class="col-1-3">
+ <el-input
+ v-model="form.gainhospitalname"
+ placeholder="璇疯緭鍏ヨ幏鍙栨満鏋勫悕绉�"
+ />
+ </el-form-item>
<!-- <el-col :span="8">
<el-form-item label="鎹愮尞缂栧彿" prop="gainhospitalno">
<el-input
@@ -198,7 +170,7 @@
/>
</el-form-item>
</el-col> -->
- </el-row>
+ </div>
</el-form>
</el-card>
@@ -425,42 +397,30 @@
<span class="detail-title">鐩稿叧闄勪欢</span>
</div>
- <!-- 涓婁紶鍖哄煙锛堟棤鍒嗙被閫夋嫨锛岀敱Tab鎺у埗锛� -->
- <div class="upload-wrapper">
- <UploadAttachment
- ref="uploadAttachment"
- :file-list="attachmentFileList"
- :limit="attachmentLimit"
- :accept="attachmentAccept"
- :multiple="true"
- @change="handleAttachmentChange"
- @upload-success="handleUploadSuccess"
- @upload-error="handleUploadError"
- @remove="handleAttachmentRemove"
- />
- <div style="font-size:12px; color:#909399; margin-top:4px;">
- 褰撳墠涓婁紶鍒嗙被锛�<el-tag size="small" type="info">{{
- activeTab === "鏈垎绫�" ? "鏈垎绫�" : activeTab
- }}</el-tag>
- 锛堝垏鎹� Tab 鍙敼鍙樹笂浼犲垎绫伙級
- </div>
- </div>
-
<!-- 闄勪欢鍒楄〃 - 鍒嗙被Tab灞曠ず锛屾敮鎸佷慨鏀瑰垎绫� -->
- <div class="attachment-list" v-if="attachments && attachments.length > 0">
- <el-tabs v-model="activeTab" type="border-card">
- <el-tab-pane
- v-for="category in categories"
- :key="category"
- :label="category + '(' + getCategoryCount(category) + ')'"
- :name="category"
- >
- <el-table
- :data="getCategoryFiles(category)"
- style="width: 100%"
- size="small"
- border
+ <el-tabs v-model="activeTab" type="border-card">
+ <el-tab-pane
+ v-for="category in categories"
+ :key="category"
+ :label="category + '(' + getCategoryCount(category) + ')'"
+ :name="category"
+ >
+ <div style="margin-bottom: 10px; text-align: right;">
+ <el-button
+ size="mini"
+ type="primary"
+ icon="el-icon-plus"
+ @click="openUploadDialog(category)"
>
+ 娣诲姞闄勪欢
+ </el-button>
+ </div>
+ <el-table
+ :data="getCategoryFiles(category)"
+ style="width: 100%"
+ size="small"
+ border
+ >
<el-table-column label="鏂囦欢鍚�" min-width="180">
<template #default="scope">
<i
@@ -521,15 +481,15 @@
>
</template>
</el-table-column>
- </el-table>
- </el-tab-pane>
- </el-tabs>
- </div>
-
- <!-- 鏃犻檮浠舵椂鏄剧ず -->
- <div v-else style="text-align:center; padding:20px; color:#909399;">
- 鏆傛棤闄勪欢锛岃涓婁紶
- </div>
+ </el-table>
+ <div
+ v-if="getCategoryFiles(category).length === 0"
+ style="text-align:center; padding:20px; color:#909399;"
+ >
+ 鏆傛棤闄勪欢
+ </div>
+ </el-tab-pane>
+ </el-tabs>
</el-card>
<div style="text-align: center; margin: 30px 0;">
<el-button type="primary" @click="handleSave" :loading="saveLoading">
@@ -631,45 +591,68 @@
</div>
</el-dialog>
- <!-- 鏂囦欢棰勮寮圭獥 -->
+ <!-- 涓婁紶瀵硅瘽妗� -->
<el-dialog
- :title="filePreviewTitle"
- :visible.sync="filePreviewVisible"
- width="800px"
- @close="filePreviewVisible = false"
+ :title="`涓婁紶${currentUploadCategory}闄勪欢`"
+ :visible.sync="uploadDialogVisible"
+ width="480px"
+ :close-on-click-modal="false"
>
- <div v-if="currentPreviewFile">
- <div v-if="currentPreviewFile.fileType === 'image'">
- <img
- :src="currentPreviewFile.fileUrl"
- style="max-width: 100%; max-height: 500px;"
- />
+ <el-upload
+ ref="uploadRef"
+ class="upload-demo"
+ drag
+ :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__tip" slot="tip">
+ 鏀寔涓婁紶pdf銆乯pg銆乸ng銆乨oc銆乨ocx鏍煎紡鏂囦欢锛屽崟涓枃浠朵笉瓒呰繃10MB
</div>
- <div v-else-if="currentPreviewFile.fileType === 'pdf'">
- <iframe
- :src="currentPreviewFile.fileUrl"
- width="100%"
- height="500px"
- ></iframe>
- </div>
- <div v-else>
- <p>涓嶆敮鎸侀瑙堟鏂囦欢绫诲瀷锛岃涓嬭浇鏌ョ湅</p>
- </div>
- </div>
+ </el-upload>
+
+ <span 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>
+ </span>
</el-dialog>
+
+ <!-- 鏂囦欢棰勮寮圭獥 -->
+ <FilePreviewDialog
+ :visible="previewVisible"
+ :file="currentPreviewFile"
+ @close="previewVisible = false"
+ @download="handleDownload"
+ />
</div>
</template>
<script>
import { witnessList, witnessadd, witnessedit } from "@/api/businessApi";
-import UploadAttachment from "@/components/UploadAttachment";
+import FilePreviewDialog from "@/components/FilePreviewDialog";
import CaseBasicInfo from "@/components/CaseBasicInfo";
+import { getToken } from "@/utils/auth";
import dayjs from "dayjs";
export default {
name: "OrganProcurementDetail",
components: {
- UploadAttachment,
+ FilePreviewDialog,
CaseBasicInfo
},
dicts: [
@@ -779,19 +762,22 @@
},
// 闄勪欢鏁版嵁
attachments: [],
- attachmentFileList: [],
- // 闄勪欢鐩稿叧閰嶇疆
- attachmentLimit: 10,
- attachmentAccept:
- ".pdf,.jpg,.jpeg,.png,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt",
+ // 涓婁紶鐩稿叧
+ uploadAction: process.env.VUE_APP_BASE_API + "/common/upload",
+ headers: {
+ Authorization: "Bearer " + getToken()
+ },
+ uploadDialogVisible: false,
+ uploadLoading: false,
+ tempFileList: [],
+ currentUploadCategory: "",
// 缂栬緫瀵硅瘽妗�
editDialogVisible: false,
currentRecord: {},
currentEditIndex: -1,
// 鏂囦欢棰勮鐩稿叧
- filePreviewVisible: false,
- currentPreviewFile: null,
- filePreviewTitle: ""
+ previewVisible: false,
+ currentPreviewFile: null
};
},
computed: {
@@ -847,22 +833,6 @@
// 鑾峰彇鍣ㄥ畼瀛楀吀
organDict() {
return this.dict.type.sys_Organ || [];
- }
- },
- 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
}
},
created() {
@@ -934,19 +904,8 @@
fileType: item.fileType || "" // 榛樿绌哄瓧绗︿覆琛ㄧず鏈垎绫�
}));
this.form.attachments = this.attachments;
- // 鍚屾 attachmentFileList
- this.attachmentFileList = this.attachments.map(item => ({
- uid: item.id || Math.random(),
- name: item.fileName,
- url: item.path || item.fileUrl,
- fileSize: item.fileSize,
- uploadTime: item.uploadTime,
- status: "success",
- raw: item
- }));
} else {
this.attachments = [];
- this.attachmentFileList = [];
}
// 澶勭悊鎹愮尞鍣ㄥ畼瀛楁
@@ -1382,133 +1341,157 @@
this.handleConfirmProcurement();
},
- // 闄勪欢鐩稿叧鏂规硶
- /** 闄勪欢鍙樺寲澶勭悊 */
- handleAttachmentChange(fileList) {
- this.attachmentFileList = fileList;
+ // ===== 闄勪欢鐩稿叧鏂规硶 =====
+ // 鎵撳紑涓婁紶瀵硅瘽妗�
+ openUploadDialog(category) {
+ this.currentUploadCategory = category;
+ this.tempFileList = [];
+ this.uploadDialogVisible = true;
+ this.$nextTick(() => {
+ if (this.$refs.uploadRef) {
+ this.$refs.uploadRef.clearFiles();
+ }
+ });
},
- /** 闄勪欢绉婚櫎澶勭悊 */
- handleAttachmentRemove(file) {
- // 鐩存帴璋冪敤鏂扮殑鍒犻櫎鏂规硶
- if (file.raw) {
- this.handleRemoveAttachmentByFile(file.raw);
- } else if (file.url) {
- const target = this.attachments.find(
- item => item.path === file.url || item.fileUrl === file.url
- );
- if (target) {
- this.handleRemoveAttachmentByFile(target);
- }
- }
-},
-
- /** 涓婁紶鎴愬姛澶勭悊 */
- handleUploadSuccess({ file, fileList, response }) {
- if (response.code === 200) {
- // 鏍规嵁褰撳墠婵�娲荤殑 Tab 鍐冲畾鍒嗙被锛堟湭鍒嗙被 Tab 瀵瑰簲绌哄瓧绗︿覆锛�
- const category = this.activeTab === '鏈垎绫�' ? '' : this.activeTab;
- const attachmentObj = {
- fileName: file.name,
- path: response.fileUrl || file.url,
- fileUrl: response.fileUrl || file.url,
- fileType: category, // 鍏抽敭锛氳褰曞垎绫�
- 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('鏂囦欢涓婁紶鎴愬姛');
- }
-},
-// 鑾峰彇鏌愬垎绫荤殑鏂囦欢鏁伴噺
-getCategoryCount(category) {
- return this.attachments.filter(item => {
- const type = item.fileType || '';
- if (category === '鏈垎绫�') {
- return !this.presetCategories.includes(type);
- }
- return type === category;
- }).length;
-},
-
-// 鑾峰彇鏌愬垎绫荤殑鏂囦欢鍒楄〃
-getCategoryFiles(category) {
- return this.attachments.filter(item => {
- const type = item.fileType || '';
- if (category === '鏈垎绫�') {
- return !this.presetCategories.includes(type);
- }
- return type === category;
- });
-},
-
-// 鏇存柊闄勪欢鍒嗙被锛堜笅鎷変慨鏀规椂瑙﹀彂锛�
-updateAttachmentCategory(row, newVal) {
- const target = this.attachments.find(item => item === row);
- if (target) {
- target.fileType = newVal; // 鍙兘涓虹┖瀛楃涓�
- // 鍚屾鏇存柊 attachmentFileList
- const fileItem = this.attachmentFileList.find(
- f => f.raw === row || f.url === row.fileUrl
- );
- if (fileItem) {
- fileItem.raw.fileType = newVal;
- fileItem.fileType = newVal || '鏈垎绫�';
- }
- // 濡傛灉褰撳墠婵�娲荤殑tab娌℃湁鏂囦欢浜嗭紝鑷姩鍒囨崲鍒扮涓�涓湁鏂囦欢鐨則ab
- const currentTabHasFiles = this.getCategoryFiles(this.activeTab).length > 0;
- if (!currentTabHasFiles) {
- const firstCategory = this.categories[0];
- if (firstCategory) this.activeTab = firstCategory;
- }
- }
-},
-
-// 鎸夋枃浠跺璞″垹闄わ紙鐢ㄤ簬琛ㄦ牸涓殑鍒犻櫎鎸夐挳锛�
-handleRemoveAttachmentByFile(file) {
- const index = this.attachments.findIndex(item => item === file);
- if (index > -1) {
- this.attachments.splice(index, 1);
- // 鍚屾鍒犻櫎 attachmentFileList
- const fileIndex = this.attachmentFileList.findIndex(
- f => f.raw === file || f.url === file.fileUrl
- );
- if (fileIndex > -1) {
- this.attachmentFileList.splice(fileIndex, 1);
- }
- this.$message.success('闄勪欢鍒犻櫎鎴愬姛');
- }
-},
- /** 涓婁紶閿欒澶勭悊 */
- handleUploadError({ file, fileList, error }) {
- console.error("闄勪欢涓婁紶澶辫触:", error);
- this.$message.error("鏂囦欢涓婁紶澶辫触锛岃閲嶈瘯");
+ // 涓婁紶鍓嶆牎楠�
+ beforeUpload(file) {
+ const allowedTypes = [
+ "application/pdf",
+ "image/jpeg",
+ "image/png",
+ "application/msword",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+ ];
+ const maxSize = 10 * 1024 * 1024;
+ 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");
+ if (!isTypeOk) {
+ this.$message.error("鏂囦欢鏍煎紡涓嶆敮鎸侊紝璇蜂笂浼爌df銆乯pg銆乸ng銆乨oc鎴杁ocx鏍煎紡鏂囦欢");
+ return false;
+ }
+ if (file.size > maxSize) {
+ this.$message.error("鏂囦欢澶у皬涓嶈兘瓒呰繃10MB");
+ return false;
+ }
+ return true;
},
- /** 鎵嬪姩鍒犻櫎闄勪欢 */
- handleRemoveAttachment(index) {
- this.attachments.splice(index, 1);
- this.attachmentFileList.splice(index, 1);
- this.$message.success("闄勪欢鍒犻櫎鎴愬姛");
+ // 鏂囦欢閫夋嫨鍙樺寲
+ handleFileChange(file, fileList) {
+ this.tempFileList = fileList;
},
- /** 鏂囦欢棰勮 */
+ // 涓存椂绉婚櫎
+ handleTempRemove(file, fileList) {
+ this.tempFileList = fileList;
+ },
+
+ // 涓婁紶鎴愬姛澶勭悊
+ handleUploadSuccess(response, file, fileList) {
+ if (response.code !== 200) {
+ this.$message.error(response.msg || "涓婁紶澶辫触");
+ return;
+ }
+ // 鏈垎绫诲搴旂┖瀛楃涓诧紝涓庡睍绀�/淇濆瓨閫昏緫涓�鑷�
+ const category = this.currentUploadCategory === "鏈垎绫�" ? "" : this.currentUploadCategory;
+ const attachmentObj = {
+ fileName: file.name,
+ path: response.fileUrl || response.url || response.data || file.url,
+ fileUrl: response.fileUrl || response.url || response.data || file.url,
+ fileType: category,
+ fileSize: file.size,
+ uploadTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
+ };
+ if (!Array.isArray(this.attachments)) {
+ this.attachments = [];
+ }
+ this.attachments.push(attachmentObj);
+ this.$message.success("鏂囦欢涓婁紶鎴愬姛");
+ this.uploadLoading = false;
+ this.uploadDialogVisible = false;
+ this.tempFileList = [];
+ },
+
+ // 鎻愪氦涓婁紶
+ submitUpload() {
+ if (this.tempFileList.length === 0) {
+ this.$message.warning("璇峰厛閫夋嫨瑕佷笂浼犵殑鏂囦欢");
+ return;
+ }
+ this.uploadLoading = true;
+ this.$refs.uploadRef.submit();
+ },
+
+ // 鑾峰彇鏌愬垎绫荤殑鏂囦欢鏁伴噺
+ getCategoryCount(category) {
+ return this.attachments.filter(item => {
+ const type = item.fileType || "";
+ if (category === "鏈垎绫�") {
+ return !this.presetCategories.includes(type);
+ }
+ return type === category;
+ }).length;
+ },
+
+ // 鑾峰彇鏌愬垎绫荤殑鏂囦欢鍒楄〃
+ getCategoryFiles(category) {
+ return this.attachments.filter(item => {
+ const type = item.fileType || "";
+ if (category === "鏈垎绫�") {
+ return !this.presetCategories.includes(type);
+ }
+ return type === category;
+ });
+ },
+
+ // 鏇存柊闄勪欢鍒嗙被锛堜笅鎷変慨鏀规椂瑙﹀彂锛�
+ updateAttachmentCategory(row, newVal) {
+ const target = this.attachments.find(item => item === row);
+ if (target) {
+ target.fileType = newVal;
+ const currentTabHasFiles = this.getCategoryFiles(this.activeTab).length > 0;
+ if (!currentTabHasFiles) {
+ const firstCategory = this.categories[0];
+ if (firstCategory) this.activeTab = firstCategory;
+ }
+ }
+ },
+
+ // 鎸夋枃浠跺璞″垹闄わ紙鐢ㄤ簬琛ㄦ牸涓殑鍒犻櫎鎸夐挳锛�
+ handleRemoveAttachmentByFile(file) {
+ this.$confirm("纭畾瑕佸垹闄よ繖涓檮浠跺悧锛�", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ const index = this.attachments.findIndex(item => item === file);
+ if (index > -1) {
+ this.attachments.splice(index, 1);
+ this.$message.success("闄勪欢鍒犻櫎鎴愬姛");
+ }
+ })
+ .catch(() => {});
+ },
+
+ // 鏂囦欢棰勮
handlePreview(file) {
this.currentPreviewFile = {
fileName: file.fileName,
fileUrl: file.path || file.fileUrl,
fileType: this.getFileType(file.fileName)
};
- this.filePreviewTitle = file.fileName;
- this.filePreviewVisible = true;
+ this.previewVisible = true;
},
- /** 鏂囦欢涓嬭浇 */
+ // 鏂囦欢涓嬭浇
handleDownload(file) {
const fileUrl = file.path || file.fileUrl;
const fileName = file.fileName;
@@ -1767,4 +1750,73 @@
margin-bottom: 10px;
}
}
+
+/* ===== 绾歌川琛ㄦ牸缃戞牸鏍峰紡 ===== */
+.paper-card >>> .el-card__body {
+ padding: 16px;
+}
+
+.paper-form {
+ border-left: 1px solid #d0d3db;
+ background: #fff;
+}
+
+.paper-form >>> .form-row {
+ display: flex;
+ width: 100%;
+ border-top: 1px solid #d0d3db;
+}
+
+.paper-form >>> .el-form-item {
+ flex: 0 0 33.3333%;
+ display: flex;
+ margin: 0;
+ background: #fff;
+ border-right: 1px solid #d0d3db;
+ border-bottom: 1px solid #d0d3db;
+}
+.paper-form >>> .el-form-item::after,
+.paper-form >>> .el-form-item::before {
+ display: none;
+}
+
+.paper-form >>> .col-1-3 { flex: 0 0 33.3333%; }
+.paper-form >>> .col-half { flex: 0 0 50%; }
+.paper-form >>> .col-2-3 { flex: 0 0 66.6666%; }
+.paper-form >>> .col-full { flex: 0 0 100%; }
+
+.paper-form >>> .el-form-item__label {
+ flex: 0 0 120px;
+ width: 120px !important;
+ float: none;
+ padding: 0 8px !important;
+ background: #ecf5ff;
+ border-right: 1px solid #d0d3db;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ font-size: 13px;
+ font-weight: 600;
+ color: #2c3038;
+ line-height: 1.3;
+ white-space: normal;
+ word-break: break-all;
+}
+.paper-form >>> .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before {
+ color: #f56c6c;
+ margin-right: 2px;
+}
+
+.paper-form >>> .el-form-item__content {
+ flex: 1;
+ margin-left: 0 !important;
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ padding: 6px 10px;
+ background: #fff;
+ min-height: 42px;
+ line-height: 1.4;
+}
</style>
--
Gitblit v1.9.3