471 lines
19 KiB
Plaintext
471 lines
19 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
|||
|
|
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
|||
|
|
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
|||
|
|
<%@page import="com.sipai.entity.work.GroupContent" %>
|
|||
|
|
<% request.setAttribute("Type_Point", GroupContent.Type_Point); %>
|
|||
|
|
<% request.setAttribute("Type_Content", GroupContent.Type_Content); %>
|
|||
|
|
|
|||
|
|
<%@page import="com.sipai.entity.work.GroupContentForm" %>
|
|||
|
|
<% request.setAttribute("Type_row", GroupContentForm.Type_row);%>
|
|||
|
|
<% request.setAttribute("Type_column", GroupContentForm.Type_column);%>
|
|||
|
|
|
|||
|
|
<% request.setAttribute("Showtextst_TRUE", GroupContentForm.Showtextst_TRUE);%>
|
|||
|
|
<% request.setAttribute("Showtextst_FALSE", GroupContentForm.Showtextst_FALSE);%>
|
|||
|
|
<style type="text/css">
|
|||
|
|
.select2-container .select2-selection--single {
|
|||
|
|
height: 34px;
|
|||
|
|
line-height: 34px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.select2-selection__arrow {
|
|||
|
|
margin-top: 3px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<!-- 颜色选择器-->
|
|||
|
|
<link rel="stylesheet"
|
|||
|
|
href="<%=request.getContextPath()%>/plugins/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css"
|
|||
|
|
type="text/css" rel="stylesheet" />
|
|||
|
|
<script type="text/javascript"
|
|||
|
|
src="<%=request.getContextPath()%>/plugins/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"
|
|||
|
|
charset="utf-8"></script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
|
|||
|
|
var grouptypeid="";
|
|||
|
|
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/work/groupContent/doupdate.do", $("#subForm").serialize()+"&grouptypeid="+grouptypeid, function (result) {
|
|||
|
|
var data = $.parseJSON(result);
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
initTreeView();
|
|||
|
|
// showAlert('s','保存成功');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.msg);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
morder: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '顺序不能为空'
|
|||
|
|
},
|
|||
|
|
regexp: {
|
|||
|
|
regexp: /^[0-9]*$/,
|
|||
|
|
message: '顺序必须为数字'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function dodel() {
|
|||
|
|
swal({
|
|||
|
|
text: "您确定要删除此记录?",
|
|||
|
|
dangerMode: true,
|
|||
|
|
buttons: {
|
|||
|
|
cancel: {
|
|||
|
|
text: "取消",
|
|||
|
|
value: null,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-default btn-sm",
|
|||
|
|
closeModal: true,
|
|||
|
|
},
|
|||
|
|
confirm: {
|
|||
|
|
text: "确定",
|
|||
|
|
value: true,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-danger btn-sm",
|
|||
|
|
closeModal: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
.then(function (willDelete) {
|
|||
|
|
if (willDelete) {
|
|||
|
|
$.post(ext.contextPath + '/work/groupContent/dodelete.do', $("#subForm").serialize(), function (result) {
|
|||
|
|
// var data= $.parseJSON(result);
|
|||
|
|
if (result.code == 1) {
|
|||
|
|
initTreeView();
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', result.msg);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
if ('${groupContent.type}'=='${Type_Content}') {
|
|||
|
|
$.post(ext.contextPath + "/work/groupType/getGroupTypeTree.do", function (data) {
|
|||
|
|
//console.log("sdata",data);
|
|||
|
|
var select = $("#grouptypeName").select2({
|
|||
|
|
data: data,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
escapeMarkup: function (markup) {
|
|||
|
|
return markup;
|
|||
|
|
}, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
formatResult: function formatRepo(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
}, // 函数用来渲染结果
|
|||
|
|
formatSelection: function formatRepoSelection(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
$("#grouptypeName").on("select2:select", function (e) {
|
|||
|
|
// doReloadCalendar();
|
|||
|
|
});
|
|||
|
|
select.on("change", function (e) {
|
|||
|
|
grouptypeid = $('#grouptypeName').val();
|
|||
|
|
});
|
|||
|
|
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});//选中元素上下居中
|
|||
|
|
if (data.length != 0) {
|
|||
|
|
select.val('${groupContent.grouptypeid}').trigger("change");//设置选中
|
|||
|
|
} else {
|
|||
|
|
select.val("").trigger("change");//设置选中
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
$("#contentFormTable").bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/work/groupContentForm/getlist.do', // 获取表格数据的url
|
|||
|
|
// cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
|||
|
|
striped: true, //表格显示条纹,默认为false
|
|||
|
|
pagination: true, // 在表格底部显示分页组件,默认false
|
|||
|
|
pageList: [5, 10, 15], // 设置页面可以显示的数据条数
|
|||
|
|
pageSize: 5, // 页面数据条数
|
|||
|
|
pageNumber: 1, // 首页页码
|
|||
|
|
paginationDetailHAlign: ' hidden',//去除分页的显示
|
|||
|
|
sidePagination: 'server', // 设置为服务器端分页
|
|||
|
|
detailView: true,//父子表
|
|||
|
|
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
|||
|
|
return {
|
|||
|
|
type: '${Type_row}',
|
|||
|
|
pid: '${groupContent.id}'
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'insertrow', // 要排序的字段
|
|||
|
|
sortOrder: 'asc', // 排序规则
|
|||
|
|
onExpandRow: function (index, row, $detail) {
|
|||
|
|
initDetailTable(index, row, $detail);
|
|||
|
|
//存入sessionStorage
|
|||
|
|
sessionStorage.setItem("index", index);
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
field: 'insertrow', // 返回json数据中的name
|
|||
|
|
title: '名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return "第" + value + "行";
|
|||
|
|
}
|
|||
|
|
}, {
|
|||
|
|
title: "操作",
|
|||
|
|
align: 'center',
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: 100, // 定义列的宽度,单位为像素px
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return '<div class="btn-group"><button class="btn btn-default btn-sm" onclick="doContentFormForColumnAddFun(\'' + row.id + '\')"><i class="fa fa-plus-circle"></i></button>' +
|
|||
|
|
'<button class="btn btn-default btn-sm" onclick="delContentFormForRowFun(\'' + row.id + '\')"><i class="fa fa-trash-o"></i></button></div>';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
onLoadSuccess: function () { //加载成功时执行
|
|||
|
|
$(".bs-checkbox").css({'text-align': 'center', 'vertical-align': 'middle'})
|
|||
|
|
},
|
|||
|
|
onLoadError: function () { //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var initDetailTable = function (index, row, $detail) {
|
|||
|
|
var pid = row.id;
|
|||
|
|
var detailTable = $detail.html('<table></table>').find('table');
|
|||
|
|
$(detailTable).bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/work/groupContentForm/getlist.do', // 获取表格数据的url
|
|||
|
|
// cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
|||
|
|
striped: true, //表格显示条纹,默认为false
|
|||
|
|
pagination: true, // 在表格底部显示分页组件,默认false
|
|||
|
|
pageList: [15, 30, 50], // 设置页面可以显示的数据条数
|
|||
|
|
pageSize: 15, // 页面数据条数
|
|||
|
|
pageNumber: 1, // 首页页码
|
|||
|
|
paginationDetailHAlign: ' hidden',//去除分页的显示
|
|||
|
|
sidePagination: 'server', // 设置为服务器端分页
|
|||
|
|
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
|||
|
|
return {
|
|||
|
|
type: '${Type_column}',
|
|||
|
|
pid: pid
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'insertColumn', // 要排序的字段
|
|||
|
|
sortOrder: 'asc', // 排序规则
|
|||
|
|
columns: [{
|
|||
|
|
field: 'insertcolumn', // 返回json数据中的name
|
|||
|
|
title: '名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return "第" + value + "列";
|
|||
|
|
}
|
|||
|
|
}, {
|
|||
|
|
field: 'rows', // 返回json数据中的name
|
|||
|
|
title: '所占行', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
}, {
|
|||
|
|
field: 'columns', // 返回json数据中的name
|
|||
|
|
title: '所占列', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
}, {
|
|||
|
|
field: 'showtext', // 返回json数据中的name
|
|||
|
|
title: '单元内容', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
}, {
|
|||
|
|
field: 'showtextst', // 返回json数据中的name
|
|||
|
|
title: '输入单元', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
if(value=='${Showtextst_TRUE}'){
|
|||
|
|
return "是";
|
|||
|
|
}else if(value=='${Showtextst_FALSE}'){
|
|||
|
|
return "否";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
// {
|
|||
|
|
// field: 'mpid', // 返回json数据中的name
|
|||
|
|
// title: '测量点', // 表格表头显示文字
|
|||
|
|
// align: 'center', // 左右居中
|
|||
|
|
// valign: 'middle' // 上下居中
|
|||
|
|
// },
|
|||
|
|
{
|
|||
|
|
title: "操作",
|
|||
|
|
align: 'center',
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: 100, // 定义列的宽度,单位为像素px
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return '<div class="btn-group"><button class="btn btn-default btn-sm" onclick="editContentFormForColumnFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>' +
|
|||
|
|
'<button class="btn btn-default btn-sm" onclick="delContentFormForColumnFun(\'' + row.id + '\',\'' + pid + '\')"><i class="fa fa-trash-o"></i></button></div>';
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
onLoadSuccess: function () { //加载成功时执行
|
|||
|
|
adjustBootstrapTableView("table");
|
|||
|
|
console.info("加载数据成功");
|
|||
|
|
},
|
|||
|
|
onLoadError: function () { //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//通过sessionStorage自动展开
|
|||
|
|
var doExpend = function () {
|
|||
|
|
if (sessionStorage.getItem("index") != null) {
|
|||
|
|
$("#contentFormTable").bootstrapTable('expandRow', sessionStorage.getItem("index"));
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function addContentFormRowFun() {
|
|||
|
|
$.post(ext.contextPath + "/work/groupContentForm/dosaveForRow.do", {pid: '${groupContent.id}'}, function (data) {
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
$("#contentFormTable").bootstrapTable('refresh');
|
|||
|
|
setTimeout(doExpend, 500);
|
|||
|
|
} else if (data.code == 0) {
|
|||
|
|
showAlert('d', '保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.msg);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function doContentFormForColumnAddFun(pid) {
|
|||
|
|
$.post(ext.contextPath + '/work/groupContentForm/doadd.do', {pid: pid}, function (data) {
|
|||
|
|
$("#contentFormSubDiv").html(data);
|
|||
|
|
openModal('contentFormSubModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function editContentFormForColumnFun(id) {
|
|||
|
|
$.post(ext.contextPath + '/work/groupContentForm/doedit.do', {id: id}, function (data) {
|
|||
|
|
$("#contentFormSubDiv").html(data);
|
|||
|
|
openModal('contentFormSubModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function delContentFormForRowFun(id) {
|
|||
|
|
swal({
|
|||
|
|
text: "您确定要删除此记录?",
|
|||
|
|
dangerMode: true,
|
|||
|
|
buttons: {
|
|||
|
|
cancel: {
|
|||
|
|
text: "取消",
|
|||
|
|
value: null,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-default btn-sm",
|
|||
|
|
closeModal: true,
|
|||
|
|
},
|
|||
|
|
confirm: {
|
|||
|
|
text: "确定",
|
|||
|
|
value: true,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-danger btn-sm",
|
|||
|
|
closeModal: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
.then(function (willDelete) {
|
|||
|
|
if (willDelete) {
|
|||
|
|
$.post(ext.contextPath + '/work/groupContentForm/dodelForRow.do', {
|
|||
|
|
id: id,
|
|||
|
|
pid: '${groupContent.id}'
|
|||
|
|
}, function (data) {
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
$("#contentFormTable").bootstrapTable('refresh');
|
|||
|
|
setTimeout(doExpend, 500);
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.msg, 'alertDiv');
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function delContentFormForColumnFun(id, pid) {
|
|||
|
|
swal({
|
|||
|
|
text: "您确定要删除此记录?",
|
|||
|
|
dangerMode: true,
|
|||
|
|
buttons: {
|
|||
|
|
cancel: {
|
|||
|
|
text: "取消",
|
|||
|
|
value: null,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-default btn-sm",
|
|||
|
|
closeModal: true,
|
|||
|
|
},
|
|||
|
|
confirm: {
|
|||
|
|
text: "确定",
|
|||
|
|
value: true,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-danger btn-sm",
|
|||
|
|
closeModal: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
.then(function (willDelete) {
|
|||
|
|
if (willDelete) {
|
|||
|
|
$.post(ext.contextPath + '/work/groupContentForm/dodelForColumn.do', {
|
|||
|
|
id: id,
|
|||
|
|
pid: pid
|
|||
|
|
}, function (data) {
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
$("#contentFormTable").bootstrapTable('refresh');
|
|||
|
|
setTimeout(doExpend, 500);
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.msg, 'alertDiv');
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<div class="box box-primary">
|
|||
|
|
<div class="box-header with-border">
|
|||
|
|
<h3 class="box-title">修改</h3>
|
|||
|
|
|
|||
|
|
<div class="box-tools pull-right">
|
|||
|
|
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
|||
|
|
class="glyphicon glyphicon-floppy-disk"></i></a>
|
|||
|
|
<a onclick="dodel()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
|||
|
|
class="glyphicon glyphicon-trash"></i></a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.box-header -->
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<form class="form-horizontal " id="subForm">
|
|||
|
|
<input id="id" name="id" type="hidden" value="${groupContent.id}"/>
|
|||
|
|
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<div id="menu4SelectDiv"></div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">名称</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="name" name="name" placeholder="名称"
|
|||
|
|
value="${groupContent.name }">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">顺序</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="morder" name="morder" placeholder="顺序"
|
|||
|
|
value="${groupContent.morder}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<c:if test="${groupContent.type==Type_Content}">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">班组类型</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select class="form-control select2 " id="grouptypeName" name="grouptypeName"
|
|||
|
|
style="width: 220px;"></select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</c:if>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<c:if test="${groupContent.type==Type_Content}">
|
|||
|
|
<div class="box box-solid" id="box">
|
|||
|
|
<div class="box-header with-border">
|
|||
|
|
<h3 class="box-title">内容配置</h3>
|
|||
|
|
|
|||
|
|
<div class="box-tools pull-right">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<div>
|
|||
|
|
<div id="alertDiv_power"></div>
|
|||
|
|
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
|||
|
|
<button type="button" class="btn btn-default" onclick="addContentFormRowFun();"><i
|
|||
|
|
class="fa fa-plus"></i> 插入行
|
|||
|
|
</button>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<br>
|
|||
|
|
<table id="contentFormTable"></table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</c:if>
|
|||
|
|
|