mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 06:29:20 +08:00
feat: 迁移旧媒体文件到统一文件系统 sys/file
Backend: - SysFileController 新增 deleteFile + updateFile 接口 - 新增 SysFileUpdateDTO 用于更新文件元信息 - SysFileServiceImpl 实现 deleteFile + updateFile(带 companyId 校验) Frontend: - 导入订单页面改用 batchUploadFilesApi(返回 storagePath) - 文件管理页 media/file/index.vue 改用 system/file API - uploadFileApi → batchUploadFilesApi - url → accessUrl - updateFileApi 改用 system/file - FileEditModal 改用 system/file 类型和 API 旧媒体系统 (media/file) 不再使用,待后续清理。
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { FileDTO, FileVO } from '#/api/media/file/types';
|
||||
import type { FileDTO, FileVO } from '#/api/system/file/types';
|
||||
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Form, Input, message } from 'ant-design-vue';
|
||||
|
||||
import { updateFileApi } from '#/api/media/file';
|
||||
import { updateFileApi } from '#/api/system/file';
|
||||
|
||||
defineOptions({ name: 'FileEditModal' });
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { FileDTO, FileVO } from '#/api/media/file/types';
|
||||
import type { FileDTO, FileVO } from '#/api/system/file/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
@@ -23,8 +23,7 @@ import {
|
||||
batchUploadFilesApi,
|
||||
deleteFileApi,
|
||||
getFilePageApi,
|
||||
uploadFileApi,
|
||||
} from '#/api/media/file';
|
||||
} from '#/api/system/file';
|
||||
|
||||
import FileEditModal from './components/FileEditModal.vue';
|
||||
|
||||
@@ -212,7 +211,7 @@ function refreshTable() {
|
||||
const handleUpload = async (file: File) => {
|
||||
uploadLoading.value = true;
|
||||
try {
|
||||
await uploadFileApi(file);
|
||||
await batchUploadFilesApi([file]);
|
||||
message.success('文件上传成功');
|
||||
refreshTable();
|
||||
} catch {
|
||||
@@ -241,12 +240,12 @@ const handleEdit = (record: FileVO.Info) => {
|
||||
};
|
||||
|
||||
const handlePreview = (record: FileVO.Info) => {
|
||||
window.open(record.url, '_blank');
|
||||
window.open(record.accessUrl, '_blank');
|
||||
};
|
||||
|
||||
const handleDownload = (record: FileVO.Info) => {
|
||||
const link = document.createElement('a');
|
||||
link.href = record.url;
|
||||
link.href = record.accessUrl;
|
||||
link.download = record.filename;
|
||||
link.click();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user