This commit is contained in:
oneao committed 2026-03-24 17:29:55 +08:00
1 parent 401a6719f6
commit b7f50f3ccb
22 files changed
+1595 -343

No files matched your search

@@ -32,7 +32,7 @@ import { loadDataApi, saveObjectKeysApi, deleteFileApi } from "@/request/api";
const props = defineProps({
father: {
type: String,
type: [String, Number],
required: true,
},
moduleId: {
@@ -56,6 +56,8 @@ const props = defineProps({
default: () => [],
},
});
const emits = defineEmits(["files-deleted"]);
const treeRef = ref(null);
const tableRef = ref(null);
@@ -206,6 +208,8 @@ watch(
if (newCategories && newCategories.length > 0) {
categories.value[0].children.push(...newCategories);
}
console.log(categories.value);
},
{ immediate: true },
);
@@ -349,11 +353,7 @@ 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;
@@ -498,9 +498,7 @@ 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;
@@ -513,10 +511,7 @@ 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");
}
@@ -526,9 +521,7 @@ 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);
@@ -573,6 +566,8 @@ async function deleteFiles(files) {
}
}
emits("files-deleted", files);
ElMessage.success("文件删除成功");
done();
} catch (error) {
@@ -598,12 +593,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) {
@@ -661,6 +656,8 @@ function onClosed() {
loading.value = false;
loadingTip.value = "正在加载中 . . .";
cateId.value = "";
}
function handleTreeNodeClick(data) {
@@ -690,9 +687,7 @@ 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
@@ -792,11 +787,7 @@ function handleTreeNodeClick(data) {
</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>
@@ -808,15 +799,9 @@ 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" />
@@ -832,15 +817,9 @@ 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"
>
<template v-if="file.mx_inputdatetime || file.mx_updatedatetime">
|
{{
formatTime(
file.mx_updatedatetime || file.mx_inputdatetime,
)
}}
{{ formatTime(file.mx_updatedatetime || file.mx_inputdatetime) }}
</template>
</div>
</div>
@@ -862,17 +841,8 @@ function handleTreeNodeClick(data) {
>
<G3Icon icon="lucide:download" />
</el-button>
<el-dropdown
v-if="!props.readonly"
placement="top"
trigger="click"
>
<el-button
type="info"
size="small"
circle
style="margin-left: 12px"
>
<el-dropdown v-if="!props.readonly" placement="top" trigger="click">
<el-button type="info" size="small" circle style="margin-left: 12px">
<G3Icon icon="lucide:ellipsis" />
</el-button>
<template #dropdown>
@@ -912,28 +882,14 @@ 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>
@@ -974,26 +930,14 @@ 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>
@@ -1029,12 +973,9 @@ function handleTreeNodeClick(data) {
:url-list="previewImageList"
:initial-index="preViewImageIndex"
hide-on-click-modal
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>
@@ -1047,16 +988,10 @@ 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')">
@@ -1086,11 +1021,7 @@ 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>