Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
on-site-service-admin-view
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
external
on-site-service-admin-view
Commits
68e9d6cd
Commit
68e9d6cd
authored
Aug 10, 2022
by
shangtx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 服务管理增加首页展示设置
parent
f0f5ecd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
ServiceList.vue
src/views/serv/ServiceList.vue
+41
-4
No files found.
src/views/serv/ServiceList.vue
View file @
68e9d6cd
...
...
@@ -21,6 +21,16 @@
@
click=
"enableChange(record, index)"
/>
</
template
>
<
template
#
showInHome=
"{ record, index }"
>
<a-switch
v-if=
"hasPerm('SYS0210101.ENABLE') && record.type == 2"
:checked=
"record.showInHome"
checked-children=
"展示"
un-checked-children=
"隐藏"
:loading=
"showInHomeLoadingKeys.includes(record.id)"
@
click=
"showInHomeChange(record, index)"
/>
</
template
>
<
template
#
free
>
<SubClassEdit
ref=
"SubClassEdit"
:success=
"reset"
/>
<CategoryEdit
ref=
"CategoryEdit"
:success=
"reset"
/>
...
...
@@ -51,6 +61,13 @@ const columns = [
dataIndex
:
'enabled'
,
filter
:
{
type
:
SearchType
.
ENUM
}
},
{
title
:
'首页展示'
,
scopedSlots
:
{
customRender
:
'showInHome'
},
enum
:
'SYS0002'
,
dataIndex
:
'showInHome'
,
filter
:
{
type
:
SearchType
.
ENUM
}
},
{
title
:
'创建时间'
,
dataIndex
:
'createTime'
,
...
...
@@ -73,6 +90,7 @@ export default {
pagination
:
false
,
codes
:
[[
'SYS0002'
],
[]],
loadingKeys
:
[],
showInHomeLoadingKeys
:
[],
rowKey
:
'key'
}
},
...
...
@@ -82,12 +100,10 @@ export default {
this
.
expandedRowKeys
=
this
.
dataSource
.
map
((
d
)
=>
d
.
id
+
''
)
},
enableChange
(
record
,
index
)
{
console
.
info
(
'record'
,
record
)
if
(
this
.
loadingKeys
.
includes
(
record
.
id
))
{
return
}
this
.
loadingKeys
.
push
(
record
.
id
)
console
.
info
(
'index'
,
index
)
saveOrUpdateSubClass
({
id
:
record
.
id
,
enabled
:
!
record
.
enabled
})
.
then
(({
code
})
=>
{
if
(
code
==
200
)
{
...
...
@@ -95,15 +111,36 @@ export default {
const
pIndex
=
this
.
dataSource
.
findIndex
(
(
d
)
=>
d
.
id
==
record
.
categoryId
)
console
.
info
(
pIndex
)
this
.
dataSource
[
pIndex
].
children
[
index
].
enabled
=
!
record
.
enabled
console
.
info
(
this
.
dataSource
)
}
})
.
finally
(()
=>
{
this
.
loadingKeys
.
splice
(
this
.
loadingKeys
.
indexOf
(
record
.
id
),
1
)
})
},
showInHomeChange
(
record
,
index
)
{
if
(
this
.
loadingKeys
.
includes
(
record
.
id
))
{
return
}
this
.
showInHomeLoadingKeys
.
push
(
record
.
id
)
saveOrUpdateSubClass
({
id
:
record
.
id
,
showInHome
:
!
record
.
showInHome
})
.
then
(({
code
})
=>
{
if
(
code
==
200
)
{
this
.
$message
.
success
(
'保存成功'
)
const
pIndex
=
this
.
dataSource
.
findIndex
(
(
d
)
=>
d
.
id
==
record
.
categoryId
)
this
.
dataSource
[
pIndex
].
children
[
index
].
showInHome
=
!
record
.
showInHome
}
})
.
finally
(()
=>
{
this
.
showInHomeLoadingKeys
.
splice
(
this
.
showInHomeLoadingKeys
.
indexOf
(
record
.
id
),
1
)
})
},
edit
(
record
)
{
const
categoryName
=
this
.
dataSource
.
filter
(
(
d
)
=>
d
.
id
==
record
.
categoryId
...
...
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