Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
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
西魏
cms_sys
Commits
3932bb6b
Commit
3932bb6b
authored
Dec 17, 2019
by
tianbj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文章分类
parent
7f159a07
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
15 deletions
+85
-15
CategoryAction.java
src/main/java/net/mingsoft/cms/action/CategoryAction.java
+11
-3
ICategoryBiz.java
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
+3
-0
CategoryBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
+19
-0
form.ftl
src/main/webapp/WEB-INF/manager/cms/category/form.ftl
+32
-6
index.ftl
src/main/webapp/WEB-INF/manager/cms/category/index.ftl
+1
-1
form.ftl
src/main/webapp/WEB-INF/manager/cms/content/form.ftl
+19
-5
No files found.
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
3932bb6b
...
...
@@ -204,11 +204,9 @@ public class CategoryAction extends BaseAction{
@LogAnn
(
title
=
"删除分类"
,
businessType
=
BusinessTypeEnum
.
DELETE
)
@RequiresPermissions
(
"cms:category:del"
)
public
ResultData
delete
(
@RequestBody
List
<
CategoryEntity
>
categorys
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
int
[]
ids
=
new
int
[
categorys
.
size
()];
for
(
int
i
=
0
;
i
<
categorys
.
size
();
i
++){
ids
[
i
]
=
Integer
.
parseInt
(
categorys
.
get
(
i
).
getId
())
;
categoryBiz
.
delete
(
Integer
.
parseInt
(
categorys
.
get
(
i
).
getId
()))
;
}
categoryBiz
.
delete
(
ids
);
return
ResultData
.
build
().
success
();
}
/**
...
...
@@ -265,6 +263,16 @@ public class CategoryAction extends BaseAction{
if
(!
StringUtil
.
checkLength
(
category
.
getCategoryParentId
()+
""
,
0
,
100
)){
return
ResultData
.
build
().
error
(
getResString
(
"err.length"
,
this
.
getResString
(
"category.parent.id"
),
"1"
,
"100"
));
}
//判断是否选择子级为所属栏目
CategoryEntity
_category
=
new
CategoryEntity
();
_category
.
setCategoryParentId
(
category
.
getId
());
_category
.
setAppId
(
BasicUtil
.
getAppId
());
List
<
CategoryEntity
>
categoryList
=
categoryBiz
.
queryChilds
(
_category
);
for
(
CategoryEntity
item:
categoryList
){
if
(
item
.
getId
().
equals
(
category
.
getCategoryId
())){
return
ResultData
.
build
().
error
(
getResString
(
"cannot.select.child"
));
}
}
category
.
setAppId
(
BasicUtil
.
getAppId
());
categoryBiz
.
updateEntity
(
category
);
return
ResultData
.
build
().
success
(
category
);
...
...
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
View file @
3932bb6b
...
...
@@ -24,4 +24,6 @@ public interface ICategoryBiz extends IBaseBiz {
void
saveEntity
(
CategoryEntity
entity
);
void
updateEntity
(
CategoryEntity
entity
);
void
delete
(
int
categoryId
);
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
3932bb6b
...
...
@@ -128,4 +128,22 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
super
.
updateEntity
(
entity
);
setChildParentId
(
entity
);
}
@Override
public
void
delete
(
int
categoryId
)
{
// TODO Auto-generated method stub
CategoryEntity
category
=
(
CategoryEntity
)
categoryDao
.
getEntity
(
categoryId
);
//删除父类
if
(
category
!=
null
){
category
.
setCategoryParentId
(
null
);
List
<
CategoryEntity
>
childrenList
=
categoryDao
.
queryChildren
(
category
);
int
[]
ids
=
new
int
[
childrenList
.
size
()];
for
(
int
i
=
0
;
i
<
childrenList
.
size
();
i
++){
//删除子类
ids
[
i
]
=
Integer
.
parseInt
(
childrenList
.
get
(
i
).
getId
());
}
categoryDao
.
delete
(
ids
);
deleteEntity
(
categoryId
);
}
}
}
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/category/form.ftl
View file @
3932bb6b
...
...
@@ -38,7 +38,13 @@
gutter=
"0"
justify=
"start"
align=
"top"
>
<el-col
span=
"12"
>
<el-form-item
label=
"栏目管理属性"
prop=
"categoryType"
>
<el-form-item
prop=
"categoryType"
>
<template
slot=
'label'
>
栏目类型
<el-popover
slot=
"label"
placement=
"top-start"
title=
"提示"
trigger=
"hover"
>
列表:常用于带列表、详情的业务,例如:新闻列表、图片列表
<br>
封面:常用单篇文章显示,例如:关于我们、公司介绍
<i
class=
"el-icon-question"
slot=
"reference"
></i>
</el-popover>
</template>
<el-radio-group
v-model=
"form.categoryType"
:style=
"{width: ''}"
:disabled=
"false"
>
...
...
@@ -63,7 +69,7 @@
gutter=
"0"
justify=
"start"
align=
"top"
>
<el-col
span=
"12"
>
<el-form-item
:label=
"form.categoryType =='1'? '内容模板' : '封面模板'"
prop=
"categoryUrl
"
>
<el-form-item
prop=
"categoryUrl"
:label=
"form.categoryType =='1'? '内容模板' : '封面模板'
"
>
<el-select
v-model=
"form.categoryUrl"
:style=
"{width: '100%'}"
:filterable=
"false"
...
...
@@ -76,7 +82,12 @@
</el-form-item>
</el-col>
<el-col
span=
"12"
>
<el-form-item
label=
"列表模板"
prop=
"categoryListUrl"
v-if=
"form.categoryType == '1'"
>
<el-form-item
prop=
"categoryListUrl"
v-if=
"form.categoryType == '1'"
>
<template
slot=
'label'
>
列表模板
<el-popover
slot=
"label"
placement=
"top-start"
title=
"提示"
trigger=
"hover"
content=
"当栏目类型为列表时有效"
>
<i
class=
"el-icon-question"
slot=
"reference"
></i>
</el-popover>
</template>
<el-select
v-model=
"form.categoryListUrl"
:style=
"{width: '100%'}"
:filterable=
"false"
...
...
@@ -93,7 +104,12 @@
gutter=
"0"
justify=
"start"
align=
"top"
>
<el-col
span=
"12"
>
<el-form-item
label=
"自定义模型"
prop=
"mdiyModelId"
>
<el-form-item
prop=
"mdiyModelId"
>
<template
slot=
'label'
>
自定义模型
<el-popover
slot=
"label"
placement=
"top-start"
title=
"提示"
width=
"400"
trigger=
"hover"
content=
"如果发布时候文章字段信息不够,可以采用铭飞代码生成器生成自定义模型,再通过“自定义管理->自定义模型->导入”功能导入模型,注意类型是cms"
>
<i
class=
"el-icon-question"
slot=
"reference"
></i>
</el-popover>
</template>
<el-select
v-model=
"form.mdiyModelId"
:style=
"{width: '100%'}"
:filterable=
"false"
...
...
@@ -169,7 +185,11 @@
el
:
'#form'
,
data
()
{
return
{
treeList
:[],
treeList
:[{
id
:
'0'
,
categoryTitle
:
'顶级栏目'
,
children
:[],
}],
saveDisabled
:
false
,
//表单数据
form
:
{
...
...
@@ -217,7 +237,7 @@
ms
.
http
.
get
(
ms
.
manager
+
"/cms/category/list.do"
,{
pageSize
:
9999
}).
then
(
function
(
res
){
if
(
res
.
result
){
//res.data.rows.push({id:0,categoryId: null,categoryTitle:'顶级栏目管理'});
that
.
treeList
=
ms
.
util
.
treeData
(
res
.
data
.
rows
,
'id'
,
'categoryId'
,
'children'
);
that
.
treeList
[
0
].
children
=
ms
.
util
.
treeData
(
res
.
data
.
rows
,
'id'
,
'categoryId'
,
'children'
);
}
}).
catch
(
function
(
err
){
console
.
log
(
err
);
...
...
@@ -246,6 +266,9 @@
that
.
saveDisabled
=
false
;
return
}
if
(
data
.
categoryId
==
'0'
){
data
.
categoryId
=
''
;
}
data
.
categoryImg
=
JSON
.
stringify
(
data
.
categoryImg
);
ms
.
http
.
post
(
url
,
data
).
then
(
function
(
data
)
{
if
(
data
.
result
)
{
...
...
@@ -291,6 +314,9 @@
})
}
else
{
res
.
data
.
categoryImg
=
[]
}
if
(
!
res
.
data
.
categoryId
){
res
.
data
.
categoryId
=
'0'
;
}
that
.
form
=
res
.
data
;
}
...
...
src/main/webapp/WEB-INF/manager/cms/category/index.ftl
View file @
3932bb6b
...
...
@@ -17,7 +17,7 @@
</el-col>
</el-header>
<el-main
class=
"ms-container"
>
<el-table
ref=
"multipleTable"
:indent=
"
10
"
<el-table
ref=
"multipleTable"
:indent=
"
6
"
height=
"calc(100vh - 20px)"
border
:data=
"dataList"
row-key=
"id"
...
...
src/main/webapp/WEB-INF/manager/cms/content/form.ftl
View file @
3932bb6b
...
...
@@ -9,8 +9,7 @@
<el-header
class=
"ms-header ms-tr"
height=
"50px"
>
<el-button
type=
"primary"
icon=
"iconfont icon-baocun"
size=
"mini"
@
click=
"save()"
:loading=
"saveDisabled"
>
保存
</el-button>
<el-button
size=
"mini"
icon=
"iconfont icon-fanhui"
plain
onclick=
"javascript:history.go(-1)"
v-if=
"returnIsShow"
>
返回
<el-button
size=
"mini"
icon=
"iconfont icon-fanhui"
plain
onclick=
"javascript:history.go(-1)"
>
返回
</el-button>
</el-header>
<el-main
class=
"ms-container"
>
...
...
@@ -24,7 +23,7 @@
<el-row
gutter=
"0"
justify=
"start"
align=
"top"
>
<el-col
span=
"12
"
>
<el-col
:span=
"returnIsShow?'12':'24'
"
>
<el-form-item
label=
"文章标题"
prop=
"contentTitle"
>
<el-input
v-model=
"form.contentTitle"
:disabled=
"false"
...
...
@@ -34,7 +33,7 @@
</el-input>
</el-form-item>
</el-col>
<el-col
span=
"12"
>
<el-col
span=
"12"
v-if=
"returnIsShow"
>
<el-form-item
label=
"所属栏目"
prop=
"contentCategoryId"
>
<tree-select
:props=
"{value: 'id',label: 'categoryTitle',children: 'children'}"
:options=
"contentCategoryIdOptions"
:style=
"{width:'100%'}"
...
...
@@ -275,6 +274,15 @@
this
.
$refs
.
form
[
0
].
validate
((
valid
)
=>
{
if
(
valid
)
{
that
.
saveDisabled
=
true
;
if
(
that
.
categoryIdOptions
.
filter
(
f
=>
f
[
'id'
]
==
that
.
form
.
contentCategoryId
)[
0
].
categoryType
==
'2'
){
that
.
$notify
({
title
:
'提示'
,
message
:
'所属栏目不能为封面'
,
type
:
'error'
});
that
.
saveDisabled
=
false
;
return
}
var
data
=
JSON
.
parse
(
JSON
.
stringify
(
that
.
form
));
if
(
data
.
contentType
!=
null
){
data
.
contentType
=
data
.
contentType
.
join
(
','
);
...
...
@@ -389,6 +397,12 @@
res
.
data
.
contentImg
=
[]
}
that
.
form
=
res
.
data
;
var
category
=
that
.
categoryIdOptions
.
filter
(
f
=>
f
[
'id'
]
==
that
.
form
.
contentCategoryId
);
if
(
category
.
length
==
1
){
if
(
category
[
0
].
categoryType
==
'2'
){
that
.
returnIsShow
=
false
;
}
}
that
.
changeModel
();
}
}).
catch
(
function
(
err
)
{
...
...
@@ -401,7 +415,7 @@
ms
.
http
.
get
(
ms
.
manager
+
"/cms/category/list.do"
,
{
pageSize
:
9999
}).
then
(
function
(
res
)
{
if
(
res
.
result
)
{
that
.
contentCategoryIdOptions
=
ms
.
util
.
treeData
(
res
.
data
.
rows
,
'id'
,
'categoryId'
,
'children'
);
that
.
categoryIdOptions
=
res
.
data
.
rows
that
.
categoryIdOptions
=
res
.
data
.
rows
;
that
.
changeModel
();
}
}).
catch
(
function
(
err
)
{
...
...
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