This commit is contained in:
oneao committed 2026-03-25 17:31:22 +08:00
1 parent 11bcef03e1
commit a4e59dd5d1
39 files changed
+2333 -459

No files matched your search

@@ -13,9 +13,12 @@ import { formatToDate } from "@/utils/time";
import { ElLoading, ElMessage } from "element-plus";
import { saveAs } from "file-saver";
import JSZip from "jszip";
import { usePermissionStore } from "@/store/permission";
const tableRef = ref();
const permissionStore = usePermissionStore();
const columns = ref([]);
const tableData = ref([]);
@@ -53,9 +56,7 @@ const viewName = "v_container";
const showPreview = ref(false);
const previewIndex = ref(-1);
const previewImageList = computed(() => {
return tableData.value
.map((item) => item.b_container_img)
.filter((img) => img);
return tableData.value.map((item) => item.b_container_img).filter((img) => img);
});
const currentRow = ref({});
@@ -188,12 +189,9 @@ async function deleteRows(rows = []) {
const safeDeleteIds = deleteIds.map((id) => Number(id));
// 使用安全的 SQL 查询
const fileRes = await loadDataApi(
"bf_file",
`father IN (${safeDeleteIds.join(",")})`,
"",
["subid"],
);
const fileRes = await loadDataApi("bf_file", `father IN (${safeDeleteIds.join(",")})`, "", [
"subid",
]);
if (!fileRes.success) {
return;
@@ -269,11 +267,7 @@ async function handleDownloadOne(data) {
});
try {
const fileRes = await loadDataApi(
"bf_file",
`father = '${data.b_id}'`,
"mx_xh asc",
);
const fileRes = await loadDataApi("bf_file", `father = ${data.b_id}`, "mx_xh asc");
if (!fileRes.success) {
ElMessage.error("获取附件失败");
@@ -281,11 +275,7 @@ async function handleDownloadOne(data) {
}
const downloadFiles = fileRes.data.map((item, index) => ({
mx_filename: buildFileName(
data.b_container_no,
index + 1,
item.mx_filename,
),
mx_filename: buildFileName(data.b_container_no, index + 1, item.mx_filename),
mx_mapfilename: item.mx_mapfilename,
}));
@@ -348,11 +338,7 @@ async function handleDownloadBatch() {
// 👉 先统计总文件数(用于进度)
for (const item of records) {
const fileRes = await loadDataApi(
"bf_file",
`father = '${item.b_id}'`,
"",
);
const fileRes = await loadDataApi("bf_file", `father = '${item.b_id}'`, "");
if (fileRes.success) {
total += (fileRes.data || []).length;
}
@@ -360,17 +346,11 @@ async function handleDownloadBatch() {
// 👉 正式处理
for (const item of records) {
const folderName = `${item.b_container_no}_${formatToDate(
item.b_inputdatetime,
)}`;
const folderName = `${item.b_container_no}_${formatToDate(item.b_inputdatetime)}`;
const folder = zip.folder(folderName);
const fileRes = await loadDataApi(
"bf_file",
`father = '${item.b_id}'`,
"mx_xh asc",
);
const fileRes = await loadDataApi("bf_file", `father = '${item.b_id}'`, "mx_xh asc");
if (!fileRes.success) {
ElMessage.error("获取附件失败");
@@ -387,8 +367,7 @@ async function handleDownloadBatch() {
const blob = await res.blob();
const fileName =
buildFileName(item.b_container_no, index + 1, file.mx_filename) ||
"未命名文件";
buildFileName(item.b_container_no, index + 1, file.mx_filename) || "未命名文件";
folder.file(fileName, blob);
} catch (e) {
@@ -478,13 +457,21 @@ function buildFileName(containerNo, index, fileName) {
<div class="g3-content">
<div class="content-top">
<div>
<el-button type="primary" @click="handleDownloadBatch">
<el-button
type="primary"
@click="handleDownloadBatch"
:disabled="!permissionStore.hasActionPermission(1)"
>
<el-icon class="el-icon--left">
<G3Icon icon="lucide:cloud-download" />
</el-icon>
批量下载
</el-button>
<el-button type="danger" @click="handleDeleteRows">
<el-button
type="danger"
@click="handleDeleteRows"
:disabled="!permissionStore.hasActionPermission(2)"
>
<el-icon class="el-icon--left">
<G3Icon icon="lucide:trash-2" />
</el-icon>
@@ -500,7 +487,7 @@ function buildFileName(containerNo, index, fileName) {
</el-button>
</el-tooltip>
<el-tooltip content="刷新">
<el-button circle>
<el-button circle @click="loadTableDatas">
<el-icon>
<G3Icon icon="lucide:refresh-ccw" />
</el-icon>
@@ -547,14 +534,7 @@ function buildFileName(containerNo, index, fileName) {
}"
height="100%"
>
<vxe-column
field="seq"
type="seq"
width="50"
align="center"
title=" "
fixed="left"
/>
<vxe-column field="seq" type="seq" width="50" align="center" title=" " fixed="left" />
<vxe-column type="checkbox" width="50" align="center" fixed="left" />
<vxe-column
v-for="column in columns"
@@ -575,30 +555,40 @@ function buildFileName(containerNo, index, fileName) {
/>
</template>
<template v-else>
{{
formatValueByFormat(
row[column.col_FieldName],
column.col_DisplayFormat,
)
}}
{{ formatValueByFormat(row[column.col_FieldName], column.col_DisplayFormat) }}
</template>
</template>
</vxe-column>
<vxe-column width="220" align="center" fixed="right" title="操作">
<template #default="{ row }">
<el-button link type="primary" @click="handleDownloadOne(row)">
<el-button
link
type="primary"
@click="handleDownloadOne(row)"
:disabled="!permissionStore.hasActionPermission(1)"
>
<el-icon class="el-icon--left">
<G3Icon icon="lucide:cloud-download" />
</el-icon>
下载
</el-button>
<el-button link type="primary" @click="handleFileShow(row)">
<el-button
link
type="primary"
@click="handleFileShow(row)"
:disabled="!permissionStore.hasActionPermission(3)"
>
<el-icon class="el-icon--left">
<G3Icon icon="lucide:file-image" />
</el-icon>
图片
</el-button>
<el-button link type="danger" @click="handleDeleteRow(row)">
<el-button
link
type="danger"
@click="handleDeleteRow(row)"
:disabled="!permissionStore.hasActionPermission(2)"
>
<el-icon class="el-icon--left">
<G3Icon icon="lucide:trash-2" />
</el-icon>