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
da21280b
Commit
da21280b
authored
Jan 15, 2019
by
ms-dev
Browse files
配置文件更新
parent
33bb27de
Changes
67
Hide whitespace changes
Inline
Side-by-side
src/main/webapp/WEB-INF/manager/include/ui/editor.ftl
0 → 100644
View file @
da21280b
<#--简易编辑器-->
<#-
-name
:输入框名称-->
<#-
-width
\
height
:编辑器的宽度高度-->
<#-
-content
:初始化内容-->
<#
macro
editor name label="" content="" validation="" width="100%" height="480" labelStyle="" appId="" help="" helpDirection="" colSm="">
<
div
class="form-group ms-form-group">
<#include "control.ftl"/><#rt/>
<div class="ms-form-control ms-from-group-input col-sm-9 has-feedback">
<script type="text/plain" id="editor_$
{
name
}
" name="$
{
name
}
" style="width:$
{
width
}
px;height:$
{
height
}
px">$
{
content
?
default
(
''
)}
</script>
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
// var ue = UE.getEditor('editor_$
{
name
}
');
var URL = window.UEDITOR_HOME_URL || "$
{
base
}
/static/plugins/ueditor/1.4.3.1/";
var ue = UE.getEditor('editor_$
{
name
}
',
{
imageScaleEnabled
:
true
,
//
服务器统一请求接口路径
serverUrl
:
URL
+
"jsp/msController.jsp?jsonConfig=%7BvideoUrlPrefix:'${base}',fileUrlPrefix:'${base}',imageUrlPrefix:'${base}',imagePathFormat:'/upload/${appId?default(0)}/editor/%7Btime%7D',filePathFormat:'/upload/${appId?default(0)}/editor/%7Btime%7D',videoPathFormat:'/upload/${appId?default(0)}/editor/%7Btime%7D'%7D"
,
autoHeightEnabled
:
true
,
autoFloatEnabled
:
false
,
scaleEnabled
:
true
,
compressSide
:
0
,
maxImageSideLength
:
2000
,
maximumWords
:
80000
,
}
);
//重新设置编辑器的style
ue.ready(function ()
{
$
(
".edui-editor-bottomContainer"
)
.height
(
30
)
;
}
);
</script>
</div>
</
div
>
</#
macro
>
<#--简易编辑器-->
<#-
-inputName
:输入框名称-->
<#-
-width
\
height
:编辑器的宽度高度-->
<#-
-content
:初始化内容-->
<#
macro
smallUedit inputName width height content>
<script type="text/plain" id="editor_$
{
inputName
}
" name="$
{
inputName
}
">$
{
content
?
default
(
''
)}
</script>
<div class="editor-bottom-bar">
当前已输入
<span class="char_count">
0
</span>
个字符, 您还可以输入
<span class="char_remain">
80000
</span>
个字符。
</div>
<style>
.editor-bottom-bar
{
white-space
:
nowrap
;
border
:
1
px
solid
#
ccc
;
line-height
:
20
px
;
font-size
:
12
px
;
text-align
:
right
;
margin-right
:
5
px
;
color
:
#
aaa
;
border-top
:
0
;
width
:
$
{
width
}
px
;
}
</style>
<script type="text/javascript">
var charLimit = 80000;
window.editor_$
{
inputName
}
= new UE.ui.Editor(
{
initialFrameWidth
:
$
{
width
},
initialFrameHeight
:
$
{
height
}
}
);
window.editor_$
{
inputName
}
.render("editor_$
{
inputName
}
");
function computeChar()
{
var
len
=
editor_
$
{
inputName
}
.getContent
()
.length
;
if
(
len
>
charLimit
)
{
$
(
".editor-bottom-bar"
)
.html
(
"<span style='color:red;'>你输入的字符个数("
+
len
+
")已经超出最大允许值!</span>"
)
}
else
{
$
(
".editor-bottom-bar"
)
.html
(
"当前已输入<span class='char_count'>"
+
len
+
"</span>个字符, 您还可以输入<span class='char_remain'>"
+
(
charLimit
-
len
)
+
"</span>个字符。"
)
}
}
window.editor_$
{
inputName
}
.addListener("keyup", function(type, evt)
{
computeChar
()
}
)
</script>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/file.ftl
0 → 100644
View file @
da21280b
<#--
<
input
type="file"/>
-->
<#
macro
file
accept="" value=""
label="" noHeight="false" required="false" colspan="" width="100" help="" helpPosition="2" colon=":" hasColon="true"
id="" name="" class="" style="" size="" title="" disabled="" tabindex="" accesskey="" labelStyle=""
onclick="" ondblclick="" onmousedown="" onmouseup="" onmouseover="" onmousemove="" onmouseout="" onfocus="" onblur="" onkeypress="" onkeydown="" onkeyup="" onselect="" onchange=""
>
<#
include
"control.ftl"/><#rt/>
<
input
type="file"<#rt/>
<#
if
id!=""> id="$
{
id
}
"</#if><#rt/>
<#
if
accept!=""> accept="$
{
accept
}
"</#if><#rt/>
<#
if
value!=""> value="$
{
value
}
"</#if><#rt/>
<#
include
"common-attributes.ftl"/><#rt/>
<#
include
"scripting-events.ftl"/><#rt/>
/>
<#
include
"control-close.ftl"/><#rt/>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/form.ftl
0 → 100644
View file @
da21280b
<#--
<
form
></
form
>
name
:表单名称
id
:表单
id
action
:提交地址
method
:提交方式
-->
<#
macro
form name id="" target=""
action="" method="post" enctype=""
class="form-horizontal" style="display:none; width:100%; background-color: white;" isvalidation=false tooltip=false
redirect=""
>
<
form
<#
rt
/>
role="form"<#rt/>
method="$
{
method
}
"<#rt/>
action="$
{
action
}
"<#rt/>
<#
if
target!="">target="$
{
target
}
" <#else> target="_self"</#if><#rt/>
<#
if
id!=""> id="$
{
id
}
"<#else> id="$
{
name
}
"</#if><#rt/>
<#
if
enctype!=""> enctype="$
{
enctype
}
"</#if><#rt/>
<#
include
"/include/ui/common-attributes.ftl"/><#rt/>
>
<@
ms
.hidden
name="redirect" value="$
{
redirect
}
"/>
<#
nested
/><#
rt
/>
<
script
>
$(function()
{
var
id
=
"${name}"
;
<#
if
id
??
&&
id
!=
""
>
id
=
"${id}"
</#
if
>
$
(
'#'+
id
)
.fadeIn
(
"slow"
)
;
<#
if
isvalidation
>
$
(
'#'+
id
)
.bootstrapValidator
({
<#
if
tooltip
>
container
:
'
tooltip
'
,
</#
if
>
feedbackIcons
:
{
valid
:
'
glyphicon
glyphicon-ok
'
,
invalid
:
'
glyphicon
glyphicon-remove
'
,
validating
:
'
glyphicon
glyphicon-refresh
'
}
})
;
</#
if
>
//$
(
"#${name} .form-group>div.radio"
)
.siblings
(
"i.form-control-feedback"
)
.clone
()
.prependTo
(
$
(
"#${name} .form-group>div.radio"
))
;
//$
(
"#${name} .form-group>div.radio"
)
.siblings
(
"i.form-control-feedback"
)
.remove
()
;
<#
if
!
class
?
has_content
>
$
(
"#${name} .form-group>label"
)
.removeClass
(
"col-sm-2"
)
;
$
(
"#${name} .form-group>div"
)
.removeClass
(
"col-sm-9"
)
;
var
width
=
$
(
"#${name} .form-group>div.ms-from-group-input"
)
.width
()
;
//$
(
"#${name} .form-group>div.ms-from-group-input>:input"
)
.unwrap
()
.parent
()
.width
(
width
)
;
$
(
"#${name} .form-group>div.ms-from-group-input"
)
.addClass
(
"has-feedback"
)
.parent
()
.width
(
width
)
;
//$
(
"#${name} .form-group label"
)
.removeClass
(
"checkbox-inline"
)
.removeClass
(
"radio-inline"
)
;
//$
(
"#${name} .has-feedback .form-control-feedback"
)
.css
({
top
:
"25px"
})
;
<#
elseif
class
?
index_of
(
"searchForm"
)
gt
-1
>
$
(
"#${name} .form-group>label"
)
.removeClass
(
"col-sm-3"
)
;
$
(
"#${name} .form-group>div"
)
.removeClass
(
"col-sm-9"
)
;
$
(
"#${name} .form-group>label"
)
.addClass
(
"col-sm-4"
)
;
$
(
"#${name} .form-group>div"
)
.addClass
(
"col-sm-8"
)
;
$
(
"#${name} .ms-form-group"
)
.addClass
(
"col-sm-4"
)
;
$
(
"#${name}"
)
.show
()
;
</#
if
>
}
)
</
script
>
</
form
>
</#
macro
>
<#
macro
searchForm name id="" target=""
action="" method="post" enctype=""
class="searchForm form-inline" style="display:none; background-color: white;" isvalidation=false tooltip=true >
<@ms.form name="$
{
name
}
" id="$
{
id
}
" action="$
{
action
}
" style="display:none;background-color: white;" isvalidation=true class="$
{
class
}
" tooltip=true>
<#nested/><#rt/>
</@ms.form>
<div class="search-form-div"></div>
<script type="text/javascript">
$(function()
{
//收缩筛选
var
clickTimes
=
1
;
var
searchFormheight
=
$
(
"#searchForm"
)
.height
()
;
//初始化顶住筛选部分的空白
div
$
(
".search-form-div"
)
.height
(
searchFormheight
+
15
)
;
var
_
height
=
parseInt
(
searchFormheight
)
-26
;
$
(
"#searchForm"
)
.find
(
".close"
)
.click
(
function
(){
var
obj
=
$
(
this
)
;
if
(
clickTimes
%
2
==
1
)
{
//空白
div
与筛选同时往上缩
$
(
".search-form-div"
)
.animate
({
height
:
"0px"
},
"slow"
)
;
$
(
"#searchForm"
)
.animate
({
top
:
"-"
+_
height
+
"px"
},
"slow"
)
;
obj
.find
(
"span"
)
.removeClass
(
"glyphicon-chevron-up"
)
.addClass
(
"glyphicon-chevron-down"
)
;
}
else
{
//空白
div
与筛选同时展开
$
(
".search-form-div"
)
.animate
({
height
:
searchFormheight
+
15
+
"px"
},
"slow"
)
;
$
(
"#searchForm"
)
.animate
({
top
:
"46px"
},
"slow"
)
;
obj
.find
(
"span"
)
.removeClass
(
"glyphicon-chevron-down"
)
.addClass
(
"glyphicon-chevron-up"
)
;
}
clickTimes
++
})
}
)
</
script
>
</#
macro
>
<#
macro
searchFormButton close="">
<div class="bottom" style="clear:both">
<div class="close"><span class="glyphicon glyphicon-chevron-up"></span></div>
<@ms.resetButton/>
<#nested/><#rt/>
</div>
</#
macro
>
<#--自定义行-->
<#
macro
formRow label=" " class="form-control" colSm="" groupClass="form-group" width="" labelStyle="" help="" style="" >
<div class="$
{
groupClass
}
">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="col-sm-9 ms-from-group-input" style="line-height:30px;<#if width!=""> width:$
{
width
}
px;</#if>$
{
style
}
"<#rt/>>
<#nested/>
</div>
</div>
</#
macro
>
<#--
<
input
type="text"/>
-->
<#
macro
fromgroup id="" size="" label="" style="">
<
div
class="form-group ms-form-group" style="$
{
style
}
" help="">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="ms-form-control">
<#nested/><#rt/>
</div>
</
div
>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/index.ftl
0 → 100644
View file @
da21280b
<#
include
"/include/ui/input.ftl"/>
<#
include
"/include/ui/input-tree.ftl"/>
<#
include
"/include/ui/select.ftl"/>
<#
include
"/include/ui/textarea.ftl"/>
<#
include
"/include/ui/file.ftl"/>
<#
include
"/include/ui/button.ftl"/>
<#
include
"/include/ui/form.ftl"/>
<#
include
"/include/ui/date.ftl"/>
<#
include
"/include/ui/editor.ftl"/>
<#
include
"/include/ui/time.ftl"/>
<#
include
"/include/ui/tree.ftl"/>
<#
include
"/include/manager.ftl"/>
<#
include
"/include/ui/page.ftl"/>
<#
include
"/include/ui/table.ftl"/>
<#
include
"/include/ui/modal.ftl"/>
<#
include
"/include/ui/upload.ftl"/>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/include/ui/input-tree.ftl
0 → 100644
View file @
da21280b
<#--
树形控件,以input下拉框的形式显示(官网:http://www.ztree.me/v3/main.php#_zTreeInfo) -->
<#--
treeId(必须):树形加载和控制区域的ID,一张页面同时加载多个树形时必须用该值进行区分 -->
<#--
json(必须):需要加载成树形的数据,数据结构为:[
{
categoryId
:
1
,
categoryCategoryId
:
0
,
categoryTitle
:
""
}
,
{
categoryId
:
2
,
categoryCategoryId
:
1
,
categoryTitle
:
""
}
] -->
<#--
jsonId(必须):json数据中ID名称,如:categoryId -->
<#--
jsonPid(必须):json数据中关联的父ID,如:categoryCategoryId -->
<#--
jsonName(必须):json数据中需要显示的数据名称,如:categoryTitle -->
<#--
rootName:顶级根节点,直接传入根节点名称即可。如:顶级分类 -->
<#--
name(必须):隐藏input框的name与id值,用于保存选中数据的ID -->
<#--
value:隐藏input框的val默认值,适用用于加载初始化数据 -->
<#--
text:选择框加载的默认提示信息 -->
<#--
parent:是否可以选择父节点,false默认不允许,true允许 -->
<#--
expandAll:控制节点数据显示的时候是全部展开还是全部折叠(true[默认]:全部展开,false:全部折叠)。 -->
<#--
showIcon:是否显示文件夹图标,true(默认):显示;false:不显示 -->
<#--
required:是否是必选项,true(默认)必选 false -->
<#--
onclick: 选择节点后触发的事件,会注入event,treeId,treeNode三个参数,参考ztree官方文档-->
<#
macro
inputTree treeId json jsonId jsonPid jsonName name text
rootName="" value="" parent=false onclick="" expandAll="true" showIcon="true"
required=true >
<!-- css样式开始 -->
<style type="text/css">
.ztree
${
treeId
}{
width
:100%;
max-height
:
240px;overflow:auto;
}
.ztree
${
treeId
}
li a
{
padding
:
0
}
#$
{
treeId
}
i
{
right
:
0
}
</style>
<!-- css样式结束 -->
<!-- 初始化样式开始 -->
<div class="dropdown" id="$
{
treeId
}
">
<button id="treeLabel$
{
treeId
}
" class="form-control dropdown-toggle" data-toggle="dropdown" aria-expanded="true" style="text-align:left">
$
{
text
?
default
(
'请选择'
)}
</button>
<input type="text" style="position: absolute;height:0;border: none;" <#if name?has_content>name="$
{
name
}
" id="$
{
name
}
"</#if> value="$
{
value
?
default
(
0
)}
"
<#if required && validation?? && validation?has_content><#--验证框架,需要bootstrapValidator框架-->
<#list validation?keys as key>
$
{
key
}
="$
{
validation
[
key
]}
"<#rt/>
</#list>
<#elseif required>
data-bv-between="true" data-bv-between-message="请选择!" data-bv-between-min="1" data-bv-between-max="99998" required data-bv-notempty-message="请选择分类"
</#if>
/>
<ul class="ztree ztree$
{
treeId
}
dropdown-menu" role="menu" id="tree$
{
treeId
}
" aria-labelledby="treeLabel$
{
treeId
}
">
</ul>
</div>
<!-- 初始化样式结束 -->
<!-- js操作方法开始 input -->
<script>
//初始化树形数据
var zNodes$
{
treeId
}
= <#if json?has_content>$
{
json
}
<#else>[]</#if>;
//初始化树形结构
var setting$
{
treeId
}
=
{
view
:{
//控制视图
fontCss
:{
"white-space"
:
"normal"
,
"display"
:
"initial"
,
"word-break"
:
"break-all"
},
showIcon
:
$
{
showIcon
},
//是否显示节点文件夹图标
showLine
:
true
,
//是否显示借点连接线
expandSpeed
:
""
,
//折叠时的动画速度
,
参考
jquery
中动画效果的
speed
参数
,
三种预定速度之一的字符串
(
"slow"
,
"normal"
,
or
"fast"
)
},
data
:
{
//控制显示数据
simpleData
:
{
enable
:
true
,
//是否采用简单数据模式
(
A
rray
)
idKey
:
"${jsonId}"
,
//节点
ID
名称
pIdKey
:
"${jsonPid}"
,
//父节点
ID
名称
},
key
:{
name
:
"${jsonName}"
,
//节点数据保存节点名称的属性名称。
}
},
callback
:
{
//控制获取选择的节点数据
beforeClick
:
<#
if
!
parent
>
beforeClick
$
{
treeId
}
<#
else
>
null
</#
if
>
,
//用于捕获单击节点之前的事件回调函数,并且根据返回值确定是否允许单击操作
onClick
:
getZtreeId
$
{
treeId
},
//用于捕获节点被点击的事件回调函数
},
check
:{
//控制节点的选中方式
(
暂时未启用
,
根据后期需求再做调整
)
autoCheckTrigger
:
true
,
//是否触发自动勾选
enable
:
false
,
//节点上是否显示选择框
,
false
:
不显示
,
true
:
显示。
chkStyle
:
"checkbox"
,
//勾选框类型
(
checkbox
[默认值]
或
radio
)
chkboxType
:{
"Y"
:
"ps"
,
"N"
:
"ps"
},
//设置勾选关联关系
},
}
;
var zTreeObj$
{
treeId
}
="";
$(function()
{
//自定义顶级栏目
<#
if
rootName
?
has_content
>
zNodes
$
{
treeId
}
[
zNodes
$
{
treeId
}
.length
]
=
{
$
{
jsonName
}:
"${rootName}"
,
$
{
jsonId
}:
0
,
$
{
jsonPid
}:
0
}
;
</#
if
>
//加载树形
$
.fn.zTree.init
(
$
(
"#tree${treeId}"
),
setting
$
{
treeId
},
zNodes
$
{
treeId
})
;
//
zTree
内部函数对象
,
主要用户调用
zTree
内部方法
zTreeObj
$
{
treeId
}
=
$
.fn.zTree.getZTreeObj
(
"tree${treeId}"
)
;
//展开
(
true
)
/折叠
(
false
)
全部节点
(
zTree
内部方法
)
zTreeObj
$
{
treeId
}
.expandAll
(
$
{
expandAll
})
;
//加载默认节点
<#
if
value
?
has_content
>
var
nodes
=
zTreeObj
$
{
treeId
}
.getNodeByParam
(
"${jsonId}"
,
$
{
value
},
null
)
if
(
nodes
!=
null
)
{
zTreeObj
$
{
treeId
}
.selectNode
(
nodes
)
;
$
(
"#treeLabel${treeId}"
)
.text
(
nodes
.$
{
jsonName
})
;
}
</#
if
>
//当属性为折叠时,控制下拉菜单的开启和关闭
<#
if
expandAll
=
"false"
>
$
(
"body"
)
.on
(
"click"
,
function
(
e
)
{
e
=
window
.event
||
e
;
//
兼容
IE
7
//获取当前点击事件对象
var
objZtree
=
$
(
e
.srcElement
||
e
.target
)
;
//获取当前点击事件
ID
,
并对点击的子节点
ID
进行切割获取自定义
ID
var
objZtreeId
=
objZtree
.attr
(
"id"
)
;
//当用户点击选择框时还原下拉框属性
if
(
objZtreeId
!=
undefined
&&
objZtreeId
.split
(
"_"
)[
0
]
== "treeLabel$
{
treeId
}
")
{
$
(
"#tree${treeId}"
)
.attr
(
"style"
,
""
)
;
return
;
}
//切割获取到的
ID
判断点击事件是否产生在下拉框
if
(
objZtreeId
!=
undefined
&&
objZtreeId
.split
(
"_"
)[
0
]
== "tree$
{
treeId
}
")
{
$
(
"#tree${treeId}"
)
.attr
(
"style"
,
"display:block"
)
;
}
else
{
$
(
"#tree${treeId}"
)
.attr
(
"style"
,
"display:none"
)
;
}
})
;
</#
if
>
}
);
<#if !parent>
//对节点选择进行限制,用户只能选择子节点
function beforeClick$
{
treeId
}
(treeId,treeNode)
{
var
check
=
(
treeNode
&&
!
treeNode
.isParent
)
;
if
(
!
check
){
<@
ms
.notify
msg
=
"请选择该分类的子分类!"
/>
}
;
return
check
;
}
</#if>
//获取树形中选中的值,将选择值加载到隐藏框中
function getZtreeId$
{
treeId
}
(event,treeId,treeNode)
{
var
booleanClick
=
true
;
//用于捕获节点被点击的事件回调函数
<#
if
onclick
?
has_content
>
booleanClick
=$
{
onclick
}(
event
,
treeId
,
treeNode
)
;
</#
if
>
if
(
booleanClick
==
false
){
return
;
}
//将用户选择数据
ID
加载到隐藏框
$
(
"#${treeId} input[name='${name}']"
)
.val
(
treeNode
.$
{
jsonId
})
;
<#
if
required
>
$
(
"form:first"
)
.bootstrapValidator
(
'
revalidateField
'
,
'$
{
name
}
'
)
;
</#
if
>
//将用户选择数据的名称加载到输入框
$
(
"#treeLabel${treeId}"
)
.text
(
treeNode
.$
{
jsonName
})
;
}
</script>
<!-- js操作方法结束 -->
</#
macro
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/include/ui/input.ftl
0 → 100644
View file @
da21280b
<#--
<
input
type="text"/>
-->
<#
macro
text id="" name="" value="" label="" title="" colSm=""
class="form-control" style="" readonly="" disabled=false maxlength="" minlength=""
validation="" size="" width="" placeholder="" groupClass="form-group" onclick="" onchange="" labelStyle="" autocomplete="off" help="" helpDirection="">
<
div
class="$
{
groupClass
}
ms-form-group">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="col-sm-9 ms-from-group-input ms-form-input" style="<#if width!="">width:$
{
width
}
px;</#if>$
{
style
}
"<#rt/>>
<input type="text" autocomplete="$
{
autocomplete
}
"<#rt/>
<#if id!=""> id="$
{
id
}
"</#if><#rt/>
<#if maxlength!=""> maxlength="$
{
maxlength
}
"</#if><#rt/>
<#if size!=""> maxlesizength="$
{
size
}
"</#if><#rt/>
<#if readonly!=""> readonly="$
{
readonly
}
"</#if><#rt/>
<#if value?? && value?string!=""> value="$
{
value
?
html
}
"</#if><#rt/>
<#if onchange?? && onchange!=""> onchange="$
{
onchange
}
"</#if><#rt/>
<#include "/include/ui/common-attributes.ftl" /><#rt/>
/><#rt/>
</div>
</
div
>
</#
macro
>
<#--数字输入框-->
<#
macro
number id="" name="" value="" label="" title="" min=0 max=200 isFloat=false colSm=""
class="form-control" style="" readonly="" disabled=false maxlength="10" minlength=""
validation="" size="" width="150" placeholder="" groupClass="form-group" onclick="" onchange="" labelStyle="" autocomplete="off" help="" helpDirection="">
<#assign reg="^-?\\d+$">
<#if isFloat>
<#assign reg="^\\d+(\\.\\d+)?$">
</#if>
<@ms.text
id="$
{
id
}
" name="$
{
name
}
" value="$
{
value
}
" label="$
{
label
}
" title="$
{
title
}
"
class="$
{
class
}
" style="$
{
style
}
" readonly="$
{
readonly
}
"
maxlength="$
{
maxlength
}
"
minlength="$
{
minlength
}
"
size="$
{
size
}
" width="$
{
width
}
" placeholder="$
{
placeholder
}
" groupClass="$
{
groupClass
}
" onclick="$
{
onclick
}
" onchange="$
{
onchange
}
" labelStyle="$
{
labelStyle
}
"
autocomplete="$
{
autocomplete
}
" help="$
{
help
}
" helpDirection="$
{
helpDirection
}
"
validation=
{
"data-bv-between"
:
"true"
,
"data-bv-between-message"
:
"必须大于等于${min}且小于等于${max}"
,
"data-bv-between-min"
:
"${min}"
,
"data-bv-between-max"
:
"${max}"
,
"data-bv-regexp"
:
"true"
,
"data-bv-regexp-regexp"
:
"${reg}"
,
"data-bv-regexp-message"
:
"请输入数字"
}
/>
</#
macro
>
<#--
<
input
type="password"/>
-->
<#
macro
password
id="" name="" value="" label="" title="" colSm=""
class="form-control" style="" readonly="" disabled=false maxlength="" minlength=""
validation="" size="" width="" placeholder="" groupClass="form-group" onclick="" onchange="" labelStyle="" autocomplete="off" help="" helpDirection="">
<
div
class="form-group ms-form-group">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="ms-form-control ms-from-group-input col-sm-9" <#if width!=""> style="width:$
{
width
}
px"</#if><#rt/>>
<input type="password" autocomplete="$
{
autocomplete
}
"<#rt/>
<#if id!=""> id="$
{
id
}
"</#if><#rt/>
<#if maxlength!=""> maxlength="$
{
maxlength
}
"</#if><#rt/>
<#if readonly!=""> readonly="$
{
readonly
}
"</#if><#rt/>
<#if value!=""> value="$
{
value
}
"</#if><#rt/>
<#if onchange?? && onchange!=""> onchange="$
{
onchange
}
"</#if><#rt/>
<#include "/include/ui/common-attributes.ftl"/><#rt/>
/>
</div>
</
div
>
</#
macro
>
<#--
<
input
type="hidden"/>
-->
<#
macro
hidden
id="" name="" value=""
>
<
input
type="hidden"<#rt/>
<#
if
id!=""> id="$
{
id
}
"</#if><#rt/>
<#
if
name!=""> name="$
{
name
}
"</#if><#rt/>
<#
if
value?string!=""> value="$
{
value
}
"</#if><#rt/>
/>
</#
macro
>
<#--
<
input
type="radio"/>
-->
<#
macro
radio
name list listKey="" listValue="" value="" width="" colSm=""
help="" helpPosition="2" colon=":" hasColon="true"
label="" class="" style="" disabled=false direction=false validation="" size="" labelStyle="" onclick="" help="" helpDirection="">
<
div
class="form-group ms-form-group _$
{
name
}
Div">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="col-sm-9 ms-from-group-input " style="margin-top:7px<#if width!=""> ;width:$
{
width
}
px</#if>"<#rt/>>
<#if list?is_sequence><#--LIST-->
<#if listKey!="" && listValue!="">
<#list list as item>
<#local rkey=item[listKey]>
<#local rvalue=item[listValue]>
<#local index=item_index>
<#local hasNext=item_has_next>
<#include "radio-item.ftl"><#t/>
</#list>
<#else>
<#list list as item>
<#local rkey=item>
<#local rvalue=item>
<#local index=item_index>
<#local hasNext=item_has_next>
<#include "radio-item.ftl"><#t/>
</#list>
</#if>
<#else>
<#list list?keys as key><#--MAP-->
<#local rkey=key/>
<#local rvalue=list[key]/>
<#local index=key_index>
<#local hasNext=key_has_next>
<#include "radio-item.ftl"><#t/>
</#list>
</#if>
</div>
</
div
>
<script>
$(function()
{
<#
if
direction
>
$
(
"._${name}Div .ms-radio"
)
.width
(
"100%"
)
;
</#
if
>
}
)
</script>
</#
macro
>
<#--
<
input
type="checkbox"/>
-->
<#
macro
checkbox
list listKey="" listValue="" valueList=[] colSm=""
label="" colon=":" hasColon="true"
id="" name="" class="" style="" size="" title="" disabled=false
validation="" direction=true
width=""
labelStyle=""
help=""
helpDirection=""
>
<
div
class="form-group ms-form-group _$
{
name
}
Div">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="col-sm-9 ms-from-group-input " style="margin-top:7px<#if width!=""> ;width:$
{
width
}
px</#if>"<#rt/> >
<#if list?is_sequence>
<#if listKey!="" && listValue!="">
<#list list as item>
<#local rkey=item[listKey]>
<#local rvalue=item[listValue]>
<#local index=item_index>
<#local hasNext=item_has_next>
<#include "/include/ui/checkboxlist-item.ftl"><#t/>
</#list>
<#else>
<#list list as item>
<#local rkey=item>
<#local rvalue=item>
<#local index=item_index>
<#local hasNext=item_has_next>
<#include "/include/ui/checkboxlist-item.ftl"><#t/>
</#list>
</#if>
<#else>
<#list list?keys as key>
<#local rkey=key/>
<#local rvalue=list[key]/>
<#local index=key_index>
<#local hasNext=key_has_next>
<#include "/include/ui/checkboxlist-item.ftl"><#t/>
</#list>
</#if>
</div>
</
div
>
<script>
$(function()
{
<#
if
direction
>
//$
(
"._${name}Div label.ms-checkbox"
)
.removeClass
(
"checkbox"
)
.addClass
(
"checkbox-inline"
)
;
<#
else
>
//$
(
"._${name}Div label.ms-checkbox"
)
.removeClass
(
"checkbox-inline"
)
.addClass
(
"checkbox"
)
;
</#
if
>
}
)
</script>
</#
macro
>
<#--
<
input
type="checkbox"/>
4.5.5废弃
-->
<#
macro
checkboxlist
list listKey="" listValue="" valueList=[] colSm=""
label="" colon=":" hasColon="true"
id="" name="" class="" style="" size="" title="" disabled=false
validation="" direction=true
width=""
labelStyle=""
help=""
helpDirection=""
>
<
div
class="form-group ms-form-group">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="col-sm-9" <#if width!=""> style="$
{
width
}
px"</#if><#rt/>>
<#if list?is_sequence>
<#if listKey!="" && listValue!="">
<#list list as item>
<#local rkey=item[listKey]>
<#local rvalue=item[listValue]>
<#local index=item_index>
<#local hasNext=item_has_next>
<#include "/include/ui/checkboxlist-item.ftl"><#t/>
</#list>
<#else>
<#list list as item>
<#local rkey=item>
<#local rvalue=item>
<#local index=item_index>
<#local hasNext=item_has_next>
<#include "/include/ui/checkboxlist-item.ftl"><#t/>
</#list>
</#if>
<#else>
<#list list?keys as key>
<#local rkey=key/>
<#local rvalue=list[key]/>
<#local index=key_index>
<#local hasNext=key_has_next>
<#include "/include/ui/checkboxlist-item.ftl"><#t/>
</#list>
</#if>
</div>
</
div
>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/modal.ftl
0 → 100644
View file @
da21280b
<#--模态框按钮区域
废弃-->
<#
macro
modalButtonarea>
<div class="modal-footer">
<#nested/>
</div>
</#
macro
>
<#--警告的模态框-->
<#
macro
warn modalName>
<div id="warn$
{
modalName
}
Dialog" class="modal fade $
{
modalName
}
" tabindex="-1" data-focus-on="input:first">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title" id="warn$
{
modalName
}
Title">警告!</h4>
</div>
<div class="modal-body" id="warn$
{
modalName
}
Body">
<#nested/>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
<button type="button" id="warn$
{
modalName
}
Ok" class="btn btn-primary right" >确定</button>
</div>
</div>
</div>
</div>
</#
macro
>
<#--模块框
modalName废弃属性-->
<#
macro
modal id="" title="标题" style="" height="300" resetFrom=true modalName="" size="S">
<#if style!="">
<#assign _style="$
{
style
}
">
<#elseif size=="S">
<#assign _style="width:450px;height:150px;">
<#elseif size=="M">
<#assign _style="width:600px;height:500px;">
<#elseif size=="L">
<#assign _style="width:900px;height:650px;">
</#if>
<div class="modal fade $
{
modalName
}
$
{
id
}
" id="$
{
modalName
}
$
{
id
}
" >
<div class="modal-dialog" style="$
{
_
style
}
;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="$
{
modalName
}
$
{
id
}
Title">
$
{
title
}
</h4>
</div>
<#nested/>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
<#if resetFrom>
$(function()
{
$
(
'#$
{
modalName
}
$
{
id
}
'
)
.on
(
'
hide
.bs.modal
'
,
function
(
event
)
{
if
(
$
(
"#${modalName}${id} form"
)
.length
>
0
)
{
$
(
"#${modalName}${id} form"
)
.data
(
'
bootstrapValidator
'
)
.resetForm
(
true
)
;
$
(
"#${modalName}${id} form"
)[
0
]
.reset();
}
})
}
);
</#if>
</script>
</#
macro
>
<#--模态框内容
height属性废弃, 直接在style里面修改-->
<#
macro
modalBody style="" height="">
<div class="modal-body" style="$
{
style
}
">
<#nested/>
</div>
</#
macro
>
<#--模态框按钮区域-->
<#
macro
modalButton>
<div class="modal-footer">
<#nested/>
</div>
</#
macro
>
<#--通用弹窗-->
<#-
-modalName
:弹出窗的名称-->
<#--调用方法
open
弹出窗口名称,例如:窗口名称
abc ,调用openabc('展示内容','标题')-->
<#--注意使用的时候,
message
的内容只能是
id
或字符串对象-->
<#
macro
modalDialog modalName>
<div class="modal fade" id="$
{
modalName
}
Dialog" style="overflow-y: hidden;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="$
{
modalName
}
Title">
</h4>
</div>
<!--startprint-->
<div class="modal-body" id="$
{
modalName
}
Body">
</div>
<!--添加其他信息-
<div class="modal-footer" id="$
{
modalName
}
Footer">
</div>
-->
<!--endprint-->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
function open$
{
modalName
}
(message,title)
{
if
(
title
)
{
$
(
"#${modalName}Title"
)
.html
(
title
)
;
}
try
{
if
(
message
)
{
message
.show
()
;
}
}
catch
(
e
){
<@
ms
.notify
msg
=
"文本"
type
=
"warning"
/>
}
$
(
"#${modalName}Body "
)
.html
(
message
)
;
$
(
'#$
{
modalName
}
D
ialog
'
)
.modal
()
;
}
function close$
{
modalName
}
()
{
$
(
'#
warn
$
{
modalName
}
D
ialog
'
)
.modal
(
'
hide
'
)
;
}
</script>
</#
macro
>
<#--通用警告弹窗-->
<#-
-warnModal
:弹出窗的名称-->
<#--调用方法
open
弹出窗口名称,例如:窗口名称
abc ,调用openabc('展示内容','标题','点击确定按钮之后回调方法,如果没有则不会显示确认按钮')-->
<#
macro
warnModal modalName>
<div id="warn$
{
modalName
}
Dialog" class="modal fade" tabindex="-1" data-focus-on="input:first">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title" id="warn$
{
modalName
}
Title">警告!</h4>
</div>
<div class="modal-body" id="warn$
{
modalName
}
Body">
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
<button type="button" id="warn$
{
modalName
}
Ok" class="btn btn-primary right" style="display:none">确定</button>
</div>
</div>
</div>
</div>
<script>
function warn$
{
modalName
}
(message,title,func)
{
if
(
title
)
{
$
(
"#warn${modalName}Title"
)
.html
(
title
)
;
}
if
(
func
)
{
$
(
"#warn${modalName}Ok "
)
.show
()
;
$
(
"#warn${modalName}Ok "
)
.one
(
"click"
,
function
(){
eval
(
func
)
;
})
;
}
$
(
"#warn${modalName}Body "
)
.html
(
message
)
;
$
(
'#
warn
$
{
modalName
}
D
ialog
'
)
.modal
()
;
}
function closewarn$
{
modalName
}
()
{
$
(
'#
warn
$
{
modalName
}
D
ialog
'
)
.modal
(
'
hide
'
)
;
}
</script>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/page.ftl
0 → 100644
View file @
da21280b
<#--后台的
UI
界面通用区域定义-->
<#
macro
html5 width="100%" style="">
<!
DOCTYPE
html>
<
html
lang="en">
<head>
<#include "$
{
managerViewPath
}
/include/macro.ftl"/>
<#include "$
{
managerViewPath
}
/include/meta.ftl"/>
</head>
<body>
<div class="ms-content">
<div class="ms-content-body" style="width:$
{
width
}
;$
{
style
}
">
<#nested/>
<div class='notifications ms-notifications top-right'></div>
</div>
</div>
</body>
</
html
>
</#
macro
>
<#
macro
nav title="板块名称" back=false style="">
<div class="ms-content-body-title" style="$
{
style
}
">
<strong>$
{
title
}
</strong>
<#nested/>
<#if back>
<@ms.backButton/>
</#if>
</div>
</#
macro
>
<#--面板-->
<#
macro
panel style="">
<div class="ms-content-body-panel" style="$
{
style
}
">
<#nested/>
</div>
</#
macro
>
<#--面板导航-->
<#
macro
panelNav empty=false>
<div class="ms-content-body-panel-nav" <#if empty>style=" padding: 0;"</#if>>
<#nested/>
</div>
</#
macro
>
<#--提示-->
<#
macro
notify msg="提示信息" type="warning">
$('.ms-notifications').offset(
{
top
:
43
}
).notify(
{
type
:
'$
{
type
}
'
,
message
:
{
text
:
'$
{
msg
}
'
}
}
).show();
</#
macro
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/include/ui/radio-item.ftl
0 → 100644
View file @
da21280b
<
label
class="ms-radio" style="padding-right:10px"><input type="radio"<#rt/>
value="$
{
rkey
}
"<#rt/>
<#if onclick?? && onclick!=""> onclick="$
{
onclick
}
"</#if><#rt/>
<#
if
disabled?? && disabled> disabled="disabled" </#if><#rt/>
<#
if
(rkey?string=="" && (!value?? || value?string=="")) || (value?? && value?string!="" && value?string==rkey?string)> checked="checked"</#if><#rt/>
<#
include
"common-attributes.ftl"/><#rt/>
/>
$
{
rvalue
}
</label> <#if hasNext> </#if>
src/main/webapp/WEB-INF/manager/include/ui/select.ftl
0 → 100644
View file @
da21280b
<#--
<
select
><
option
></
option
></
select
>
-->
<#
macro
select
list=[] value="" multiple=false listKey="" listValue="" listDeep=""
label="" validation="" colon=":" hasColon="true" readonly=""
id="" name="" class="form-control" style="" size="" title="" disabled=false
labelStyle=""
width=""
help=""
helpDirection=""
default=""
defaultValue=""
select2=false
>
<
div
class="form-group ms-form-group">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="col-sm-9 ms-form-control ms-from-group-input" <#if width!=""> style="width:$
{
width
}
px"</#if><#rt/>>
<select<#rt/>
<#if id!=""> id="$
{
id
}
"</#if><#rt/>
<#if multiple>multiple="multiple"</#if><#rt/>
<#if readonly!=""> readonly="$
{
readonly
}
"</#if><#rt/>
<#include "/include/ui/common-attributes.ftl"/><#rt/>
><#rt/>
<#if default?has_content>
<option value="<#if value?has_content>$
{
value
}
</#if>">$
{
default
}
</option>
</#if>
<#if list?is_sequence><#--LIST-->
<#if listKey!="" && listValue!="">
<#list list as item>
<#local rkey=item[listKey]>
<#local rvalue=item[listValue]>
<option value="$
{
rkey
}
" <#if rkey?string==value?string> selected="selected"</#if>>$
{
rvalue
}
</option><#rt/>
</#list>
<#else>
<#list list as item>
<option value="$
{
item
}
" <#if item?string==value?string> selected="selected"</#if>>$
{
item
}
</option><#rt/>
</#list>
</#if>
<#else>
<#list list?keys as key>
<#local rkey=key/>
<#local rvalue=list[key]/>
<option value="$
{
rkey
}
" <#if rkey?string==value?string> selected="selected"</#if>>$
{
rvalue
}
</option><#rt/>
</#list>
</#if>
</select>
</div>
</
div
>
<#
if
select2>
<script>
$(function()
{
$
(
"select[name='${name}']"
)
.select2
({
width
:
"${width}px"
})
;
$
(
"select[name='${name}']"
)
.select2
()
.val
(
"${value}"
)
.trigger
(
"change"
)
;;
}
)
</script>
</#
if
>
</#
macro
>
<#
macro
select2 name list value="" multiple=false listKey="" listValue="" listDeep="" default="请选择"
label="" validation="" colon=":" hasColon="true" readonly=""
class="form-control" style="" size="" title="" disabled=false
labelStyle=""
width=""
>
<select id="$
{
name
}
" name="$
{
name
}
">
<option></option>
</select>
<script>
$(function()
{
$
(
"#${name}"
)
.select2
():
}
)
</script>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/table.ftl
0 → 100644
View file @
da21280b
<#--表格列表-->
<#-
-head
:表格头部标题,数值格式-->
<#-
-head
:表格头部标题-->
<#
macro
table head="" filed="" listItem="" editField="" editJs="" checkbox="" id="" dateformat="yyyy-MM-dd">
<script>
<#if checkbox?has_content>
$(function()
{
$
(
"input[name='allCheck${checkbox}']"
)
.on
(
"click"
,
function
(){
if
(
this
.checked
){
$
(
"input[name='${checkbox}']"
)
.each
(
function
(){
this
.checked
=
true
;
})
;
}
else
{
$
(
"input[name='${checkbox}']"
)
.each
(
function
(){
this
.checked
=
false
;
})
;
}
})
;
}
)
</#if>
</script>
<table class="table table-hover">
<!--表格栏目属性 开始-->
<thead>
<tr>
<#if checkbox?has_content>
<th class="text-center" width="10">
<input type="checkbox" name="allCheck$
{
checkbox
}
">
</th>
</#if>
<#if head?has_content>
<#list head as h>
<#if h?html?length gt 5 && h?html?substring(0,6)=="<th">
$
{
h
}
<#elseif h?contains(",") && h?split(",")[1]?eval gt 0>
<th width="$
{
h
?
split
(
","
)[
1
]}
">
$
{
h
?
split
(
","
)[
0
]}
</th>
<#else>
<th>
$
{
h
}
</th>
</#if>
</#list>
</#if>
</tr>
<#if filed?has_content && listItem?has_content>
<#list listItem?eval as item>
<tr>
<#if checkbox?has_content >
<td>
<input type="checkbox" name="$
{
checkbox
}
" value="$
{
item
[
checkbox
]}
">
</td>
</#if>
<#list filed as f>
<td>
<#if editField?seq_contains(f)>
<a href="javascript:$
{
editJs
}
($
{
item
[
checkbox
]}
)">$
{
item
[
f
]
}
</a>
<#else>
<#if item[f]?has_content && item[f]?is_date>
$
{
item
[
f
]?
string
(
dateformat
)}
<#else>
$
{
item
[
f
]?
default
(
'-'
)}
</#if>
</#if>
</td>
</#list>
</tr>
</#list>
<#if listItem?eval?size==0>
<tr>
<td colspan="$
{
filed
?
size
+
1
}
"><@ms.nodata content="暂无数据" /></td>
</tr>
</#if>
</#if>
</thead>
<!--表格栏目属性 结束-->
<tbody id=$
{
id
}
>
<#nested/>
</tbody>
</table>
</#
macro
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/include/ui/textarea.ftl
0 → 100644
View file @
da21280b
<#--
<
textarea
name="textarea"></textarea>
-->
<#
macro
textarea
name
wrap="soft"
readonly=""
cols=""
rows=""
value=""
label=""
title=""
required="false"
id=""
class="form-control"
style=""
size=""
disabled=false
maxlength=""
placeholder=""
validation=""
labelStyle=""
width=""
help=""
helpDirection=""
colSm=""
>
<
div
class="form-group ms-form-group">
<#include "/include/ui/control.ftl"/><#rt/>
<div class="ms-form-control ms-from-group-input col-sm-9" style="<#if width!="">width:$
{
width
}
px;</#if>"<#rt/>>
<textarea<#rt/>
<#if id!=""> id="$
{
id
}
"</#if><#rt/>
<#if wrap!=""> wrap="$
{
wrap
}
"</#if><#rt/>
<#if readonly!=""> readonly="$
{
readonly
}
"</#if><#rt/>
<#if cols!=""> cols="$
{
cols
}
"</#if><#rt/>
<#if rows!=""> rows="$
{
rows
}
"</#if><#rt/>
<#include "/include/ui/common-attributes.ftl"/><#rt/>
><#if value?? && value!="">$
{
value
!?
html
}
</#if></textarea>
</div>
</
div
>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/time.ftl
0 → 100644
View file @
da21280b
<#--
<
input
type="t"/>
-->
<#
macro
time id="" name="" value=""
label="" title="" size="" labelStyle="" width=""
class="form-control" style="" readonly="" disabled=false maxlength="" minlength="" placeholder="" validation=""
help=""
helpDirection=""
>
<
div
class="form-group ms-form-group">
<#include "control.ftl"/><#rt/>
<div class="control-group col-sm-9 ms-from-group-input" style="min-widht:200px;<#if width!="">width:$
{
width
}
px</#if>"<#rt/>>
<div class="controls">
<div class="input-prepend input-group date" <#if id!=""> id="$
{
id
}
"<#elseif name!="">id="$
{
name
}
"</#if><#rt/>
data-date="" data-date-format="hh:ii" data-link-format="hh:ii">
<span class="add-on input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
<input type="text"<#rt/>
<#if maxlength!=""> maxlength="$
{
maxlength
}
"</#if><#rt/>
<#if readonly!=""> readonly="$
{
readonly
}
"</#if><#rt/>
<#if value?? && value?string!=""> value="$
{
value
?
html
}
"</#if><#rt/>
<#include "common-attributes.ftl"/><#rt/>/>
</div>
</div>
</div>
</
div
>
<
script
>
$(function()
{
$
(
'#$
{
name
}
'
)
.datetimepicker
({
language
:
'
cn
'
,
todayBtn
:
1
,
autoclose
:
true
,
todayHighlight
:
1
,
format
:
'
hh
:
ii
'
,
startView
:
1
,
minView
:
0
,
maxView
:
1
,
forceParse
:
0
,
})
;
}
);
</
script
>
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/tree.ftl
0 → 100644
View file @
da21280b
<#--
树形控件,以input下拉框的形式显示(官网:http://www.ztree.me/v3/main.php#_zTreeInfo) -->
<#--
treeId(必须):树形加载和控制区域的ID,一张页面同时加载多个树形时必须用该值进行区分 -->
<#--
json(必须):需要加载成树形的数据,数据结构为:[
{
categoryId
:
1
,
categoryCategoryId
:
0
,
categoryTitle
:
""
}
,
{
categoryId
:
2
,
categoryCategoryId
:
1
,
categoryTitle
:
""
}
] -->
<#--
jsonId(必须):json数据中ID名称,如:categoryId -->
<#--
jsonPid(必须):json数据中关联的父ID,如:categoryCategoryId -->
<#--
jsonName(必须):json数据中需要显示的数据名称,如:categoryTitle -->
<#--
jsonUrl:如过json数据中存在跳转地址则直接将字段名称填入点击树形时可自动跳转 -->
<#--
addNodesName:增加顶级根节点,直接传入根节点名称即可。如:顶级分类 -->
<#--
buttonText:选择框加载的默认提示信息 -->
<#--
inputName(必须):隐藏input框的name值,用于保存选中数据的ID -->
<#--
inputValue:隐藏input框的val默认值,适用用于加载初始化数据 -->
<#--
inputId:隐藏input框的id值,用于保存选中数据的ID -->
<#--
selectParent:用户选择父节点时的提示信息,当该值存在时,用户不能选择存在子节点的父节点,并提示传入的值,当该值不存在时用户可以选择任意 -->
<#--
clickZtreeId: 选择节点后触发的事件-->
<#--
expandAll:控制节点数据显示的时候是全部展开还是全部折叠(true[默认]:全部展开,false:全部折叠)。 -->
<#--
showIcon:是否显示文件夹图标,true:显示;false(默认):不显示 -->
<#--
内置函数调用方法说明:
调用对象的函数名: zTreeObj$
{
treeId
}
(treeId为自定义的ID名称);
/
**
*
根据节点数据的属性搜索,获取条件完全匹配的单一节点数据 JSON 对象
*
如有重复则返回最近的一条。
*
@param key:需要精确匹配的属性名称
*
@param value:需要精确匹配的属性值,可以是任何类型,只要保证与 key 指定的属性值保持一致即可
*
@param parentNodeJSON:搜索范围,指定在某个父节点下的子节点中进行搜索忽略此参数,为null时表示在全部节点中搜索
*
@return JSON
*
/
zTreeObj$
{
treeId
}
.getNodeByParam(key,value,parentNode);
/
**
*
获取根节点数据,既获取PID=0的数据集合
*
@return ArrayList(json)
*
/
zTreeObj$
{
treeId
}
.getNodes();
/
**
*
根据节点数据的属性搜索,获取条件完全匹配的节点数据 JSON 对象集合
*
@param key:需要精确匹配的属性名称
*
@param value:需要精确匹配的属性值,可以是任何类型,只要保证与 key 指定的属性值保持一致即可
*
@param parentNode:可以指定在某个父节点下的子节点中搜索,为null时表示在全部节点中搜索
*
@return ArrayList(json)
*
/
zTreeObj$
{
treeId
}
.getNodesByParam(key,value,parentNode);
-->
<#--废弃,推荐使用
inputTree
参考input_tree.ftl-->
<#
macro
treeInput treeId="" json="" jsonId="" jsonPid="" jsonName="" jsonUrl="" addNodesName="" buttonText="" inputName="" inputValue="" inputId="" selectParent="" clickZtreeId="" expandAll="true" showIcon="false" >
<!-- css样式开始 -->
<style type="text/css">
.ztree
${
treeId
}{
width
:100%;
max-height
:
240px;overflow:auto;
}
.ztree
${
treeId
}
li a
{
padding
:
0
}
</style>
<!-- css样式结束 -->
<!-- 初始化样式开始 -->
<div class="dropdown" id="$
{
treeId
}
">
<button type="text" id="treeLabel$
{
treeId
}
" class="form-control dropdown-toggle" data-toggle="dropdown" aria-expanded="true" style="text-align:left">
$
{
buttonText
?
default
(
'请选择'
)}
</button>
<input type="hidden" <#if inputName?has_content>name="$
{
inputName
}
"</#if> <#if inputId?has_content>id="$
{
inputId
}
"</#if> value="$
{
inputValue
?
default
(
0
)}
">
<ul class="ztree ztree$
{
treeId
}
dropdown-menu" role="menu" id="treeDome$
{
treeId
}
" aria-labelledby="treeLabel$
{
treeId
}
">
</ul>
</div>
<!-- 初始化样式结束 -->
<!-- js操作方法开始 input -->
<script>
//初始化树形数据
var zNodes$
{
treeId
}
= <#if json?has_content>$
{
json
}
<#else>[]</#if>;
//初始化树形结构
var setting$
{
treeId
}
=
{
view
:{
//控制视图
fontCss
:{
"white-space"
:
"normal"
,
"display"
:
"initial"
,
"word-break"
:
"break-all"
},
showIcon
:
$
{
showIcon
},
//是否显示节点文件夹图标
showLine
:
true
,
//是否显示借点连接线
expandSpeed
:
""
,
//折叠时的动画速度
,
参考
jquery
中动画效果的
speed
参数
,
三种预定速度之一的字符串
(
"slow"
,
"normal"
,
or
"fast"
)
},
data
:
{
//控制显示数据
simpleData
:
{
enable
:
true
,
//是否采用简单数据模式
(
A
rray
)
idKey
:
"${jsonId}"
,
//节点
ID
名称
pIdKey
:
"${jsonPid}"
,
//父节点
ID
名称
},
key
:{
name
:
"${jsonName}"
,
//节点数据保存节点名称的属性名称。
url
:
"${jsonUrl}"
,
//节点跳转地址属性
}
},
callback
:
{
//控制获取选择的节点数据
beforeClick
:
<#
if
selectParent
?
has_content
>
beforeClick
$
{
treeId
}
<#
else
>
null
</#
if
>
,
//用于捕获单击节点之前的事件回调函数,并且根据返回值确定是否允许单击操作
onClick
:
getZtreeId
$
{
treeId
},
//用于捕获节点被点击的事件回调函数
},
check
:{
//控制节点的选中方式
(
暂时未启用
,
根据后期需求再做调整
)
autoCheckTrigger
:
true
,
//是否触发自动勾选
enable
:
false
,
//节点上是否显示选择框
,
false
:
不显示
,
true
:
显示。
chkStyle
:
"checkbox"
,
//勾选框类型
(
checkbox
[默认值]
或
radio
)
chkboxType
:{
"Y"
:
"ps"
,
"N"
:
"ps"
},
//设置勾选关联关系
},
}
;
var zTreeObj$
{
treeId
}
="";
$(function()
{
//自定义顶级栏目
<#
if
addNodesName
?
has_content
>
zNodes
$
{
treeId
}
[
zNodes
$
{
treeId
}
.length
]
=
{
$
{
jsonName
}:
"${addNodesName}"
,
$
{
jsonId
}:
0
,
$
{
jsonPid
}:
0
}
;
</#
if
>
//加载树形
$
.fn.zTree.init
(
$
(
"#treeDome${treeId}"
),
setting
$
{
treeId
},
zNodes
$
{
treeId
})
;
//
zTree
内部函数对象
,
主要用户调用
zTree
内部方法
zTreeObj
$
{
treeId
}
=
$
.fn.zTree.getZTreeObj
(
"treeDome${treeId}"
)
;
//展开
(
true
)
/折叠
(
false
)
全部节点
(
zTree
内部方法
)
zTreeObj
$
{
treeId
}
.expandAll
(
$
{
expandAll
})
;
//加载默认节点
<#
if
inputValue
?
has_content
>
zTreeObj
$
{
treeId
}
.selectNode
(
zTreeObj
$
{
treeId
}
.getNodeByParam
(
"${jsonId}"
,
$
{
inputValue
},
null
))
;
</#
if
>
//当属性为折叠时,控制下拉菜单的开启和关闭
<#
if
expandAll
=
"false"
>
$
(
"body"
)
.on
(
"click"
,
function
(
e
)
{
e
=
window
.event
||
e
;
//
兼容
IE
7
//获取当前点击事件对象
var
objZtree
=
$
(
e
.srcElement
||
e
.target
)
;
//获取当前点击事件
ID
,
并对点击的子节点
ID
进行切割获取自定义
ID
var
objZtreeId
=
objZtree
.attr
(
"id"
)
;
//当用户点击选择框时还原下拉框属性
if
(
objZtreeId
!=
undefined
&&
objZtreeId
.split
(
"_"
)[
0
]
== "treeLabel$
{
treeId
}
")
{
$
(
"#treeDome${treeId}"
)
.attr
(
"style"
,
""
)
;
return
;
}
//切割获取到的
ID
判断点击事件是否产生在下拉框
if
(
objZtreeId
!=
undefined
&&
objZtreeId
.split
(
"_"
)[
0
]
== "treeDome$
{
treeId
}
")
{
$
(
"#treeDome${treeId}"
)
.attr
(
"style"
,
"display:block"
)
;
}
else
{
$
(
"#treeDome${treeId}"
)
.attr
(
"style"
,
"display:none"
)
;
}
})
;
</#
if
>
}
);
<#if selectParent?has_content>
//对节点选择进行限制,用户只能选择子节点
function beforeClick$
{
treeId
}
(treeId,treeNode)
{
var
check
=
(
treeNode
&&
!
treeNode
.isParent
)
;
if
(
!
check
){
$
(
"#treeLabel${treeId}"
)
.text
(
"${selectParent}"
)
;
}
;
return
check
;
}
</#if>
//获取树形中选中的值,将选择值加载到隐藏框中
function getZtreeId$
{
treeId
}
(event,treeId,treeNode)
{
var
booleanClick
=
true
;
//用于捕获节点被点击的事件回调函数
<#
if
clickZtreeId
?
has_content
>
booleanClick
=$
{
clickZtreeId
}
;
</#
if
>
if
(
booleanClick
==
false
){
return
;
}
//将用户选择数据
ID
加载到隐藏框
$
(
"#${treeId} input[name='${inputName}']"
)
.val
(
treeNode
.$
{
jsonId
})
;
//将用户选择数据的名称加载到输入框
$
(
"#treeLabel${treeId}"
)
.text
(
treeNode
.$
{
jsonName
})
;
}
</script>
<!-- js操作方法结束 -->
</#
macro
>
<#------------------------------------------------------------------------------------------------------------------------------------------------------------------>
<#--
getZtreeId:外部重写JS方法:
/
**
*
外部点击树形节点时触发的事件,(传入参数必须与下述参数名保持一致)
*
event:获取到的触发事件
*
treeId:载体ID,这里为:treeDome$
{
treeId
}
*
treeNode:内置函数对象,这里可直接调用内置函数方法
*
treeNode.$
{
jsonId
}
:获取点击的树形节点的ID
*
treeNode.$
{
jsonName
}
:获取点击树形节点的名称
*
.....
*
/
getZtreeId$
{
treeId
}
(event,treeId,treeNode);
-->
<#--
树形控件,以input下拉框的形式显示(官网:http://www.ztree.me/v3/main.php#_zTreeInfo) -->
<#--
treeId(必须):树形加载和控制区域的ID,一张页面同时加载多个树形时必须用该值进行区分 -->
<#--
json(必须):需要加载成树形的数据,数据结构为:[
{
categoryId
:
1
,
categoryCategoryId
:
0
,
categoryTitle
:
""
}
,
{
categoryId
:
2
,
categoryCategoryId
:
1
,
categoryTitle
:
""
}
] -->
<#--
jsonId(必须):json数据中ID名称,如:categoryId -->
<#--
jsonPid(必须):json数据中关联的父ID,如:categoryCategoryId -->
<#--
jsonName(必须):json数据中需要显示的数据名称,如:categoryTitle -->
<#--
jsonUrl:如过json数据中存在跳转地址则直接将字段名称填入点击树形时可自动跳转 -->
<#--
addNodesName:增加顶级根节点,直接传入根节点名称即可。如:顶级分类 -->
<#--
expandAll:控制节点数据显示的时候是全部展开还是全部折叠(true[默认]:全部展开,false:全部折叠)。 -->
<#--
showIcon:是否显示文件夹图标,true:显示;false(默认):不显示 -->
<#--
内置函数调用方法说明:
调用对象的函数名: zTreeObj$
{
treeId
}
(treeId为自定义的ID名称);
/
**
*
根据节点数据的属性搜索,获取条件完全匹配的单一节点数据 JSON 对象
*
如有重复则返回最近的一条。
*
@param key:需要精确匹配的属性名称
*
@param value:需要精确匹配的属性值,可以是任何类型,只要保证与 key 指定的属性值保持一致即可
*
@param parentNodeJSON:搜索范围,指定在某个父节点下的子节点中进行搜索忽略此参数,为null时表示在全部节点中搜索
*
@return JSON
*
/
zTreeObj$
{
treeId
}
.getNodeByParam(key,value,parentNode);
/
**
*
获取根节点数据,既获取PID=0的数据集合
*
@return ArrayList(json)
*
/
zTreeObj$
{
treeId
}
.getNodes();
/
**
*
根据节点数据的属性搜索,获取条件完全匹配的节点数据 JSON 对象集合
*
@param key:需要精确匹配的属性名称
*
@param value:需要精确匹配的属性值,可以是任何类型,只要保证与 key 指定的属性值保持一致即可
*
@param parentNode:可以指定在某个父节点下的子节点中搜索,为null时表示在全部节点中搜索
*
@return ArrayList(json)
*
/
zTreeObj$
{
treeId
}
.getNodesByParam(key,value,parentNode);
-->
<#
macro
tree id="ztree$
{
.now
?
string
(
'
yyyyMMddhhmmss
'
)}
" type="default" data=[] url="" idKey="" pIdKey="" text="" label="" treeId="" json="" jsonId="" jsonPid="" jsonName="" jsonUrl="" validation="" addNodesName="" expandAll="true" showIcon="false" getZtreeId="" ischeck="false" help="">
<#
if
type="checkbox">
<ul id="$
{
id
}
" class="ztree"></ul>
<SCRIPT type="text/javascript">
<!--
var $
{
id
}
;
ms.post("$
{
url
}
",null,function(json)
{
var
setting
=
{
check
:
{
enable
:
true
,
chkboxType
:
{
"Y"
:
"ps"
,
"N"
:
"ps"
}
},
data
:
{
simpleData
:
{
enable
:
true
,
//是否采用简单数据模式
(
A
rray
)
idKey
:
"${idKey}"
,
//节点
ID
名称
pIdKey
:
"${pIdKey}"
,
//父节点
ID
名称
},
key
:{
name
:
"${text}"
//节点数据保存节点名称的属性名称。
}
}
}
;
$
(
document
)
.ready
(
function
(){
$
.fn.zTree.init
(
$
(
"#${id}"
),
setting
,
json
)
;
$
{
id
}
=
$
.fn.zTree.getZTreeObj
(
"${id}"
)
;
$
{
id
}
.expandAll
(
true
)
;
})
;
}
);
//-->
</SCRIPT>
<#
elseif
type=="default"> <#--默认调用方式在4.5.5将废弃-->
<!--
初始化样式开始 -->
<div class="form-group ms-form-group ">
<#include "control.ftl"/><#rt/>
<div class="ms-form-control <#if label!="">col-sm-9</#if>">
<ul class="ztree" id="treeDome$
{
treeId
}
">
</ul>
</div>
</div>
<!--
初始化样式结束 -->
<!--
js操作方法开始 tree-->
<script>
//初始化树形数据
var zNodes$
{
treeId
}
= $
{
json
?
default
(
'[]'
)}
;
var zTreeObj$
{
treeId
}
;
//初始化树形结构
var setting$
{
treeId
}
=
{
view
:{
//控制视图
fontCss
:{
"white-space"
:
"normal"
,
"display"
:
"initial"
,
"word-break"
:
"break-all"
},
showIcon
:
$
{
showIcon
},
//是否显示节点文件夹图标
showLine
:
true
,
//是否显示借点连接线
expandSpeed
:
"fast"
,
//折叠时的动画速度
,
参考
jquery
中动画效果的
speed
参数
,
三种预定速度之一的字符串
(
"slow"
,
"normal"
,
or
"fast"
)
},
data
:
{
//控制显示数据
simpleData
:
{
enable
:
true
,
//是否采用简单数据模式
(
A
rray
)
idKey
:
"${jsonId}"
,
//节点
ID
名称
pIdKey
:
"${jsonPid}"
,
//父节点
ID
名称
},
key
:{
name
:
"${jsonName}"
,
//节点数据保存节点名称的属性名称。
url
:
"${jsonUrl}"
,
//节点跳转地址属性
}
},
callback
:
{
//控制获取选择的节点数据
onClick
:
<#
if
getZtreeId
?
has_content
>
getZtreeId
$
{
treeId
}
<#
else
>
null
</#
if
>
,
//用于捕获节点被点击的事件回调函数
},
check
:{
//控制节点的选中方式
(
暂时未启用
,
根据后期需求再做调整
)
autoCheckTrigger
:
true
,
//是否触发自动勾选
enable
:
$
{
ischeck
},
//节点上是否显示选择框
,
false
:
不显示
,
true
:
显示。
chkStyle
:
"checkbox"
,
//勾选框类型
(
checkbox
[默认值]
或
radio
)
chkboxType
:{
"Y"
:
"ps"
,
"N"
:
"ps"
},
//设置勾选关联关系
},
}
;
$(function()
{
//自定义顶级栏目
<#
if
addNodesName
?
has_content
>
zNodes
$
{
treeId
}
[
zNodes
$
{
treeId
}
.length
]
=
{
$
{
jsonName
}:
"${addNodesName}"
,
$
{
jsonId
}:
0
,
$
{
jsonPid
}:
0
}
;
</#
if
>
//加载树形
$
.fn.zTree.init
(
$
(
"#treeDome${treeId}"
),
setting
$
{
treeId
},
zNodes
$
{
treeId
})
;
//
zTree
内部函数对象
,
主要用户调用
zTree
内部方法
zTreeObj
$
{
treeId
}
=
$
.fn.zTree.getZTreeObj
(
"treeDome${treeId}"
)
;
//展开
(
true
)
/折叠
(
false
)
全部节点
(
zTree
内部方法
)
zTreeObj
$
{
treeId
}
.expandAll
(
$
{
expandAll
})
;
}
);
<#if getZtreeId?has_content>
function getZtreeId$
{
treeId
}
(event,treeId,treeNode)
{
$
{
getZtreeId
}
;
}
</#if>
</script>
<!--
js操作方法结束 -->
</#
if
>
</#
macro
>
<#--------------------------------------------------------------------------
-->
<#--
树形控件,树形结构table 格式-->
<#--
tbodyId(必须) 需要进行委派的容器Id, 如要委派到tbody的id值-->
<#--
treeId(必须):树形加载和控制区域的ID,一张页面同时加载多个树形时必须用该值进行区分 -->
<#--
json(必须):需要加载成树形的数据,数据结构为:[
{
categoryId
:
1
,
categoryCategoryId
:
0
,
categoryTitle
:
""
}
,
{
categoryId
:
2
,
categoryCategoryId
:
1
,
categoryTitle
:
""
}
] -->
<#--
jsonId(必须):json数据中ID名称,如:categoryId -->
<#--
jsonPid(必须):json数据中关联的父ID,如:categoryCategoryId -->
<#--
jsonName(必须):json数据中需要显示的数据名称,如:categoryTitle -->
<#--
tmplBefored是否插入节点图标之前 false不插入, true插入-->
<#--
#befored$
{
treeId
}
在节点图标之前需要插入列表属性,如果要使用必须tmplBefored="true"-->
<#--
#after$
{
treeId
}
(必须) 在节点图标之后需要插入列表属性-->
<#--
该结构中调用方法简略说明,如果需要其他更改,请添加方法:
clickDome$
{
treeId
}
,展开节点|关闭节点
getChilds$
{
treeId
}
,获取当前点击的子节点
removeChilds$
{
treeId
}
,/移除点击节点的所有子节点
-->
<#
macro
treeTable tbodyId="" treeId="" json="" jsonId="" jsonPid="" jsonName="" style="" tmplBefored="false">
<ul class="ztreeTable" id="treeDome$
{
treeId
}
" style="display:none">
</ul>
<!-- 列表HTML模版开始 -->
<script id="treeTableTmpl$
{
treeId
}
" type="text/x-jquery-tmpl">
<tr data-id="
{{
=
$
{
jsonId
}}}
" id="columnTitle
{{
=
$
{
jsonId
}}}
" >
<td>
{{
=
$
{
jsonId
}}}
</td>
<#if tmplBefored== "true" >
{{
tmpl
(
$data
)
'#
befored
$
{
treeId
}
'
}}
</#if>
<td>
<a class="btn btn-xs red tooltips switch-list columnTitle" data-id="
{{
=
$
{
jsonId
}}}
" onclick="clickDome$
{
treeId
}
(this)" data-parentId="
{{
=
$
{
jsonPid
}}}
" data-toggle="tooltip" data-original-title="查看子节点">
<i class="glyphicon glyphicon-folder-close"></i>
</a>
{{
=
$
{
jsonName
}}}
</td>
{{
tmpl
(
$data
)
'#
after
$
{
treeId
}
'
}}
</tr>
</script>
<!--
列表HTML模版结束 -->
<!--
js操作方法开始 -->
<script>
var zTreeObj$
{
treeId
}
; //zTree内部函数对象变量,主要用户调用zTree内部方法
//初始化树形结构
var setting$
{
treeId
}
=
{
data
:
{
//控制显示数据
simpleData
:
{
enable
:
true
,
//是否采用简单数据模式
(
A
rray
)
idKey
:
"${jsonId}"
,
//节点
ID
名称
pIdKey
:
"${jsonPid}"
,
//父节点
ID
名称
},
key
:{
name
:
"${jsonName}"
,
//节点数据保存节点名称的属性名称。
}
},
}
;
$(function()
{
//初始化树形数据
var
zNodes
$
{
treeId
}
=
$
{
json
?
default
(
'[]'
)}
;
//加载树形
$
.fn.zTree.init
(
$
(
"#treeDome${treeId}"
),
setting
$
{
treeId
},
zNodes
$
{
treeId
})
;
//
zTree
内部函数对象
,
主要用户调用
zTree
内部方法
zTreeObj
$
{
treeId
}
=
$
.fn.zTree.getZTreeObj
(
"treeDome${treeId}"
)
;
//获取
zTree
中的数据对象
var
zTreeList
=
zTreeObj
$
{
treeId
}
.getNodes
()
;
//将内容委派到其中
$
(
"#treeTableTmpl${treeId}"
)
.tmpl
(
zTreeList
)
.appendTo
(
"#${tbodyId}"
)
;
}
);
//展开节点|关闭节点
function clickDome$
{
treeId
}
(obj)
{
var
columnId
=
$
(
obj
)
.attr
(
"data-id"
)
;//当前点击的节点
var
booleanBeging
=
true
;
//用来处理是否展开/关闭节点
$
(
".columnTitle"
)
.each
(
function
(){
//判断是否存在子节点
if
(
$
(
this
)
.attr
(
"data-parentId"
)
==
columnId
){
booleanBeging
=
false
;
return
false
;
}
})
;
//判断节点文件夹关闭图标是否存在,存在则显示打开的文件夹图标
if
(
$
(
obj
)
.find
(
".glyphicon"
)
.hasClass
(
"glyphicon-folder-close"
)){
$
(
obj
)
.find
(
".glyphicon"
)
.removeClass
(
"glyphicon-folder-close"
)
;
$
(
obj
)
.find
(
".glyphicon"
)
.addClass
(
"glyphicon-folder-open"
)
;
}
else
if
(
$
(
obj
)
.find
(
".glyphicon"
)
.hasClass
(
"glyphicon-folder-open"
)){
//判断节点文件夹打开图标是否存在,存在则显示关闭的文件夹图标
$
(
obj
)
.find
(
".glyphicon"
)
.removeClass
(
"glyphicon-folder-open"
)
$
(
obj
)
.find
(
".glyphicon"
)
.addClass
(
"glyphicon-folder-close"
)
;
}
if
(
booleanBeging
==
true
){
getChilds
$
{
treeId
}(
columnId
)
;//获取当前点击的子节点
}
else
{
removeChilds
$
{
treeId
}(
columnId
)
;//移除点击节点的子节点
}
}
//获取当前点击的子节点
function getChilds$
{
treeId
}
(jsonId)
{
//拿到所有节点,比对该节点内是否存在父节点
id
跟当前点击节点
id
一致,累加到数组内容,循环完毕后委派到
html
内
var
rootNodes
=
zTreeObj
$
{
treeId
}
.getNodes
()
;
//获取根节点
var
allNodes
=
zTreeObj
$
{
treeId
}
.transformToArray
(
rootNodes
)
;
//很据跟节点获取所有节点
var
selectNodes
;
//选中的节点
var
arrayNodes
=
new
A
rray
()
;
//需要委派的节点
for
(
var
i
=
0
;
i
<
allNodes
.length
;
i
++
){
//将所有节点选中
zTreeObj
$
{
treeId
}
.selectNode
(
allNodes
[
i
]
,
true
)
;
}
selectNodes
=
zTreeObj
$
{
treeId
}
.getSelectedNodes
()
;
for
(
var
j
=
0
;
j
<
selectNodes
.length
;
j
++
){
//判断是否是当前点击的节点的子节点
if
(
selectNodes
[
j
].$
{
jsonPid
}
==
jsonId
){
arrayNodes
.push
(
selectNodes
[
j
]
)
;
}
}
$
(
"#treeTableTmpl${treeId}"
)
.tmpl
(
arrayNodes
)
.insertAfter
(
"#columnTitle"
+
jsonId
)
;
//文字首行缩进
$
(
".columnTitle"
)
.each
(
function
(){
var
id
=
$
(
this
)
.attr
(
"data-id"
)
;
var
curChilds
=
zTreeObj
$
{
treeId
}
.getNodesByParam
(
"${jsonId}"
,
id
,
null
)
;
var
indent
=
curChilds
[
0
]
.level;
$
(
this
)
.parents
(
"td"
)
.css
(
"text-indent"
,(
indent
*
5
)
+
"px"
)
;
})
;
}
//移除点击节点的子节点
function removeChilds$
{
treeId
}
(jsonId)
{
$
(
".columnTitle"
)
.each
(
function
(){
if
(
$
(
this
)
.attr
(
"data-parentId"
)
==
jsonId
){
removeChilds
$
{
treeId
}(
$
(
this
)
.attr
(
"data-id"
))
;
$
(
"#columnTitle"
+$
(
this
)
.attr
(
"data-id"
))
.detach
()
;
}
})
;
}
</script>
<!--
js操作方法结束 -->
</#
macro
>
src/main/webapp/WEB-INF/manager/include/ui/upload.ftl
0 → 100644
View file @
da21280b
<#--上传控件-->
<#--上传控件-->
<#-
-path
:上传路径,文件夹是在
ms
属性配置文件里面配置,会自动增加当前
appId--
>
<#-
-uploadFloderPath
:如果
path
路径无法满足可以使用这个参数重新定义上传路径-->
<#-
-inputName
:
name
值-->
<#-
-filetype
:上传规则-->
<#-
-size
:上传数量-->
<#-
-msg
:提示信息-->
<#-
-imgs
:默认显示的图片-->
<#-
-maxSize
:默认文件大小
单位m-->
<#--如果是反复显示图片需要调用
showImgs
(
imgs
地址可以包含"|"符合,
input
的名称)-->
<#
macro
uploadImg path inputName size="1" uploadFloderPath="" filetype="
*
.jpg;
*
.png;
*
.gif;
*
.bmp;
*
.jpeg" msg="" imgs="" maxSize="1">
<div id="ms__uploadPic_$
{
inputName
}
">
<style>
.msUploadImgs
{
margin
:
0;padding: 0;list-style: none;
}
.msUploadImgs
li
{
list-style
:
none
;
float
:
left
;
text-align
:
center
;
border
:
1
px
solid
#
F
3
F
3
F
3
;
margin
:
8
px
;
width
:
100
px
;
}
.msUploadImgs
img
{
width
:
100
%;
height
:
100
px
;
}
.msUploadImgs
li span
{
cursor
:
pointer
;
}
.divUploader
{
clear
:
both
}
</style>
<ul class="msUploadImgs">
<#if imgs!="">
<#list imgs?split("|") as img>
<#if img!="">
<li id="SWFUpload_9_$
{
img_index
}
">
<div class="displayimg">
<img src="$
{
basePath
}
/$
{
img
}
">
</div>
<span class="front-cover" onclick="removePreview$
{
inputName
}
(this,'$
{
img
}
'+'|')"><a class="btn btn-xs red tooltips " data-original-title="点击删除图片"><i class="glyphicon glyphicon-trash"></i></a>
</span>
</li>
</#if>
</#list>
</#if>
</ul>
<div class="divUploader"><input type="button" id="up_file_$
{
inputName
}
" />
<#if msg!="">
<div class="alert alert-warning alert-dismissable">$
{
msg
}
</div>
</#if>
</div>
<input type="hidden" size="100" name="$
{
inputName
}
" id="$
{
inputName
}
" value="$
{
imgs
?
default
(
''
)}
" />
</div>
<script type="text/javascript">
$(function ()
{
$
(
'#
ms__uploadPic_
$
{
inputName
}
'
)
.swfupload
({
upload_url
:
"${basePath}/file/upload.do"
,
post_params
:{
"uploadPath"
:
"${path}"
,
"uploadFloderPath"
:
"${uploadFloderPath}"
,
"isRename"
:
"true"
,
"maxSize"
:
"${maxSize}"
,
"allowedFile"
:
"${filetype}"
,
"allowedFile"
:
""
},
file_size_limit
:
$
{
maxSize
?
default
(
"1"
)}
*
1024
,
file_types
:
"${filetype?default("
*
.jpg
;
*
.png
;
*
.gif
;
*
.bmp
;
*
.jpeg
")}"
,
file_types_description
:
"Image files"
,
file_upload_limit
:
$
{
size
?
default
(
"5"
)},
flash_url
:
"${basePath}/static/plugins/jquery.swfupload/1.0.0/swfupload.swf"
,
button_image_url
:
static
+
"/plugins/jquery.swfupload/1.0.0/button.png"
,
button_width
:
92
,
button_height
:
34
,
button_placeholder
:
$
(
'#
up_file_
$
{
inputName
}
'
)[
0
]
,
debug
:
false
})
.bind
(
'
fileQueued
'
,
function
(
event
,
file
)
{
if
(
$
(
"#ms__uploadPic_${inputName} .msUploadImgs"
)
.children
()
.length
>=$
{
size
?
default
(
"5"
)})
{
$
(
this
)
.swfupload
(
'
cancelUpload
'
)
;
<@
ms
.notify
msg
=
"最多上传${size}个文件!"
type
=
"warning"
/>
}
else
{
var
listitem
=
'<
li
id
=
"' + file.id + '"
><
div
class
=
"displayimg"
><
img
src
=
"'+static+'/plugins/jquery.swfupload/1.0.0/load.gif"
/></
div
><
span
class
=
"front-cover"
>
0
%</
span
></
li
>';
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
'
)
.append
(
listitem
)
;
$
(
this
)
.swfupload
(
'
startUpload
'
)
;
}
})
.bind
(
'
fileQueueError
'
,
function
(
event
,
file
,
errorCode
,
message
)
{
if
(
errorCode
==
-130
)
{
<@
ms
.notify
msg
=
"文件类型错误!"
type
=
"warning"
/>
}
else
if
(
errorCode
==
-100
)
{
<@
ms
.notify
msg
=
"最多上传${size}个文件!"
type
=
"warning"
/>
}
else
{
<@
ms
.notify
msg
=
"上传图片过多或上传图片过大!"
type
=
"warning"
/>
}
})
.bind
(
'
uploadStart
'
,
function
(
event
,
file
)
{
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
file
.id
)
.find
(
'
span
.front-cover
'
)
.text
(
'
0
%'
)
;
})
.bind
(
'
uploadProgress
'
,
function
(
event
,
file
,
bytesLoaded
)
{
var
percentage
=
M
ath
.round
((
bytesLoaded
/
file
.size
)
*
100
)
;
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
file
.id
)
.find
(
'
span
.front-cover
'
)
.text
(
percentage
+
'%'
)
;
})
.bind
(
'
uploadSuccess
'
,
function
(
event
,
file
,
serverData
)
{
var
item
=
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
file
.id
)
;
item
.find
(
'
div
.displayimg
'
)
.html
(
'<
img
src
=
"${basePath}/' + serverData + '"
/>'
)
;
item
.find
(
'
span
.front-cover
'
)
.html
(
'<
a
class
=
"btn btn-xs red tooltips "
data-original-title
=
"点击删除图片"
><
i
class
=
"glyphicon glyphicon-trash"
></
i
></
a
>'
)
;
if
(
$
(
'#$
{
inputName
}
'
)
.val
()
!=
""
){
$
(
'#$
{
inputName
}
'
)
.val
(
$
(
'#$
{
inputName
}
'
)
.val
()
+
"|"
+
serverData
)
}
else
{
$
(
'#$
{
inputName
}
'
)
.val
(
serverData
)
}
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
file
.id
+
'
span
.front-cover
'
)
.bind
(
'
click
'
,
function
()
{
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
file
.id
+
''
)
.slideUp
(
'
fast
'
)
;
var
swfu
=
$
.swfupload.getInstance
(
'#
ms__uploadPic_
$
{
inputName
}
'
)
;
var
stats
=
swfu
.getStats
()
;
stats
.successful_uploads--
;
swfu
.setStats
(
stats
)
;
//判断保存图片的输入框中是否存在
"|"
如果存在则表示图片至少要两张
if
(
$
(
'#$
{
inputName
}
'
)
.val
()
.indexOf
(
"|"
)
<
0
)
{
$
(
'#$
{
inputName
}
'
)
.val
(
$
(
'#$
{
inputName
}
'
)
.val
()
.replace
(
serverData
,
""
))
;
}
else
{
$
(
'#$
{
inputName
}
'
)
.val
(
$
(
'#$
{
inputName
}
'
)
.val
()
.replace
(
serverData
+
"|"
,
""
))
;
}
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
file
.id
)
.remove
()
;
setInputValue
$
{
inputName
}()
;
})
;
})
.bind
(
'
uploadComplete
'
,
function
(
event
,
file
)
{
$
(
this
)
.swfupload
(
'
startUpload
'
)
;
})
}
);
// 设置文本框的值 用于提交数据
function setInputValue$
{
inputName
}
()
{
var
value
=
""
;
//
设置文本的值
$
(
"#ms__uploadPic_${inputName}"
)
.find
(
"ul li .displayimg img"
)
.each
(
function
(){
var
src
=
$
(
this
)
.attr
(
'
src
'
)
.replace
(
'$
{
basePath
}
/'
,
''
)
;
value
+=
src
+
'|';
})
;
//
删除最后一个
"|"
if
(
value
){
value
=
value
.slice
(
0
,
-1
)
;
}
$
(
'#$
{
inputName
}
'
)
.val
(
value
)
;
}
function removePreview$
{
inputName
}
(uid,imgPath)
{
var
swfu
=
$
.swfupload.getInstance
(
'#
ms__uploadPic_
$
{
inputName
}
'
)
;
var
stats
=
swfu
.getStats
()
;
stats
.successful_uploads--
;
swfu
.setStats
(
stats
)
;
//
imgPath
=
imgPath
.replace
(
"|"
,
""
)
//判断保存图片的输入框中是否存在
"|"
如果存在则表示图片至少要两张
//
if
(
$
(
'#$
{
inputName
}
'
)
.val
()
.indexOf
(
"|"
)
<
0
)
{
//$
(
'#$
{
inputName
}
'
)
.val
(
$
(
'#$
{
inputName
}
'
)
.val
()
.replace
(
imgPath
,
""
))
;
//
}
else
{
//$
(
'#$
{
inputName
}
'
)
.val
(
$
(
'#$
{
inputName
}
'
)
.val
()
.replace
(
imgPath
+
"|"
,
""
))
;
//
}
//
var
obj
=$
(
"#ms__uploadPic_${inputName}"
)
.find
(
"ul li:last"
)
;
//
var
imgSrcPath
=
obj
.find
(
".displayimg img"
)
.attr
(
"src"
)
.replace
(
"${basePath}/"
,
""
)
;
//判断是否删除的是最后一张
,
如果是则删除时不含
"|"
//
if
(
imgSrcPath
==
imgPath
.replace
(
"|"
,
""
)){
//$
(
'#$
{
inputName
}
'
)
.val
(
$
(
'#$
{
inputName
}
'
)
.val
()
.replace
(
"|"
+
imgPath
.replace
(
"|"
,
""
),
""
))
;
//
}
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
uid
.parentNode.id
)
.slideUp
(
'
fast
'
,
function
()
{
$
(
this
)
.remove
()
;
setInputValue
$
{
inputName
}()
;
})
;
}
/
**
*
提供给弹窗显示图片使用
*
/
function showImgs$
{
inputName
}
(imgs,inputName)
{
//
var
swfu
=
$
.swfupload.getInstance
(
'#
ms__uploadPic_
'+
inputName
)
;
//
var
stats
=
swfu
.getStats
()
;
$
(
".msUploadImgs"
)
.children
()
.remove
()
;
if
(
imgs
)
{
var
_
imgs
=
imgs
.split
(
"
\|
"
)
;
for
(
i
=
0
;
i
<_
imgs
.length
;
i
++
)
{
if
(
_
imgs
[
i
]!=
""
)
{
var
imgLi
=
'<
li
id
=
"SWFUpload_9_'+i+'"
>';
imgLi
+='<
div
class
=
"displayimg"
>';
imgLi
+='<
img
src
=
"${basePath}/'+_imgs[i]+'"
>';
imgLi
+='</
div
>';
imgLi
+='<
span
class
=
"front-cover"
onclick
=
"removePreview${inputName}(this,
\'
'+_imgs[i]+'
\'
+'|')"
><
a
class
=
"btn btn-xs red tooltips "
data-original-title
=
"点击删除图片"
><
i
class
=
"glyphicon glyphicon-trash"
></
i
></
a
>';
imgLi
+='</
span
>';
imgLi
+='</
li
>';
$
(
".msUploadImgs"
)
.append
(
imgLi
)
;;
//
stats
.successful_uploads
++;
//
swfu
.setStats
(
stats
)
;
}
}
}
}
</script>
</#
macro
>
<#--上传控件-->
<#-
-path
:上传路径,文件夹是在
ms
属性配置文件里面配置,会自动增加当前
appId--
>
<#-
-uploadFloderPath
:如果
path
路径无法满足可以使用这个参数重新定义上传路径-->
<#-
-inputName
:
name
值-->
<#-
-filetype
:上传规则-->
<#-
-size
:上传数量-->
<#-
-msg
:提示信息-->
<#-
-callBack
:回调提示信息-->
<#-
-isRename
:是否重命名
true
:将使用时间命名,否则使用上传是文件名,可能会出现同名称覆盖的问题,中文也会存在问题-->
<#-
-maxSize
:默认文件大小
单位m-->
<#
macro
uploadFile path inputName uploadFloderPath="" size=1 filetype="
*
.zip,
*
.rar,
*
.doc,
*
.xls,
*
.doc,
*
.txt,
*
.pdf" msg="" maxSize="10" callBack="" isRename=false>
<div id="ms__uploadPic_$
{
inputName
}
">
<div class="divUploader"><input type="button" id="up_file_$
{
inputName
}
" />
<#if msg!="">
<div class="alert alert-warning alert-dismissable">$
{
msg
}
</div>
</#if>
</div>
<input type="hidden" size="100" name="$
{
inputName
}
" id="$
{
inputName
}
" value="$
{
imgs
?
default
(
''
)}
" />
</div>
<script type="text/javascript">
$(function ()
{
$
(
'#
ms__uploadPic_
$
{
inputName
}
'
)
.swfupload
({
upload_url
:
"${basePath}/file/upload.do"
,
post_params
:{
"uploadPath"
:
"/${path}"
,
"uploadFloderPath"
:
"${uploadFloderPath}"
,
"isRename"
:
"${isRename?default("
true
")}"
,
"maxSize"
:
"${maxSize}"
,
"allowedFile"
:
"${filetype}"
,
"allowedFile"
:
""
},
file_size_limit
:
$
{
maxSize
?
default
(
"1"
)}
*
1024
,
file_types
:
"${filetype?default("
*
.jpg
;
*
.png
;
*
.gif
;
*
.bmp
;
*
.jpeg
;
*
.zip
;
*
.rar
")}"
,
file_upload_limit
:
$
{
size
?
default
(
"5"
)},
flash_url
:
"${basePath}/static/plugins/jquery.swfupload/1.0.0/swfupload.swf"
,
button_image_url
:
static
+
"/plugins/jquery.swfupload/1.0.0/button_file.png"
,
button_width
:
92
,
button_height
:
34
,
button_placeholder
:
$
(
'#
up_file_
$
{
inputName
}
'
)[
0
]
,
debug
:
false
})
.bind
(
'
fileQueued
'
,
function
(
event
,
file
)
{
if
(
$
(
"#ms__uploadPic_${inputName} .msUploadImgs"
)
.children
()
.length
>=$
{
size
?
default
(
"5"
)})
{
$
(
this
)
.swfupload
(
'
cancelUpload
'
)
;
<@
ms
.notify
msg
=
"上传图片过多或上传图片过大!"
type
=
"warning"
/>
}
else
{
$
(
this
)
.swfupload
(
'
startUpload
'
)
;
}
})
.bind
(
'
fileQueueError
'
,
function
(
event
,
file
,
errorCode
,
message
)
{
if
(
errorCode
==
-130
)
{
<@
ms
.notify
msg
=
"文件类型错误!"
type
=
"warning"
/>
}
else
if
(
errorCode
==
-100
)
{
<@
ms
.notify
msg
=
"最多上传${size}个文件!"
type
=
"warning"
/>
}
else
{
//
alert
(
errorCode
+'上传图片过多或上传图片过大!'
)
;
<@
ms
.notify
msg
=
"上传文件过大!"
type
=
"warning"
/>
}
<#
if
callBack
!=
""
>
eval
(
"${callBack}(errorCode)"
)
;
</#
if
>
})
.bind
(
'
uploadStart
'
,
function
(
event
,
file
)
{
$
(
'#
ms__uploadPic_
$
{
inputName
}
ul
li
#'
+
file
.id
)
.find
(
'
span
.front-cover
'
)
.text
(
'
0
%'
)
;
})
.bind
(
'
uploadProgress
'
,
function
(
event
,
file
,
bytesLoaded
)
{
var
percentage
=
M
ath
.round
((
bytesLoaded
/
file
.size
)
*
100
)
;
})
.bind
(
'
uploadSuccess
'
,
function
(
event
,
file
,
serverData
)
{
$
(
'#$
{
inputName
}
'
)
.val
(
serverData
)
;
<#
if
callBack
!=
""
>
eval
(
"${callBack}(serverData)"
)
;
<#
else
>
<@
ms
.notify
msg
=
"上传成功"
type
=
"success"
/>
</#
if
>
})
.bind
(
'
uploadComplete
'
,
function
(
event
,
file
)
{
$
(
this
)
.swfupload
(
'
startUpload
'
)
;
})
}
);
</script>
</#
macro
>
<#--
plupload 图片上传组件 -->
<#--
path 图片上传地址-->
<#--
triggerBtnId 触发上传对话框的dom元素id-->
<#--
imgId 放置图片的的标签id 为空的话不显示 -->
<#--
container 用来指定Plupload所创建的html结构的父容器,默认为前面指定的browse_button的父元素。该参数的值可以是一个元素的id,也可以是DOM元素本身。-->
<#--
filetype 图片文件类型用 , 隔开-->
<#--
maxSize 文件最大值 单位 M-->
<#
macro
pluploadImg path triggerBtnId imgId="" filetype="
*
.jpg;
*
.png;
*
.gif;
*
.bmp;
*
.jpeg" maxSize="1" callback="" isRename=true>
<#
assign
onlyId = triggerBtnId />
<script type="text/javascript">
var ms__uploader_$
{
onlyId
}
= new plupload.Uploader(
{
runtimes
:
'
html5
'
,
browse_button
:
'$
{
triggerBtnId
}
'
,
url
:
"${basePath}/upload"
,
//
接收上传请求的
servlet
地址
multi_selection
:
false
,
//
只能选择
1
个文件
filters
:
{
max_file_size
:
'$
{
maxSize
}
mb
'
,
mime_types
:
[
{
title
:
"ImageFiles"
,
extensions
:
"jpg,gif,png,bmp,jpeg"
}
]
},
//
上传服务器数据
post
multipart_params
:
{
"uploadPath"
:
"/${path}"
,
"isRename"
:
"${isRename?default("
true
")}"
,
"maxSize"
:
$
{
maxSize
},
"allowedFile"
:
"${filetype?default('*.jpg;*.png;*.gif;*.bmp;*.jpeg')}"
}
}
);
//在实例对象上调用init()方法进行初始化
ms__uploader_$
{
onlyId
}
.init();
// 初始化方法
ms__uploader_$
{
onlyId
}
.bind('Init', function(loader)
{
}
);
// 用户添加文件, 开始的时候立即添加
ms__uploader_$
{
onlyId
}
.bind('FilesAdded', function(up, files)
{
uploader
.start
()
;
}
);
// 队列中所有文件被上传完
ms__uploader_$
{
onlyId
}
.bind('UploadComplete', function(up, file)
{
}
);
// 当一个文件开始上传的时候触发
ms__uploader_$
{
onlyId
}
.bind('UploadFile', function(up, file)
{
}
);
// 文件上传成功的时候触发
ms__uploader_$
{
onlyId
}
.bind('FileUploaded', function(uploader, file, result)
{
if
(
result
.status
==
200
){
//
图片的服务器路径
var
imgUrl
=
result
.response
;
$
(
'#$
{
imgId
}
'
)
.attr
(
'
src
'
,
'$
{
basePath
}
/'
+
imgUrl
)
;
}
else
{
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
success
'
,
message
:
{
text
:
'上传失败,请求返回码
:
'
+
result
.status
}
})
.show
()
;
}
<#
if
callback
!=
""
>
eval
(
"${callBack}(result)"
)
;
</#
if
>
}
);
</
script
>
</#
macro
>
src/main/webapp/WEB-INF/manager/index.ftl
0 → 100644
View file @
da21280b
<!
DOCTYPE
html>
<
html
lang="zh">
<
head
>
<
title
><#
if
app?has_content>$
{
app
.basicTitle
}
<#else>MS</#if>管理系统</title>
<
link
rel="bookmark" href="favicon.ico"/>
<#
include
"$
{
managerViewPath
}
/include/macro.ftl"/>
<#
include
"$
{
managerViewPath
}
/include/meta.ftl"/>
<
script
src="http://cdn.mingsoft.net/model/4.6.0/ms.mstore.client.min.js"></script>
</
head
>
<
script
type="text/javascript">
$(function()
{
var
menuJson
=$
{
modelList
}
;
$
(
'
.dropdown-toggle
'
)
.dropdown
()
;
//加载头部菜单
manager
.topMenu.initMenu
(
menuJson
)
;
//点击头部菜单从左侧显示当前菜单子菜单
$
(
".ms-menu-list"
)
.delegate
(
".ms-menu-detail"
,
"click"
,
function
(){
manager
.topMenu.showChildMenu
(
$
(
this
),
menuJson
)
;
})
;
//获取管理员帐号
$
(
"#editLoginPassword"
)
.click
(
function
()
{
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
"${managerPath}/editPassword.do"
,
success
:
function
(
msg
){
var
json
=
JSON
.parse
(
msg
.resultMsg
)
;
$
(
".editLoginPassword input[name='managerName']"
)
.val
(
json
)
;
//$
(
".editLoginPassword"
)
.modal
()
;
}
})
;
})
;
//修改密码
$
(
"#editLoginPasswordButton"
)
.click
(
function
()
{
var
vobj
=
$
(
"#updatePasswordFrom"
)
.data
(
'
bootstrapValidator
'
)
.validate
()
;
if
(
vobj
.isValid
()){
$
(
this
)
.postForm
(
"#updatePasswordFrom"
,{
func
:
function
(
data
)
{
if
(
data
.result
){
alert
(
"密码修改成功!"
)
;
location
.reload
()
;
}
else
{
alert
(
data
.resultMsg
)
;
}
}})
;
}
else
{
alert
(
"表单验证失败"
)
;
}
})
;
//退出系统
$
(
"#loginOutBtn"
)
.click
(
function
()
{
//$
(
this
)
.request
({
func
:
function
(
data
)
{
//
location
.reload
()
;
//
}})
;
window
.location.href
=
"${managerPath}/logout"
})
;
$
(
".ms-menu-child li a"
)
.each
(
function
()
{
var
tag
=
"?"
;
if
(
$
(
this
)
.data
(
"url"
)
.indexOf
(
"?"
)
>
0
)
{
tag
=
"&"
;
}
$
(
this
)
.data
(
"url"
,
"${managerPath}/"
+$
(
this
)
.data
(
"url"
)
+
tag
+
"modelId="
+$
(
this
)
.data
(
"id"
)
+
"&modelTitle="
+
encodeURI
(
$
(
this
)
.data
(
"title"
)))
;
})
;
}
);
</
script
>
<
body
class="over-hide theme-index" >
<!--顶部开始 -->
<div class="ms-top">
<!--头部LOGO-->
<div class="ms-top-logo">
<img src="$
{
skin_manager_logo
}
"/>
<!--span class="slideMenu">
<span class="icon iconfont icon-open"></span>
<span class="icon iconfont icon-close" style="display: none;"></span>
</span-->
</div>
<!--头部一级菜单-->
<div class="ms-top-menu">
<div class="menu-default">
<#noparse>
<script id="ms-menu-list-tmpl" type="text/x-jquery-tmpl">
{{
if
modelModelId
==
0
}}
<li data-model-id="$
{
modelId
}
" data-model-icon="$
{
modelIcon
}
" class="ms-menu-detail">$
{
modelTitle
}
</li>
{{
/
if
}}
</script>
</#noparse>
<ul class="ms-menu-list">
</ul>
<span class="glyphicon glyphicon-menu-hamburger openMenu"></span>
</div>
</div>
<!--头部用户信息/进入MStore-->
<div class="ms-top-user">
<div class="dropdown">
<div id="dLabel" class="ms-top-info" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-user"></span>
$
{
S
ession
.manager_session.managerName
}
<span class="caret"></span>
</div>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li role="presentation" data-toggle="modal" data-target="#editLoginPassword">
<a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-cog"></span> 修改密码</a>
</li>
<li role="presentation" data-toggle="modal" data-target="#loginOut">
<a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-off"></span> 退出</a>
</li>
</ul>
</div>
<div class="ms-top-mstore" data-toggle="tooltip" data-placement="bottom" title="点击进入Mstore">
<span class="glyphicon glyphicon-th-large animated"></span>
<span class="mstore-update"></span>
</div>
</div>
</div>
<#noparse>
<script id="ms-menu-tmpl" type="text/x-jquery-tmpl">
{{
if
modelModelId
==
0
}}
<div class="ms-menu-parent" data-model-id="$
{
modelId
}
">
<div class="ms-menu-parent-header ms-menu-parent-active">
<div class="ms-menu-parent-title" data-flag="true">
<i class="icon iconfont icon-logo">$
{
modelIcon
}
</i>
$
{
modelTitle
}
</div>
<span class="closeMenu">×</span>
</div>
<ul class="ms-menu-child child-list$
{
modelId
}
" id="tab-tools">
</ul>
</div>
{{
/
if
}}
</script>
<script id="ms-menu-child-tmpl" type="text/x-jquery-tmpl">
<li><a style="cursor: pointer;" data-title='$
{
modelTitle
}
' data-url='$
{
modelUrl
}
' data-id='$
{
modelId
}
'><!--span class="caret"></span-->$
{
modelTitle
}
</a></li>
</script>
</#noparse>
<!--左边菜单开始-->
<div class="ms-menu-div">
<div class="slideMenu">
<span class="icon iconfont icon-open"></span>
<span class="icon iconfont icon-close" style="display: none;"></span>
</div>
</div>
<div class="ms-menu">
<div class="ms-menu-none"></div>
<!--span class="slideMenu glyphicon glyphicon-tasks"></span-->
</div>
<!--左边菜单结束-->
<!--右边开始-->
<div class="ms-content">
<div class="wellcome">
<h2>欢迎进入MS系统</h2>
<p>欢迎加群: 221335098 或到
<a href="http://ms.mingsoft.net/mbbs/main.do" target="_blank" style="text-decoration: none;">官方论坛进行技术交流</a>
</p>
</div>
<div class="easyui-tabs">
</div>
</div>
<!--右边结束-->
<!--修改登录密码模态框-->
<@ms.modal id="editLoginPassword" title="修改密码">
<@ms.modalBody>
<@ms.form isvalidation=true name="updatePasswordFrom" action="$
{
managerPath
}
/updatePassword.do">
<@ms.text name="managerName" width="280" label="账号:" title="managerName" value="" readonly="readonly" validation=
{
"required"
:
"true"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.password width="280" name="oldManagerPassword" label="旧密码:" title="managerPassword" validation=
{
"required"
:
"true"
,
"minlength"
:
"6"
,
"maxlength"
:
"20"
,
"data-bv-notempty-message"
:
"必填项目"
,
"data-bv-stringlength-message"
:
"6-20个字符以内!"
}
/>
<@ms.password width="280" name="newManagerPassword" label="新密码:" title="managerPassword" validation=
{
"required"
:
"true"
,
"minlength"
:
"6"
,
"maxlength"
:
"20"
,
"data-bv-notempty-message"
:
"必填项目"
,
"data-bv-stringlength-message"
:
"6-20个字符以内!"
}
/>
</@ms.form>
</@ms.modalBody>
<@ms.modalButton>
<@ms.savebutton value="更新密码" id="editLoginPasswordButton"/>
</@ms.modalButton>
</@ms.modal>
<@ms.modal id="loginOut" title="退出提示!">
<@ms.modalBody>
确认退出?
</@ms.modalBody>
<@ms.modalButton>
<@ms.button value="确认退出" id="loginOutBtn" url="$
{
managerPath
}
/loginOut.do"/>
</@ms.modalButton>
</@ms.modal>
</
body
>
</
html
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/login.ftl
0 → 100644
View file @
da21280b
<!
DOCTYPE
html>
<
html
lang="en">
<
head
>
<#
include
"$
{
managerViewPath
}
/include/meta.ftl"/>
<
title
><#
if
app?has_content>$
{
app
.appName
}
<#else>MS</#if>管理系统$
{
managerViewPath
}
</title>
<
link
rel="shortcut icon" href="$
{
static
}
/global/images/ms.ico"/>
<
link
rel="bookmark" href="$
{
static
}
/global/images/ms.icoo"/>
<
script
type="text/javascript" src="http://cdn.mingsoft.net/plugins/vue/2.3.3/vue.min.js"></script>
<
script
type="text/javascript" src="http://cdn.mingsoft.net/plugins/validator/5.5.0/validator.min.js"></script>
<
link
rel="stylesheet/less" type="text/css" href="$
{
static
}
/skin/manager/$
{
manager_ui
}
/less/login.less" media="all" />
<
script
type="text/javascript" src="http://cdn.mingsoft.net/plugins/less/2.5.3/less.min.js" ></script>
<
script
>
if(top.location != location)
{
top
.location.href
=
location
.href
;
}
</
script
>
</
head
>
<
style
>
.gray
{
background
:#92908
E
}
</
style
>
<
body
>
<#if app?has_content>
<div id="mcms-login">
<img src="$
{
static
}
/skin/manager/$
{
manager_ui
}
/images/pic.png" class="login-images login-float" />
<div class="login-form-container login-float">
<div class="login-title">
<span class="login-chinese-title">账号登录 /</span>
<span class="login-english-title">User login</span>
</div>
<div class="ms-login-error-text">
<img src="$
{
static
}
/skin/manager/$
{
manager_ui
}
/images/error.png" v-show="errorText != ''" />
<span v-text="errorText" v-show="errorText != ''"></span>
</div>
<form class="form-horizontal" id="loginForm" action="$
{
managerPath
}
/checkLogin.do">
<input type="text" maxlength="12" class="login-people-name" :class="
{
'
ms-error
'
:
error
==
'
peopleName
'
}
" id="managerName" name="managerName" @blur="checkPeopleName" @keyup="chanageBackgroundColor" placeholder="用户名" v-model="peopleName" />
<input type="password" maxlength="20" class="login-people-name" :class="
{
'
ms-error
'
:
error
==
'
peoplePassword
'
}
" id="managerPassword" name="managerPassword" @blur="checkPeoplePassword" @keyup="chanageBackgroundColor" placeholder="密码" v-model="peoplePassword" />
<div class="login-code">
<input type="text" onKeyUp ="value=value.replace(/[\W]/g,'')" maxlength="4" class="login-float login-code-input" :class="
{
'
ms-error
'
:
error
==
'
rand_code
'
}
" id="rand_code" name="rand_code" @blur="checkCode" @keyup="chanageBackgroundColor" placeholder="验证码" v-model="code" />
<img id="ms-login-code" class="login-code-img login-float" src="$
{
basePath
}
/code" @click="changeCode"/>
<p class="login-float login-code-text">
<span>看不清?</span><br/>
<spna class="login-code-change" @click="changeCode">换一张</span>
</p>
</div>
<p class="login-remmember-password">
<input id="remember" type="checkbox" name="" />
<label class="login-remember" for="remember">记住密码</label>
</p>
<div id="login-button" class="login-button" v-on:click="toLogin">登录</div>
</form>
</div>
</div>
<#else>
<div id="errorDisplay">
<img src="$
{
static
}
/skin/manager/$
{
manager_ui
}
/images/errorDisplay.png"/>
<div class="errorData">
<p >系统配置异常,请手动去掉WEB-INF/ms.install.bak文件的后缀.bak,再重启系统进入登录界面进行初始化</p>
</div>
<div>
</#if>
</body>
<script>
var loginForm = new Vue(
{
el
:
'#
mcms-login
'
,
data
:{
isRight
:
true
,
errorText
:
""
,
//错误提示
error
:
""
,
//输入框错误的显示
peopleName
:
""
,
//用户名输入框
peoplePassword
:
""
,
//密码输入框
code
:
""
,
//验证码
},
watch
:
{
peopleName
:
function
()
{
var
pattern
=
/[^\
w
\
u4E00-
\
u9FA5
]/
ig
;
if
(
!
validator
.isNull
(
this
.peopleName
)
&&
this
.peopleName.indexOf
(
" "
)
<
0
&&
validator
.isLength
(
this
.peopleName
,
{
min
:
6
,
max
:
20
})
&&
pattern
.test
(
this
.peopleName
)
==
false
&&
this
.error
==
'
peopleName
'
){
this
.errorText
=
""
;
this
.error
=
""
;
}
},
peoplePassword
:
function
()
{
if
(
!
validator
.isNull
(
this
.peoplePassword
)
&&
this
.peoplePassword.indexOf
(
" "
)
<
0
&&
validator
.isLength
(
this
.peoplePassword
,
{
min
:
6
,
max
:
20
})
&&
this
.error
==
'
peoplePassword
'
){
this
.errorText
=
""
;
this
.error
=
""
;
}
},
code
:
function
(){
if
(
!
validator
.isNull
(
this
.code
)
&&
this
.code.length
==
4
&&
this
.error
==
'
rand_code
'
){
this
.errorText
=
""
;
this
.error
=
""
;
}
}
},
mounted
:
function
()
{
var
_
this
=
this
;
//页面初始化时,如果帐号密码
cookie
存在则填充
if
(
$
.cookie
(
'
managerName
'
)
&&
$
.cookie
(
'
managerPassword
'
)){
_
this
.peopleName
=
$
.cookie
(
'
managerName
'
)
;
_
this
.peoplePassword
=
$
.cookie
(
'
managerPassword
'
)
;
$
(
"#remember"
)
.attr
(
"checked"
,
true
)
;
}
//检测浏览器版本
if
(
navigator
.userAgent.toLowerCase
()
.indexOf
(
"msie"
)
>
0
)
{
alert
(
"您当前的浏览器版本太低,建议使用IE8以上版本浏览器,推荐使用Chrome浏览器"
)
;
}
//
js
监听回车键
document
.onkeydown
=
function
(
e
)
{
e
=
e
?
e
:
window
.event
;
var
keyCode
=
e
.which
?
e
.which
:
e
.keyCode
;
if
(
keyCode
==
13
)
{
_
this
.login
()
;
}
}
},
methods
:{
//错误提示显示
errorShow
:
function
(
msg
,
type
){
this
.errorText
=
msg
;
this
.error
=
type
;
},
changeCode
:
function
(){
$
(
"#ms-login-code"
)
.attr
(
"src"
,
"${basePath}/code?t="
+
new
D
ate
()
.getTime
())
},
//判断用户名
checkPeopleName
:
function
(){
var
pattern
=
/[^\
w
\
u4E00-
\
u9FA5
]/
ig
;
if
(
validator
.isNull
(
this
.peopleName
)){
this
.errorShow
(
"用户名不能为空"
,
'
peopleName
'
)
;
this
.isRight
=
false
;
return
;
}
else
if
(
this
.peopleName.indexOf
(
" "
)
>=
0
)
{
this
.errorShow
(
"用户名不能包含空格"
,
'
peopleName
'
)
;
this
.isRight
=
false
;
return
;
}
else
if
(
!
validator
.isLength
(
this
.peopleName
,
{
min
:
3
,
max
:
12
})){
this
.errorShow
(
"用户名为3~12个字符"
,
'
peopleName
'
)
;
this
.isRight
=
false
;
return
;
}
else
if
(
pattern
.test
(
this
.peopleName
)){
this
.errorShow
(
"用户名不能包含特殊字符"
,
'
peopleName
'
)
;
this
.isRight
=
false
;
return
;
}
},
//判断密码
checkPeoplePassword
:
function
(){
if
(
validator
.isNull
(
this
.peoplePassword
)){
this
.errorShow
(
"密码不能为空"
,
'
peoplePassword
'
)
;
this
.isRight
=
false
;
return
;
}
else
if
(
!
validator
.isLength
(
this
.peoplePassword
,
{
min
:
6
,
max
:
20
})){
this
.errorShow
(
"密码长度在6~20位之间!"
,
'
peoplePassword
'
)
;
this
.isRight
=
false
;
return
;
}
else
if
(
this
.peoplePassword.indexOf
(
" "
)
>=
0
){
this
.errorShow
(
"密码是不能包含空格"
,
'
peoplePassword
'
)
;
this
.isRight
=
false
;
return
;
}
},
//判断验证码
checkCode
:
function
(){
if
(
validator
.isNull
(
this
.code
)){
this
.errorShow
(
"验证码不能为空"
,
'
rand_code
'
)
;
this
.isRight
=
false
;
return
;
}
else
if
(
this
.code.length
!=
4
){
this
.errorShow
(
"验证码为4位!"
,
'
rand_code
'
)
;
this
.isRight
=
false
;
return
;
}
},
//登录判断验证
checkLogin
:
function
(){
this
.checkPeoplePassword
()
;
this
.checkPeopleName
()
;
this
.checkCode
()
;
},
//验证登录数据
login
:
function
(){
loginForm
.checkLogin
()
;
if
(
this
.isRight
){
$
(
"#login-button"
)
.html
(
"正在登录"
)
;
$
(
"#login-button"
)
.attr
(
"style"
,
"pointer-events: none;"
)
;
$
(
this
)
.postForm
(
"#loginForm"
,{
loadingText
:
"正在登录中.."
,
func
:
function
(
data
)
{
if
(
data
.result
){
location
.href
=
base
+
"${baseManager}/index.do"
;
}
else
{
alert
(
data
.resultMsg
)
;
$
(
"#ms-login-code"
)
.attr
(
"src"
,
"${basePath}/code?t="
+
new
D
ate
()
.getTime
())
$
(
"#login-button"
)
.html
(
"登录"
)
;
$
(
"#login-button"
)
.attr
(
"style"
,
"pointer-events: auto;"
)
;
$
(
"#login-button"
)
.css
({
"background-color"
:
"#0099ff"
})
;
}
;
}})
;
}
else
{
this
.isRight
=
true
;
}
},
//删除
cookies
delCookies
:
function
(
names
){
for
(
i
=
0
;
i
<
names
.length
;
i
++
){
$
.cookie
(
names
[
i
]
,
null
,{
expires
:
-1
})
;
}
},
//删除并且修改
cookies
delAndSetCookies
:
function
(
names
,
values
,
date
){
this
.delCookies
(
names
)
;
for
(
i
=
0
;
i
<
values
.length
;
i
++
){
$
.cookie
(
names
[
i
]
,
values
[
i
]
,
{
expires
:
date
})
;
}
},
//改变登录按钮背景色
chanageBackgroundColor
:
function
(){
if
(
$
(
"#managerName"
)
.val
()
.length
>=
3
&& $
(
"#managerPassword"
)
.val
()
.length
>=
6
&&
$
(
"#rand_code"
)
.val
()
.length
==
4
){
$
(
"#login-button"
)
.css
({
"background-color"
:
"#0099ff"
})
;
}
else
{
$
(
"#login-button"
)
.css
({
"background-color"
:
"#eeeeee"
})
;
}
},
//点击登录方法
toLogin
:
function
(){
var
names
=
new
A
rray
(
'
managerName
'
,
'
managerPassword
'
)
;
var
values
=
new
A
rray
(
$
(
"#managerName"
)
.val
(),
$
(
"#managerPassword"
)
.val
())
;
if
(
$
(
"#remember"
)
.is
(
":checked"
)){
this
.delAndSetCookies
(
names
,
values
,
1
)
;
}
else
{
this
.delCookies
(
names
)
;
}
this
.login
()
;
}
}
}
)
</script>
</
html
>
src/main/webapp/WEB-INF/manager/main.ftl
0 → 100644
View file @
da21280b
<!
DOCTYPE
html>
<
html
lang="en">
<
head
>
<title>铭飞MCMS</title>
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<
style
>
body
{
height: 100%;
}
</
style
>
</
head
>
<
body
>
</
body
>
</
html
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/manager/manager.ftl
0 → 100644
View file @
da21280b
<!
DOCTYPE
html>
<
html
lang="en">
<
head
>
<#include "$
{
managerViewPath
}
/include/macro.ftl"/>
<#include "$
{
managerViewPath
}
/include/meta.ftl"/>
</
head
>
<
body
>
<@
ms
.content
>
<@ms.contentBody>
<@ms.contentNav title="管理员管理">
<@ms.panelNavBtnGroup>
<@ms.panelNavBtnAdd id="totalAdd" title=""/>
<@ms.panelNavBtnDel id="totalDelete"/>
</@ms.panelNavBtnGroup>
</@ms.contentNav >
<@ms.contentPanel>
<@ms.table head=['账号','昵称','密码','角色名称',"<th style='text-align:center'>添加时间</th>"] checkbox="checkbox">
<#if listManager?has_content>
<#list listManager as manager>
<tr>
<td style="text-align:center;width:10%;">
<#if manager.managerName != managerSession.managerName>
<input type="checkbox" name="checkbox" value="$
{
manager
.managerId
?
c
?
default
(
0
)}
">
</#if>
</td>
<td style="width:10%">
<#if manager.managerName != managerSession.managerName>
<a class="btn btn-xs tooltips updateModalBtn" data-toggle="tooltip" data-id="$
{
manager
.managerId
?
c
?
default
(
0
)}
" data-original-title="编辑">
$
{
manager
.managerName
?
default
(
"暂无"
)}
</a>
<#else>
$
{
manager
.managerName
?
default
(
"暂无"
)}
</#if>
</td>
<td style="width:10%">$
{
manager
.managerNickName
?
default
(
"暂无"
)}
</td>
<td style="width:25%">$
{
manager
.managerPassword
?
default
(
"暂无"
)}
</td>
<td style="width:10%" >$
{
manager
.roleName
?
default
(
"暂无"
)}
</td>
<td class="text-center">$
{
manager
.managerTime
?
string
(
"yyyy-MM-dd HH:mm:ss"
)}
</td>
</tr>
</#list>
<#else>
<tr>
<td colspan="5" class="text-left">
<@ms.nodata/>
</td>
</tr>
</#if>
</@ms.table>
<@showPage page=page/>
</@ms.contentPanel>
</@ms.contentBody>
<!--=================模态框部分开始=================-->
<!--修改/保存的模态框开始-->
<@ms.modal modalName="update" title="">
<@ms.modalBody height="250">
<@ms.form isvalidation=true name="updateManager" id="updateManager" action="">
<@ms.text name="managerName" label="账号" title="账号" maxlength="30" placeholder="请输入账号" validation=
{
"required"
:
"true"
,
"data-bv-notempty-message"
:
"账号不能为空"
}
/>
<@ms.text name="managerNickName" label="昵称" title="昵称" maxlength="30" placeholder="请输入昵称" validation=
{
"required"
:
"true"
,
"data-bv-notempty-message"
:
"昵称不能为空"
}
/>
<@ms.text name="managerPassword" label="密码" title="密码" maxlength="100" placeholder="请输入密码"/>
<@ms.select name="managerRoleID" label="选择角色" list=listRole id="orderStatus" listKey="roleId" listValue="roleName" value="" style="width:57%" validation=
{
"required"
:
"true"
,
"data-bv-notempty-message"
:
"角色不能为空"
}
/>
<input type="hidden" class="managerPeopleID" name="managerPeopleID" value="0"/>
<input type="hidden" class="oldManagerName" name="oldManagerName" value=""/>
</@ms.form>
</@ms.modalBody>
<@ms.modalButton>
<@ms.savebutton id="updateButton"/>
</@ms.modalButton>
</@ms.modal>
<!--修改/保存的模态框结束-->
<!--多选删除的模态框开始-->
<@ms.modal modalName="deleteAll" title="批量删除管理员">
<@ms.modalBody>
您确定删除您所勾选的管理员吗?
</@ms.modalBody>
<@ms.modalButton>
<@ms.button value="返回" id="closeDelete"/>
<@ms.button class="btn btn-danger" id="deleteButton" value="删除"/>
</@ms.modalButton>
</@ms.modal>
<!--多选删除的模态框结束-->
<!--单个删除的模态框开始-->
<@ms.modal modalName="deleteRadio" title="删除管理员">
<@ms.modalBody>
您确定删除您所勾选的管理员吗?
</@ms.modalBody>
<@ms.modalButton>
<@ms.button value="返回" id="closeRadio"/>
<@ms.button class="btn btn-danger" id="deleteRadio" value="删除"/>
</@ms.modalButton>
</@ms.modal>
<!--单个删除的模态框结束-->
<@ms.modal modalName="managerPageModel" title="主页面绑定">
<@ms.modalBody>
<@ms.form isvalidation=true name="managerPageForm" id="managerPageForm" class="form-inline" action="$
{
managerPath
}
/managerModelPage/save.do">
<@ms.text name="managerModelPageUrl" label="主界面地址:" title="主界面地址:" size="5" maxlength="30" placeholder="请输入主页面地址"/>
<@ms.select name="managerModelPageModelId" label="选择模块" list=listManager id="orderStatus" listKey="managerRoleID" listValue="roleName" value="" style="width:57%"/>
<input type="hidden" name="managerModelPagemanagerId">
</@ms.form>
</@ms.modalBody>
<@ms.modalButton>
<@ms.button value="返回" id="closeSaveUrl"/>
<@ms.savebutton id="saveUrl"/>
</@ms.modalButton>
</@ms.modal>
<!--=================模态框部分结束=================-->
</@ms.content>
<script>
var URL='';
//模态框的操作
$(function ()
{
$
(
"#totalAdd"
)
.click
(
function
(){
$
(
"#updateTitle"
)
.text
(
"新增管理员"
)
;
$
(
"#updateButton"
)
.text
(
"保存"
)
;
URL
=
"${managerPath}/manager/save.do"
;
$
(
".update"
)
.modal
()
;
})
;
$
(
"#closeUpdate"
)
.click
(
function
(){
$
(
".update"
)
.modal
(
"hide"
)
;
})
;
$
(
"#closeDelete"
)
.click
(
function
(){
$
(
".deleteAll"
)
.modal
(
"hide"
)
;
})
;
$
(
"#closeRadio"
)
.click
(
function
(){
$
(
".deleteRadio"
)
.modal
(
"hide"
)
;
})
;
$
(
"#closeSaveUrl"
)
.click
(
function
(){
$
(
".managerPageModel"
)
.modal
(
"hide"
)
;
})
;
}
);
//全选
$("#allCheck").on("click",function()
{
if
(
this
.checked
){
$
(
"input[name='checkbox']"
)
.each
(
function
(){
this
.checked
=
true
;
})
;
}
else
{
$
(
"input[name='checkbox']"
)
.each
(
function
(){
this
.checked
=
false
;
})
;
}
}
);
//点击更新按钮
$("#updateButton").click(function()
{
var
formData
=
$
(
"#updateManager"
)
.serialize
()
;
var
vobj
=
$
(
"#updateManager"
)
.data
(
'
bootstrapValidator
'
)
.validate
()
;
var
buttonHtml
=
$
(
"#updateButton"
)
.html
()
;
if
(
vobj
.isValid
()){
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
URL
,
data
:
formData
,
beforeSend
:
function
(){
$
(
"#updateButton"
)
.text
(
$
(
"#updateButton"
)
.text
()
+
"中"
)
;
$
(
"#updateButton"
)
.attr
(
"disabled"
,
true
)
;
},
success
:
function
(
msg
){
if
(
msg
.result
==
true
){
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
success
'
,
message
:
{
text
:
buttonHtml
+
"成功"
}
})
.show
()
;
location
.reload
()
;
}
else
{
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
warning
'
,
message
:
{
text
:
msg
.resultMsg
}
})
.show
()
;
$
(
"#updateButton"
)
.text
(
buttonHtml
)
;
$
(
"#updateButton"
)
.attr
(
"disabled"
,
false
)
;
}
},
error
:
function
(){
<@
ms
.notify
msg
=
"数据请求失败,请检查请求地址和参数是否正确"
type
=
"danger"
/>
location
.href
=
base
+
"${baseManager}/role/add.do"
;
}
})
;
}
}
);
$(".updateModalBtn").click(function()
{
$
(
"#updateTitle"
)
.text
(
"编辑管理员"
)
;
$
(
"#updateButton"
)
.text
(
"更新"
)
;
//找到点击的
id
var
managerId
=
$
(
this
)
.attr
(
"data-id"
)
;
URL
=
"${managerPath}/manager/"
+
managerId
+
"/edit.do"
;
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
URL
,
data
:
"managerId="
+
managerId
,
success
:
function
(
msg
){
if
(
msg
.manager
!=
null
){
$
(
"input[name='managerName']"
)
.val
(
msg
.manager.managerName
)
;
$
(
"input[name='oldManagerName']"
)
.val
(
msg
.manager.managerName
)
;
$
(
"input[name='managerNickName']"
)
.val
(
msg
.manager.managerNickName
)
;
$
(
"input[name='managerPassword']"
)
.val
(
msg
.manager.managerPassword
)
;
$
(
"input[name='managerRoleID']"
)
.val
(
msg
.manager.managerRoleID
)
;
$
(
"select[name=managerRoleID]"
)
.find
(
"option[value="
+
msg
.manager.managerRoleID
+
"]"
)
.attr
(
"selected"
,
true
)
;
}
},
error
:
function
(){
<@
ms
.notify
msg
=
"系统异常"
type
=
"danger"
/>
}
})
;
URL
=
"${managerPath}/manager/update.do?managerId="
+
managerId
;
$
(
".update"
)
.modal
()
;
}
);
$("#totalDelete").click(function()
{
var
radioData
=
$
(
"input[name='checkbox']"
)
.serialize
()
;
if
(
radioData
!=
""
){
$
(
".deleteAll"
)
.modal
()
;//打开
}
else
{
<@
ms
.notify
msg
=
"请选择需要删除的管理员!"
type
=
"warning"
/>
}
}
);
//批量删除管理员
$("#deleteButton").click(function()
{
var
count
=
0
;
var
checkboxData
=
$
(
"input[name='checkbox']"
)
.serialize
()
;
$
(
"input[name='checkbox']"
)
.each
(
function
(){
if
(
this
.checked
==
true
){
count
++;
}
})
;
if
(
checkboxData
.length
!=
0
)
{
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
base
+
"${baseManager}/manager/allDelete.do"
,
data
:
checkboxData
,
beforeSend
:
function
(){
$
(
"#deleteButton"
)
.text
(
"删除中"
)
;
$
(
"#deleteButton"
)
.attr
(
"disabled"
,
true
)
;
},
success
:
function
(
msg
){
<@
ms
.notify
msg
=
"删除管理员成功"
type
=
"success"
/>
if
(
$
(
"tbody tr"
)
.length
==
count
&&
msg
!=
1
){
location
.href
=
base
+
"${baseManager}/manager/queryList.do?pageNo="
+
(
msg-1
)
;
}
else
{
location
.href
=
base
+
"${baseManager}/manager/queryList.do?pageNo="
+
msg
;
}
},
error
:
function
(){
<@
ms
.notify
msg
=
"批量删除管理员失败"
type
=
"danger"
/>
$
(
".deleteAll"
)
.modal
(
"hide"
)
;
}
})
;
}
else
{
<@
ms
.notify
msg
=
"删除失败,请先选择管理员"
type
=
"danger"
/>
$
(
".deleteAll"
)
.modal
(
"hide"
)
;
}
}
);
var radioManagerId
$(".delete").click(function()
{
radioManagerId
=
$
(
this
)
.attr
(
"data-id"
)
;
$
(
".deleteRadio"
)
.modal
()
;
}
);
//删除单个
$("#deleteRadio").click(function()
{
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
"${managerPath}/manager/"
+
radioManagerId
+
"/delete.do"
,
data
:
"managerId="
+
radioManagerId
,
success
:
function
(
msg
){
if
(
msg
!=
0
)
{
<@
ms
.notify
msg
=
"删除管理员成功"
type
=
"success"
/>
if
(
$
(
"tbody tr"
)
.length
==
0
&&
msg
!=
1
){
location
.href
=
base
+
"${baseManager}/manager/queryList.do?pageNo="
+
(
msg-1
)
;
}
else
{
location
.href
=
base
+
"${baseManager}/manager/queryList.do?pageNo="
+
msg
;
}
}
else
{
<@
ms
.notify
msg
=
"删除管理员失败"
type
=
"danger"
/>
$
(
".closeModal"
)
.click
()
;
}
},
error
:
function
(){
<@
ms
.notify
msg
=
"系统异常"
type
=
"danger"
/>
}
})
;
}
);
//点击弹出管理员主界面新增或更新弹出框
$(".addPage").click(function()
{
var
managerModelPageModelId
=
$
(
this
)
.attr
(
"data-id"
)
;
$
(
"input[name='managerModelPagemanagerId']"
)
.val
(
$
(
this
)
.attr
(
"data-id"
))
;
//查询该管理员的模块信息
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
base
+
"${baseManager}/model/"
+$
(
this
)
.attr
(
"data-id"
)
+
"/queryModelByRoleId.do"
,
data
:
$
(
"#managerPageForm"
)
.serialize
(),
success
:
function
(
msg
){
if
(
msg
.result
){
var
modelJson
=
jQuery
.parseJSON
(
msg
.resultMsg
)
;
$
(
"select[name='managerModelPageModelId']"
)
.html
(
""
)
;
for
(
i
=
0
;
i
<
modelJson
.length
;
i
++
)
{
if
(
modelJson
[
i
]
.modelModelId
==
0
)
{
$
(
"select[name='managerModelPageModelId']"
)
.append
(
"<option value="
+
modelJson
[
i
]
.modelId
+
">"
+
modelJson
[
i
]
.modelTitle
+
"</option>"
)
;
}
}
}
}
})
;
//查询该管理员是否绑定主界面
var
modelId
=
0
;
queryModelPage
(
modelId
,
managerModelPageModelId
)
;
$
(
".managerPageModel"
)
.modal
()
;
}
);
//查询模块是否绑定主界面
function queryModelPage(modelId,managerModelPageModelId)
{
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
"${managerPath}/managerModelPage/"
+
modelId
+
"/getEntity.do"
,
data
:
"managerModelPageModelId="
+
managerModelPageModelId
,
success
:
function
(
msg
){
if
(
msg
.result
){
var
json
=
jQuery
.parseJSON
(
msg
.resultMsg
)
;
alert
(
msg
)
;
$
(
"input[name='managerModelPageUrl']"
)
.val
(
json
.managerModelPageUrl
)
;
}
}
})
;
}
//点击保存时,开始主界面信息的保存
$("#saveUrl").click(function()
{
$
.ajax
({
type
:
"post"
,
dataType
:
"json"
,
url
:
"${managerPath}/managerModelPage/save.do"
,
data
:
$
(
"#managerPageForm"
)
.serialize
(),
beforeSend
:
function
(){
$
(
"#saveUrl"
)
.text
(
"保存中"
)
;
$
(
"#saveUrl"
)
.attr
(
"disabled"
,
true
)
},
success
:
function
(
msg
){
if
(
msg
){
<@
ms
.notify
msg
=
"保存成功!"
type
=
"success"
/>
location
.href
=
base
+
"${baseManager}/manager/queryList.do"
;
}
}
})
;
}
);
</script>
</
body
>
</
html
>
src/main/webapp/WEB-INF/manager/model/index.ftl
0 → 100644
View file @
da21280b
<@
ms
.html5
>
<@ms.nav title="菜单管理"></@ms.nav>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
<@shiro.hasPermission name="model:save"><@ms.panelNavBtnAdd title="" id="addModelBtn"/></@shiro.hasPermission>
<@shiro.hasPermission name="model:del"><@ms.panelNavBtnDel title="" id="delModelBtn"/></@shiro.hasPermission>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="modelList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-side-pagination="server">
</table>
</@ms.panel>
<!--添加模块-->
<@ms.modal modalName="addEditModel" title="添加模块">
<@ms.modalBody height="350">
<@ms.form isvalidation=true name="addEditForm" action="" method="post" >
<@ms.formRow label="父级菜单">
<@ms.treeInput treeId="modelInputTree" json="$
{
parentModelList
?
default
(
''
)}
" jsonId="modelId" jsonPid="modelModelId" jsonName="modelTitle" addNodesName="顶级模块" buttonText="顶级模块" inputName="modelModelId" inputValue="0" clickZtreeId="clickZtreeId(event,treeId,treeNode);" expandAll="true" showIcon="true"/>
</@ms.formRow>
<@ms.text name="modelTitle" label="标题" title="模块标题" placeholder="请输入模块标题" value="" validation=
{
"required"
:
"true"
,
"data-bv-notempty-message"
:
"请输入模块标题!"
,
"data-bv-stringlength"
:
"true"
,
"minlength"
:
"1"
,
"maxlength"
:
"10"
,
"data-bv-stringlength-message"
:
"模块标题为1-10个字符!"
}
/>
<@ms.text name="modelIcon" label="图标" title="模块图标" placeholder="请输入模块图标" value="" validation=
{
"maxlength"
:
"20"
,
"data-bv-stringlength-message"
:
"模块图标为1-20个字符!"
}
/>
<@ms.text name="modelUrl" label="链接地址" title="模块链接地址" placeholder="请输入模块链接地址" value="" validation=
{
"maxlength"
:
"255"
,
"data-bv-stringlength-message"
:
"模块链接地址为1-255个字符!"
}
/>
<#assign isMenu=[
{
"id"
:
"0"
,
"name"
:
"否"
}
,
{
"id"
:
"1"
,
"name"
:
"是"
}
]>
<@ms.text name="modelSort" label="排序" title="模块排序" width="165px;" value="" placeholder="请输入排序" validation=
{
"required"
:
"true"
,
"maxlength"
:
"5"
,
"data-bv-notempty-message"
:
"请输入模块排序!"
}
/>
<@ms.select name="modelIsMenu" style="width: 25%;" id="modelMenuSelect" list=isMenu listKey="id" listValue="name" label="是否是菜单" value="0" title="是否是菜单" />
<@ms.hidden name="modelId" value="" id="hideModelId"/>
</@ms.form>
</@ms.modalBody>
<@ms.modalButton>
<@ms.button value="" id="addEditBtn"/>
</@ms.modalButton>
</@ms.modal>
<@ms.modal modalName="delModel" title="模块数据删除" >
<@ms.modalBody>删除此模块
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="删除" class="btn btn-danger rightDelete" id="deleteModelBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@
ms
.html5
>
<
script
>
var modelId;
var postMessage;
$(function()
{
$
(
"#modelList"
)
.bootstrapTable
({
url
:
"${managerPath}/model/list.do"
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
toolbar
:
"#toolbar"
,
idField
:
'
modelId
'
,
treeShowField
:
'
modelTitle
'
,
parentIdField
:
'
modelModelId
'
,
columns
:
[
{
checkbox
:
true
},
{
field
:
'
modelIcon
'
,
title
:
'模块图标'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
if
(
value
!=
null
){
return
"<i class='iconfont'>"
+
value
+
"</i>"
;
}
else
{
return
""
;
}
}
},{
field
:
'
modelTitle
'
,
title
:
'模块标题'
,
formatter
:
function
(
value
,
row
,
index
)
{
<@
shiro
.hasPermission
name
=
"model:update"
>
return
"<a style='cursor:pointer;text-decoration:none;' onclick='editModal("
+
row
.modelId
+
")'>"
+
value
+
"</a>"
;
</@
shiro
.hasPermission
>
<@
shiro
.lacksPermission
name
=
"model:update"
>
return
value
;
</@
shiro
.lacksPermission
>
}
},{
field
:
'
modelUrl
'
,
title
:
'模块连接地址'
,
formatter
:
function
(
value
,
row
,
index
)
{
if
(
value
==
null
){
return
""
;
}
else
{
return
value
;
}
}
},{
field
:
'
isChild
'
,
title
:
'菜单类型'
},{
field
:
'
modelSort
'
,
title
:
'模块的排序'
},{
field
:
'
modelIsMenu
'
,
title
:
'模块是否是菜单'
,
align
:
'
center
'
,
formatter
:
function
(
value
,
row
,
index
)
{
if
(
value
==
0
){
return
"否"
;
}
else
if
(
value
==
1
){
return
"是"
;
}
else
{
return
""
;
}
}
}
]
})
}
)
//新增模块
$("#addModelBtn").click(function()
{
$
(
"#addEditForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#addEditForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
postMessage
=
"保存成功!"
;
$
(
"#addEditBtn"
)
.text
(
"保存"
)
;
$
(
"#addEditForm"
)
.attr
(
"action"
,
"${managerPath}/model/save.do"
)
;
$
(
"#addEditForm"
)[
0
]
.reset();
$
(
".addEditModel"
)
.modal
()
;
$
(
"input[name='modelSort']"
)
.val
(
0
)
;
$
(
"#hideModelId"
)
.attr
(
"disabled"
,
true
)
;
}
);
//编辑模块
function editModal(id)
{
$
(
"#addEditForm"
)
.data
(
"bootstrapValidator"
)
.validate
()
;
var
isValid
=
$
(
"#addEditForm"
)
.data
(
"bootstrapValidator"
)
.isValid
()
;
if
(
!
isValid
)
{
<@
ms
.notify
msg
=
"数据提交失败,请检查数据格式!"
type
=
"warning"
/>
return
;
}
var
editUrl
=
"${managerPath}/model/get.do?modelId="
+
id
;
$
(
this
)
.request
({
url
:
editUrl
,
type
:
"json"
,
method
:
"post"
,
func
:
function
(
data
){
var
model
=
data
.model
;
//
给表单赋值
if
(
model
!=
null
){
$
(
"input[name='modelId']"
)
.val
(
model
.modelId
)
;
if
(
model
.modelIcon
!=
undefined
){
$
(
"input[name='modelIcon']"
)
.val
(
model
.modelIcon
)
;
}
if
(
model
.modelModelId
==
0
){
$
(
"#treeLabelmodelInputTree"
)
.text
(
"顶级模块"
)
;
}
else
{
$
(
"#treeLabelmodelInputTree"
)
.text
(
data
.parentModel.modelTitle
)
;
}
$
(
"#modelMenuSelect"
)
.get
(
0
)
.selectedIndex
=
model
.modelIsMenu
;
$
(
"input[name='modelTitle']"
)
.val
(
model
.modelTitle
)
;
$
(
"input[name='modelSort']"
)
.val
(
model
.modelSort
)
;
$
(
"input[name='modelUrl']"
)
.val
(
model
.modelUrl
)
;
$
(
"input[name='isChild']"
)
.val
(
model
.isChild
)
;
$
(
"#modelMenuSelect option[value="
+
model
.modelMenu
+
"]"
)
.attr
(
"selected"
,
true
)
;
$
(
"input[name='modelModelId']"
)
.val
(
model
.modelModelId
)
;
$
(
".addEditModel"
)
.modal
()
;
postMessage
=
"更新成功!"
;
$
(
"#addEditBtn"
)
.text
(
"更新"
)
;
$
(
"#hideModelId"
)
.attr
(
"disabled"
,
false
)
;
$
(
"#hideModelId"
)
.val
(
model
.modelId
)
;
$
(
"#addEditForm"
)
.attr
(
"action"
,
"${managerPath}/model/update.do"
)
;
}
}})
;
}
//提交表单
$("#addEditBtn").on("click",function()
{
var
vobj
=
$
(
"#addEditForm"
)
.data
(
'
bootstrapValidator
'
)
.validate
()
;
if
(
vobj
.isValid
()){
$
(
this
)
.postForm
(
"#addEditForm"
,{
func
:
function
(
msg
)
{
if
(
msg
.result
){
<@
ms
.notify
msg
=
"更新成功!"
type
=
"success"
/>
location
.reload
()
;
}
else
{
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
warning
'
,
message
:
{
text
:
msg
.resultMsg
}
})
.show
()
;
}
}})
;
}
}
);
//删除按钮
$("#delModelBtn").click(function()
{
//获取
checkbox
选中的数据
var
rows
=
$
(
"#modelList"
)
.bootstrapTable
(
"getSelections"
)
;
//没有选中
checkbox
if
(
rows
.length
<=
0
){
<@
ms
.notify
msg
=
"请选择需要删除的记录"
type
=
"warning"
/>
}
else
{
$
(
".delModel"
)
.modal
()
;
}
}
)
$("#deleteModelBtn").click(function()
{
var
rows
=
$
(
"#modelList"
)
.bootstrapTable
(
"getSelections"
)
;
$
(
this
)
.text
(
"正在删除..."
)
;
$
(
this
)
.attr
(
"disabled"
,
"true"
)
;
var
ids
=
""
;
for
(
var
i
=
0
;
i
<
rows
.length
;
i
++
){
if
(
ids
==
""
){
ids
=
rows
[
i
]
.modelId
;
}
else
{
ids
=
ids
+
","
+
rows
[
i
]
.modelId
}
}
$
.ajax
({
type
:
"post"
,
url
:
"${managerPath}/model/delete.do?ids="
+
ids
,
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
=
$
(
'#
modelList
'
)
.bootstrapTable
(
'
getOptions
'
)
;
params
.queryParams
=
function
(
params
)
{
$
.extend
(
params
,
search
)
;
return
params
;
}
$
(
"#modelList"
)
.bootstrapTable
(
'
refresh
'
,
{
query
:
$
(
"form[name='searchForm']"
)
.serializeJSON
()})
;
}
//排除添加功能按钮
function clickZtreeId(event,treeId,treeNode)
{
if
(
treeNode
.modelIsMenu
==
0
)
{
<@
ms
.notify
msg
=
"不能将功能按钮添加为菜单"
type
=
"danger"
/>
return
false
;
}
}
</
script
>
\ No newline at end of file
Prev
1
2
3
4
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