<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
|
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
%>
|
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<title>导航分类管理</title>
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
|
<link href="static/styles/initialize.css" rel="stylesheet" type="text/css">
|
<link href="static/styles/common.css" rel="stylesheet" type="text/css">
|
<script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="static/scripts/easyuiExtend.js"></script>
|
<script type="text/javascript" src="static/scripts/jquery-extend.js"></script>
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui-datagrid-dnd/datagrid-dnd.js"></script>
|
|
<!-- 弹窗加载组件 -->
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
|
<!-- wcp组件 -->
|
<script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
|
|
<!--[if lt IE 9]>
|
<script type="text/javascript" src="static/plugins/json2.js"></script>
|
<![endif]-->
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.infoPicker.js"></script>
|
<style>
|
html, body {
|
height: 100%;
|
width: 100%;
|
overflow: hidden;
|
}
|
|
.combobox-group {
|
clear: both;
|
}
|
|
.combobox-gitem {
|
float: left;
|
padding-right: 10px;
|
}
|
</style>
|
|
</head>
|
|
<body class="pt-tree">
|
<div>
|
<div class="pt-main-top clear">
|
<div class="pt-nav pt-nav-xs">
|
<span class="pt-title-icon"><i class="fa fa-tasks"></i></span>
|
<div class="pt-title">
|
<div>
|
<h4>导航分类管理</h4>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="pt-left-tools clear">
|
<div class="pull-left" style="margin-left: 10px;">
|
|
<a class="easyui-menubutton pt-btn-primary" data-options="menu:'#div_MenuAdd'">
|
<i class="fa fa-plus-square"></i> 新增
|
</a>
|
|
<!-- <button class="pt-btn pt-btn-success" id="btnAddRootClassification">
|
<i class="fa fa-plus-square"></i>新增根分类
|
</button>
|
<button class="pt-btn pt-btn-purple" id="btnAddSubClassification">
|
<i class="fa fa-plus-square-o"></i>新增子分类
|
</button> -->
|
<shiro:hasPermission name="SYS_CONFIG.MODULE.OPERATION.CONFIG.NAVIGATIONCLASSIFICATION.SAVE">
|
<button class="pt-btn pt-btn-primary" id="btnUpdateClassification">
|
<i class="fa fa-pencil"></i>修改
|
</button>
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_CONFIG.MODULE.OPERATION.CONFIG.NAVIGATIONCLASSIFICATION.DELETE">
|
<button class="pt-btn pt-btn-danger" id="btnDeleteClassification">
|
<i class="fa fa-trash-o"></i>删除
|
</button>
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_CONFIG.MODULE.OPERATION.CONFIG.NAVIGATIONCLASSIFICATION.ADD">
|
<div id="div_MenuAdd" style="width:150px;">
|
<div id="btnAddRootClassification" data-options="iconCls:'fa fa-plus-square'">新增根分类</div>
|
<div id="btnAddSubClassification" data-options="iconCls:'fa fa-plus-square-o'">新增子分类</div>
|
</div>
|
</shiro:hasPermission>
|
</div>
|
<div class="pull-right" style="margin-right: 10px;" id="btnSelectCondition_css">
|
<shiro:hasPermission name="SYS_CONFIG.MODULE.OPERATION.CONFIG.NAVIGATIONCLASSIFICATION.SAVE">
|
<button class="pt-btn pt-btn-info" id="btnSelectCondition">
|
<i class="fa fa-plus-square-o"></i>修改条件
|
</button>
|
</shiro:hasPermission>
|
<a href="javascript:;" class="pt-btn pt-btn-info" onclick="enableSort(this)" id="sort">
|
<i class="fa fa-retweet"></i> 排序
|
</a>
|
</div>
|
</div>
|
<div class="pt-left-menu" style="padding-top:0px;width: 270px">
|
<div class="easyui-panel">
|
<ul id="ul_classification"></ul>
|
</div>
|
|
</div>
|
<div class="pt-right-main" id="dg_manual_css" style="margin-left: 265px">
|
<table id="dg_manual" style="width: 99%;">
|
</table>
|
</div>
|
<div class="pt-right-main" id="dg_intelligence_css" style="margin-left: 265px">
|
<table id="dg_intelligence" style="width: 99%;">
|
</table>
|
</div>
|
</div>
|
</body>
|
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<script>
|
//定义页面全局变量
|
var NowSelectedNodeId = null;
|
var params = {
|
callBack: null,
|
};
|
var classificationType = "";
|
var intelligenceType = "";
|
var hidden = false;
|
|
//页面加载事件
|
$(function () {
|
//初始化表格
|
$('#dg_manual').datagrid({
|
url: 'config/classificationColumn/getClassificationColumnPageList',
|
fitColumns: true,
|
striped: true,
|
idField: "classificationColumnId",
|
rownumbers: true,
|
pagination: true,
|
columns: [[
|
{
|
field: 'displayName',
|
title: '字段名称',
|
width: 200,
|
align: 'center'
|
},
|
{
|
field: 'selectCondition',
|
title: '查询条件',
|
width: 200,
|
align: 'center'
|
},
|
{
|
field: 'defaultValue',
|
title: '默认值',
|
width: 250,
|
align: 'center'
|
}
|
]]
|
});
|
|
//初始化表格
|
$('#dg_intelligence').datagrid({
|
url: 'config/classificationColumn/getClassificationColumnPageList',
|
fitColumns: true,
|
striped: true,
|
idField: "classificationColumnId",
|
rownumbers: true,
|
pagination: true,
|
columns: [[
|
{
|
field: 'displayName',
|
title: '字段名称',
|
width: 100,
|
align: 'center'
|
},
|
{
|
field: 'columnName',
|
title: '字段/公式',
|
width: 200,
|
align: 'center'
|
},
|
{
|
field: 'sortType',
|
title: '排序方式',
|
width: 200,
|
align: 'center',
|
formatter: function (value, rowData, rowIndex) {
|
if (value == "asc") {
|
return '升序<input type="radio" name="sortType' + rowData.classificationColumnId + '" id="sortType"' + rowIndex + ' checked onclick=\'sortTypeOnclick("' + rowData.classificationColumnId + '");\' value="asc" />' +
|
' 降序<input type="radio" name="sortType' + rowData.classificationColumnId + '" id="sortType"' + rowIndex + ' onclick=\'sortTypeOnclick("' + rowData.classificationColumnId + '");\' value="desc" />';
|
} else {
|
return '升序<input type="radio" name="sortType' + rowData.classificationColumnId + '" id="sortType"' + rowIndex + ' onclick=\'sortTypeOnclick("' + rowData.classificationColumnId + '");\' value="asc" />' +
|
' 降序<input type="radio" name="sortType' + rowData.classificationColumnId + '" id="sortType"' + rowIndex + ' checked onclick=\'sortTypeOnclick("' + rowData.classificationColumnId + '");\' value="desc" />';
|
}
|
|
}
|
}, {
|
field: 'classificationColumnId',
|
title: '操作',
|
width: 100,
|
align: 'center',
|
formatter: function (value, row, index) {
|
var html = "";
|
if (intelligenceType == "0") {
|
html += ' <a onclick=\'editClassificationColumn("' + value + '");\' class="pt-color-success"><i class="fa fa-pencil" title="编辑"></i></a>';
|
}
|
html += '<a onclick=\'deleteClassificationColumn("' + value + '");\' class="pt-color-danger"><i class="fa fa-trash-o" title="删除1"></i></a>';
|
return html;
|
}
|
}
|
|
]]
|
});
|
|
$("#dg_intelligence_css").hide();
|
|
//初始化菜单树
|
bindClassificationTree();
|
//初始化滚动条
|
new ResizeScroll({
|
"id": ".pt-form",
|
fun: function () {
|
|
var wh = $(window).height();
|
//$(".pt-form").height(wh-79-48);
|
return (wh - 132 - 48);
|
|
}
|
});
|
|
//绑定按钮事件
|
//添加根参数按钮事件
|
$("#btnAddRootClassification").click(function () {
|
var parentId = "0";
|
var parentName = "顶级分类";
|
var url = "config/navigationClassification/editNavigationClassification?classificationId=0&parentId=0&moduleId=" + "${moduleId}";
|
var title = "新增分类";
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: ["650px", "500px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
//将回调函数传给子页面
|
iframeWin.params.callBack = refreshData;
|
iframeWin.load(parentName);
|
}
|
});
|
|
//window.event ? window.event.returnValue == false : e.preventDefault();
|
|
});
|
|
//添加子参数按钮事件
|
$("#btnAddSubClassification").click(function () {
|
var node = $('#ul_classification').tree('getSelected');
|
if (node != null && node.id != 0 && node.attributes.classificationType == 0) {
|
var parentId = node.id;
|
var parentName = node.text;
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "config/navigationClassification/getByidClassification?classificationId=" + parentId,
|
}).done(function (result) {
|
if (result.classificationType == 0) {
|
var url = "config/navigationClassification/editNavigationClassification?classificationId=0&parentId=" + parentId + "&moduleId=" + "${moduleId}";
|
var title = "新增子分类";
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: ["650px", "500px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
//将回调函数传给子页面
|
iframeWin.params.callBack = refreshData;
|
iframeWin.load(parentName);
|
}
|
});
|
} else {
|
wcp.notify.warn('智能分类不能添加子分类!');
|
}
|
}));
|
|
} else {
|
wcp.message.error('请先选择一个分类(不能是智能子分类)!');
|
}
|
});
|
|
|
//修改按钮事件
|
$("#btnUpdateClassification").click(function () {
|
var node = $('#ul_classification').tree('getSelected');
|
if (node != null && node.id != 0) {
|
var classificationId = node.id;
|
var parentName = node.text;
|
var url = "config/navigationClassification/editNavigationClassification?classificationId=" + classificationId;
|
var title = "修改分类";
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: ["650px", "480px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
//将回调函数传给子页面
|
iframeWin.params.callBack = refreshData;
|
iframeWin.load(parentName, classificationId);
|
}
|
});
|
|
} else {
|
wcp.message.error('请先选择一个分类(不能是智能子分类)!');
|
|
}
|
});
|
|
$("#btnDeleteClassification").click(function () {
|
var node = $('#ul_classification').tree('getSelected');
|
if (node != null && node.id != 0) {
|
//判断是否有子参数
|
var msg = "";
|
if (node.children != null && node.children.length > 0) {
|
msg = '当前参数有子分类,确定要和子分类一起删除吗?';
|
} else {
|
msg = '确定要删除当前选中的分类吗?';
|
}
|
|
layer.confirm(msg, {
|
icon: 3,
|
title: '提示'
|
}, function (index) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "config/navigationClassification/deleteNavigationClassificatn",
|
data: node.id,
|
}).done(function (result) {
|
wcp.notify.success('删除成功!');
|
|
//重置选中的数据
|
NowSelectedNodeId = null;
|
|
//重新加载菜参数数据
|
bindClassificationTree();
|
$('#parentId').combotree('reload');
|
}));
|
|
layer.close(index);
|
});
|
} else {
|
wcp.message.error('请先选择要删除的分类(不能是智能子分类)!');
|
}
|
|
});
|
|
//选择条件按钮事件
|
$("#btnSelectCondition").click(function () {
|
var node = $('#ul_classification').tree('getSelected');
|
if (intelligenceType == 1 || intelligenceType == 2) {
|
var rows = $('#dg_intelligence').datagrid("getRows");
|
if (rows.length >= 1) {
|
wcp.message.error('该分类只允许选择一个字段,请先删除当前字段!');
|
return false;
|
}
|
}
|
if (node != null && node.id != 0) {
|
var classificationId = node.id;
|
var title = "";
|
if (classificationType == "0") {
|
title = "修改条件";
|
} else {
|
title = "选择字段";
|
}
|
var url = "config/navigationClassification/selectManualColumnIndex?classificationId=" + classificationId + "&moduleId=" + "${moduleId}";
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: ["650px", "550px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
//将回调函数传给子页面
|
if (classificationType == "0") {
|
iframeWin.params.callBack = refreshdg_manual;
|
} else {
|
iframeWin.params.callBack = refreshdg_intelligence;
|
}
|
|
}
|
});
|
} else {
|
wcp.message.info('请先选择一个分类(不能是智能子分类)!')
|
}
|
|
});
|
|
});
|
|
//绑定二级分类树
|
function bindClassificationTree() {
|
$("#ul_classification").tree({
|
method: "get",
|
url: "config/navigationClassification/listClassificationByTreeForTop?moduleId=${moduleId}",
|
animate: true,
|
onBeforeLoad: function (node, param) {
|
new ResizeScroll({
|
"id": "#ul_classification",
|
fun: function () {
|
var wh = $(window).height();
|
//$("#ul_dept").height(wh-79-39);
|
return (wh - 69 - 40 - 20);
|
|
}
|
});
|
|
wcp.ui.setBusy("#ul_classification");
|
},
|
onLoadSuccess: function (node, data) {
|
wcp.ui.clearBusy("#ul_classification");
|
new ResizeScroll({
|
"id": "#ul_classification",
|
fun: function () {
|
|
var wh = $(window).height();
|
//$("#ul_dept").height(wh-79-39);
|
return (wh - 69 - 40 - 20);
|
|
}
|
});
|
|
//重新加载数据时,选中之前被选中的数据
|
if (NowSelectedNodeId != null) {
|
var node = $('#ul_classification').tree('find', NowSelectedNodeId);
|
if (node != null) {
|
$('#ul_classification').tree('select', node.target);
|
}
|
}
|
},
|
onLoadError: function (args) {
|
wcp.ui.clearBusy("#ul_classification");
|
},
|
onClick: function (node) {
|
NowSelectedNodeId = node.id;
|
if (node.id != 0) {
|
wcp.ajax({
|
url: "config/navigationClassification/getByidClassification?classificationId=" + node.id,
|
}).done(function (result) {
|
classificationType = result.classificationType;
|
intelligenceType = result.intelligenceType;
|
if (result.classificationType == 0) {
|
$("#btnSelectCondition").html('<i class="fa fa-plus-square-o"></i>修改条件')
|
$('#dg_manual').datagrid('load', {
|
classificationId: node.id
|
});
|
$("#btnAddSubClassification").show();
|
$("#dg_manual_css").show();
|
$("#dg_intelligence_css").hide();
|
var parent = $("#ul_classification").tree('getParent', node.target);
|
if (parent == null) {
|
$("#btnSelectCondition_css").hide();
|
} else {
|
$("#btnSelectCondition_css").show();
|
}
|
} else {
|
$("#btnSelectCondition").html('<i class="fa fa-plus-square-o"></i>选择字段')
|
$('#dg_intelligence').datagrid('load', {
|
classificationId: node.id
|
});
|
$("#btnAddSubClassification").hide();
|
$("#dg_manual_css").hide();
|
$("#dg_intelligence_css").show();
|
$("#btnSelectCondition_css").show();
|
}
|
if (intelligenceType != 0) {
|
$('#dg_intelligence').datagrid('hideColumn', 'sortType');
|
$('#dg_intelligence').datagrid('hideColumn', 'columnName');
|
} else {
|
$('#dg_intelligence').datagrid('showColumn', 'sortType');
|
$('#dg_intelligence').datagrid('showColumn', 'columnName');
|
}
|
});
|
} else {
|
$("#btnAddSubClassification").hide();
|
$("#btnSelectCondition_css").show();
|
}
|
|
},
|
onBeforeExpand: function (node, param) {
|
$('#ul_classification').tree('options').url = "config/navigationClassification/listClassificationByTreeForSingle?moduleId=${moduleId}&classificationId=" + node.id;
|
}
|
})
|
}
|
|
//修改排序方式
|
function sortTypeOnclick(index) {
|
var sortType = $('input:radio[name="sortType' + index + '"]:checked').val();
|
wcp.ajax({
|
url: "config/classificationColumn/updateSortType?classificationColumnId=" + index + "&sortType=" + sortType + "&classificationId=" + NowSelectedNodeId,
|
}).done(function (result) {
|
top.wcp.notify.success("修改成功!");
|
refreshdg_intelligence();
|
var tip = $.trim($("#sort").text());
|
if (tip == "保存排序") {
|
$('#dg_intelligence').datagrid("enableDnd")
|
}
|
});
|
}
|
|
function enableSort(obj) {
|
var node = $('#ul_classification').tree('getSelected');
|
var oA = $(obj);
|
var tip = $.trim(oA.text());
|
if (node != null && node.id != 0) {
|
var classificationId = node.id;
|
if (classificationType == "0") {
|
if (tip == "排序") {
|
oA.html('<i class="fa fa-retweet"></i>保存排序');
|
$('#dg_manual').datagrid("enableDnd");
|
} else if (tip == "保存排序") {
|
oA.html('<i class="fa fa-retweet"></i>排序');
|
//保存表格中排序
|
saveSortNum('dg_manual');
|
}
|
} else {
|
if (tip == "排序") {
|
oA.html('<i class="fa fa-retweet"></i>保存排序');
|
$('#dg_intelligence').datagrid("enableDnd");
|
} else if (tip == "保存排序") {
|
oA.html('<i class="fa fa-retweet"></i>排序');
|
//保存表格中排序
|
saveSortNum('dg_intelligence');
|
}
|
|
}
|
|
} else {
|
wcp.message.error('请先选择一个分类(不能是智能子分类)!');
|
}
|
|
}
|
|
//保存排序号
|
function saveSortNum(dataGridId) {
|
var data = $('#' + dataGridId).datagrid('getRows');
|
if (data.length > 0) {
|
for (i = 0; i < data.length; i++) {
|
if (data[i].hasOwnProperty('_selected')) {
|
//删除isNewRecord属性
|
delete data[i]._selected;
|
}
|
}
|
var url = "config/classificationColumn/saveSortNum?classificationId=" + NowSelectedNodeId;
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: url,
|
data: JSON.stringify(data),
|
}).done(function (result) {
|
top.wcp.notify.success("保存成功!");
|
refreshdg_intelligence();
|
}));
|
} else {
|
top.wcp.notify.success("没有数据!");
|
}
|
|
}
|
|
//编辑分类列
|
function editClassificationColumn(classificationColumnId) {
|
var url = "config/classificationColumn/editClassificationColumn?classificationColumnId=" + classificationColumnId;
|
top.layer.open({
|
title: "编辑分类列",
|
type: 2,
|
area: ["650px", "350px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
//将回调函数传给子页面
|
if (classificationType == "0") {
|
iframeWin.params.callBack = refreshdg_manual;
|
} else {
|
iframeWin.params.callBack = refreshdg_intelligence;
|
}
|
|
}
|
});
|
}
|
|
function deleteClassificationColumn(classificationColumnId) {
|
layer.confirm("确定要删除选择的字段吗?", {
|
icon: 3,
|
title: '提示'
|
}, function (index) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "config/classificationColumn/deleteClassificationColumn?classificationId=" + NowSelectedNodeId,
|
data: JSON.stringify(classificationColumnId),
|
}).done(function (result) {
|
wcp.notify.success('删除成功!');
|
//重新加载菜参数数据
|
bindClassificationTree();
|
$('#parentId').combotree('reload');
|
//刷新数据
|
refreshdg_intelligence();
|
}));
|
|
layer.close(index);
|
});
|
}
|
|
//重新加载下拉树
|
function refreshData() {
|
//重新加载参数数据
|
bindClassificationTree();
|
$('#parentId').combotree('reload');
|
}
|
|
//重新加载手动字段表格
|
function refreshdg_manual(id) {
|
$('#dg_manual').datagrid('load', {
|
classificationId: id
|
});
|
bindClassificationTree();
|
$('#parentId').combotree('reload');
|
}
|
|
//重新加载智能字段表格
|
function refreshdg_intelligence() {
|
$('#dg_intelligence').datagrid('load', {
|
classificationId: NowSelectedNodeId
|
});
|
bindClassificationTree();
|
$('#parentId').combotree('reload');
|
}
|
|
//选择图标
|
function selectIcon() {
|
wcp.picker.selectIcon({
|
title: "请选择图标",
|
nameElement: "txt_Icon",
|
layerOpener: window
|
});
|
}
|
</script>
|
</html>
|