From f1313b1f1c08a5e10fe4e309e82c97f911d5505c Mon Sep 17 00:00:00 2001 From: dlarmor <121919810@qq.com> Date: Tue, 14 Mar 2023 10:47:52 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=20->=20=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E6=96=87=E4=BB=B6=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/en.ts | 3 +- src/locales/zh-CN.ts | 3 +- src/views/infra/file/form.vue | 82 ++++++++++ src/views/infra/file/index.vue | 162 ++++++++++++++++++++ src/views/infra/fileList/fileList.data.ts | 52 ------- src/views/infra/fileList/index.vue | 173 ---------------------- 6 files changed, 248 insertions(+), 227 deletions(-) create mode 100644 src/views/infra/file/form.vue create mode 100644 src/views/infra/file/index.vue delete mode 100644 src/views/infra/fileList/fileList.data.ts delete mode 100644 src/views/infra/fileList/index.vue diff --git a/src/locales/en.ts b/src/locales/en.ts index 1600a19f..4f4d4895 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -297,7 +297,8 @@ export default { typeCreate: 'Dict Type Create', typeUpdate: 'Dict Type Eidt', dataCreate: 'Dict Data Create', - dataUpdate: 'Dict Data Eidt' + dataUpdate: 'Dict Data Eidt', + fileUpload: 'File Upload' }, dialog: { dialog: 'Dialog', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 7c5742c4..6f46f1ab 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -297,7 +297,8 @@ export default { typeCreate: '字典类型新增', typeUpdate: '字典类型编辑', dataCreate: '字典数据新增', - dataUpdate: '字典数据编辑' + dataUpdate: '字典数据编辑', + fileUpload: '上传文件' }, dialog: { dialog: '弹窗', diff --git a/src/views/infra/file/form.vue b/src/views/infra/file/form.vue new file mode 100644 index 00000000..8550d440 --- /dev/null +++ b/src/views/infra/file/form.vue @@ -0,0 +1,82 @@ + + + + + 将文件拖到此处,或 点击上传 + + + 提示:仅允许导入 jpg、png、gif 格式文件! + + + + + + + + + + + + diff --git a/src/views/infra/file/index.vue b/src/views/infra/file/index.vue new file mode 100644 index 00000000..77beb3e5 --- /dev/null +++ b/src/views/infra/file/index.vue @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + 搜索 + 重置 + + 上传文件 + + + + + + + + + + + + + + + + + + 删除 + + + + + + + + + + + + diff --git a/src/views/infra/fileList/fileList.data.ts b/src/views/infra/fileList/fileList.data.ts deleted file mode 100644 index 29be6dae..00000000 --- a/src/views/infra/fileList/fileList.data.ts +++ /dev/null @@ -1,52 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' -const { t } = useI18n() // 国际化 - -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: 'seq', - action: true, - columns: [ - { - title: '文件名', - field: 'name' - }, - { - title: '文件路径', - field: 'path', - isSearch: true - }, - { - title: 'URL', - field: 'url', - table: { - cellRender: { - name: 'XPreview' - } - } - }, - { - title: '文件大小', - field: 'size', - formatter: 'formatSize' - }, - { - title: '文件类型', - field: 'type', - isSearch: true - }, - { - title: t('common.createTime'), - field: 'createTime', - formatter: 'formatDate', - isForm: false, - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - } - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/src/views/infra/fileList/index.vue b/src/views/infra/fileList/index.vue deleted file mode 100644 index cda8b68d..00000000 --- a/src/views/infra/fileList/index.vue +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - - - - {{ row.url }} - - - - - - - - - - - 将文件拖到此处,或点击上传 - - 请上传 .jpg, .png, .gif 标准格式文件 - - - - - - - - - - - From fee8245f4ed758fa42a0ef39ca7f65a7b4b59f3f Mon Sep 17 00:00:00 2001 From: dlarmor <121919810@qq.com> Date: Tue, 14 Mar 2023 11:45:37 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=20->=20=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E6=96=87=E4=BB=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/fileConfig/fileConfig.data.ts | 77 ---- src/views/infra/fileConfig/form.vue | 195 ++++++++ src/views/infra/fileConfig/index.vue | 433 +++++++----------- 3 files changed, 365 insertions(+), 340 deletions(-) delete mode 100644 src/views/infra/fileConfig/fileConfig.data.ts create mode 100644 src/views/infra/fileConfig/form.vue diff --git a/src/views/infra/fileConfig/fileConfig.data.ts b/src/views/infra/fileConfig/fileConfig.data.ts deleted file mode 100644 index d0f64869..00000000 --- a/src/views/infra/fileConfig/fileConfig.data.ts +++ /dev/null @@ -1,77 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' -const { t } = useI18n() // 国际化 - -// 表单校验 -export const rules = reactive({ - name: [required], - storage: [required], - config: { - basePath: [required], - host: [required], - port: [required], - username: [required], - password: [required], - mode: [required], - endpoint: [required], - bucket: [required], - accessKey: [required], - accessSecret: [required], - domain: [required] - } -}) - -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: 'seq', - primaryTitle: '配置编号', - action: true, - actionWidth: '400px', - columns: [ - { - title: '配置名', - field: 'name', - isSearch: true - }, - { - title: '存储器', - field: 'storage', - dictType: DICT_TYPE.INFRA_FILE_STORAGE, - dictClass: 'number', - isSearch: true - }, - { - title: '主配置', - field: 'master', - dictType: DICT_TYPE.INFRA_BOOLEAN_STRING, - dictClass: 'boolean' - }, - { - title: t('form.remark'), - field: 'remark', - form: { - component: 'Input', - componentProps: { - type: 'textarea', - rows: 4 - }, - colProps: { - span: 24 - } - } - }, - { - title: t('common.createTime'), - field: 'createTime', - formatter: 'formatDate', - isForm: false, - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - } - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/src/views/infra/fileConfig/form.vue b/src/views/infra/fileConfig/form.vue new file mode 100644 index 00000000..ee7bd238 --- /dev/null +++ b/src/views/infra/fileConfig/form.vue @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 主动模式 + 主动模式 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/infra/fileConfig/index.vue b/src/views/infra/fileConfig/index.vue index 9d796a65..4416b094 100644 --- a/src/views/infra/fileConfig/index.vue +++ b/src/views/infra/fileConfig/index.vue @@ -1,294 +1,201 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - + - + - - - - + + - - - - - - - - - - - - - - - 主动模式 - 主动模式 - - - - - - - - - - - - - - - - - - - - - - + + 搜索 + 重置 + + 新增 + - - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + 编辑 + + + 主配置 + + 测试 + + 删除 + + + + + + + + + + - From fe2fa21d44c93b419dbe55bc0b1cd6172aaaccc0 Mon Sep 17 00:00:00 2001 From: dlarmor <121919810@qq.com> Date: Tue, 14 Mar 2023 11:48:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=20->=20=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E6=8E=A5=E5=8F=A3=E6=96=87=E4=BB=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/{fileList => file}/index.ts | 15 ++------------- src/api/infra/fileConfig/index.ts | 14 +++++++------- src/views/infra/fileConfig/form.vue | 6 +++--- src/views/infra/fileConfig/index.vue | 8 ++++---- 4 files changed, 16 insertions(+), 27 deletions(-) rename src/api/infra/{fileList => file}/index.ts (54%) diff --git a/src/api/infra/fileList/index.ts b/src/api/infra/file/index.ts similarity index 54% rename from src/api/infra/fileList/index.ts rename to src/api/infra/file/index.ts index 48b3c991..f64bc0d6 100644 --- a/src/api/infra/fileList/index.ts +++ b/src/api/infra/file/index.ts @@ -1,16 +1,5 @@ import request from '@/config/axios' -export interface FileVO { - id: number - configId: number - path: string - name: string - url: string - size: string - type: string - createTime: Date -} - export interface FilePageReqVO extends PageParam { path?: string type?: string @@ -18,11 +7,11 @@ export interface FilePageReqVO extends PageParam { } // 查询文件列表 -export const getFilePageApi = (params: FilePageReqVO) => { +export const getFilePage = (params: FilePageReqVO) => { return request.get({ url: '/infra/file/page', params }) } // 删除文件 -export const deleteFileApi = (id: number) => { +export const deleteFile = (id: number) => { return request.delete({ url: '/infra/file/delete?id=' + id }) } diff --git a/src/api/infra/fileConfig/index.ts b/src/api/infra/fileConfig/index.ts index 2151141c..2f096706 100644 --- a/src/api/infra/fileConfig/index.ts +++ b/src/api/infra/fileConfig/index.ts @@ -31,36 +31,36 @@ export interface FileConfigPageReqVO extends PageParam { } // 查询文件配置列表 -export const getFileConfigPageApi = (params: FileConfigPageReqVO) => { +export const getFileConfigPage = (params: FileConfigPageReqVO) => { return request.get({ url: '/infra/file-config/page', params }) } // 查询文件配置详情 -export const getFileConfigApi = (id: number) => { +export const getFileConfig = (id: number) => { return request.get({ url: '/infra/file-config/get?id=' + id }) } // 更新文件配置为主配置 -export const updateFileConfigMasterApi = (id: number) => { +export const updateFileConfigMaster = (id: number) => { return request.put({ url: '/infra/file-config/update-master?id=' + id }) } // 新增文件配置 -export const createFileConfigApi = (data: FileConfigVO) => { +export const createFileConfig = (data: FileConfigVO) => { return request.post({ url: '/infra/file-config/create', data }) } // 修改文件配置 -export const updateFileConfigApi = (data: FileConfigVO) => { +export const updateFileConfig = (data: FileConfigVO) => { return request.put({ url: '/infra/file-config/update', data }) } // 删除文件配置 -export const deleteFileConfigApi = (id: number) => { +export const deleteFileConfig = (id: number) => { return request.delete({ url: '/infra/file-config/delete?id=' + id }) } // 测试文件配置 -export const testFileConfigApi = (id: number) => { +export const testFileConfig = (id: number) => { return request.get({ url: '/infra/file-config/test?id=' + id }) } diff --git a/src/views/infra/fileConfig/form.vue b/src/views/infra/fileConfig/form.vue index ee7bd238..a23aac9f 100644 --- a/src/views/infra/fileConfig/form.vue +++ b/src/views/infra/fileConfig/form.vue @@ -147,7 +147,7 @@ const openModal = async (type: string, id?: number) => { if (id) { formLoading.value = true try { - formData.value = await FileConfigApi.getFileConfigApi(id) + formData.value = await FileConfigApi.getFileConfig(id) } finally { formLoading.value = false } @@ -167,10 +167,10 @@ const submitForm = async () => { try { const data = formData.value as unknown as FileConfigApi.FileConfigVO if (formType.value === 'create') { - await FileConfigApi.createFileConfigApi(data) + await FileConfigApi.createFileConfig(data) message.success(t('common.createSuccess')) } else { - await FileConfigApi.updateFileConfigApi(data) + await FileConfigApi.updateFileConfig(data) message.success(t('common.updateSuccess')) } modelVisible.value = false diff --git a/src/views/infra/fileConfig/index.vue b/src/views/infra/fileConfig/index.vue index 4416b094..3b683e4e 100644 --- a/src/views/infra/fileConfig/index.vue +++ b/src/views/infra/fileConfig/index.vue @@ -135,7 +135,7 @@ const queryFormRef = ref() // 搜索的表单 const getList = async () => { loading.value = true try { - const data = await FileConfigApi.getFileConfigPageApi(queryParams) + const data = await FileConfigApi.getFileConfigPage(queryParams) list.value = data.list total.value = data.total } finally { @@ -167,7 +167,7 @@ const handleDelete = async (id: number) => { // 删除的二次确认 await message.delConfirm() // 发起删除 - await FileConfigApi.deleteFileConfigApi(id) + await FileConfigApi.deleteFileConfig(id) message.success(t('common.delSuccess')) // 刷新列表 await getList() @@ -178,7 +178,7 @@ const handleMaster = (id) => { message .confirm('是否确认修改配置编号为"' + id + '"的数据项为主配置?') .then(function () { - return FileConfigApi.updateFileConfigMasterApi(id) + return FileConfigApi.updateFileConfigMaster(id) }) .then(() => { getList() @@ -188,7 +188,7 @@ const handleMaster = (id) => { } /** 测试按钮操作 */ const handleTest = (id) => { - FileConfigApi.testFileConfigApi(id) + FileConfigApi.testFileConfig(id) .then((response) => { message.alert('测试通过,上传文件成功!访问地址:' + response) }) From 1a7f89a8e23a41a0f313afd5e0b9c81bd2dbb7bb Mon Sep 17 00:00:00 2001 From: dlarmor <121919810@qq.com> Date: Tue, 14 Mar 2023 11:50:31 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=20->=20=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E6=8E=A5=E5=8F=A3=E6=96=87=E4=BB=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/file/index.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/infra/file/index.vue b/src/views/infra/file/index.vue index 77beb3e5..0f63ea28 100644 --- a/src/views/infra/file/index.vue +++ b/src/views/infra/file/index.vue @@ -87,7 +87,7 @@