mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-10-31 18:28:44 +08:00 
			
		
		
		
	file 重构的 review 代码
This commit is contained in:
		| @@ -13,6 +13,7 @@ export interface FileClientConfig { | ||||
|   accessSecret?: string | ||||
|   domain: string | ||||
| } | ||||
|  | ||||
| export interface FileConfigVO { | ||||
|   id: number | ||||
|   name: string | ||||
| @@ -24,14 +25,8 @@ export interface FileConfigVO { | ||||
|   createTime: Date | ||||
| } | ||||
|  | ||||
| export interface FileConfigPageReqVO extends PageParam { | ||||
|   name?: string | ||||
|   storage?: number | ||||
|   createTime?: Date[] | ||||
| } | ||||
|  | ||||
| // 查询文件配置列表 | ||||
| export const getFileConfigPage = (params: FileConfigPageReqVO) => { | ||||
| export const getFileConfigPage = (params: PageParam) => { | ||||
|   return request.get({ url: '/infra/file-config/page', params }) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -59,14 +59,17 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成 | ||||
| const handleFileChange = (file) => { | ||||
|   data.value.path = file.name | ||||
| } | ||||
|  | ||||
| /** 处理文件上传中 */ | ||||
| const handleFileUploadProgress = () => { | ||||
|   formLoading.value = true // 禁止修改 | ||||
| } | ||||
|  | ||||
| /** 发起文件上传 */ | ||||
| const submitFileForm = () => { | ||||
|   unref(uploadRef)?.submit() | ||||
| } | ||||
|  | ||||
| /** 文件上传成功处理 */ | ||||
| const handleFileSuccess = () => { | ||||
|   // 清理 | ||||
| @@ -78,5 +81,3 @@ const handleFileSuccess = () => { | ||||
|   emit('success') | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style scoped></style> | ||||
|   | ||||
| @@ -147,6 +147,7 @@ const handleDelete = async (id: number) => { | ||||
|   } catch {} | ||||
| } | ||||
|  | ||||
| // TODO 写到 utils/index.ts 中 | ||||
| const sizeFormat = (row) => { | ||||
|   const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] | ||||
|   const srcSize = parseFloat(row.size) | ||||
| @@ -155,6 +156,7 @@ const sizeFormat = (row) => { | ||||
|   const sizeStr = size.toFixed(2) //保留的小数位数 | ||||
|   return sizeStr + ' ' + unitArr[index] | ||||
| } | ||||
|  | ||||
| /** 初始化 **/ | ||||
| onMounted(() => { | ||||
|   getList() | ||||
|   | ||||
| @@ -68,7 +68,7 @@ | ||||
|         width="180" | ||||
|         :formatter="dateFormatter" | ||||
|       /> | ||||
|       <el-table-column label="操作" align="center"> | ||||
|       <el-table-column label="操作" align="center" width="240px"> | ||||
|         <template #default="scope"> | ||||
|           <el-button | ||||
|             link | ||||
| @@ -173,8 +173,10 @@ const handleDelete = async (id: number) => { | ||||
|     await getList() | ||||
|   } catch {} | ||||
| } | ||||
|  | ||||
| /** 主配置按钮操作 */ | ||||
| const handleMaster = (id) => { | ||||
|   // TODO 改成 await 的形式 | ||||
|   message | ||||
|     .confirm('是否确认修改配置编号为"' + id + '"的数据项为主配置?') | ||||
|     .then(function () { | ||||
| @@ -186,14 +188,17 @@ const handleMaster = (id) => { | ||||
|     }) | ||||
|     .catch(() => {}) | ||||
| } | ||||
|  | ||||
| /** 测试按钮操作 */ | ||||
| const handleTest = (id) => { | ||||
|   // TODO 改成 await 的形式 | ||||
|   FileConfigApi.testFileConfig(id) | ||||
|     .then((response) => { | ||||
|       message.alert('测试通过,上传文件成功!访问地址:' + response) | ||||
|     }) | ||||
|     .catch(() => {}) | ||||
| } | ||||
|  | ||||
| /** 初始化 **/ | ||||
| onMounted(() => { | ||||
|   getList() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV