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] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E8=AE=BE=E6=96=BD=20->=20=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=E6=96=87=E4=BB=B6=E8=B0=83=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) })