Skip to content

Commit d468124

Browse files
committed
file 重构的 review 代码
1 parent ba90932 commit d468124

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/api/infra/fileConfig/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface FileClientConfig {
1313
accessSecret?: string
1414
domain: string
1515
}
16+
1617
export interface FileConfigVO {
1718
id: number
1819
name: string
@@ -24,14 +25,8 @@ export interface FileConfigVO {
2425
createTime: Date
2526
}
2627

27-
export interface FileConfigPageReqVO extends PageParam {
28-
name?: string
29-
storage?: number
30-
createTime?: Date[]
31-
}
32-
3328
// 查询文件配置列表
34-
export const getFileConfigPage = (params: FileConfigPageReqVO) => {
29+
export const getFileConfigPage = (params: PageParam) => {
3530
return request.get({ url: '/infra/file-config/page', params })
3631
}
3732

src/views/infra/file/form.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,17 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
5959
const handleFileChange = (file) => {
6060
data.value.path = file.name
6161
}
62+
6263
/** 处理文件上传中 */
6364
const handleFileUploadProgress = () => {
6465
formLoading.value = true // 禁止修改
6566
}
67+
6668
/** 发起文件上传 */
6769
const submitFileForm = () => {
6870
unref(uploadRef)?.submit()
6971
}
72+
7073
/** 文件上传成功处理 */
7174
const handleFileSuccess = () => {
7275
// 清理
@@ -78,5 +81,3 @@ const handleFileSuccess = () => {
7881
emit('success')
7982
}
8083
</script>
81-
82-
<style scoped></style>

src/views/infra/file/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const handleDelete = async (id: number) => {
147147
} catch {}
148148
}
149149
150+
// TODO 写到 utils/index.ts 中
150151
const sizeFormat = (row) => {
151152
const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
152153
const srcSize = parseFloat(row.size)
@@ -155,6 +156,7 @@ const sizeFormat = (row) => {
155156
const sizeStr = size.toFixed(2) //保留的小数位数
156157
return sizeStr + ' ' + unitArr[index]
157158
}
159+
158160
/** 初始化 **/
159161
onMounted(() => {
160162
getList()

src/views/infra/fileConfig/index.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
width="180"
6969
:formatter="dateFormatter"
7070
/>
71-
<el-table-column label="操作" align="center">
71+
<el-table-column label="操作" align="center" width="240px">
7272
<template #default="scope">
7373
<el-button
7474
link
@@ -173,8 +173,10 @@ const handleDelete = async (id: number) => {
173173
await getList()
174174
} catch {}
175175
}
176+
176177
/** 主配置按钮操作 */
177178
const handleMaster = (id) => {
179+
// TODO 改成 await 的形式
178180
message
179181
.confirm('是否确认修改配置编号为"' + id + '"的数据项为主配置?')
180182
.then(function () {
@@ -186,14 +188,17 @@ const handleMaster = (id) => {
186188
})
187189
.catch(() => {})
188190
}
191+
189192
/** 测试按钮操作 */
190193
const handleTest = (id) => {
194+
// TODO 改成 await 的形式
191195
FileConfigApi.testFileConfig(id)
192196
.then((response) => {
193197
message.alert('测试通过,上传文件成功!访问地址:' + response)
194198
})
195199
.catch(() => {})
196200
}
201+
197202
/** 初始化 **/
198203
onMounted(() => {
199204
getList()

0 commit comments

Comments
 (0)