From 092ab7eb2c21b8a803a8eb5e4463927316b1bae6 Mon Sep 17 00:00:00 2001 From: chabai <14799297+dhasjklhdfjkasfbhfasfj@user.noreply.gitee.com> Date: Thu, 14 Aug 2025 15:27:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97=EF=BC=8C=E5=B0=86=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E5=95=86=E5=8A=A1=E6=A8=A1=E5=9D=97=E4=B8=9A=E5=8A=A1copy?= =?UTF-8?q?=E5=88=B0=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/data/index.ts | 188 ++ src/apis/data/type.ts | 98 + src/apis/index.ts | 1 + src/router/route.ts | 22 +- src/types/components.d.ts | 63 + src/views/data/data.vue | 3787 +++++++++++++++++++++++++++++++++++++ 6 files changed, 4158 insertions(+), 1 deletion(-) create mode 100644 src/apis/data/index.ts create mode 100644 src/apis/data/type.ts create mode 100644 src/views/data/data.vue diff --git a/src/apis/data/index.ts b/src/apis/data/index.ts new file mode 100644 index 0000000..cec076f --- /dev/null +++ b/src/apis/data/index.ts @@ -0,0 +1,188 @@ +// @/apis/data/index.ts - 数据管理API +import http from '@/utils/http' +import type { + FolderInfo, + FileInfo, + FolderListParams, + FileListParams, + FolderListResponse, + FileListResponse, + CreateFolderParams, + RenameFolderParams, + DeleteFolderParams, + UploadFileParams, + DownloadFileParams, + DeleteFileParams, + PreviewFileParams, + RenameFileParams +} from './type' + +const { request, requestRaw } = http + +// 导出类型定义 +export type { + FolderInfo, + FileInfo, + FolderListParams, + FileListParams, + FolderListResponse, + FileListResponse, + CreateFolderParams, + RenameFolderParams, + DeleteFolderParams, + UploadFileParams, + DownloadFileParams, + DeleteFileParams, + PreviewFileParams, + RenameFileParams +} + +// 获取文件夹列表(分页) +export function getFolderListApi(params?: FolderListParams) { + return request({ + url: '/data/folder/list', + method: 'get', + params: { + page: params?.page || 1, + pageSize: params?.pageSize || 10, + folderName: params?.folderName + } + }) +} + +// 获取文件列表(分页) +export function getFilesApi(params?: FileListParams) { + return request({ + url: '/data/file/list', + method: 'get', + params: { + page: params?.page || 1, + pageSize: params?.pageSize || 10, + folderId: params?.folderId || '0', + fileName: params?.fileName, + sortField: params?.sortField, + sortOrder: params?.sortOrder + } + }) +} + +// 创建文件夹 +export function createFolderApi(data: CreateFolderParams) { + return request({ + url: '/data/folder/creatFolder', + method: 'post', + data: { + name: data.name, + parentId: data.parentId || '0' + } + }) +} + +// 重命名文件夹 +export function updateFolderApi(folderId: string, newName: string) { + return request({ + url: '/data/folder/rename', + method: 'put', + params: { + folderId: folderId, + newName: newName + } + }) +} + +// 删除文件夹 +export function deleteFolderApi(folderId: string) { + return request({ + url: '/data/folder/delete', + method: 'delete', + params: { + folderId: folderId + } + }) +} + +// 上传文件 +export function uploadFileApi( + file: File, + folderId: string, + onUploadProgress?: (progressEvent: any) => void, + cancelToken?: any +) { + const formData = new FormData() + formData.append('file', file) + + return requestRaw({ + url: '/data/file/add', + method: 'post', + params: { + folderId: folderId + }, + data: formData, + onUploadProgress, + cancelToken, + headers: { + 'Content-Type': 'multipart/form-data' + } + }).then(response => response.data) + .catch(error => { + // 确保错误不会抛出,而是返回一个错误对象 + console.error('上传文件API错误:', error) + return { + code: 500, + msg: error.message || '上传失败', + success: false + } + }) +} + +// 下载文件 +export function downloadFileApi(fileId: string) { + return request({ + url: '/data/file/download', + method: 'get', + params: { + fileId: fileId + }, + responseType: 'blob' + }) +} + +// 删除文件 +export function deleteFileApi(fileId: string) { + return request({ + url: '/data/file/delete', + method: 'delete', + params: { + fileId: fileId + } + }) +} + +// 预览文件 +export function previewFileApi(fileId: string) { + return request({ + url: '/data/file/preview', + method: 'get', + params: { + fileId: fileId + }, + responseType: 'blob' + }) +} + +// 重命名文件 +export function renameFileApi(fileId: string, newFileName: string) { + return request({ + url: '/data/file/rename', + method: 'put', + params: { + fileId: fileId, + newFileName: newFileName + } + }) +} + +// 重命名文件(兼容旧接口) +export function updateFileNameApi(fileId: string, data: RenameFileParams) { + return renameFileApi(fileId, data.newFileName) +} \ No newline at end of file diff --git a/src/apis/data/type.ts b/src/apis/data/type.ts new file mode 100644 index 0000000..b5aa836 --- /dev/null +++ b/src/apis/data/type.ts @@ -0,0 +1,98 @@ +/** 文件夹信息接口 */ +export interface FolderInfo { + folderId: string + name: string + parentId: string + createTime?: string + updateTime?: string + } + + /** 文件信息接口 */ + export interface FileInfo { + fileId: string + fileName: string + fileSize: number + fileType: string + folderId: string + createTime?: string + updateTime?: string + } + + /** 文件夹列表查询参数 */ + export interface FolderListParams { + page?: number + pageSize?: number + folderName?: string + } + + /** 文件列表查询参数 */ + export interface FileListParams { + page?: number + pageSize?: number + folderId?: string + fileName?: string + sortField?: string + sortOrder?: string + } + + /** 文件夹列表响应 */ + export interface FolderListResponse { + data: FolderInfo[] + total: number + current: number + size: number + } + + /** 文件列表响应 */ + export interface FileListResponse { + data: FileInfo[] + total: number + current: number + size: number + } + + /** 创建文件夹请求参数 */ + export interface CreateFolderParams { + name: string + parentId?: string + } + + /** 重命名文件夹请求参数 */ + export interface RenameFolderParams { + folderId: string + newName: string + } + + /** 删除文件夹请求参数 */ + export interface DeleteFolderParams { + folderId: string + } + + /** 上传文件请求参数 */ + export interface UploadFileParams { + file: File + folderId: string + onUploadProgress?: (progressEvent: any) => void + cancelToken?: any + } + + /** 下载文件请求参数 */ + export interface DownloadFileParams { + fileId: string + } + + /** 删除文件请求参数 */ + export interface DeleteFileParams { + fileId: string + } + + /** 预览文件请求参数 */ + export interface PreviewFileParams { + fileId: string + } + + /** 重命名文件请求参数 */ + export interface RenameFileParams { + fileId: string + newFileName: string + } \ No newline at end of file diff --git a/src/apis/index.ts b/src/apis/index.ts index 8218898..c39615e 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -20,6 +20,7 @@ export * as RegulationAPI from './regulation' export * as TrainingAPI from './training' export * as EquipmentAPI from './equipment' export * as BussinessAPI from './bussiness/bussiness' +export * as DataAPI from './data' export * from './area/type' export * from './auth/type' diff --git a/src/router/route.ts b/src/router/route.ts index 05536b6..ddc8ced 100644 --- a/src/router/route.ts +++ b/src/router/route.ts @@ -1184,7 +1184,7 @@ export const systemRoutes: RouteRecordRaw[] = [ name: 'bussinesskonwledge', component: Layout, redirect: '/bussiness-knowledge/data', - meta: { title: '商务资料知识库', icon: 'database', hidden: false, sort: 5.5 }, + meta: { title: '智能商务', icon: 'database', hidden: false, sort: 5.5 }, children: [ { path: '/bussiness-konwledge/data', @@ -1198,6 +1198,26 @@ export const systemRoutes: RouteRecordRaw[] = [ }, ], }, + // 数据管理模块 + { + path: '/data-management', + name: 'dataManagement', + component: Layout, + redirect: '/data-management/data', + meta: { title: '数据管理', icon: 'database', hidden: false, sort: 5.6 }, + children: [ + { + path: '/data-management/data', + name: 'data-management', + component: () => import('@/views/data/data.vue'), + meta: { + title: '数据管理', + icon: 'database', + hidden: false, + }, + }, + ], + }, { path: '/image-detection', name: 'ImageDetection', diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 7fa6b1b..a427ece 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -7,7 +7,70 @@ export {} declare module 'vue' { export interface GlobalComponents { + ApprovalAssistant: typeof import('./../components/ApprovalAssistant/index.vue')['default'] + ApprovalMessageItem: typeof import('./../components/NotificationCenter/ApprovalMessageItem.vue')['default'] + Avatar: typeof import('./../components/Avatar/index.vue')['default'] + Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default'] + CellCopy: typeof import('./../components/CellCopy/index.vue')['default'] + Chart: typeof import('./../components/Chart/index.vue')['default'] + CircularProgress: typeof import('./../components/CircularProgress/index.vue')['default'] + ColumnSetting: typeof import('./../components/GiTable/src/components/ColumnSetting.vue')['default'] + CronForm: typeof import('./../components/GenCron/CronForm/index.vue')['default'] + CronModal: typeof import('./../components/GenCron/CronModal/index.vue')['default'] + DateRangePicker: typeof import('./../components/DateRangePicker/index.vue')['default'] + DayForm: typeof import('./../components/GenCron/CronForm/component/day-form.vue')['default'] + FilePreview: typeof import('./../components/FilePreview/index.vue')['default'] + GiCellAvatar: typeof import('./../components/GiCell/GiCellAvatar.vue')['default'] + GiCellGender: typeof import('./../components/GiCell/GiCellGender.vue')['default'] + GiCellStatus: typeof import('./../components/GiCell/GiCellStatus.vue')['default'] + GiCellTag: typeof import('./../components/GiCell/GiCellTag.vue')['default'] + GiCellTags: typeof import('./../components/GiCell/GiCellTags.vue')['default'] + GiCodeView: typeof import('./../components/GiCodeView/index.vue')['default'] + GiDot: typeof import('./../components/GiDot/index.tsx')['default'] + GiEditTable: typeof import('./../components/GiEditTable/GiEditTable.vue')['default'] + GiFooter: typeof import('./../components/GiFooter/index.vue')['default'] + GiForm: typeof import('./../components/GiForm/src/GiForm.vue')['default'] + GiIconBox: typeof import('./../components/GiIconBox/index.vue')['default'] + GiIconSelector: typeof import('./../components/GiIconSelector/index.vue')['default'] + GiIframe: typeof import('./../components/GiIframe/index.vue')['default'] + GiOption: typeof import('./../components/GiOption/index.vue')['default'] + GiOptionItem: typeof import('./../components/GiOptionItem/index.vue')['default'] + GiPageLayout: typeof import('./../components/GiPageLayout/index.vue')['default'] + GiSpace: typeof import('./../components/GiSpace/index.vue')['default'] + GiSplitButton: typeof import('./../components/GiSplitButton/index.vue')['default'] + GiSplitPane: typeof import('./../components/GiSplitPane/index.vue')['default'] + GiSplitPaneFlexibleBox: typeof import('./../components/GiSplitPane/components/GiSplitPaneFlexibleBox.vue')['default'] + GiSvgIcon: typeof import('./../components/GiSvgIcon/index.vue')['default'] + GiTable: typeof import('./../components/GiTable/src/GiTable.vue')['default'] + GiTag: typeof import('./../components/GiTag/index.tsx')['default'] + GiThemeBtn: typeof import('./../components/GiThemeBtn/index.vue')['default'] + HourForm: typeof import('./../components/GenCron/CronForm/component/hour-form.vue')['default'] + Icon403: typeof import('./../components/icons/Icon403.vue')['default'] + Icon404: typeof import('./../components/icons/Icon404.vue')['default'] + Icon500: typeof import('./../components/icons/Icon500.vue')['default'] + IconBorders: typeof import('./../components/icons/IconBorders.vue')['default'] + IconTableSize: typeof import('./../components/icons/IconTableSize.vue')['default'] + IconTreeAdd: typeof import('./../components/icons/IconTreeAdd.vue')['default'] + IconTreeReduce: typeof import('./../components/icons/IconTreeReduce.vue')['default'] + ImageImport: typeof import('./../components/ImageImport/index.vue')['default'] + ImageImportWizard: typeof import('./../components/ImageImportWizard/index.vue')['default'] + IndustrialImageList: typeof import('./../components/IndustrialImageList/index.vue')['default'] + JsonPretty: typeof import('./../components/JsonPretty/index.vue')['default'] + MinuteForm: typeof import('./../components/GenCron/CronForm/component/minute-form.vue')['default'] + MonthForm: typeof import('./../components/GenCron/CronForm/component/month-form.vue')['default'] + NotificationCenter: typeof import('./../components/NotificationCenter/index.vue')['default'] + ParentView: typeof import('./../components/ParentView/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + SecondForm: typeof import('./../components/GenCron/CronForm/component/second-form.vue')['default'] + SplitPanel: typeof import('./../components/SplitPanel/index.vue')['default'] + TextCopy: typeof import('./../components/TextCopy/index.vue')['default'] + TurbineGrid: typeof import('./../components/TurbineGrid/index.vue')['default'] + UserSelect: typeof import('./../components/UserSelect/index.vue')['default'] + Verify: typeof import('./../components/Verify/index.vue')['default'] + VerifyPoints: typeof import('./../components/Verify/Verify/VerifyPoints.vue')['default'] + VerifySlide: typeof import('./../components/Verify/Verify/VerifySlide.vue')['default'] + WeekForm: typeof import('./../components/GenCron/CronForm/component/week-form.vue')['default'] + YearForm: typeof import('./../components/GenCron/CronForm/component/year-form.vue')['default'] } } diff --git a/src/views/data/data.vue b/src/views/data/data.vue new file mode 100644 index 0000000..d4d6c3a --- /dev/null +++ b/src/views/data/data.vue @@ -0,0 +1,3787 @@ + + + + +