This commit is contained in:
oneao committed 2026-03-23 21:12:09 +08:00
1 parent 3e172a1d53
commit 401a6719f6
12 files changed
+487 -277

No files matched your search

@@ -349,7 +349,11 @@ async function uploadLocalFiles(files) {
const tempUrl = URL.createObjectURL(blob);
if (file.size > 512000) {
const { url, size, blob: compressedBlob } = await compressImage(tempUrl);
const {
url,
size,
blob: compressedBlob,
} = await compressImage(tempUrl);
fileInfo.mx_mapfilename = url;
fileInfo.mx_filesize = size;
@@ -494,7 +498,9 @@ async function handleDownloadFile(file) {
function handleShowPreview(file) {
console.log(file);
if (isImage(file.mx_fileext)) {
const index = previewImageList.value.findIndex((item) => item === file.mx_mapfilename);
const index = previewImageList.value.findIndex(
(item) => item === file.mx_mapfilename,
);
if (index !== -1) {
preViewImageIndex.value = index;
@@ -507,7 +513,10 @@ function handleShowPreview(file) {
if (isExcel(file.mx_fileext)) {
// https://view.officeapps.live.com/op/view.aspx?src=
window.open(`https://view.officeapps.live.com/op/view.aspx?src=${fileUrl}`, "_blank");
window.open(
`https://view.officeapps.live.com/op/view.aspx?src=${fileUrl}`,
"_blank",
);
} else {
window.open(fileUrl, "_blank");
}
@@ -517,7 +526,9 @@ function handleShowPreview(file) {
function handleDownloadPreviewImage(index) {
const previewFileUrl = previewImageList.value[index];
const previewFile = fileList.value.find((item) => item.mx_mapfilename === previewFileUrl);
const previewFile = fileList.value.find(
(item) => item.mx_mapfilename === previewFileUrl,
);
if (previewFile) {
handleDownloadFile(previewFile);
@@ -558,7 +569,7 @@ async function deleteFiles(files) {
try {
for (const item of files) {
if (item.subid) {
await deleteFileApi("bf_file", item.subid);
await deleteFileApi(item.subid);
}
}
@@ -587,12 +598,12 @@ async function handleSave() {
loading.value = true;
loadingTip.value = "正在保存中 . . .";
const { insertdata, updatedata, deletedata, hasChanges } = compareAndClassifyData(
fileList.value,
oldFileList.value,
"subid",
["_content", "_status", "checked"],
);
const { insertdata, updatedata, deletedata, hasChanges } =
compareAndClassifyData(fileList.value, oldFileList.value, "subid", [
"_content",
"_status",
"checked",
]);
// 处理新增的文件
for (const item of insertdata) {
@@ -679,7 +690,9 @@ function handleTreeNodeClick(data) {
<div class="g3-title">
附件管理({{ fileList.length }})
<template v-if="!props.readonly"> 未上传 ({{ pendingFileList.length }}) </template>
<template v-if="!props.readonly">
未上传 ({{ pendingFileList.length }})
</template>
</div>
</template>
<input
@@ -719,6 +732,9 @@ function handleTreeNodeClick(data) {
style="margin-left: 8px"
@click="handleDownloadZip"
>
<el-icon class="el-icon--left">
<G3Icon icon="lucide:download" />
</el-icon>
打包下载
</el-button>
@@ -729,6 +745,9 @@ function handleTreeNodeClick(data) {
:disabled="checkedFiles.length === 0 || loading"
@click="handleBatchDelete()"
>
<el-icon class="el-icon--left">
<G3Icon icon="lucide:trash-2" />
</el-icon>
批量删除
</el-button>
</div>
@@ -738,7 +757,7 @@ function handleTreeNodeClick(data) {
<span class="g3-mode">
模式:{{ displayMode === 0 ? "卡片视图" : "列表视图" }}
<el-icon class="el-icon--right">
<ArrowDown />
<G3Icon icon="lucide:chevron-down" />
</el-icon>
</span>
<template #dropdown>
@@ -767,13 +786,17 @@ function handleTreeNodeClick(data) {
>
<div v-if="fileList.length === 0" class="g3-tip">
<el-icon size="64">
<UploadFilled />
<G3Icon icon="lucide:cloud-upload" />
</el-icon>
<div>支持 拖拽文件、粘贴文件、多文件上传</div>
</div>
<div v-else-if="displayMode === 0" class="g3-files">
<div v-for="(file, index) in fileList" :key="index" class="g3-file-item">
<div
v-for="(file, index) in fileList"
:key="index"
class="g3-file-item"
>
<div class="g3-file-checkbox">
<el-checkbox v-model="file._checked" size="large" />
</div>
@@ -785,9 +808,15 @@ function handleTreeNodeClick(data) {
<span v-if="file._status === 'pending'">未上传</span>
<span v-if="file._status === 'failed'">上传失败</span>
</div>
<div class="g3-file-preview" @click.stop="handleShowPreview(file)">
<div
class="g3-file-preview"
@click.stop="handleShowPreview(file)"
>
<template v-if="getFileIcon(file.mx_fileext) === 'image'">
<el-image class="g3-file-preview-img" :src="file.mx_mapfilename" />
<el-image
class="g3-file-preview-img"
:src="file.mx_mapfilename"
/>
</template>
<template v-else>
<G3Icon :icon="getFileIcon(file.mx_fileext)" size="88" />
@@ -803,8 +832,15 @@ function handleTreeNodeClick(data) {
<div>{{ formatFileSize(file.mx_filesize) }}</div>
<div>
{{ file.mx_updateuser_id || file.mx_inputuser_id }}
<template v-if="file.mx_inputdatetime || file.mx_updatedatetime">
| {{ formatTime(file.mx_updatedatetime || file.mx_inputdatetime) }}
<template
v-if="file.mx_inputdatetime || file.mx_updatedatetime"
>
|
{{
formatTime(
file.mx_updatedatetime || file.mx_inputdatetime,
)
}}
</template>
</div>
</div>
@@ -812,26 +848,33 @@ function handleTreeNodeClick(data) {
<el-button
v-if="!props.readonly"
type="danger"
:icon="Delete"
size="small"
circle
@click.stop="handleDeleteOne(file)"
/>
>
<G3Icon icon="lucide:trash-2" />
</el-button>
<el-button
type="primary"
:icon="Download"
size="small"
circle
@click.stop="handleDownloadFile(file)"
/>
<el-dropdown v-if="!props.readonly" placement="top" trigger="click">
>
<G3Icon icon="lucide:download" />
</el-button>
<el-dropdown
v-if="!props.readonly"
placement="top"
trigger="click"
>
<el-button
type="info"
:icon="More"
size="small"
circle
style="margin-left: 12px"
/>
>
<G3Icon icon="lucide:ellipsis" />
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="handleShowUpdateDialog(file)">
@@ -855,9 +898,6 @@ function handleTreeNodeClick(data) {
height="100%"
show-overflow
show-header-overflow
:cell-config="{
height: 26,
}"
:sort-config="{
trigger: 'cell',
}"
@@ -872,14 +912,28 @@ function handleTreeNodeClick(data) {
<el-checkbox v-model="row._checked" size="large" />
</template>
</vxe-column>
<vxe-column field="mx_filename" title="文件名" sortable align="center">
<vxe-column
field="mx_filename"
title="文件名"
sortable
align="center"
>
<template #default="{ row }">
<el-button type="primary" link @click.stop="handleShowPreview(row)">
<el-button
type="primary"
link
@click.stop="handleShowPreview(row)"
>
{{ row.mx_filename }}
</el-button>
</template>
</vxe-column>
<vxe-column field="mx_inputdatetime" title="上传日期" sortable align="center">
<vxe-column
field="mx_inputdatetime"
title="上传日期"
sortable
align="center"
>
<template #default="{ row }">
{{ formatTime(row.mx_inputdatetime) }}
</template>
@@ -904,7 +958,14 @@ function handleTreeNodeClick(data) {
</vxe-column>
<vxe-column width="180" title="操作">
<template #default="{ row }">
<div style="display: flex; align-items: center; justify-content: center">
<div
style="
display: flex;
align-items: center;
justify-content: center;
height: 28px;
"
>
<el-button
v-if="!props.readonly"
type="danger"
@@ -913,14 +974,26 @@ function handleTreeNodeClick(data) {
>
删除
</el-button>
<el-button type="primary" link @click.stop="handleDownloadFile(row)">
<el-button
type="primary"
link
@click.stop="handleDownloadFile(row)"
>
下载
</el-button>
<el-dropdown v-if="!props.readonly" placement="top" trigger="click">
<el-button type="info" link style="margin-left: 12px"> 更多 </el-button>
<el-dropdown
v-if="!props.readonly"
placement="top"
trigger="click"
>
<el-button type="info" link style="margin-left: 12px">
更多
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="handleShowUpdateDialog(row)">
<el-dropdown-item
@click="handleShowUpdateDialog(row)"
>
修改文件信息
</el-dropdown-item>
</el-dropdown-menu>
@@ -937,10 +1010,16 @@ function handleTreeNodeClick(data) {
</div>
<template v-if="!props.readonly" #footer>
<el-button type="primary" :icon="HelpFilled" :disabled="loading" @click="handleClickUpload">
<el-button type="primary" :disabled="loading" @click="handleClickUpload">
<el-icon class="el-icon--left">
<G3Icon icon="lucide:mouse-pointer" />
</el-icon>
选择
</el-button>
<el-button type="primary" :icon="UploadFilled" :disabled="loading" @click="handleSave">
<el-button type="primary" :disabled="loading" @click="handleSave">
<el-icon class="el-icon--left">
<G3Icon icon="lucide:upload" />
</el-icon>
上传
</el-button>
</template>
@@ -953,7 +1032,9 @@ function handleTreeNodeClick(data) {
preview-teleported
@close="showPreview = false"
>
<template #toolbar="{ actions, prev, next, reset, activeIndex, setActiveItem }">
<template
#toolbar="{ actions, prev, next, reset, activeIndex, setActiveItem }"
>
<ElIcon @click="prev">
<Back />
</ElIcon>
@@ -966,10 +1047,16 @@ function handleTreeNodeClick(data) {
<ElIcon @click="actions('zoomOut')">
<ZoomOut />
</ElIcon>
<ElIcon @click="actions('zoomIn', { enableTransition: false, zoomRate: 2 })">
<ElIcon
@click="actions('zoomIn', { enableTransition: false, zoomRate: 2 })"
>
<ZoomIn />
</ElIcon>
<ElIcon @click="actions('clockwise', { rotateDeg: 180, enableTransition: false })">
<ElIcon
@click="
actions('clockwise', { rotateDeg: 180, enableTransition: false })
"
>
<RefreshRight />
</ElIcon>
<ElIcon @click="actions('anticlockwise')">
@@ -999,7 +1086,11 @@ function handleTreeNodeClick(data) {
<template #footer>
<div class="dialog-footer">
<el-button @click="showUpdateDialog = false"> 取消 </el-button>
<el-button type="primary" :loading="updateLoading" @click="handleConfirmUpdate">
<el-button
type="primary"
:loading="updateLoading"
@click="handleConfirmUpdate"
>
确认
</el-button>
</div>