Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
zxn-adputin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lijin
zxn-adputin
Commits
da148f0b
Commit
da148f0b
authored
Sep 25, 2025
by
hzl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加资源组编辑功能
parent
48c7f575
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
6 deletions
+96
-6
resourceGroup.js
src/api/resourceGroup.js
+6
-3
index.vue
src/views/resourceGroup/index.vue
+90
-3
No files found.
src/api/resourceGroup.js
View file @
da148f0b
...
@@ -31,9 +31,12 @@ export function getResourceGroupById(id) {
...
@@ -31,9 +31,12 @@ export function getResourceGroupById(id) {
// 更新资源组
// 更新资源组
export
function
updateResourceGroup
(
id
,
data
)
{
export
function
updateResourceGroup
(
id
,
data
)
{
return
request
({
return
request
({
url
:
`
${
process
.
env
.
PUTIN_API
}
/resource-groups/
${
id
}
`
,
url
:
`
${
process
.
env
.
PUTIN_API
}
/resource-groups/update`
,
method
:
'put'
,
method
:
'post'
,
data
data
:
{
id
:
id
,
...
data
}
})
})
}
}
...
...
src/views/resourceGroup/index.vue
View file @
da148f0b
...
@@ -48,12 +48,16 @@
...
@@ -48,12 +48,16 @@
<el-tag
type=
"info"
size=
"small"
>
{{
scope
.
row
.
count
||
0
}}
</el-tag>
<el-tag
type=
"info"
size=
"small"
>
{{
scope
.
row
.
count
||
0
}}
</el-tag>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
width=
"1
2
0"
>
<el-table-column
label=
"操作"
align=
"center"
width=
"1
8
0"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-button
<el-button
size=
"mini"
size=
"mini"
type=
"primary"
type=
"primary"
@
click=
"handleDetail(scope.row)"
>
详情
</el-button>
@
click=
"handleDetail(scope.row)"
>
详情
</el-button>
<el-button
size=
"mini"
type=
"warning"
@
click=
"handleEdit(scope.row)"
>
编辑
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -78,7 +82,7 @@
...
@@ -78,7 +82,7 @@
<el-input
v-model=
"form.name"
></el-input>
<el-input
v-model=
"form.name"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"上传素材"
>
<el-form-item
label=
"上传素材"
v-if=
"!form.id"
>
<file-upload
<file-upload
:upload-url=
"uploadUrl"
:upload-url=
"uploadUrl"
:extra-data=
"extraData"
:extra-data=
"extraData"
...
@@ -128,6 +132,23 @@
...
@@ -128,6 +132,23 @@
</div>
</div>
</el-dialog>
</el-dialog>
<!-- 编辑资源组对话框 -->
<el-dialog
title=
"编辑资源组"
:visible
.
sync=
"editDialogVisible"
width=
"50%"
>
<el-form
:model=
"editForm"
:rules=
"editRules"
ref=
"editForm"
label-width=
"120px"
>
<el-form-item
label=
"资源组名称"
prop=
"name"
>
<el-input
v-model=
"editForm.name"
></el-input>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
type=
"textarea"
v-model=
"editForm.remark"
:rows=
"3"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"handleEditCancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"submitEditForm"
:loading=
"editSubmitLoading"
>
确定
</el-button>
</div>
</el-dialog>
<!-- 资源组详情对话框 -->
<!-- 资源组详情对话框 -->
<el-dialog
<el-dialog
title=
"资源组详情"
title=
"资源组详情"
...
@@ -348,7 +369,22 @@ export default {
...
@@ -348,7 +369,22 @@ export default {
detailUploadLoading
:
false
,
detailUploadLoading
:
false
,
// 文件搜索
// 文件搜索
fileSearchName
:
''
fileSearchName
:
''
,
// 编辑对话框相关
editDialogVisible
:
false
,
editForm
:
{
id
:
null
,
name
:
''
,
remark
:
''
},
editRules
:
{
name
:
[
{
required
:
true
,
message
:
'请输入资源组名称'
,
trigger
:
'blur'
},
{
min
:
1
,
max
:
50
,
message
:
'长度在1-50个字符之间'
,
trigger
:
'blur'
}
]
},
editSubmitLoading
:
false
}
}
},
},
...
@@ -791,6 +827,57 @@ export default {
...
@@ -791,6 +827,57 @@ export default {
handleFileSearch
()
{
handleFileSearch
()
{
this
.
filePagination
.
currentPage
=
1
this
.
filePagination
.
currentPage
=
1
this
.
fetchFileList
()
this
.
fetchFileList
()
},
// 处理编辑
handleEdit
(
row
)
{
this
.
editForm
=
{
id
:
row
.
id
,
name
:
row
.
name
,
remark
:
row
.
remark
||
''
}
this
.
editDialogVisible
=
true
},
// 处理编辑取消
handleEditCancel
()
{
this
.
editForm
=
{
id
:
null
,
name
:
''
,
remark
:
''
}
this
.
editDialogVisible
=
false
},
// 提交编辑表单
submitEditForm
()
{
this
.
$refs
.
editForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
editSubmitLoading
=
true
const
formData
=
{
resourceGroupName
:
this
.
editForm
.
name
,
remark
:
this
.
editForm
.
remark
}
updateResourceGroup
(
this
.
editForm
.
id
,
formData
).
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
this
.
$message
.
success
(
'更新成功'
)
this
.
editDialogVisible
=
false
this
.
fetchData
()
}
else
{
this
.
$message
.
error
(
'更新失败: '
+
(
response
.
message
||
'未知错误'
))
}
}).
catch
(
error
=>
{
console
.
error
(
'更新资源组失败:'
,
error
)
this
.
$message
.
error
(
'更新失败: '
+
error
.
message
)
}).
finally
(()
=>
{
this
.
editSubmitLoading
=
false
})
}
else
{
return
false
}
})
}
}
}
}
}
}
...
...
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