Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d4681248
authored
Mar 14, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file 重构的 review 代码
parent
ba909325
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
10 deletions
+13
-10
src/api/infra/fileConfig/index.ts
+2
-7
src/views/infra/file/form.vue
+3
-2
src/views/infra/file/index.vue
+2
-0
src/views/infra/fileConfig/index.vue
+6
-1
No files found.
src/api/infra/fileConfig/index.ts
View file @
d4681248
...
@@ -13,6 +13,7 @@ export interface FileClientConfig {
...
@@ -13,6 +13,7 @@ export interface FileClientConfig {
accessSecret
?:
string
accessSecret
?:
string
domain
:
string
domain
:
string
}
}
export
interface
FileConfigVO
{
export
interface
FileConfigVO
{
id
:
number
id
:
number
name
:
string
name
:
string
...
@@ -24,14 +25,8 @@ export interface FileConfigVO {
...
@@ -24,14 +25,8 @@ export interface FileConfigVO {
createTime
:
Date
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
})
return
request
.
get
({
url
:
'/infra/file-config/page'
,
params
})
}
}
...
...
src/views/infra/file/form.vue
View file @
d4681248
...
@@ -59,14 +59,17 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
...
@@ -59,14 +59,17 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
const
handleFileChange
=
(
file
)
=>
{
const
handleFileChange
=
(
file
)
=>
{
data
.
value
.
path
=
file
.
name
data
.
value
.
path
=
file
.
name
}
}
/** 处理文件上传中 */
/** 处理文件上传中 */
const
handleFileUploadProgress
=
()
=>
{
const
handleFileUploadProgress
=
()
=>
{
formLoading
.
value
=
true
// 禁止修改
formLoading
.
value
=
true
// 禁止修改
}
}
/** 发起文件上传 */
/** 发起文件上传 */
const
submitFileForm
=
()
=>
{
const
submitFileForm
=
()
=>
{
unref
(
uploadRef
)?.
submit
()
unref
(
uploadRef
)?.
submit
()
}
}
/** 文件上传成功处理 */
/** 文件上传成功处理 */
const
handleFileSuccess
=
()
=>
{
const
handleFileSuccess
=
()
=>
{
// 清理
// 清理
...
@@ -78,5 +81,3 @@ const handleFileSuccess = () => {
...
@@ -78,5 +81,3 @@ const handleFileSuccess = () => {
emit
(
'success'
)
emit
(
'success'
)
}
}
</
script
>
</
script
>
<
style
scoped
></
style
>
src/views/infra/file/index.vue
View file @
d4681248
...
@@ -147,6 +147,7 @@ const handleDelete = async (id: number) => {
...
@@ -147,6 +147,7 @@ const handleDelete = async (id: number) => {
}
catch
{}
}
catch
{}
}
}
// TODO 写到 utils/index.ts 中
const
sizeFormat
=
(
row
)
=>
{
const
sizeFormat
=
(
row
)
=>
{
const
unitArr
=
[
'Bytes'
,
'KB'
,
'MB'
,
'GB'
,
'TB'
,
'PB'
,
'EB'
,
'ZB'
,
'YB'
]
const
unitArr
=
[
'Bytes'
,
'KB'
,
'MB'
,
'GB'
,
'TB'
,
'PB'
,
'EB'
,
'ZB'
,
'YB'
]
const
srcSize
=
parseFloat
(
row
.
size
)
const
srcSize
=
parseFloat
(
row
.
size
)
...
@@ -155,6 +156,7 @@ const sizeFormat = (row) => {
...
@@ -155,6 +156,7 @@ const sizeFormat = (row) => {
const
sizeStr
=
size
.
toFixed
(
2
)
//保留的小数位数
const
sizeStr
=
size
.
toFixed
(
2
)
//保留的小数位数
return
sizeStr
+
' '
+
unitArr
[
index
]
return
sizeStr
+
' '
+
unitArr
[
index
]
}
}
/** 初始化 **/
/** 初始化 **/
onMounted
(()
=>
{
onMounted
(()
=>
{
getList
()
getList
()
...
...
src/views/infra/fileConfig/index.vue
View file @
d4681248
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
width=
"180"
width=
"180"
:formatter=
"dateFormatter"
:formatter=
"dateFormatter"
/>
/>
<el-table-column
label=
"操作"
align=
"center"
>
<el-table-column
label=
"操作"
align=
"center"
width=
"240px"
>
<
template
#
default=
"scope"
>
<
template
#
default=
"scope"
>
<el-button
<el-button
link
link
...
@@ -173,8 +173,10 @@ const handleDelete = async (id: number) => {
...
@@ -173,8 +173,10 @@ const handleDelete = async (id: number) => {
await
getList
()
await
getList
()
}
catch
{}
}
catch
{}
}
}
/** 主配置按钮操作 */
/** 主配置按钮操作 */
const
handleMaster
=
(
id
)
=>
{
const
handleMaster
=
(
id
)
=>
{
// TODO 改成 await 的形式
message
message
.
confirm
(
'是否确认修改配置编号为"'
+
id
+
'"的数据项为主配置?'
)
.
confirm
(
'是否确认修改配置编号为"'
+
id
+
'"的数据项为主配置?'
)
.
then
(
function
()
{
.
then
(
function
()
{
...
@@ -186,14 +188,17 @@ const handleMaster = (id) => {
...
@@ -186,14 +188,17 @@ const handleMaster = (id) => {
})
})
.
catch
(()
=>
{})
.
catch
(()
=>
{})
}
}
/** 测试按钮操作 */
/** 测试按钮操作 */
const
handleTest
=
(
id
)
=>
{
const
handleTest
=
(
id
)
=>
{
// TODO 改成 await 的形式
FileConfigApi
.
testFileConfig
(
id
)
FileConfigApi
.
testFileConfig
(
id
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
message
.
alert
(
'测试通过,上传文件成功!访问地址:'
+
response
)
message
.
alert
(
'测试通过,上传文件成功!访问地址:'
+
response
)
})
})
.
catch
(()
=>
{})
.
catch
(()
=>
{})
}
}
/** 初始化 **/
/** 初始化 **/
onMounted
(()
=>
{
onMounted
(()
=>
{
getList
()
getList
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment