Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
a480376d
Commit
a480376d
authored
Jan 15, 2019
by
ms-dev
Browse files
优化结构
parent
cd4672a3
Changes
60
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/config/ShiroConfiguration.java
View file @
a480376d
...
...
@@ -5,6 +5,7 @@ import java.util.Map;
import
org.apache.shiro.spring.web.ShiroFilterFactoryBean
;
import
org.apache.shiro.web.mgt.DefaultWebSecurityManager
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -14,54 +15,53 @@ import org.apache.shiro.mgt.SecurityManager;
@Configuration
public
class
ShiroConfiguration
{
@Value
(
"${ms.manager.path}"
)
private
String
managerPath
;
@Bean
public
ShiroFilterFactoryBean
shirFilter
(
SecurityManager
securityManager
)
{
ShiroFilterFactoryBean
shiroFilterFactoryBean
=
new
ShiroFilterFactoryBean
();
// 必须设置 SecurityManager
shiroFilterFactoryBean
.
setSecurityManager
(
securityManager
);
// setLoginUrl 如果不设置值,默认会自动寻找Web工程根目录下的"/login.jsp"页面 或 "/login" 映射
shiroFilterFactoryBean
.
setLoginUrl
(
"/notL
ogin"
);
// 设置无权限时跳转的 url;
shiroFilterFactoryBean
.
setUnauthorizedUrl
(
"/notRole
"
);
public
ShiroFilterFactoryBean
shirFilter
(
SecurityManager
securityManager
)
{
ShiroFilterFactoryBean
shiroFilterFactoryBean
=
new
ShiroFilterFactoryBean
();
// 必须设置 SecurityManager
shiroFilterFactoryBean
.
setSecurityManager
(
securityManager
);
// setLoginUrl 如果不设置值,默认会自动寻找Web工程根目录下的"/login.jsp"页面 或 "/login" 映射
shiroFilterFactoryBean
.
setLoginUrl
(
managerPath
+
"/l
ogin
.do
"
);
// 设置无权限时跳转的 url;
shiroFilterFactoryBean
.
setUnauthorizedUrl
(
managerPath
+
"/404.do
"
);
// 设置拦截器
Map
<
String
,
String
>
filterChainDefinitionMap
=
new
LinkedHashMap
<>();
//游客,开发权限
filterChainDefinitionMap
.
put
(
"/guest/**"
,
"anon"
);
//用户,需要角色权限 “user”
filterChainDefinitionMap
.
put
(
"/user/**"
,
"roles[user]"
);
//管理员,需要角色权限 “admin”
filterChainDefinitionMap
.
put
(
"/admin/**"
,
"roles[admin]"
);
//开放登陆接口
filterChainDefinitionMap
.
put
(
"/ms/login.do"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/ms/checkLogin.do"
,
"anon"
);
//其余接口一律拦截
//主要这行代码必须放在所有权限设置的最后,不然会导致所有 url 都被拦截
filterChainDefinitionMap
.
put
(
"/**"
,
"anon"
);
// 设置拦截器
Map
<
String
,
String
>
filterChainDefinitionMap
=
new
LinkedHashMap
<>();
// 游客,开发权限
filterChainDefinitionMap
.
put
(
"/static/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/html/**"
,
"anon"
);
// 开放登陆接口
filterChainDefinitionMap
.
put
(
managerPath
+
"/login.do"
,
"anon"
);
filterChainDefinitionMap
.
put
(
managerPath
+
"/checkLogin.do"
,
"anon"
);
// 其余接口一律拦截
// 主要这行代码必须放在所有权限设置的最后,不然会导致所有 url 都被拦截
filterChainDefinitionMap
.
put
(
managerPath
+
"/**"
,
"authc"
);
shiroFilterFactoryBean
.
setFilterChainDefinitionMap
(
filterChainDefinitionMap
);
return
shiroFilterFactoryBean
;
}
shiroFilterFactoryBean
.
setFilterChainDefinitionMap
(
filterChainDefinitionMap
);
return
shiroFilterFactoryBean
;
}
/**
* 注入 securityManager
*/
@Bean
public
SecurityManager
securityManager
()
{
DefaultWebSecurityManager
securityManager
=
new
DefaultWebSecurityManager
();
// 设置realm.
securityManager
.
setRealm
(
customRealm
());
return
securityManager
;
}
/**
* 注入 securityManager
*/
@Bean
public
SecurityManager
securityManager
()
{
DefaultWebSecurityManager
securityManager
=
new
DefaultWebSecurityManager
();
// 设置realm.
securityManager
.
setRealm
(
customRealm
());
return
securityManager
;
}
/**
* 自定义身份认证 realm;
* <p>
* 必须写这个类,并加上 @Bean 注解,目的是注入 CustomRealm,
* 否则会影响 CustomRealm类 中其他类的依赖注入
*/
@Bean
public
BaseAuthRealm
customRealm
()
{
return
new
BaseAuthRealm
();
}
/**
* 自定义身份认证 realm;
* <p>
* 必须写这个类,并加上 @Bean 注解,目的是注入 CustomRealm, 否则会影响 CustomRealm类 中其他类的依赖注入
*/
@Bean
public
BaseAuthRealm
customRealm
()
{
return
new
BaseAuthRealm
();
}
}
\ No newline at end of file
src/main/resources/application.yml
View file @
a480376d
#服务配置
server
:
#端口
port
:
8081
tomcat
:
max-http-header-size
:
10240
#单位:字节
#项目名称
servlet.context-path
:
/ms-mcms
# slf4j日志配置
logging
:
# 配置级别
level
:
#分包配置级别,即不同的目录下可以使用不同的级别
net.mingsoft
:
trace
#铭飞配置
ms
:
manager
:
path
:
/ms
view-path
:
/WEB-INF/manager
#session配置
session
:
timeout
:
1800000
#会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms
validation-interval
:
120000
#会话清理间隔时间, 单位:毫秒,2m=120000ms
#上传配置
upload
:
path
:
/upload
denied
:
exe
allowed
:
jpg
max-size
:
1
memory-size
:
4096
#spring配置
spring
:
profiles
:
active
:
dev
...
...
@@ -39,29 +67,4 @@ spring:
mybatis
:
mapper-locations
:
classpath*:**/dao/*.xml
configuration
:
database-id
:
mysql
# slf4j日志配置
logging
:
# 配置级别
level
:
#分包配置级别,即不同的目录下可以使用不同的级别
net.mingsoft
:
trace
com.mingsoft
:
trace
ms
:
manager
:
path
:
/ms
view
:
#已过期
path
:
/WEB-INF/manager
session
:
timeout
:
1800000
#会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms
validation.interval
:
120000
#会话清理间隔时间, 单位:毫秒,2m=120000ms
upload
:
path
:
/upload
denied
:
exe
allowed
:
jpg
max
:
size
:
1
memory
:
size
:
4096
\ No newline at end of file
database-id
:
mysql
\ No newline at end of file
src/main/webapp/WEB-INF/manager/app/app.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="应用设置">
<@shiro.hasPermission name="app:update"><@ms.saveButton title="" postForm="appForm"/></@shiro.hasPermission>
</@ms.nav>
<@ms.panel>
<@ms.form isvalidation=true name="appForm" action="$
{
managerPath
}
/app/update.do">
<@ms.hidden name="appId" value="$
{
app
.appId
?
default
(
0
)}
" />
<@ms.text name="appName" width="500" label="网站标题" value="$
{
app
.appName
?
default
(
''
)}
" title="网站标题" placeholder="请输入网站标题" validation=
{
"maxlength"
:
"50"
,
"required"
:
"true"
,
"data-bv-notempty-message"
:
"必填项目"
,
"data-bv-stringlength-message"
:
"网站标题在50个字符以内!"
}
/>
<!--网站Logo,暂时不兼容-->
<@ms.formRow label="网站Logo" help="提示:文章缩略图,支持jpg,png格式">
<@ms.uploadImg path="app" inputName="appLogo" size="1" maxSize="1" imgs="$
{
app
.appLogo
!
(
''
)}
"/>
</@ms.formRow>
<@ms.checkbox name="appMobileStyle" width="200" list=[
{
"id"
:
"m"
,
"value"
:
"启用"
}
] listKey="id" listValue="value" valueList=["$
{
app
.appMobileStyle
!
(
''
)}
"] label="启用移动端"
help="启用后手机用户访问网站会显示手机版网页,前提是网站必需提供移动端皮肤,相关教程:<a href='http://ms.ming-soft.com/mbbs/13086/detail.do' target='_blank'>铭飞移动端开发教程</a>"/>
<@ms.select name="appStyle" width="300" id="appStyle" label="模板风格" />
<@ms.textarea name="appKeyword" label="关键字" value="$
{
app
.appKeyword
?
default
(
''
)}
" rows="4" placeholder="请输入关键字"/>
<@ms.textarea name="appDescription" label="描述" value="$
{
app
.appDescription
?
default
(
''
)}
" rows="4" placeholder="请输入站点描述"/>
<@ms.textarea name="appCopyright" label="版权信息" value="$
{
app
.appCopyright
?
default
(
''
)}
" rows="4" placeholder="请输入版权信息"/>
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
$(function()
{
<#
if
app
.appId
!=
0
>
ms
.get
(
"${managerPath}/template/queryAppTemplateSkin.do"
,
null
,
function
(
msg
){
if
(
msg
.fileName
!=
null
&&
msg
.fileName.length
!=
0
){
//清空默认信息
$
(
"#appStyle"
)
.html
(
""
)
;
for
(
var
i
=
0
;
i
<
msg
.fileName.length
;
i
++
){
if
(
"${app.appStyle?default('')}"
==
msg
.fileName
[
i
]
)
{
$
(
"#appStyle"
)
.append
(
"<option value="
+
msg
.fileName
[
i
]+
" selected>"
+
msg
.fileName
[
i
]+
"</option>"
)
}
else
{
$
(
"#appStyle"
)
.append
(
"<option value="
+
msg
.fileName
[
i
]+
">"
+
msg
.fileName
[
i
]+
"</option>"
)
}
}
}
else
{
$
(
".appStyle"
)
.append
(
"<option>暂无模版</option>"
)
;
}
})
;
</#
if
>
}
);
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/basic/basic.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="基础内容更新">
<@ms.saveButton postForm="basicForm"/>
</@ms.nav>
<@ms.panel>
<#assign basicTitle="">
<#assign basicId="0">
<#assign basicDescription="">
<#assign action="$
{
managerPath
}
/basic/save.do">
<#if basic?has_content>
<#assign basicTitle="$
{
basic
.basicTitle
?
default
(
''
)}
">
<#assign basicDescription="$
{
basic
.basicDescription
?
default
(
''
)}
">
<#assign basicId="$
{
basic
.basicId
}
">
<#assign action="$
{
managerPath
}
/basic/update.do">
</#if>
<@ms.form action="$
{
action
}
" name="basicForm" redirect="$
{
managerPath
}
/basic/$
{
categoryId
?
default
(
'
0
'
)}
/list.do">
<@ms.hidden name="basicId" value="$
{
basicId
?
default
(
''
)}
"/>
<@ms.hidden name="basicCategoryId" value="$
{
categoryId
?
default
(
'
0
'
)}
"/>
<@ms.text label="标题" name="basicTitle" value="$
{
basicTitle
?
default
(
''
)}
" size="33" style="width:40%" maxlength="120" />
<@ms.textarea label="描述" name="basicDescription" value="$
{
basicDescription
?
default
(
''
)}
" cols="110" rows="5" maxlength="1000" />
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/basic/basic_list.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="基础内容管理"></@ms.nav>
<@ms.panel>
<@ms.searchForm name="basicForm" action="$
{
managerPath
}
/basic/$
{
categoryId
?
default
(
0
)}
/list.do">
<@ms.text label="关键字" name="keyword" placeholder="输入关键字" value="$
{
keyword
?
default
(
''
)}
"/>
<@ms.searchFormButton>
<@ms.queryButton form="basicForm"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panelNav>
<@ms.addButton url="$
{
managerPath
}
/basic/add.do?categoryId=$
{
categoryId
?
default
(
0
)}
&categoryTitle=$
{
categoryTitle
?
default
(
0
)}
"/>
<@ms.delButton fieldName="basicId" onclick="remove"/>
</@ms.panelNav>
<@
ms
.table
head=['编号,100',"标题"]
filed=["basicId","basicTitle"]
listItem="basicList"
id="basicId"
checkbox="basicId"
editField=["basicTitle"]
editJs="edit"
/>
<#if page?has_content>
<@ms.showPage page=page/>
</#if>
</@ms.panel>
</@
ms
.html5
>
<
script
>
function edit(id)
{
location
.href
=
base
+
"${baseManager}/basic/"
+
id
+
"/edit.do"
;
}
function remove(ids)
{
ms
.post
(
"${managerPath}/basic/allDelete.do"
,
"basicIds="
+
ids
,
function
(
msg
){
if
(
msg
.result
){
location
.reload
()
;
}
})
;
}
</
script
>
src/main/webapp/WEB-INF/manager/basic/city/form.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="省市县镇村数据编辑" back=true>
<@ms.saveButton onclick="save()"/>
</@ms.nav>
<@ms.panel>
<@ms.form name="cityForm" isvalidation=true>
<@ms.hidden name="id" value="$
{
cityEntity
.id
?
default
(
''
)}
"/>
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
var url = "$
{
managerPath
}
/basic/city/save.do";
if($("input[name = 'id']").val() > 0)
{
url
=
"${managerPath}/basic/city/update.do"
;
$
(
".btn-success"
)
.text
(
"更新"
)
;
}
//编辑按钮onclick
function save()
{
$
(
"#cityForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#cityForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
var
btnWord
=$
(
".btn-success"
)
.text
()
;
$
(
".btn-success"
)
.text
(
btnWord
+
"中..."
)
;
$
(
".btn-success"
)
.prop
(
"disabled"
,
true
)
;
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
data
:
$
(
"form[name = 'cityForm']"
)
.serialize
(),
url
:
url
,
success
:
function
(
status
)
{
if
(
status
.result
==
true
)
{
<@
ms
.notify
msg
=
"保存或更新成功"
type
=
"success"
/>
location
.href
=
"${managerPath}/basic/city/index.do"
;
}
else
{
<@
ms
.notify
msg
=
"保存或更新失败!"
type
=
"danger"
/>
location
.href
=
"${managerPath}/basic/city/index.do"
;
}
}
})
}
</
script
>
src/main/webapp/WEB-INF/manager/basic/city/index.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="省市县镇村数据管理"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.text label="省" name="provinceName" value="" width="240px;" placeholder="请输入省/直辖市/自治区级名称" />
<@ms.text label="市" name="cityName" value="" width="240px;" placeholder="请输入市级名称" />
<@ms.text label="县" name="countyName" value="" width="240px;" placeholder="请输入县/区级名称" />
<@ms.text label="镇" name="townName" value="" width="240px;" placeholder="请输入街道/镇级名称" />
<@ms.text label="村" name="villageName" value="" width="240px;" placeholder="请输入村委会名称" />
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="cityList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delCity" title="授权数据删除" >
<@ms.modalBody>删除此授权
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="确认删除?" id="deleteCityBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@
ms
.html5
>
<
script
>
$(function()
{
$
(
"#cityList"
)
.bootstrapTable
({
url
:
"${managerPath}/basic/city/list.do"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
toolbar
:
"#toolbar"
,
columns
:
[
{
checkbox
:
true
},
{
field
:
'
provinceName
'
,
title
:
'省/直辖市/自治区级名称'
,
align
:
'
center
'
},{
field
:
'
cityName
'
,
title
:
'市级名称'
,
align
:
'
center
'
},{
field
:
'
countyName
'
,
title
:
'县/区级名称'
,
align
:
'
center
'
},{
field
:
'
townName
'
,
title
:
'街道/镇级名称'
,
align
:
'
center
'
},{
field
:
'
villageName
'
,
title
:
'村委会名称'
,
align
:
'
center
'
}
]
})
}
)
//增加按钮
$("#addCityBtn").click(function()
{
location
.href
=
"${managerPath}/basic/city/form.do"
;
}
)
//删除按钮
$("#delCityBtn").click(function()
{
//获取
checkbox
选中的数据
var
rows
=
$
(
"#cityList"
)
.bootstrapTable
(
"getSelections"
)
;
//没有选中
checkbox
if
(
rows
.length
<=
0
){
<@
ms
.notify
msg
=
"请选择需要删除的记录"
type
=
"warning"
/>
}
else
{
$
(
".delCity"
)
.modal
()
;
}
}
)
$("#deleteCityBtn").click(function()
{
var
rows
=
$
(
"#cityList"
)
.bootstrapTable
(
"getSelections"
)
;
$
(
this
)
.text
(
"正在删除..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/basic/city/delete.do"
,
data
:
JSON
.stringify
(
rows
),
dataType
:
"json"
,
contentType
:
"application/json"
,
success
:
function
(
msg
)
{
if
(
msg
.result
==
true
)
{
<@
ms
.notify
msg
=
"删除成功"
type
=
"success"
/>
}
else
{
<@
ms
.notify
msg
=
"删除失败"
type
=
"danger"
/>
}
location
.reload
()
;
}
})
}
);
//查询功能
function search()
{
var
search
=
$
(
"form[name='searchForm']"
)
.serializeJSON
()
;
var
params
=
$
(
'#
cityList
'
)
.bootstrapTable
(
'
getOptions
'
)
;
params
.queryParams
=
function
(
params
)
{
$
.extend
(
params
,
search
)
;
return
params
;
}
$
(
"#cityList"
)
.bootstrapTable
(
'
refresh
'
,
{
query
:
$
(
"form[name='searchForm']"
)
.serializeJSON
()})
;
}
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/basic/file/form.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="基础文件表编辑" back=true>
<#if fileEntity.id??>
<@ms.updateButton onclick="saveOrUpdate()"/>
<#else>
<@ms.saveButton onclick="saveOrUpdate()"/>
</#if>
</@ms.nav>
<@ms.panel>
<@ms.form name="fileForm" isvalidation=true>
<@ms.hidden name="id" value="$
{(
fileEntity
.id
)
?
default
(
''
)}
"/>
<@ms.text label="文件分类编号" name="categoryId" value="$
{(
fileEntity
.categoryId
)
?
default
(
''
)}
" width="240px;" placeholder="请输入文件分类编号" validation=
{
"data-bv-between"
:
"true"
,
"required"
:
"true"
,
"data-bv-between-message"
:
"文件分类编号必须大于0小于9999999999"
,
"data-bv-between-min"
:
"0"
,
"data-bv-between-max"
:
"9999999999"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="文件名称" name="fileName" value="$
{(
fileEntity
.fileName
)
?
default
(
''
)}
" width="240px;" placeholder="请输入文件名称" validation=
{
"required"
:
"true"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"文件名称长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="文件链接" name="fileUrl" value="$
{(
fileEntity
.fileUrl
)
?
default
(
''
)}
" width="240px;" placeholder="请输入文件链接" validation=
{
"required"
:
"true"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"文件链接长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="文件大小" name="fileSize" value="$
{(
fileEntity
.fileSize
)
?
default
(
''
)}
" width="240px;" placeholder="请输入文件大小" validation=
{
"data-bv-between"
:
"true"
,
"required"
:
"true"
,
"data-bv-between-message"
:
"文件大小必须大于0小于9999999999"
,
"data-bv-between-min"
:
"0"
,
"data-bv-between-max"
:
"9999999999"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="文件详情Json数据" name="fileJson" value="$
{(
fileEntity
.fileJson
)
?
default
(
''
)}
" width="240px;" placeholder="请输入文件详情Json数据" validation=
{
"required"
:
"true"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"文件详情Json数据长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="文件类型:图片、音频、视频等" name="fileType" value="$
{(
fileEntity
.fileType
)
?
default
(
''
)}
" width="240px;" placeholder="请输入文件类型:图片、音频、视频等" validation=
{
"required"
:
"true"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"文件类型:图片、音频、视频等长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="子业务" name="isChild" value="$
{(
fileEntity
.isChild
)
?
default
(
''
)}
" width="240px;" placeholder="请输入子业务" validation=
{
"required"
:
"true"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"子业务长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
var logoClass = "glyphicon-floppy-saved";
var url = "$
{
managerPath
}
/basic/file/save.do";
if($("input[name = 'id']").val() > 0)
{
logoClass
=
"glyphicon-open"
;
url
=
"${managerPath}/basic/file/update.do"
;
}
//编辑按钮onclick
function saveOrUpdate()
{
$
(
"#fileForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#fileForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
var
btnWord
=$
(
".btn-success"
)
.text
()
;
$
(
".btn-success"
)
.text
(
btnWord
+
"中..."
)
;
$
(
".btn-success"
)
.prop
(
"disabled"
,
true
)
;
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
data
:
$
(
"form[name = 'fileForm']"
)
.serialize
(),
url
:
url
,
success
:
function
(
data
)
{
if
(
data
.id
>
0
)
{
<@
ms
.notify
msg
=
"保存或更新成功"
type
=
"success"
/>
location
.href
=
"${managerPath}/basic/file/index.do"
;
}
else
{
$
(
".btn-success"
)
.html
(
btnWord
+
"<span class='glyphicon "
+
logoClass
+
"' style='margin-right:5px'></span>"
)
;
$
(
".btn-success"
)
.text
(
btnWord
)
;
$
(
".btn-success"
)
.removeAttr
(
"disabled"
)
;
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
danger
'
,
message
:
{
text
:
data
.resultMsg
}
})
.show
()
;
}
}
})
}
</
script
>
src/main/webapp/WEB-INF/manager/basic/file/index.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="基础文件表管理"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNavBtnGroup>
<@shiro.hasPermission name="file:save"><@ms.panelNavBtnAdd id="addFileBtn" title=""/></@shiro.hasPermission>
<@shiro.hasPermission name="file:del"><@ms.panelNavBtnDel id="delFileBtn" title=""/></@shiro.hasPermission>
</@ms.panelNavBtnGroup>
</div>
<table id="fileList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delFile" title="基础文件表数据删除" >
<@ms.modalBody>删除此基础文件表
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="确认" class="btn btn-danger rightDelete" id="deleteFileBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@
ms
.html5
>
<
script
>
$(function()
{
$
(
"#fileList"
)
.bootstrapTable
({
url
:
"${managerPath}/basic/file/list.do"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
toolbar
:
"#toolbar"
,
columns
:
[
{
checkbox
:
true
},
{
field
:
'
id
'
,
title
:
'文件编号'
,
width
:
'
11
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
categoryId
'
,
title
:
'文件分类编号'
,
width
:
'
11
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
appId
'
,
title
:
'
APP
编号'
,
width
:
'
11
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
fileName
'
,
title
:
'文件名称'
,
width
:
'
200
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
fileUrl
'
,
title
:
'文件链接'
,
width
:
'
500
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
fileSize
'
,
title
:
'文件大小'
,
width
:
'
11
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
fileJson
'
,
title
:
'文件详情
J
son
数据'
,
width
:
'
500
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
fileType
'
,
title
:
'文件类型:图片、音频、视频等'
,
width
:
'
50
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
isChild
'
,
title
:
'子业务'
,
width
:
'
50
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
updateDate
'
,
title
:
'更新时间'
,
width
:
'
0
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
updateBy
'
,
title
:
'更新者'
,
width
:
'
11
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
createBy
'
,
title
:
'创建者'
,
width
:
'
11
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
createDate
'
,
title
:
'创建时间'
,
width
:
'
0
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
del
'
,
title
:
'删除标记'
,
width
:
'
1
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/file/form.do?id="
+
row
.id
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
}
]
})
}
)
//增加按钮
$("#addFileBtn").click(function()
{
location
.href
=
"${managerPath}/basic/file/form.do"
;
}
)
//删除按钮
$("#delFileBtn").click(function()
{
//获取
checkbox
选中的数据
var
rows
=
$
(
"#fileList"
)
.bootstrapTable
(
"getSelections"
)
;
//没有选中
checkbox
if
(
rows
.length
<=
0
){
<@
ms
.notify
msg
=
"请选择需要删除的记录"
type
=
"warning"
/>
}
else
{
$
(
".delFile"
)
.modal
()
;
}
}
)
$("#deleteFileBtn").click(function()
{
var
rows
=
$
(
"#fileList"
)
.bootstrapTable
(
"getSelections"
)
;
$
(
this
)
.text
(
"正在删除..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/basic/file/delete.do"
,
data
:
JSON
.stringify
(
rows
),
dataType
:
"json"
,
contentType
:
"application/json"
,
success
:
function
(
msg
)
{
if
(
msg
.result
==
true
)
{
<@
ms
.notify
msg
=
"删除成功"
type
=
"success"
/>
}
else
{
<@
ms
.notify
msg
=
"删除失败"
type
=
"danger"
/>
}
location
.reload
()
;
}
})
}
);
//查询功能
function search()
{
var
search
=
$
(
"form[name='searchForm']"
)
.serializeJSON
()
;
var
params
=
$
(
'#
fileList
'
)
.bootstrapTable
(
'
getOptions
'
)
;
params
.queryParams
=
function
(
params
)
{
$
.extend
(
params
,
search
)
;
return
params
;
}
$
(
"#fileList"
)
.bootstrapTable
(
'
refresh
'
,
{
query
:
$
(
"form[name='searchForm']"
)
.serializeJSON
()})
;
}
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/basic/index.ftl
deleted
100644 → 0
View file @
cd4672a3
<!
DOCTYPE
html>
<
html
lang="en">
<
head
>
<#
include
"/include/meta.ftl"/> <!--调用head内样式信息-->
<
script
type="text/javascript" src="$
{
base
}
/jquery/zTree_v3/jquery.ztree.all-3.5.min.js"></script>
<
link
rel="stylesheet" href="$
{
base
}
/jquery/zTree_v3/zTreeStyle.css" type="text/css">
</
head
>
<
style
>
.container
{
margin
:0;
padding
:0;
width
:
auto
}
hr
{
margin-top
:
9
px
;
margin-bottom
:
9
px
;
padding
:
0
;
}
.rowpadding3
{
padding-bottom
:
3px;
}
.ms-button-group
{
padding
:0
px
0px 8px 0px
}
.row
{
margin-left
:
0
;
margin-right
:
0
}
.form-horizontal .form-group
{
margin-left
:0;
margin-right
:0}
.form-group
{
overflow
:
hidden;
}
.bs-example
>
.dropdown
>
.dropdown-menu
{
position
:
static
;
margin-bottom
:
5
px
;
clear
:
left
;
}
.bs-example
>
.dropdown
>
.dropdown-toggle
{
float
:
left
;
}
.padding-zero
{
padding
:0;}
.link-style
a:hover
{
color
:
#
000
;
}
.link-style
a:visited
{
color
:
#
000
;
}
.form-inline .form-group
{
display
:
inline-block
;
margin-bottom
:
0
;
vertical-align
:
middle
;
}
#tableArticle .updateArticle
{
cursor
:
pointer
;
}
#menuBtn
{
margin
:
0
}
#menuContent
{
overflow
:
auto
;
max-height
:
240
px
;
display
:
none
;
z-index
:
999
;
position
:
absolute
;
float
:
left
;
padding
:
5
px
0
;
margin
:
2
px
0
0
;
background-color
:
#
ffffff
;
border
:
1
px
solid
rgba
(
0
,
0
,
0
,
0.1
5
)
;
border-radius
:
4
px
;
-webkit-box-shadow
:
0
6
px
12
px
rgba
(
0
,
0
,
0
,
0.1
75
)
;
box-shadow
:
0
6
px
12
px
rgba
(
0
,
0
,
0
,
0.1
75
)
;
background-clip
:
padding-box
;
}
select, option,#menuBtn
{
cursor
:
pointer
;
background
:
white
;
}
.selColumn
{
min-width
:173
px
;
height:34px;
}
.categoryTree
{
border-right
:1
px
solid #eeeeee;padding:0;
}
</
style
>
<
script
>
</
script
>
<
body
>
<!----------------------------------- bootstarp 布局容器 开始-------------------------------->
<div class="container-fluid link-style">
<div class="row">
<div class="col-md-2 categoryTree">
<ul id="categoryTree" class="ztree" style="margin-top:0; width:100%;margin-left:-9px">
</div>
<!--右侧内容编辑区域开始-->
<div class="col-md-10" style="margin-top:0;padding:0;margin:0">
<!--------内容 部分 开始-------->
<div class="row" style="margin-top:0; width:100%;;padding:0 0 0 10px;margin:0">
<iframe src="$
{
managerPath
}
/basic/0/list.do" style="width:100%;maring:0;padding:0;border:none;height:100%" id="listFrame" target="listFrame" ></iframe>
</div>
<!--内容部分结束-->
</div>
<!--右侧内容编辑区域结束-->
</div>
</div>
<!--引用弹出框插件-->
<@warnModal modalName="Model"/>
<!--JQ特效部分-->
<script>
$(function()
{
$
(
".categoryTree"
)
.height
(
$
(
document
)
.height
())
;
$
(
"#listFrame"
)
.height
(
$
(
document
)
.height
())
;
//
zTree
框架
var
setting
=
{
callback
:
{
onClick
:
function
(
event
,
treeId
,
treeNode
)
{
if
(
treeNode
.id
>
0
)
{
$
(
"#listFrame"
)
.attr
(
"src"
,
"${managerPath}/basic/"
+
treeNode
.id
+
"/list.do?categoryTitle="
+
encodeURIComponent
(
treeNode
.name
))
;
}
}
},
view
:
{
dblClickExpand
:
dblClickExpand
},
data
:
{
simpleData
:
{
enable
:
true
}
}
}
;
function
dblClickExpand
(
treeId
,
treeNode
)
{
return
treeNode
.level
>
0
;
}
$
(
document
)
.ready
(
function
(){
$
.fn.zTree.init
(
$
(
"#categoryTree"
),
setting
,
zNodes
)
;
})
;
//获取栏目节点列表
var
listColumn
=$
{
listCategory
}
;
var
zNodes
=
new
A
rray
()
;
//遍历节点,添加到数字中
for
(
var
i
=
0
;
i
<
listColumn
.length
;
i
++
){
zNodes
[
i
]
=
{
id
:
listColumn
[
i
]
.categoryId
,
pId
:
listColumn
[
i
]
.categoryCategoryId
,
name
:
listColumn
[
i
]
.categoryTitle
,
open
:
false
}
;
}
}
);
</script>
</
body
>
</
html
>
src/main/webapp/WEB-INF/manager/basic/manager/index.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="管理员管理"></@ms.nav>
<style>
.select2-container .select2-container--default
{
height
:
34
px
;
}
.select2-container .select2-selection--single
{
font: inherit;
border: 1px solid #ccc;
display: block;
height: 34px;
padding: 0px 3px;
font-size: 14px;
color: rgb(85, 85, 85);
}
</style>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
<@shiro.hasPermission name="manager:save"><@ms.panelNavBtnAdd title="" id="addManagerBtn"/></@shiro.hasPermission>
<@shiro.hasPermission name="manager:del"><@ms.panelNavBtnDel title="" id="delManagerBtn"/></@shiro.hasPermission>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="managerList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delManager" title="管理员删除" >
<@ms.modalBody>删除此管理员
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="删除" class="btn btn-danger rightDelete" id="deleteManagerBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
<@ms.modal id="addManager" title="管理员编辑" resetFrom=true>
<@ms.modalBody>
<@ms.form name="managerForm" isvalidation=true action="$
{
managerPath
}
/basic/manager/save.do" redirect="$
{
managerPath
}
/basic/manager/index.do">
<@ms.hidden name="managerId" value="0"/>
<@ms.text label="管理员名" name="managerName" value="" width="240px;" placeholder="请输入管理员名" validation=
{
"required"
:
"true"
,
"minlength"
:
"3"
,
"maxlength"
:
"12"
,
"data-bv-stringlength-message"
:
"管理员用户名长度为3~12个字符!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="管理员昵称" name="managerNickName" value="" width="240px;" placeholder="请输入管理员昵称" validation=
{
"required"
:
"true"
,
"maxlength"
:
"15"
,
"data-bv-stringlength-message"
:
"管理员昵称长度不能超过十五个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="管理员密码" name="managerPassword" value="" width="240px;" placeholder="请输入管理员密码" validation=
{
"minlength"
:
"6"
,
"maxlength"
:
"20"
,
"data-bv-stringlength-message"
:
"管理员密码长度为6~20个字符!"
}
/>
<@ms.select id="managerRoleID" name="managerRoleID" label="角色编号"/>
</@ms.form>
</@ms.modalBody>
<@ms.modalButton>
<@ms.saveButton id= "saveOrUpdate"/>
</@ms.modalButton>
</@
ms
.modal
>
</@
ms
.html5
>
<
script
>
$(function()
{
//加载选择角色列表
$
(
"#managerRoleID"
)
.request
({
url
:
"${managerPath}/basic/role/list.do"
,
type
:
"json"
,
method
:
"post"
,
func
:
function
(
msg
)
{
var
managerArr
=
msg
.rows
;
$
(
"#managerRoleID"
)
.val
(
null
)
.trigger
(
"change"
)
;
if
(
managerArr
.length
!=
0
&&
(
$
(
"#managerRoleID"
)
.val
()
==
null
)){
for
(
var
i
=
0
;
i
<
managerArr
.length
;
i
++
){
$
(
"#managerRoleID"
)
.append
(
$
(
"<option>"
)
.val
(
managerArr
[
i
]
.roleId
)
.text
(
managerArr
[
i
]
.roleName
))
;
$
(
"#managerRoleID"
)
.select2
({
width
:
"210px"
})
.val
(
managerArr
[
i
]
.roleId
)
.trigger
(
"change"
)
;
}
}
else
if
(
$
(
"#managerRoleID"
)
.val
()
<
0
)
{
$
(
"#managerRoleID"
)
.append
(
"<option>暂无角色</option>"
)
;
}
//使用
select2
插件
$
(
"#managerRoleID"
)
.select2
({
width
:
"210px"
})
;
}})
;
$
(
"#managerList"
)
.bootstrapTable
({
url
:
"${managerPath}/basic/manager/query.do"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
toolbar
:
"#toolbar"
,
columns
:
[
{
checkbox
:
true
,
formatter
:
function
(
value
,
row
,
index
){
//不能删除自己
if
(
"${Session.manager_session.managerName}"
==
row
.managerName
){
return
{
disabled
:
true
}
;
}
}
},{
field
:
'
managerName
'
,
title
:
'账号'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.managerId
==
0
){
return
value
;
}
else
{
<@
shiro
.hasPermission
name
=
"manager:update"
>
return
"<a onclick='updateSearch("
+
row
.managerId
+
")' style='cursor:pointer;text-decoration:none;' >"
+
value
+
"</a>"
;
</@
shiro
.hasPermission
>
<@
shiro
.lacksPermission
name
=
"manager:update"
>
return
value
;
</@
shiro
.lacksPermission
>
}
}
},
{
field
:
'
managerNickName
'
,
title
:
'昵称'
},
{
field
:
'
managerPassword
'
,
title
:
'密码'
},
{
field
:
'
roleName
'
,
title
:
'角色名称'
},
{
field
:
'
managerTime
'
,
title
:
'创建时间'
,
align
:
'
center
'
}
]
})
}
)
//增加按钮
$("#addManagerBtn").click(function()
{
$
(
'#
managerForm
'
)
.attr
(
"${managerPath}/basic/manager/save.do"
)
;
$
(
".addManager"
)
.modal
()
;
}
)
var url = "$
{
managerPath
}
/basic/manager/save.do";
if($("input[name = 'managerId']").val() > 0)
{
url
=
"${managerPath}/basic/manager/update.do"
;
$
(
".btn-success"
)
.text
(
"更新"
)
;
}
//保存按钮
$("#saveOrUpdate").click(function()
{
$
(
"#managerForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#managerForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
$
(
this
)
.text
(
"正在保存..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
var
managerEntity
=
$
(
'#
managerForm
'
)
.serialize
()
;
var
url
=
$
(
'#
managerForm
'
)
.attr
(
"action"
)
;
$
.ajax
({
type
:
"post"
,
url
:
url
,
data
:
managerEntity
,
dataType
:
"json"
,
success
:
function
(
data
){
if
(
data
.managerId
>
0
){
<@
ms
.notify
msg
=
"保存或更新成功"
type
=
"success"
/>
location
.reload
()
;
}
else
{
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
warning
'
,
message
:
{
text
:
data
.resultMsg
}
})
.show
()
;
$
(
"#saveOrUpdate"
)
.removeAttr
(
"disabled"
)
;
$
(
"#saveOrUpdate"
)
.text
(
"保存"
)
;
}
}
})
;
}
)
//删除按钮
$("#delManagerBtn").click(function()
{
//获取
checkbox
选中的数据
var
rows
=
$
(
"#managerList"
)
.bootstrapTable
(
"getSelections"
)
;
//没有选中
checkbox
if
(
rows
.length
<=
0
){
<@
ms
.notify
msg
=
"请选择需要删除的记录"
type
=
"warning"
/>
}
else
{
$
(
".delManager"
)
.modal
()
;
}
}
)
$("#deleteManagerBtn").click(function()
{
var
rows
=
$
(
"#managerList"
)
.bootstrapTable
(
"getSelections"
)
;
$
(
this
)
.text
(
"正在删除..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/basic/manager/delete.do"
,
data
:
JSON
.stringify
(
rows
),
dataType
:
"json"
,
contentType
:
"application/json"
,
success
:
function
(
msg
)
{
if
(
msg
.result
==
true
)
{
<@
ms
.notify
msg
=
"删除成功"
type
=
"success"
/>
}
else
{
<@
ms
.notify
msg
=
"删除失败"
type
=
"danger"
/>
}
location
.reload
()
;
}
})
}
);
//表单赋值
function updateSearch(managerId)
{
$
(
this
)
.request
({
url
:
"${managerPath}/basic/manager/get.do?managerId="
+
managerId
,
func
:
function
(
manager
)
{
if
(
manager
.managerId
>
0
)
{
$
(
"#managerForm"
)
.attr
(
"action"
,
"${managerPath}/basic/manager/update.do"
)
;
$
(
"#managerForm input[name='managerName']"
)
.val
(
manager
.managerName
)
;
$
(
"#managerForm input[name='managerId']"
)
.val
(
manager
.managerId
)
;
$
(
"#managerForm input[name='managerNickName']"
)
.val
(
manager
.managerNickName
)
;
$
(
"#managerRoleID"
)
.select2
({
width
:
"210px"
})
.val
(
manager
.managerRoleID
)
.trigger
(
"change"
)
;
$
(
"#managerForm select[name='managerRoleID']"
)
.val
(
manager
.managerRoleID
)
;
$
(
"#addManager"
)
.modal
()
;
}
}})
;
}
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/basic/people/form.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="通用用户与信息一对多表编辑" back=true>
<@ms.saveButton onclick="save()"/>
</@ms.nav>
<@ms.panel>
<@ms.form name="peopleForm" isvalidation=true>
<@ms.hidden name="bpId" value="$
{
peopleEntity
.bpId
?
default
(
''
)}
"/>
<@ms.number label="信息编号" name="bpBasicId" value="$
{
peopleEntity
.bpBasicId
?
default
(
''
)}
" width="240px;" placeholder="请输入信息编号" validation=
{
"required"
:
"false"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"信息编号长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.number label="用户编号" name="bpPeopleId" value="$
{
peopleEntity
.bpPeopleId
?
default
(
''
)}
" width="240px;" placeholder="请输入用户编号" validation=
{
"required"
:
"false"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"用户编号长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text label="创建时间" name="bpDatetime" value="$
{
peopleEntity
.bpDatetime
?
string
(
'
yyyy-MM-dd
'
)}
" width="240px;"/>
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
var url = "$
{
managerPath
}
/basic/people/save.do";
if($("input[name = 'bpId']").val() > 0)
{
url
=
"${managerPath}/basic/people/update.do"
;
$
(
".btn-success"
)
.text
(
"更新"
)
;
}
//编辑按钮onclick
function save()
{
$
(
"#peopleForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#peopleForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
var
btnWord
=$
(
".btn-success"
)
.text
()
;
$
(
".btn-success"
)
.text
(
btnWord
+
"中..."
)
;
$
(
".btn-success"
)
.prop
(
"disabled"
,
true
)
;
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
data
:
$
(
"form[name = 'peopleForm']"
)
.serialize
(),
url
:
url
,
success
:
function
(
status
)
{
if
(
status
.result
==
true
)
{
<@
ms
.notify
msg
=
"保存或更新成功"
type
=
"success"
/>
location
.href
=
"${managerPath}/basic/people/index.do"
;
}
else
{
<@
ms
.notify
msg
=
"保存或更新失败!"
type
=
"danger"
/>
location
.href
=
"${managerPath}/basic/people/index.do"
;
}
}
})
}
</
script
>
src/main/webapp/WEB-INF/manager/basic/people/index.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="通用用户与信息一对多表管理"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
<@ms.addButton id="addPeopleBtn"/>
<@ms.delButton id="delPeopleBtn"/>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="peopleList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delPeople" title="授权数据删除" >
<@ms.modalBody>删除此授权
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="确认删除?" id="deletePeopleBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@
ms
.html5
>
<
script
>
$(function()
{
$
(
"#peopleList"
)
.bootstrapTable
({
url
:
"${managerPath}/basic/people/list.do"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
toolbar
:
"#toolbar"
,
columns
:
[
{
checkbox
:
true
},
{
field
:
'
bpId
'
,
title
:
''
,
width
:
'
10
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/people/form.do?bpId="
+
row
.bpId
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
bpBasicId
'
,
title
:
'信息编号'
,
width
:
'
10
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/people/form.do?bpBasicId="
+
row
.bpBasicId
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
bpPeopleId
'
,
title
:
'用户编号'
,
width
:
'
10
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/people/form.do?bpPeopleId="
+
row
.bpPeopleId
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
},
{
field
:
'
bpDatetime
'
,
title
:
'创建时间'
,
width
:
'
19
'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
url
=
"${managerPath}/basic/people/form.do?bpDatetime="
+
row
.bpDatetime
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
}
]
})
}
)
//增加按钮
$("#addPeopleBtn").click(function()
{
location
.href
=
"${managerPath}/basic/people/form.do"
;
}
)
//删除按钮
$("#delPeopleBtn").click(function()
{
//获取
checkbox
选中的数据
var
rows
=
$
(
"#peopleList"
)
.bootstrapTable
(
"getSelections"
)
;
//没有选中
checkbox
if
(
rows
.length
<=
0
){
<@
ms
.notify
msg
=
"请选择需要删除的记录"
type
=
"warning"
/>
}
else
{
$
(
".delPeople"
)
.modal
()
;
}
}
)
$("#deletePeopleBtn").click(function()
{
var
rows
=
$
(
"#peopleList"
)
.bootstrapTable
(
"getSelections"
)
;
$
(
this
)
.text
(
"正在删除..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/basic/people/delete.do"
,
data
:
JSON
.stringify
(
rows
),
dataType
:
"json"
,
contentType
:
"application/json"
,
success
:
function
(
msg
)
{
if
(
msg
.result
==
true
)
{
<@
ms
.notify
msg
=
"删除成功"
type
=
"success"
/>
}
else
{
<@
ms
.notify
msg
=
"删除失败"
type
=
"danger"
/>
}
location
.reload
()
;
}
})
}
);
//查询功能
function search()
{
var
search
=
$
(
"form[name='searchForm']"
)
.serializeJSON
()
;
var
params
=
$
(
'#
peopleList
'
)
.bootstrapTable
(
'
getOptions
'
)
;
params
.queryParams
=
function
(
params
)
{
$
.extend
(
params
,
search
)
;
return
params
;
}
$
(
"#peopleList"
)
.bootstrapTable
(
'
refresh
'
,
{
query
:
$
(
"form[name='searchForm']"
)
.serializeJSON
()})
;
}
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/basic/role/form.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="角色设置" back=true>
<@ms.saveButton id="save"/>
</@ms.nav>
<@ms.panel>
<@ms.form name="columnForm" isvalidation=true >
<@ms.text name="roleName" label="角色名称:" title="角色名称" value="$
{
roleEntity
.roleName
?
default
(
''
)}
" width="300" validation=
{
"required"
:
"true"
,
"maxlength"
:
"30"
,
"data-bv-notempty-message"
:
"请填写角色名称"
}
/>
<@ms.formRow label="权限管理:">
<div>
<table id="modelList"
data-show-export="true"
data-method="post"
data-side-pagination="server">
</table>
</div>
</@ms.formRow>
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
$(function()
{
//数据初始化
$
(
"#modelList"
)
.bootstrapTable
({
url
:
"${managerPath}/model/modelList.do?roleId=${roleEntity.roleId?default('')}"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
idField
:
'
modelId
'
,
treeShowField
:
'
modelTitle
'
,
parentIdField
:
'
modelModelId
'
,
columns
:
[
{
field
:
'
modelTitle
'
,
title
:
'模块标题'
,
width
:
'
200
'
},{
field
:
'
attribute
'
,
title
:
'功能权限'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
attribute
=
""
;
for
(
var
i
=
0
;
i
<
row
.modelChildList.length
;
i
++
){
var
modelId
=
row
.modelChildList
[
i
]
.modelId
;
var
str
=
"<label style=' margin-top: 3px; margin-right: 20px;' class='ms-check'><input type='checkbox' data-ids='"
+
row
.modelChildList
[
i
]
.modelParentIds
+
"' value='"
+
modelId
+
"' name='attribute'/> "
+
row
.modelChildList
[
i
]
.modelTitle
+
"</label>"
if
(
row
.modelChildList
[
i
]
.chick
==
1
){
str
=
"<label style=' margin-top: 3px; margin-right: 20px;' class='ms-check'><input type='checkbox' checked='checked' data-ids='"
+
row
.modelChildList
[
i
]
.modelParentIds
+
"' value='"
+
modelId
+
"' name='attribute'/> "
+
row
.modelChildList
[
i
]
.modelTitle
+
"</label>"
;
}
if
(
attribute
==
""
){
attribute
=
str
;
}
else
{
attribute
=
attribute
+
str
;
}
}
return
attribute
;
}
}
]
})
}
)
//保存操作
$("#save").click(function()
{
$
(
"#columnForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#columnForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
var
roleName
=
$
(
"input[name=roleName]"
)
.val
()
;
var
roleId
=
"${roleEntity.roleId?default('')}"
;
var
oldRoleName
=
"${roleEntity.roleName?default('')}"
;
var
ids
=[];
$
(
"input[name=attribute]"
)
.each
(
function
()
{
if
(
$
(
this
)
.is
(
'
:
checked
'
)){
var
modelId
=
$
(
this
)
.val
()
;
var
modelModelIds
=
$
(
this
)
.attr
(
"data-ids"
)
;
ids
.push
(
modelId
)
;
if
(
modelModelIds
!=
""
)
{
var
parentIds
=
modelModelIds
.split
(
","
)
;
for
(
var
i
=
0
;
i
<
parentIds
.length
;
i
++
){
if
(
parentIds
[
i
]!=
""
)
{
if
(
$
.inArray
(
parentIds
[
i
]
,
ids
)
==
-1
){
ids
.push
(
parentIds
[
i
]
)
;
}
}
}
}
}
})
;
if
(
roleName
==
""
||
roleName
==
null
){
<@
ms
.notify
msg
=
'角色名不能为空'
type
=
"warning"
/>
}
else
{
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/basic/role/saveOrUpdateRole.do"
,
dataType
:
"json"
,
data
:{
ids
:
ids
,
roleName
:
roleName
,
roleId
:
roleId
,
oldRoleName
:
oldRoleName
},
success
:
function
(
data
){
if
(
data
.result
==
false
)
{
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
warning
'
,
message
:
{
text
:
data
.resultMsg
}
})
.show
()
;
}
else
{
<@
ms
.notify
msg
=
"操作成功"
type
=
"success"
/>
location
.href
=
"${managerPath}/basic/role/index.do"
;
}
}
})
;
}
}
)
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/basic/role/index.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="角色管理"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.text label="角色名" name="roleName" value="" width="240px;" placeholder="请输入角色名" />
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
<@shiro.hasPermission name="role:save"><@ms.panelNavBtnAdd title="" id="addRoleBtn"/></@shiro.hasPermission>
<@shiro.hasPermission name="role:del"><@ms.panelNavBtnDel title="" id="delRoleBtn"/></@shiro.hasPermission>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="roleList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delRole" title="角色删除" >
<@ms.modalBody>删除此角色
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="删除" class="btn btn-danger rightDelete" id="deleteRoleBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@
ms
.html5
>
<
script
>
$(function()
{
$
(
"#roleList"
)
.bootstrapTable
({
url
:
"${managerPath}/basic/role/list.do"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
toolbar
:
"#toolbar"
,
columns
:
[
{
checkbox
:
true
,
formatter
:
function
(
value
,
row
,
index
){
//不能删除自己
if
(
"${Session.manager_session.managerRoleID}"
==
row
.roleId
){
return
{
disabled
:
true
}
;
}
}
},{
field
:
'
roleId
'
,
title
:
'编号'
,
align
:
'
center
'
,
width
:
'
80
'
,
},{
field
:
'
roleName
'
,
title
:
'角色名'
,
formatter
:
function
(
value
,
row
,
index
)
{
if
(
"${Session.manager_session.managerRoleID}"
==
row
.roleId
){
return
value
;
}
else
{
var
url
=
"${managerPath}/basic/role/form.do?roleId="
+
row
.roleId
;
return
"<a href="
+
url
+
" target='_self'>"
+
value
+
"</a>"
;
}
}
}
]
})
}
)
//增加按钮
$("#addRoleBtn").click(function()
{
location
.href
=
"${managerPath}/basic/role/form.do"
;
}
)
//删除按钮
$("#delRoleBtn").click(function()
{
//获取
checkbox
选中的数据
var
rows
=
$
(
"#roleList"
)
.bootstrapTable
(
"getSelections"
)
;
//没有选中
checkbox
if
(
rows
.length
<=
0
){
<@
ms
.notify
msg
=
"请选择需要删除的记录"
type
=
"warning"
/>
}
else
{
$
(
".delRole"
)
.modal
()
;
}
}
)
$("#deleteRoleBtn").click(function()
{
var
rows
=
$
(
"#roleList"
)
.bootstrapTable
(
"getSelections"
)
;
$
(
this
)
.text
(
"正在删除..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/basic/role/delete.do"
,
data
:
JSON
.stringify
(
rows
),
dataType
:
"json"
,
contentType
:
"application/json"
,
success
:
function
(
msg
)
{
if
(
msg
.result
==
true
)
{
<@
ms
.notify
msg
=
"删除成功"
type
=
"success"
/>
}
else
{
<@
ms
.notify
msg
=
"删除失败"
type
=
"danger"
/>
}
location
.reload
()
;
}
})
}
);
//查询功能
function search()
{
var
search
=
$
(
"form[name='searchForm']"
)
.serializeJSON
()
;
var
params
=
$
(
'#
roleList
'
)
.bootstrapTable
(
'
getOptions
'
)
;
params
.queryParams
=
function
(
params
)
{
$
.extend
(
params
,
search
)
;
return
params
;
}
$
(
"#roleList"
)
.bootstrapTable
(
'
refresh
'
,
{
query
:
$
(
"form[name='searchForm']"
)
.serializeJSON
()})
;
}
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/category/form.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="$
{
modelTitle
}
编辑" back=true>
<@ms.saveButton onclick="save()"/>
</@ms.nav>
<@ms.panel>
<@ms.form name="categoryForm" isvalidation=true>
<@ms.hidden name="categoryId" value="$
{
categoryEntity
.categoryId
?
default
(
''
)}
"/>
<@ms.hidden name="categoryModelId" value="$
{
modelId
?
default
(
'
0
'
)}
"/>
<@ms.text label="$
{
modelTitle
}
标题" name="categoryTitle" value="$
{
categoryEntity
.categoryTitle
?
default
(
''
)}
" width="240px;" placeholder="请输入类别标题" validation=
{
"required"
:
"true"
,
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"类别标题长度不能超过五十个字符长度!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.textarea colSm="2" name="categoryDescription" label="$
{
modelTitle
}
描述" wrap="Soft" rows="3" size="" width="642px;" value="$
{
categoryEntity
.categoryDescription
?
default
(
''
)}
" placeholder="$
{
modelTitle
}
描述" validation=
{
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"栏目描述长度不能超过五十个字符长度!"
}
/>
<@ms.formRow label="缩略图">
<@ms.uploadImg path="category" inputName="categorySmallImg" size="15" filetype="" msg="" maxSize="1" imgs="$
{(
category
.categorySmallImg
)
?
default
(
''
)}
" />
</@ms.formRow>
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
var url = "$
{
managerPath
}
/category/save.do";
if($("input[name = 'categoryId']").val() > 0)
{
url
=
"${managerPath}/category/update.do"
;
$
(
".btn-success"
)
.text
(
"更新"
)
;
}
//编辑按钮onclick
function save()
{
$
(
"#categoryForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#categoryForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
var
btnWord
=$
(
".btn-success"
)
.text
()
;
$
(
".btn-success"
)
.text
(
btnWord
+
"中..."
)
;
$
(
".btn-success"
)
.prop
(
"disabled"
,
true
)
;
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
data
:
$
(
"form[name = 'categoryForm']"
)
.serialize
(),
url
:
url
,
success
:
function
(
status
)
{
if
(
status
.categoryId
!=
null
)
{
<@
ms
.notify
msg
=
"保存或更新成功"
type
=
"success"
/>
history
.go
(
-1
)
;
location
.reload
()
;
}
else
{
<@
ms
.notify
msg
=
"保存或更新失败!"
type
=
"danger"
/>
}
}
})
}
</
script
>
src/main/webapp/WEB-INF/manager/category/index.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="$
{
modelTitle
}
"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.text label="$
{
modelTitle
}
标题" name="categoryTitle" value="" width="240px;" placeholder="请输入类别标题" validation=
{
"maxlength"
:
"50"
,
"data-bv-stringlength-message"
:
"${modelTitle}标题长度不能超过五十个字符长度!"
}
/>
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
<#include "/$
{
model
?
default
(
''
)}
/category/shiro-button.ftl"/>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="categoryList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delCategory" title="$
{
modelTitle
}
数据删除" >
<@ms.modalBody>删除此数据
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button class="btn btn-danger rightDelete" id="deleteCategoryBtn" value="确定"/>
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@
ms
.html5
>
<
script
>
$(function()
{
var
category
=
{
modelId
:
$
{
modelId
?
default
(
'
0
'
)},
modelTitle
:
"${modelTitle?default('0')}"
}
;
$
(
"#categoryList"
)
.bootstrapTable
({
url
:
"${managerPath}/category/list.do"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
queryParams
:
function
(
params
)
{
return
$
.extend
(
params
,
category
)
;
},
toolbar
:
"#toolbar"
,
columns
:
[
{
checkbox
:
true
},
{
field
:
'
categoryId
'
,
title
:
'$
{
modelTitle
}
编号'
,
align
:
'
center
'
,
width
:
'
120
'
},{
field
:
'
categoryTitle
'
,
title
:
'$
{
modelTitle
}
标题'
,
formatter
:
function
(
value
,
row
,
index
)
{
<#
include
"/${model?default('')}/category/shiro-update.ftl"
/>
}
},
{
field
:
'
categoryDescription
'
,
title
:
'$
{
modelTitle
}
描述'
}
]
})
}
)
//增加按钮
$("#addCategoryBtn").click(function()
{
location
.href
=
"${managerPath}/category/form.do?modelId=${modelId?default('0')}&modelTitle=${modelTitle?default('0')}"
;
}
)
//删除按钮
$("#delCategoryBtn").click(function()
{
//获取
checkbox
选中的数据
var
rows
=
$
(
"#categoryList"
)
.bootstrapTable
(
"getSelections"
)
;
//没有选中
checkbox
if
(
rows
.length
<=
0
){
<@
ms
.notify
msg
=
"请选择需要删除的记录"
type
=
"warning"
/>
}
else
{
$
(
".delCategory"
)
.modal
()
;
}
}
)
$("#deleteCategoryBtn").click(function()
{
var
rows
=
$
(
"#categoryList"
)
.bootstrapTable
(
"getSelections"
)
;
$
(
this
)
.text
(
"正在删除..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/category/delete.do"
,
data
:
JSON
.stringify
(
rows
),
dataType
:
"json"
,
contentType
:
"application/json"
,
success
:
function
(
msg
)
{
if
(
msg
.result
==
true
)
{
<@
ms
.notify
msg
=
"删除成功"
type
=
"success"
/>
}
else
{
<@
ms
.notify
msg
=
"删除失败"
type
=
"danger"
/>
}
location
.reload
()
;
}
})
}
);
//查询功能
function search()
{
var
modelId
=
{
modelId
:
$
{
modelId
}}
;
var
search
=
$
(
"form[name='searchForm']"
)
.serializeJSON
()
;
var
params
=
$
(
'#
categoryList
'
)
.bootstrapTable
(
'
getOptions
'
)
;
params
.queryParams
=
function
(
params
)
{
$
.extend
(
params
,
search
,
modelId
)
;
return
params
;
}
$
(
"#categoryList"
)
.bootstrapTable
(
'
refresh
'
,
{
query
:
$
(
"form[name='searchForm']"
)
.serializeJSON
()})
;
}
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/category/shiro-button.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.addButton
id="addCategoryBtn"/>
<@
ms
.delButton
id="delCategoryBtn"/>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/category/shiro-update.ftl
deleted
100644 → 0
View file @
cd4672a3
var
url = "$
{
managerPath
}
/$
{
model
?
default
(
""
)}
/category/form.do?categoryId="+row.categoryId+"&modelId=$
{
modelId
?
default
(
'
0
'
)}
&modelTitle=$
{
modelTitle
?
default
(
'
0
'
)}
" ;
return
"<a href=" +url+ " target='_self'>" + value + "</a>";
\ No newline at end of file
src/main/webapp/WEB-INF/manager/column/form.ftl
deleted
100644 → 0
View file @
cd4672a3
<@
ms
.html5
>
<@ms.nav title="栏目管理" back=true>
<#if column.categoryId == 0>
<@ms.saveButton id="saveUpdate" value="保存"/>
<#else>
<@ms.updateButton id="saveUpdate" value="更新"/>
</#if>
</@ms.nav>
<@ms.panel>
<@ms.form name="columnForm" isvalidation=true action="" method="post" >
<#if column.categoryId!=0>
<@ms.hidden name="categoryId" value="$
{
column
.categoryId
?
c
?
default
(
0
)}
" />
</#if>
<@ms.text name="categoryTitle" width="200" label="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
名称" title="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
名称" placeholder="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
名称" value="$
{
column
.categoryTitle
?
default
(
''
)}
" id="" validation=
{
"data-bv-stringlength"
:
"true"
,
"required"
:
"true"
,
"data-bv-notempty-message"
:
"必填项目"
,
"data-bv-regexp"
:
"true"
,
"data-bv-regexp-regexp"
:
'^[^[!@#$%^&
*
()
_+-/~?!@#¥%…&
*
()——+—?》《:“‘’]+$'
,
"data-bv-stringlength-max"
:
"50"
,
"data-bv-regexp-message"
:
"${Session.model_title_session?default('栏目')}名称不能包含特殊字符"
,
"data-bv-stringLength-message"
:
"长度不能超过50个字符"
}
/>
<@ms.formRow label="所属栏目" width="300">
<@ms.treeInput treeId="inputTree" json="$
{
listColumn
?
default
(
''
)}
" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" inputName="categoryCategoryId" inputValue="$
{
column
.categoryCategoryId
?
c
?
default
(
0
)}
" addNodesName="顶级栏目管理" buttonText="$
{
columnSuper
.categoryTitle
?
default
(
'顶级栏目管理'
)}
" clickZtreeId="clickZtreeId(event,treeId,treeNode);" expandAll="true" showIcon="true"/>
</@ms.formRow>
<@ms.text name="categorySort" width="200" label="自定义顺序" title="自定义顺序" size="5" placeholder="请输入文章顺序" value="$
{
column
.categorySort
?
c
?
default
(
0
)}
" validation=
{
"data-bv-between"
:
"true"
,
"data-bv-between-message"
:
"自定义顺序必须大于0"
,
"data-bv-between-min"
:
"0"
,
"data-bv-between-max"
:
"99999999"
,
"data-bv-notempty-message"
:
"自定义顺序不能为空"
,
"data-bv-between-message"
:
"请输入0-99999999之间的数"
,
"required"
:
"true"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.textarea name="columnKeyword" width="600" label="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
关键字" wrap="Soft" rows="4" placeholder="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
关键字,有助于搜索" value="$
{
column
.columnKeyword
?
default
(
''
)}
" validation=
{
"data-bv-stringlength"
:
"true"
,
"data-bv-stringlength-max"
:
"200"
,
"data-bv-stringLength-message"
:
"长度不能超过200个字符"
}
/>
<@ms.textarea name="columnDescrip" width="600" label="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
描述" wrap="Soft" rows="4" placeholder="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
描述,对$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
关键字的扩展" value="$
{
column
.columnDescrip
?
default
(
''
)}
" validation=
{
"data-bv-stringlength"
:
"true"
,
"data-bv-stringlength-max"
:
"200"
,
"data-bv-stringLength-message"
:
"长度不能超过200个字符"
}
/>
<@ms.formRow label="缩略图" width="400">
<@ms.uploadImg path="column" imgs="$
{(
column
.categorySmallImg
)
?
default
(
''
)}
" inputName="categorySmallImg" size="1" msg="提示:栏目缩略图,最多可上传1张" maxSize="2" />
</@ms.formRow>
<#assign columnTypes=[
{
"id"
:
"1"
,
"name"
:
"列表"
}
,
{
"id"
:
"2"
,
"name"
:
"封面"
}
]>
<@ms.radio name="columnType" label="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
属性" list=columnTypes listKey="id" listValue="name" value="$
{
column
.columnType
?
c
?
default
(
1
)}
" />
<@ms.select name="columnContentModelId" width="200" list=[] listKey="cmId" listValue="cmTipsName" label="$
{
S
ession
.model_title_session
?
default
(
'栏目'
)}
内容模型" default="请选择" value="0"/>
<#assign columnModelUrls=[
{
"id"
:
"0"
,
"name"
:
"暂无文件"
}
]>
<@ms.select name="columnListUrl" width="300" id="columnListUrlModel" list=columnModelUrls listKey="id" listValue="name" label="列表模版" value="$
{
column
.columnListUrl
?
default
(
''
)}
" select2=true/>
<@ms.select name="columnUrl" width="300" id="columnUrlModel" default="暂无文件" list=columnModelUrls listKey="id" listValue="name" label="内容模版" value="$
{
column
.columnUrl
?
default
(
''
)}
" select2=true/>
<@ms.hidden name="modelId" value="$
{
S
ession
.model_id_session
?
default
(
'
0
'
)}
" />
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
$(
function
(){
var columnContentModelId= "$
{
column
.columnContentModelId
?
default
(
''
)}
"
$("select[name=columnContentModelId]").find("option[value="+columnContentModelId+"]").attr("selected","selected");
<#if column.columnType == 0>
$("input:radio[name='columnType']:first").attr("checked",true);
</#if>
var columnListUrlSes = "$
{
column
.columnListUrl
?
default
(
''
)}
";
var columnUrlSes = "$
{
column
.columnUrl
?
default
(
''
)}
";
//页面加载列表模板和内容模板
$.ajax(
{
type
:
"post"
,
dataType
:
"json"
,
url
:
"${managerPath}/template/queryTemplateFileForColumn.do"
,
success
:
function
(
msg
){
$
(
"#columnListUrlModel"
)
.html
(
""
)
;
$
(
"#columnUrlModel"
)
.html
(
""
)
;
if
(
msg
.length
!=
0
){
for
(
var
i
=
0
;
i
<
msg
.length
;
i
++
){
if
(
msg
[
i
]
==
columnListUrlSes
)
{
$
(
"#columnListUrlModel"
)
.append
(
"<option selected>"
+
msg
[
i
]+
"</option>"
)
}
else
{
$
(
"#columnListUrlModel"
)
.append
(
"<option>"
+
msg
[
i
]+
"</option>"
)
}
if
(
msg
[
i
]
==
columnUrlSes
){
$
(
"#columnUrlModel"
)
.append
(
"<option selected>"
+
msg
[
i
]+
"</option>"
)
}
else
{
$
(
"#columnUrlModel"
)
.append
(
"<option>"
+
msg
[
i
]+
"</option>"
)
}
}
}
else
{
$
(
"#columnListUrlModel"
)
.append
(
"<option>暂无文件</option>"
)
;
$
(
"#columnUrlModel"
)
.append
(
"<option>暂无文件</option>"
)
;
}
<#
if
column
.columnType
==
2
>
$
(
"#columnListUrlModel"
)
.parents
(
".form-group"
)
.hide
()
;
$
(
"#columnListUrlModel"
)
.css
(
"disabled"
,
true
)
;
$
(
"#columnUrlModel"
)
.parent
()
.prev
()
.text
(
"封面模板:"
)
;
</#
if
>
}
}
);
//切换栏目属性
$("input[name='columnType']").click(function()
{
if
(
$
(
this
)
.val
()
==
2
){
$
(
"#columnListUrlModel"
)
.parents
(
".form-group"
)
.hide
()
;
$
(
"#columnListUrlModel"
)
.css
(
"disabled"
,
true
)
;
$
(
"#columnUrlModel"
)
.parent
()
.prev
()
.text
(
"封面模板:"
)
;
}
else
if
(
$
(
this
)
.val
()
==
1
){
$
(
"#columnListUrlModel"
)
.parents
(
".form-group"
)
.show
()
;
$
(
"#columnListUrlModel"
)
.css
(
"disabled"
,
false
)
;
$
(
"#columnUrlModel"
)
.parent
()
.prev
()
.text
(
"内容模板:"
)
;
}
}
);
//栏目保存提交事件
$("#saveUpdate").click(function()
{
$
(
"#columnForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#columnForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
if
(
$
(
"#columnListUrlModel"
)
.find
(
"option:selected"
)
.text
()
==
"暂无文件"
){
$
(
"#columnListUrlModel"
)
.find
(
"option:selected"
)
.text
(
""
)
;
}
if
(
$
(
"#columnUrlModel"
)
.find
(
"option:selected"
)
.text
()
==
"暂无文件"
){
$
(
"#columnUrlModel"
)
.find
(
"option:selected"
)
.text
(
""
)
;
}
//如果选择的是普通文章,则
if
(
$
(
"select[name=columnContentModelId]"
)
.find
(
"option:selected"
)
.val
()
==
""
){
$
(
"select[name=columnContentModelId]"
)
.find
(
"option:selected"
)
.val
(
0
)
}
var
formdata
=
$
(
"#columnForm"
)
.serialize
()
;
var
URL
=
""
;
<#
if
column
.categoryId
==
0
>
URL
=
"${managerPath}/${model?default("")}/column/save.do?modelId=${Session.model_id_session?default(0)}&modelTitle=${Session.model_title_session?default('')}"
;
<#
else
>
URL
=
"${managerPath}/${model?default("")}/column/update.do?modelId=${Session.model_id_session?default(0)}&modelTitle=${Session.model_title_session?default('')}"
;
</#
if
>
if
(
isNaN
(
$
(
"input[name=categorySort]"
)
.val
())){
<@
ms
.notify
msg
=
"自定义排序必须是数字"
type
=
"warning"
/>
$
(
"input[name=categorySort]"
)
.val
(
0
)
;
return
;
}
$
.ajax
({
type
:
"post"
,
url
:
URL
,
data
:
formdata
,
dataType
:
"json"
,
beforeSend
:
function
(){
//获取按钮值
var
bottonText
=
$
(
"#saveUpdate"
)
.text
()
.trim
()
;
//设置按钮加载状态值
$
(
"#saveUpdate"
)
.attr
(
"data-loading-text"
,
bottonText
+
"中"
)
;
//执行加载状态
$
(
"#saveUpdate"
)
.button
(
'
loading
'
)
;
},
success
:
function
(
msg
){
if
(
msg
.result
)
{
<#
if
column
.categoryId
==
0
>
<@
ms
.notify
msg
=
"保存成功"
type
=
"success"
/>
<#
else
>
<@
ms
.notify
msg
=
"更新成功"
type
=
"success"
/>
</#
if
>
var
modelId
=
$
{
S
ession
.model_id_session
?
default
(
0
)}
;
location
.href
=
"${managerPath}/${model?default("")}/column/index.do?modelId=${Session.model_id_session?default(0)}&modelTitle=${Session.model_title_session?default('')}"
;
}
else
{
<#
if
column
.categoryId
==
0
>
<@
ms
.notify
msg
=
"保存失败"
type
=
"warning"
/>
<#
else
>
<@
ms
.notify
msg
=
"更新失败"
type
=
"warning"
/>
</#
if
>
}
$
(
"#saveUpdate"
)
.button
(
'
reset
'
)
}
})
;
}
);
//获取内容模型列表
$.ajax(
{
type
:
"post"
,
url
:
"${managerPath}/mdiy/contentModel/list.do?pageSize=100"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
success
:
function
(
data
)
{
for
(
var
i
=
0
;
i
<
data
.rows.length
;
i
++
){
var
value
=
data
.rows
[
i
];
var
columnContentModelId
=
$
{
column
.columnContentModelId
?
c
?
default
(
0
)}
;
if
(
columnContentModelId
==
value
.cmId
){
$
(
"select[name=columnContentModelId]"
)
.append
(
"<option value = "
+
value
.cmId
+
" selected='selected'>"
+
value
.cmTipsName
+
"</option>"
)
;
//添加<
option
>元素
}
else
{
$
(
"select[name=columnContentModelId]"
)
.append
(
"<option value = "
+
value
.cmId
+
">"
+
value
.cmTipsName
+
"</option>"
)
;
//添加<
option
>元素
}
}
}
}
)
});
//选择栏目后查询自定义模型
function
clickZtreeId(event,treeId,treeNode)
{
//栏目不能选择自己及其子栏目为父栏目的事件
<#
if
column
.categoryId
gt
0
>
var
booleanClick
=
true
;
var
nodeParam
=
zTreeObjinputTree
.getNodesByParam
(
"categoryId"
,
"${column.categoryId?c?default(0)}"
,
null
)
;
var
nodes
=
zTreeObjinputTree
.getNodesByParam
(
"categoryId"
,
treeNode
.categoryId
,
nodeParam
[
0
]
);
if
(
nodes
.length
>
0
||
treeNode
.categoryId
==
nodeParam
[
0
]
.categoryId)
{
booleanClick
=
false
;
<@
ms
.notify
msg
=
"不能选择该栏目作为父栏目"
type
=
"warning"
/>
}
return
booleanClick
;
</#
if
>
}
</
script
>
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
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