Skip to content

Commit fe2fa21

Browse files
committed
重构:基础设施 -> 文件管理 接口文件调整
1 parent fee8245 commit fe2fa21

File tree

4 files changed

+16
-27
lines changed

4 files changed

+16
-27
lines changed
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
import request from '@/config/axios'
22

3-
export interface FileVO {
4-
id: number
5-
configId: number
6-
path: string
7-
name: string
8-
url: string
9-
size: string
10-
type: string
11-
createTime: Date
12-
}
13-
143
export interface FilePageReqVO extends PageParam {
154
path?: string
165
type?: string
176
createTime?: Date[]
187
}
198

209
// 查询文件列表
21-
export const getFilePageApi = (params: FilePageReqVO) => {
10+
export const getFilePage = (params: FilePageReqVO) => {
2211
return request.get({ url: '/infra/file/page', params })
2312
}
2413

2514
// 删除文件
26-
export const deleteFileApi = (id: number) => {
15+
export const deleteFile = (id: number) => {
2716
return request.delete({ url: '/infra/file/delete?id=' + id })
2817
}

src/api/infra/fileConfig/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,36 @@ export interface FileConfigPageReqVO extends PageParam {
3131
}
3232

3333
// 查询文件配置列表
34-
export const getFileConfigPageApi = (params: FileConfigPageReqVO) => {
34+
export const getFileConfigPage = (params: FileConfigPageReqVO) => {
3535
return request.get({ url: '/infra/file-config/page', params })
3636
}
3737

3838
// 查询文件配置详情
39-
export const getFileConfigApi = (id: number) => {
39+
export const getFileConfig = (id: number) => {
4040
return request.get({ url: '/infra/file-config/get?id=' + id })
4141
}
4242

4343
// 更新文件配置为主配置
44-
export const updateFileConfigMasterApi = (id: number) => {
44+
export const updateFileConfigMaster = (id: number) => {
4545
return request.put({ url: '/infra/file-config/update-master?id=' + id })
4646
}
4747

4848
// 新增文件配置
49-
export const createFileConfigApi = (data: FileConfigVO) => {
49+
export const createFileConfig = (data: FileConfigVO) => {
5050
return request.post({ url: '/infra/file-config/create', data })
5151
}
5252

5353
// 修改文件配置
54-
export const updateFileConfigApi = (data: FileConfigVO) => {
54+
export const updateFileConfig = (data: FileConfigVO) => {
5555
return request.put({ url: '/infra/file-config/update', data })
5656
}
5757

5858
// 删除文件配置
59-
export const deleteFileConfigApi = (id: number) => {
59+
export const deleteFileConfig = (id: number) => {
6060
return request.delete({ url: '/infra/file-config/delete?id=' + id })
6161
}
6262

6363
// 测试文件配置
64-
export const testFileConfigApi = (id: number) => {
64+
export const testFileConfig = (id: number) => {
6565
return request.get({ url: '/infra/file-config/test?id=' + id })
6666
}

src/views/infra/fileConfig/form.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const openModal = async (type: string, id?: number) => {
147147
if (id) {
148148
formLoading.value = true
149149
try {
150-
formData.value = await FileConfigApi.getFileConfigApi(id)
150+
formData.value = await FileConfigApi.getFileConfig(id)
151151
} finally {
152152
formLoading.value = false
153153
}
@@ -167,10 +167,10 @@ const submitForm = async () => {
167167
try {
168168
const data = formData.value as unknown as FileConfigApi.FileConfigVO
169169
if (formType.value === 'create') {
170-
await FileConfigApi.createFileConfigApi(data)
170+
await FileConfigApi.createFileConfig(data)
171171
message.success(t('common.createSuccess'))
172172
} else {
173-
await FileConfigApi.updateFileConfigApi(data)
173+
await FileConfigApi.updateFileConfig(data)
174174
message.success(t('common.updateSuccess'))
175175
}
176176
modelVisible.value = false

src/views/infra/fileConfig/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const queryFormRef = ref() // 搜索的表单
135135
const getList = async () => {
136136
loading.value = true
137137
try {
138-
const data = await FileConfigApi.getFileConfigPageApi(queryParams)
138+
const data = await FileConfigApi.getFileConfigPage(queryParams)
139139
list.value = data.list
140140
total.value = data.total
141141
} finally {
@@ -167,7 +167,7 @@ const handleDelete = async (id: number) => {
167167
// 删除的二次确认
168168
await message.delConfirm()
169169
// 发起删除
170-
await FileConfigApi.deleteFileConfigApi(id)
170+
await FileConfigApi.deleteFileConfig(id)
171171
message.success(t('common.delSuccess'))
172172
// 刷新列表
173173
await getList()
@@ -178,7 +178,7 @@ const handleMaster = (id) => {
178178
message
179179
.confirm('是否确认修改配置编号为"' + id + '"的数据项为主配置?')
180180
.then(function () {
181-
return FileConfigApi.updateFileConfigMasterApi(id)
181+
return FileConfigApi.updateFileConfigMaster(id)
182182
})
183183
.then(() => {
184184
getList()
@@ -188,7 +188,7 @@ const handleMaster = (id) => {
188188
}
189189
/** 测试按钮操作 */
190190
const handleTest = (id) => {
191-
FileConfigApi.testFileConfigApi(id)
191+
FileConfigApi.testFileConfig(id)
192192
.then((response) => {
193193
message.alert('测试通过,上传文件成功!访问地址:' + response)
194194
})

0 commit comments

Comments
 (0)