u
This commit is contained in:
1 parent
04d00b5b0b
commit
26721a142e
5 files changed
+350
-23
No files matched your search
@@ -15,6 +15,7 @@ import { saveAs } from "file-saver";
|
||||
import JSZip from "jszip";
|
||||
import { usePermissionStore } from "@/store/permission";
|
||||
import { ExportVxeTableExcel, exportExcel } from "@/utils/excel";
|
||||
import HighDownloadDialog from "./high-download-dialog.vue";
|
||||
|
||||
const tableRef = ref();
|
||||
|
||||
@@ -28,6 +29,8 @@ const loading = reactive({
|
||||
table: true,
|
||||
});
|
||||
|
||||
const showHighDownload = ref(false);
|
||||
|
||||
const searchForm = ref({
|
||||
startTime: "",
|
||||
endTime: "",
|
||||
@@ -57,7 +60,9 @@ 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({});
|
||||
@@ -190,9 +195,12 @@ 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;
|
||||
@@ -268,7 +276,11 @@ 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("获取附件失败");
|
||||
@@ -276,7 +288,11 @@ 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,
|
||||
}));
|
||||
|
||||
@@ -338,7 +354,11 @@ async function handleDownloadBatch() {
|
||||
let finished = 0;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -349,7 +369,11 @@ async function handleDownloadBatch() {
|
||||
|
||||
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("获取附件失败");
|
||||
@@ -365,7 +389,8 @@ async function handleDownloadBatch() {
|
||||
const blob = getAliyunFileBlob(fileUrl);
|
||||
|
||||
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) {
|
||||
@@ -401,7 +426,6 @@ function buildFileName(containerNo, index, fileName) {
|
||||
}
|
||||
|
||||
function testExport() {
|
||||
|
||||
const options = {
|
||||
columns: [
|
||||
{
|
||||
@@ -575,6 +599,16 @@ function testExport() {
|
||||
</el-icon>
|
||||
批量下载
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="!permissionStore.hasActionPermission(1)"
|
||||
@click="showHighDownload = true"
|
||||
>
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:cloud-download" />
|
||||
</el-icon>
|
||||
高级下载
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="handleDeleteRows"
|
||||
@@ -612,7 +646,12 @@ function testExport() {
|
||||
<el-dropdown-item @click="updateViewTableColumns(tableRef)">
|
||||
栏位保存
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="ExportVxeTableExcel(tableRef)"> 导出Execl </el-dropdown-item>
|
||||
<el-dropdown-item @click="ExportVxeTableExcel(tableRef)">
|
||||
导出Execl
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="ExportVxeTableExcel(tableRef)">
|
||||
高级导出
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -644,7 +683,14 @@ function testExport() {
|
||||
show-overflow
|
||||
show-header-overflow
|
||||
>
|
||||
<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"
|
||||
@@ -665,7 +711,12 @@ function testExport() {
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ formatValueByFormat(row[column.col_FieldName], column.col_DisplayFormat) }}
|
||||
{{
|
||||
formatValueByFormat(
|
||||
row[column.col_FieldName],
|
||||
column.col_DisplayFormat,
|
||||
)
|
||||
}}
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -736,6 +787,8 @@ function testExport() {
|
||||
module-id="b_container"
|
||||
:categories="fileCategories"
|
||||
/>
|
||||
|
||||
<HighDownloadDialog v-model="showHighDownload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in new issue
Block a user