From bd7f920a53ba17016ee4f6324d155eef2bc4cece Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 03 八月 2026 17:00:37 +0800
Subject: [PATCH] feat: 发货信息展示源单号
---
src/views/safeProduction/dangerInvestigation/index.vue | 525 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 331 insertions(+), 194 deletions(-)
diff --git a/src/views/safeProduction/dangerInvestigation/index.vue b/src/views/safeProduction/dangerInvestigation/index.vue
index 7ff2a64..1c74d75 100644
--- a/src/views/safeProduction/dangerInvestigation/index.vue
+++ b/src/views/safeProduction/dangerInvestigation/index.vue
@@ -55,52 +55,82 @@
width="60" />
<el-table-column label="闅愭偅缂栧彿"
prop="hiddenCode"
- width="180"
- show-overflow-tooltip />
+ width="150"
+ align="center"
+ show-overflow-tooltip>
+ <template #default="scope">
+ <el-button class="hidden-code-link"
+ link
+ type="primary"
+ @click="openForm('detail', scope.row)">
+ {{ scope.row.hiddenCode }}
+ </el-button>
+ </template>
+ </el-table-column>
<el-table-column label="闅愭偅鎻忚堪"
prop="hiddenDesc"
+ width="150"
+ align="center"
show-overflow-tooltip />
<el-table-column label="闅愭偅鍏蜂綋浣嶇疆"
prop="location"
+ width="150"
+ align="center"
show-overflow-tooltip />
<el-table-column label="涓婃姤浜�"
prop="createUserName"
- width="180"
+ width="150"
+ align="center"
show-overflow-tooltip />
<el-table-column label="涓婃姤鏃堕棿"
prop="createTime"
+ width="180"
+ align="center"
show-overflow-tooltip />
<el-table-column label="鏁存敼瀹屾垚鏈熼檺"
prop="rectifyTime"
width="120"
+ align="center"
show-overflow-tooltip />
<el-table-column label="鏁存敼璐d换浜�"
prop="rectifyUserName"
width="120"
+ align="center"
show-overflow-tooltip />
<el-table-column label="鏁存敼璐d换浜鸿仈绯绘柟寮�"
prop="rectifyUserMobile"
- width="120"
+ width="160"
+ align="center"
show-overflow-tooltip />
<el-table-column label="鏁存敼鍏蜂綋鎺柦"
prop="rectifyMeasures"
width="120"
+ align="center"
show-overflow-tooltip />
<el-table-column label="瀹為檯鏁存敼瀹屾垚鏃堕棿"
prop="rectifyActualTime"
+ width="180"
+ align="center"
+ show-overflow-tooltip />
+ <el-table-column label="楠屾敹浜�"
+ prop="verifyUserName"
width="120"
+ align="center"
show-overflow-tooltip />
<el-table-column label="楠屾敹鎰忚"
prop="verifyRemark"
width="120"
+ align="center"
show-overflow-tooltip />
<el-table-column label="楠屾敹鏃堕棿"
prop="verifyTime"
width="120"
+ align="center"
show-overflow-tooltip />
<el-table-column label="楠屾敹缁撴灉"
prop="verifyResult"
width="120"
+ align="center"
show-overflow-tooltip>
<template #default="scope">
<el-tag v-if="scope.row.verifyResult"
@@ -111,13 +141,13 @@
</el-table-column>
<el-table-column fixed="right"
label="鎿嶄綔"
- min-width="250"
+ min-width="150"
align="center">
<template #default="scope">
- <el-button link
+ <!-- <el-button link
type="primary"
size="small"
- @click="openForm('edit', scope.row)">缂栬緫</el-button>
+ @click="openForm('edit', scope.row)">缂栬緫</el-button> -->
<el-button link
type="primary"
size="small"
@@ -125,12 +155,12 @@
<el-button link
type="primary"
size="small"
- :disabled="!isPeople(scope.row.rectifyUserId)"
+ :disabled="scope.row.isRectify || scope.row.rectifyActualTime"
@click="openForm('edit2', scope.row)">鏁存敼</el-button>
<el-button link
type="primary"
size="small"
- :disabled="!scope.row.rectifyActualTime"
+ :disabled="!scope.row.rectifyActualTime || scope.row.verifyTime || scope.row.isVerify"
@click="openForm('edit3', scope.row)">楠屾敹</el-button>
</template>
</el-table-column>
@@ -268,11 +298,11 @@
</el-col>
</el-row>
</el-form>
- <div v-if="operationType === 'edit2' || operationType === 'edit3'"
+ <div v-if="showHiddenDetail"
class="classtitle">闅愭偅璇︽儏</div>
<el-descriptions :column="2"
style="margin-bottom: 20px;"
- v-if="operationType === 'edit2' || operationType === 'edit3'"
+ v-if="showHiddenDetail"
border>
<el-descriptions-item label="闅愭偅缂栧彿">
<span class="detail-title">{{ form.hiddenCode }}</span>
@@ -309,11 +339,11 @@
</el-descriptions-item>
</el-descriptions>
<div class="classtitle"
- v-if="operationType === 'edit3'"
+ v-if="showRectifyDetail"
style="margin-top: 40px;">鏁存敼璇︽儏</div>
<el-descriptions :column="2"
style="margin-bottom: 20px;"
- v-if="operationType === 'edit3'"
+ v-if="showRectifyDetail"
border>
<el-descriptions-item label="鏁存敼鍏蜂綋鎺柦"
:span="2">
@@ -351,6 +381,20 @@
type="date"
placeholder="璇烽�夋嫨"
clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="楠屾敹浜猴細"
+ prop="verifyUserId">
+ <el-select v-model="form2.verifyUserId"
+ placeholder="璇烽�夋嫨"
+ filterable
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
</el-form-item>
</el-col>
</el-row>
@@ -402,8 +446,9 @@
<el-form-item label="楠屾敹浜猴細"
prop="verifyUserId">
<el-select v-model="form3.verifyUserId"
- disabled
+ :disabled="!!form3.verifyUserId"
placeholder="璇烽�夋嫨"
+ filterable
clearable>
<el-option v-for="item in userList"
:key="item.userId"
@@ -414,18 +459,75 @@
</el-col>
</el-row>
</el-form>
+ <div class="classtitle"
+ v-if="showVerifyDetail"
+ style="margin-top: 40px;">楠屾敹璇︽儏</div>
+ <el-descriptions :column="2"
+ style="margin-bottom: 20px;"
+ v-if="showVerifyDetail"
+ border>
+ <el-descriptions-item label="楠屾敹浜�">
+ <span class="detail-title">{{ getVerifyUserName() }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="楠屾敹鏃堕棿">
+ <span class="detail-title">{{ form3.verifyTime }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="楠屾敹缁撴灉">
+ <el-tag v-if="form3.verifyResult"
+ :type="form3.verifyResult === '閫氳繃' ? 'success' : 'danger'">
+ {{ form3.verifyResult }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="楠屾敹鎰忚"
+ :span="2">
+ <span class="detail-title">{{ form3.verifyRemark }}</span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <div class="classtitle"
+ v-if="operationType === 'detail'"
+ style="margin-top: 40px;">闄勪欢</div>
+ <div v-if="operationType === 'detail'"
+ v-loading="detailAttachmentLoading"
+ class="detail-attachment-preview-list">
+ <el-empty v-if="!detailAttachmentLoading && detailAttachmentList.length === 0"
+ description="鏆傛棤闄勪欢"
+ :image-size="80" />
+ <div v-for="item in detailAttachmentList"
+ :key="item.storageAttachmentId || item.id || getAttachmentPreviewUrl(item)"
+ class="detail-attachment-preview-card">
+ <div class="detail-attachment-header">
+ <span class="detail-attachment-name">{{ getAttachmentName(item) }}</span>
+ <el-button link
+ type="primary"
+ size="small"
+ @click="downloadDetailAttachment(item)">涓嬭浇</el-button>
+ </div>
+ <el-image v-if="isImageAttachment(item)"
+ class="detail-attachment-image"
+ :src="getAttachmentPreviewUrl(item)"
+ :preview-src-list="detailPreviewImageUrls"
+ :initial-index="getImagePreviewIndex(item)"
+ fit="contain"
+ preview-teleported />
+ <iframe v-else-if="isPdfAttachment(item)"
+ class="detail-attachment-frame"
+ :src="getAttachmentPreviewUrl(item)" />
+ <div v-else
+ class="detail-attachment-placeholder">
+ <span>璇ユ枃浠剁被鍨嬫殏涓嶆敮鎸佸唴宓岄瑙�</span>
+ <el-button link
+ type="primary"
+ @click="downloadDetailAttachment(item)">涓嬭浇鏌ョ湅</el-button>
+ </div>
+ </div>
+ </div>
</FormDialog>
- <!-- 闄勪欢鍒楄〃寮圭獥 -->
- <FileListDialog ref="fileListRef"
- v-model="fileListDialogVisible"
- :show-upload-button="true"
- :show-delete-button="true"
- :is-show-pagination="true"
- :page="filePagination"
- :upload-method="handleUpload"
- :delete-method="handleFileDelete"
- @pagination="paginationSearch"
- title="闄勪欢鍒楄〃" />
+ <FileListDialog
+ v-if="fileListDialogVisible"
+ :record-id="currentRecordId"
+ record-type="safe_hidden"
+ v-model:visible="fileListDialogVisible"/>
+
</div>
</template>
@@ -436,22 +538,18 @@
import { ElMessageBox, ElMessage } from "element-plus";
import useUserStore from "@/store/modules/user";
import { userListNoPage } from "@/api/system/user.js";
- import FileListDialog from "@/components/Dialog/FileListDialog.vue";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
+ import { attachmentList } from "@/api/basicData/storageAttachment.js";
import {
dangerInvestigationListPage,
safeHiddenAdd,
safeHiddenUpdate,
safeHiddenDel,
fileListPage,
- safeHiddenFileAdd,
- safeHiddenFileDel,
} from "@/api/safeProduction/dangerInvestigation.js";
import useFormData from "@/hooks/useFormData.js";
- import request from "@/utils/request";
import dayjs from "dayjs";
- import { get } from "@vueuse/core";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
@@ -459,6 +557,9 @@
const selectedRows = ref([]);
const userList = ref([]);
const tableLoading = ref(false);
+ const detailAttachmentList = ref([]);
+ const detailAttachmentLoading = ref(false);
+ const currentRecordId = ref(0);
const page = reactive({
current: 1,
size: 100,
@@ -473,6 +574,8 @@
return "鏁存敼椤甸潰";
} else if (type === "edit3") {
return "楠屾敹椤甸潰";
+ } else if (type === "detail") {
+ return "闅愭偅璇︽儏";
}
};
// 鑾峰彇绫诲瀷鏍囩绫诲瀷
@@ -520,11 +623,13 @@
const rules2 = {
rectifyActualTime: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }],
rectifyMeasures: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ verifyUserId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
};
const rules3 = {
verifyTime: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }],
verifyRemark: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
verifyResult: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ verifyUserId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
acceptDesc: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
};
const { hidden_danger_type } = proxy.useDict("hidden_danger_type");
@@ -536,6 +641,7 @@
const form2 = ref({
rectifyActualTime: "", // 瀹為檯鏁存敼瀹屾垚鏃堕棿
rectifyMeasures: "", // 鏁存敼鍏蜂綋鎺柦
+ verifyUserId: "", // 楠屾敹浜�
});
const form3 = ref({
verifyTime: "", // 楠屾敹鏃堕棿
@@ -545,6 +651,21 @@
verifyUserName: "",
verifyResult: "", // 楠屾敹缁撴灉
});
+ const showHiddenDetail = computed(() => ["edit2", "edit3", "detail"].includes(operationType.value));
+ const showRectifyDetail = computed(
+ () =>
+ operationType.value === "edit3" ||
+ (operationType.value === "detail" && (form2.value.rectifyMeasures || form2.value.rectifyActualTime))
+ );
+ const showVerifyDetail = computed(
+ () =>
+ operationType.value === "detail" &&
+ (form3.value.verifyUserId ||
+ form3.value.verifyUserName ||
+ form3.value.verifyRemark ||
+ form3.value.verifyTime ||
+ form3.value.verifyResult)
+ );
const riskLevelList = ref([
{
value: "閲嶅ぇ椋庨櫓",
@@ -581,6 +702,60 @@
form.value.rectifyUserName = selectedUser.nickName;
form.value.rectifyUserMobile = selectedUser.phonenumber;
}
+ };
+
+ const hasUserId = userId => userId !== null && userId !== undefined && userId !== "" && userId !== "null";
+ const normalizeUserId = userId => (hasUserId(userId) ? Number(userId) : "");
+ const getVerifyUserName = () => {
+ if (form3.value.verifyUserName) {
+ return form3.value.verifyUserName;
+ }
+ const selectedUser = userList.value.find(user => Number(user.userId) === Number(form3.value.verifyUserId));
+ return selectedUser?.nickName || selectedUser?.userName || "";
+ };
+ const getAttachmentName = row => row?.originalFilename || row?.fileName || row?.name || "";
+ const getAttachmentPreviewUrl = row => row?.previewURL || row?.previewUrl || row?.url || row?.downloadURL || row?.downloadUrl || "";
+ const getAttachmentDownloadUrl = row => row?.downloadURL || row?.downloadUrl || row?.previewURL || row?.previewUrl || row?.url || "";
+ const getAttachmentTypeText = row => `${getAttachmentName(row)} ${getAttachmentPreviewUrl(row)}`.toLowerCase().split("?")[0];
+ const isImageAttachment = row => /\.(jpg|jpeg|png|gif|bmp|webp|svg)$/.test(getAttachmentTypeText(row));
+ const isPdfAttachment = row => /\.pdf$/.test(getAttachmentTypeText(row));
+ const isRectifiedRecord = row =>
+ !!(row?.rectifyActualTime || row?.rectifyMeasures || row?.verifyTime || row?.verifyResult || row?.verifyRemark);
+ const detailPreviewImageUrls = computed(() =>
+ detailAttachmentList.value
+ .filter(isImageAttachment)
+ .map(getAttachmentPreviewUrl)
+ .filter(Boolean)
+ );
+ const getImagePreviewIndex = row => {
+ const index = detailPreviewImageUrls.value.indexOf(getAttachmentPreviewUrl(row));
+ return index > -1 ? index : 0;
+ };
+ const loadDetailAttachments = recordId => {
+ detailAttachmentLoading.value = true;
+ detailAttachmentList.value = [];
+ return attachmentList({
+ recordType: "safe_hidden",
+ recordId,
+ })
+ .then(res => {
+ detailAttachmentList.value = res?.data || [];
+ })
+ .catch(() => {
+ detailAttachmentList.value = [];
+ ElMessage.error("闄勪欢鍔犺浇澶辫触");
+ })
+ .finally(() => {
+ detailAttachmentLoading.value = false;
+ });
+ };
+ const downloadDetailAttachment = row => {
+ const url = getAttachmentDownloadUrl(row);
+ if (!url) {
+ ElMessage.warning("鏂囦欢鍦板潃鏃犳晥锛屾棤娉曚笅杞�");
+ return;
+ }
+ window.open(url, "_blank");
};
// 瀵煎叆鐩稿叧
@@ -659,6 +834,15 @@
tableLoading.value = false;
tableData.value = res.data.records;
total.value = res.data.total;
+ tableData.value.forEach(item => {
+ // console.log(item.rectifyUserId, currentUserId.value, "=======");
+ if (Number(item.rectifyUserId) != Number(currentUserId.value)) {
+ item.isRectify = true;
+ } else {
+ item.isRectify = false;
+ }
+ item.isVerify = hasUserId(item.verifyUserId) && Number(item.verifyUserId) != Number(currentUserId.value);
+ });
return res;
})
.catch(() => {
@@ -690,15 +874,18 @@
const openForm = async (type, row) => {
console.log("row", row);
operationType.value = type;
+ detailAttachmentList.value = [];
form3.value = {
verifyTime: "", // 楠屾敹鏃堕棿
verifyRemark: "", // 楠屾敹澶囨敞
verifyResult: "", // 楠屾敹鎻忚堪
verifyUserId: "", // 楠屾敹浜�
+ verifyUserName: "",
};
form2.value = {
rectifyActualTime: "", // 瀹為檯鏁存敼瀹屾垚鏃堕棿
rectifyMeasures: "", // 鏁存敼鍏蜂綋鎺柦
+ verifyUserId: "", // 楠屾敹浜�
};
if (type === "add") {
form.value = {
@@ -750,6 +937,7 @@
form2.value = {
rectifyActualTime: row.rectifyActualTime, // 瀹為檯鏁存敼瀹屾垚鏃堕棿
rectifyMeasures: row.rectifyMeasures, // 鏁存敼鍏蜂綋鎺柦
+ verifyUserId: normalizeUserId(row.verifyUserId), // 楠屾敹浜�
};
} else if (type === "edit3") {
form.value = {
@@ -775,15 +963,41 @@
verifyTime: row.verifyTime, // 楠屾敹鏃堕棿
verifyRemark: row.verifyRemark, // 楠屾敹澶囨敞
verifyResult: row.verifyResult, // 楠屾敹鎻忚堪
- verifyUserId: row.verifyUserId, // 楠屾敹浜�
+ verifyUserId: normalizeUserId(row.verifyUserId), // 楠屾敹浜�
+ verifyUserName: row.verifyUserName,
};
- console.log("form3.value", form3.value);
- if (!form3.value.verifyUserId || form3.value.verifyUserId === "null") {
- form3.value.verifyUserId = Number(currentUserId.value); // 楠屾敹浜�
- }
if (!form3.value.verifyTime || form3.value.verifyTime === "null") {
form3.value.verifyTime = dayjs().format("YYYY-MM-DD"); // 楠屾敹鎻忚堪
}
+ } else if (type === "detail") {
+ form.value = {
+ id: row.id,
+ hiddenCode: row.hiddenCode, // 闅愭偅缂栧彿
+ location: row.location, // 闅愭偅浣嶇疆
+ hiddenDesc: row.hiddenDesc, // 闅愭偅鎻忚堪
+ createUser: row.createUser, // 涓婃姤浜�
+ createUserName: row.createUserName,
+ createTime: row.createTime, // 涓婃姤鏃堕棿
+ rectifyUserId: row.rectifyUserId, // 鏁存敼璐d换浜�
+ rectifyUserName: row.rectifyUserName,
+ rectifyTime: row.rectifyTime, // 鏁存敼瀹屾垚鏈熼檺
+ rectifyUserMobile: row.rectifyUserMobile, // 鏁存敼璐d换浜烘墜鏈哄彿
+ riskLevel: row.riskLevel, // 闅愭偅椋庨櫓绛夌骇
+ type: row.type, // 闅愭偅绫诲瀷
+ };
+ form2.value = {
+ rectifyActualTime: row.rectifyActualTime, // 瀹為檯鏁存敼瀹屾垚鏃堕棿
+ rectifyMeasures: row.rectifyMeasures, // 鏁存敼鍏蜂綋鎺柦
+ verifyUserId: normalizeUserId(row.verifyUserId), // 楠屾敹浜�
+ };
+ form3.value = {
+ verifyTime: row.verifyTime, // 楠屾敹鏃堕棿
+ verifyRemark: row.verifyRemark, // 楠屾敹澶囨敞
+ verifyResult: row.verifyResult, // 楠屾敹鎻忚堪
+ verifyUserId: normalizeUserId(row.verifyUserId), // 楠屾敹浜�
+ verifyUserName: row.verifyUserName,
+ };
+ loadDetailAttachments(row.id);
}
dialogFormVisible.value = true;
};
@@ -846,9 +1060,9 @@
proxy.$refs["formRef3"].validate(valid => {
if (valid) {
safeHiddenUpdate({
- ...form3.value,
...form2.value,
...form.value,
+ ...form3.value,
}).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -862,6 +1076,9 @@
const closeDia = () => {
proxy.resetForm("formRef");
proxy.resetForm("formRef2");
+ proxy.resetForm("formRef3");
+ detailAttachmentList.value = [];
+ detailAttachmentLoading.value = false;
dialogFormVisible.value = false;
};
// 鍏抽棴浜у搧寮规
@@ -873,12 +1090,18 @@
const handleDelete = () => {
let ids = [];
if (selectedRows.value.length > 0) {
+ const rectifiedRows = selectedRows.value.filter(isRectifiedRecord);
+ if (rectifiedRows.length > 0) {
+ const hiddenCodes = rectifiedRows.map(item => item.hiddenCode).filter(Boolean).join("銆�");
+ proxy.$modal.msgWarning(`宸叉暣鏀圭殑闅愭偅涓嶈兘鍒犻櫎${hiddenCodes ? `锛�${hiddenCodes}` : ""}`);
+ return;
+ }
ids = selectedRows.value.map(item => item.id);
} else {
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ ElMessageBox.confirm("閫変腑鐨勬湭鏁存敼闅愭偅鍙婂叾闄勪欢灏嗚鍒犻櫎锛屾槸鍚︾‘璁ゅ垹闄わ紵", "鎻愮ず", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
type: "warning",
@@ -893,8 +1116,8 @@
proxy.$modal.msg("宸插彇娑�");
});
};
- const isPeople = row => {
- return row.rectifyUserId === Number(currentUserId.value);
+ const isPeople = rectifyUserId => {
+ return Number(rectifyUserId) == Number(currentUserId.value);
};
/**
@@ -935,18 +1158,8 @@
const fileListDialogVisible = ref(false);
const currentFileRow = ref(null);
const downLoadFile = row => {
- currentFileRow.value = row;
- fileListPage({
- safeHiddenId: row.id,
- current: filePagination.value.current,
- size: filePagination.value.size,
- }).then(res => {
- if (fileListRef.value) {
- fileListRef.value.open(res.data.records || []);
- console.log("res.data", res.data);
- filePagination.value.total = res.data.total || 0;
- }
- });
+ currentRecordId.value = row.id;
+ fileListDialogVisible.value = true;
};
const currentUserId = ref("");
const currentUserName = ref("");
@@ -975,154 +1188,13 @@
return "";
};
- onMounted(() => {
+ onMounted(async () => {
+ await getCurrentFactoryName();
getList();
userListNoPage().then(res => {
userList.value = res.data;
});
- getCurrentFactoryName();
});
- // 涓婁紶闄勪欢
- const handleUpload = async () => {
- if (!currentFileRow.value) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨鏁版嵁");
- return null;
- }
-
- return new Promise(resolve => {
- // 鍒涘缓涓�涓殣钘忕殑鏂囦欢杈撳叆鍏冪礌
- const input = document.createElement("input");
- input.type = "file";
- input.style.display = "none";
- input.onchange = async e => {
- const file = e.target.files[0];
- if (!file) {
- resolve(null);
- return;
- }
-
- try {
- // 浣跨敤 FormData 涓婁紶鏂囦欢
- const formData = new FormData();
- formData.append("file", file);
-
- const uploadRes = await request({
- url: "/file/upload",
- method: "post",
- data: formData,
- headers: {
- "Content-Type": "multipart/form-data",
- Authorization: `Bearer ${getToken()}`,
- },
- });
-
- if (uploadRes.code === 200) {
- // 淇濆瓨闄勪欢淇℃伅
- const fileData = {
- safeHiddenId: currentFileRow.value.id,
- name: uploadRes.data.originalName || file.name,
- url: uploadRes.data.tempPath || uploadRes.data.url,
- };
-
- const saveRes = await safeHiddenFileAdd(fileData);
- if (saveRes.code === 200) {
- proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
- // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
- const listRes = await fileListPage({
- safeHiddenId: currentFileRow.value.id,
- current: filePagination.value.current,
- size: filePagination.value.size,
- });
- if (listRes.code === 200 && fileListRef.value) {
- const fileList = (listRes.data?.records || []).map(item => ({
- name: item.name,
- url: item.url,
- id: item.id,
- ...item,
- }));
- fileListRef.value.setList(fileList);
- filePagination.value.total = listRes.data?.total || 0;
- }
- // 杩斿洖鏂版枃浠朵俊鎭�
- resolve({
- name: fileData.name,
- url: fileData.url,
- id: saveRes.data?.id,
- });
- } else {
- proxy.$modal.msgError(saveRes.msg || "鏂囦欢淇濆瓨澶辫触");
- resolve(null);
- }
- } else {
- proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触");
- resolve(null);
- }
- } catch (error) {
- proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
- resolve(null);
- } finally {
- document.body.removeChild(input);
- }
- };
-
- document.body.appendChild(input);
- input.click();
- });
- };
- // 鍒嗛〉鏌ヨ鏂囦欢鍒楄〃
- const paginationSearch = async (page, size) => {
- filePagination.value.current = page;
- filePagination.value.size = size;
- const listRes = await fileListPage({
- safeHiddenId: currentFileRow.value.id,
- current: filePagination.value.current,
- size: filePagination.value.size,
- });
- if (listRes.code === 200) {
- const fileList = (listRes.data?.records || []).map(item => ({
- name: item.name,
- url: item.url,
- id: item.id,
- ...item,
- }));
- fileListRef.value.setList(fileList);
- filePagination.value.total = listRes.data?.total || 0;
- }
- };
- // 鍒犻櫎闄勪欢
- const handleFileDelete = async row => {
- try {
- const res = await safeHiddenFileDel([row.id]);
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
- if (currentFileRow.value && fileListRef.value) {
- const listRes = await fileListPage({
- safeHiddenId: currentFileRow.value.id,
- current: filePagination.value.current,
- size: filePagination.value.size,
- });
- if (listRes.code === 200) {
- const fileList = (listRes.data?.records || []).map(item => ({
- name: item.name,
- url: item.url,
- id: item.id,
- ...item,
- }));
- fileListRef.value.setList(fileList);
- filePagination.value.total = listRes.data?.total || 0;
- }
- }
- return true; // 杩斿洖 true 琛ㄧず鍒犻櫎鎴愬姛锛岀粍浠朵細鏇存柊鍒楄〃
- } else {
- proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触");
- return false;
- }
- } catch (error) {
- proxy.$modal.msgError("鍒犻櫎澶辫触");
- return false;
- }
- };
</script>
<style scoped lang="scss">
@@ -1155,6 +1227,71 @@
justify-content: space-between;
margin-bottom: 10px;
}
+ .hidden-code-link {
+ height: auto;
+ padding: 0;
+ font-weight: 500;
+ }
+ .detail-attachment-preview-list {
+ min-height: 120px;
+ margin-bottom: 20px;
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(220px, 260px));
+ gap: 12px;
+ align-items: start;
+ }
+ .detail-attachment-preview-card {
+ border: 1px solid #e5eaf3;
+ border-radius: 6px;
+ overflow: hidden;
+ background: #fff;
+ }
+ .detail-attachment-header {
+ min-height: 36px;
+ padding: 6px 12px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ border-bottom: 1px solid #e5eaf3;
+ background: #f7f9fc;
+ }
+ .detail-attachment-name {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-weight: 500;
+ color: #303133;
+ }
+ .detail-attachment-image {
+ width: 100%;
+ height: 160px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: #fafafa;
+ }
+ .detail-attachment-frame {
+ width: 100%;
+ height: 180px;
+ border: 0;
+ display: block;
+ background: #fafafa;
+ }
+ .detail-attachment-placeholder {
+ min-height: 120px;
+ padding: 12px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+ color: #606266;
+ background: #fafafa;
+ }
+ .detail-attachment-preview-list :deep(.el-empty) {
+ grid-column: 1 / -1;
+ }
.print-preview-dialog {
.el-dialog__body {
padding: 0;
--
Gitblit v1.9.3