Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
marketing-opeartion
Overview
Overview
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
gic-web
marketing-opeartion
Commits
3e1e1cfb
Commit
3e1e1cfb
authored
Mar 16, 2022
by
chenyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: update
parent
54183e11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
13 deletions
+33
-13
CategoryDialog.vue
src/views/activity/component/CategoryDialog.vue
+32
-12
index.vue
src/views/activity/index.vue
+1
-1
No files found.
src/views/activity/component/CategoryDialog.vue
View file @
3e1e1cfb
...
...
@@ -10,7 +10,8 @@
<draggable
tag=
"ul"
:list=
"list"
class=
"list-group"
handle=
".handle"
>
<li
class=
"list-group-item"
v-for=
"(item, idx) in list"
:key=
"idx"
>
<el-form-item
:prop=
"idx+'.categoryName'"
:rules=
"rules.categoryName"
>
<el-input
v-model=
"list[idx].categoryName "
:disabled=
"!item.isEdit"
<p
class=
"show-name"
v-show=
"!item.isEdit"
>
{{
list
[
idx
].
categoryName
}}
</p>
<el-input
v-model=
"list[idx].categoryName "
v-show=
"item.isEdit"
style=
"width:430px;"
@
keyup
.
enter
.
native=
"saveEdit(idx)"
>
</el-input>
</el-form-item>
...
...
@@ -59,9 +60,9 @@ export default {
},
},
data
()
{
const
nameValidate
=
(
r
,
v
,
c
)
=>
{
const
nameValidate
=
(
r
,
v
,
c
)
=>
{
if
(
!
v
)
c
(
new
Error
(
'请填写分类名称'
));
if
(
this
.
nameMap
[
v
]
===
(
this
.
list
.
indexOf
(
el
=>
el
.
categoryName
===
v
)))
c
(
new
Error
(
`
${
v
}
分类名称重复`
));
if
(
this
.
nameMap
[
v
]
===
(
this
.
list
.
indexOf
(
el
=>
el
.
categoryName
===
v
)))
c
(
new
Error
(
`
${
v
}
分类名称重复`
));
c
();
};
return
{
...
...
@@ -91,9 +92,9 @@ export default {
this
.
loading
=
true
;
let
{
result
=
[]
}
=
await
activityCategoryGetList
().
finally
(
_
=>
this
.
loading
=
false
);
let
nameMap
=
{};
result
=
result
.
map
((
el
,
idx
)
=>
{
result
=
result
.
map
((
el
,
idx
)
=>
{
el
.
isEdit
=
false
;
nameMap
[
el
.
categoryName
]
=
idx
;
nameMap
[
el
.
categoryName
]
=
idx
;
return
el
;
});
this
.
nameMap
=
nameMap
;
...
...
@@ -104,7 +105,7 @@ export default {
this
.
$refs
.
form
.
validate
(
async
valid
=>
{
if
(
valid
)
{
let
list
=
[];
list
=
this
.
list
.
map
((
el
,
idx
)
=>
{
list
=
this
.
list
.
map
((
el
,
idx
)
=>
{
el
=
{
categorySort
:
idx
,
categoryName
:
el
.
categoryName
,
...
...
@@ -123,12 +124,14 @@ export default {
},
async
onDeleteItem
(
idx
)
{
// activityGetList
const
{
result
=
[]
}
=
await
activityGetList
({
activityCategoryId
:
this
.
list
[
idx
].
activityCategoryId
});
if
(
Array
.
isArray
(
result
)
&&
result
.
length
)
{
return
this
.
$message
.
error
(
'该分类有活动在引用,不可删除!'
);
if
(
this
.
list
[
idx
].
activityCategoryId
)
{
const
{
result
=
[]
}
=
await
activityGetList
({
activityCategoryId
:
this
.
list
[
idx
].
activityCategoryId
});
if
(
Array
.
isArray
(
result
)
&&
result
.
length
)
{
return
this
.
$message
.
error
(
'该分类有活动在引用,不可删除!'
);
}
}
this
.
list
.
splice
(
idx
,
1
);
delete
this
.
nameMap
[
this
.
list
[
idx
].
categoryName
];
delete
this
.
nameMap
[
this
.
list
[
idx
].
categoryName
];
},
editItem
(
idx
)
{
this
.
copyItem
=
{
...
this
.
list
[
idx
]
};
...
...
@@ -138,7 +141,7 @@ export default {
this
.
$refs
.
form
.
validateField
(
idx
+
'.categoryName'
,
errorMessage
=>
{
if
(
errorMessage
)
return
;
this
.
$set
(
this
.
list
,
idx
,
{
...
this
.
list
[
idx
],
isEdit
:
false
});
this
.
nameMap
[
this
.
list
[
idx
].
categoryName
]
=
idx
;
this
.
nameMap
[
this
.
list
[
idx
].
categoryName
]
=
idx
;
});
},
async
cancelEdit
(
idx
)
{
...
...
@@ -180,6 +183,17 @@ export default {
}
.el-form-item
{
margin-bottom
:
0
;
.show-name{
width
:
430px
;
height
:
32px
;
padding-left
:
11px
;
color
:
#303133
;
font-size
:
14px
;
line-height
:
32px
;
background
:
#F2F3F7
;
border-radius
:
2px
;
cursor
:
default
;
}
}
.icon-span
{
display
:
inline-block
;
...
...
@@ -192,6 +206,12 @@ export default {
background
:
#f2f3f7
;
border-radius
:
2px
;
}
&+
.icon-span
{
margin-left
:
4px
;
}
i
.iconfont-components3
{
color
:
#303133
;
}
}
.handle.icon-cp-tuozhuaipaixu
{
margin-left
:
4px
;
...
...
@@ -221,7 +241,7 @@ export default {
}
}
}
.el-dialog__footer
{
.el-dialog__footer
{
padding
:
20px
0
;
}
}
...
...
src/views/activity/index.vue
View file @
3e1e1cfb
...
...
@@ -11,7 +11,7 @@
</el-select>
</div>
<div
class=
"right-btn"
>
<el-button
@
click=
"categoryVisible=true"
<el-button
@
click=
"categoryVisible=true"
type=
"primary"
v-if=
"$getButtonLimit($buttonCode.activityCategory)"
:limit-code=
"$buttonCode.activityCategory"
>
分类管理
</el-button>
</div>
...
...
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