267 lines
11 KiB
Plaintext
267 lines
11 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<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()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
|
||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js" charset="utf-8"></script>
|
||
<script type="text/javascript">
|
||
|
||
var showMenu4SelectFun = function() {
|
||
$.post(ext.contextPath + '/efficiency/constituteConfigure/showTree4Select.do', {formId:"subForm",hiddenId:"pid",textId:"pname"} , function(data) {
|
||
$("#menu4SelectDiv").html(data);
|
||
openModal("menu4SelectModal")
|
||
});
|
||
};
|
||
|
||
function dosave() {
|
||
$.post(ext.contextPath + "/efficiency/constituteConfigure/doupdate.do", $("#subForm").serialize(), function(result) {
|
||
var data= $.parseJSON(result);
|
||
if (data.code == 1) {
|
||
initTreeView();
|
||
}else{
|
||
showAlert('d',data.result);
|
||
}
|
||
});
|
||
}
|
||
|
||
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 + '/efficiency/constituteConfigure/dodel.do', $("#subForm").serialize(), function(result) {
|
||
// var data= $.parseJSON(result);
|
||
if(result.code==1){
|
||
initTreeView();
|
||
}else{
|
||
showAlert('d',result.msg);
|
||
}
|
||
},'json');
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
$(function() {
|
||
// getFileList();
|
||
$("#table").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/efficiency/constituteConfigureDetail/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', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order, // 排序规则
|
||
pid:'${constituteConfigure.id}'
|
||
}
|
||
},
|
||
sortName: 'morder', // 要排序的字段
|
||
sortOrder: 'asc', // 排序规则
|
||
columns: [
|
||
{
|
||
field: 'mpname', // 返回json数据中的name
|
||
title: '测量点名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},{
|
||
field: 'mpid', // 返回json数据中的name
|
||
title: '测量点名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},{
|
||
field: 'type', // 返回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="editDetailFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>'+
|
||
'<button class="btn btn-default btn-sm" onclick="delDetailFun(\'' + 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("加载数据失败");
|
||
},
|
||
onReorderRow: function (newData) {
|
||
//这里的newData是整个表格数据,数组形式
|
||
// console.log("data",newData); //调试用代码
|
||
$.post(ext.contextPath + '/efficiency/constituteConfigureDetail/dosort.do',{ jsondata: JSON.stringify(newData) },//将整张表数据 不能分页
|
||
function(data) {
|
||
if (data == 1) {
|
||
//$("#table").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','数据错误','mainAlertdiv');
|
||
}
|
||
});
|
||
}
|
||
})
|
||
|
||
$("#table").tableDnD();
|
||
});
|
||
|
||
var editDetailFun = function (id) {
|
||
$.post(ext.contextPath + '/efficiency/constituteConfigureDetail/doedit.do', {
|
||
id: id,
|
||
unitId: unitId
|
||
}, function (data) {
|
||
$("#detailDiv").html(data);
|
||
openModal('subDetailModal');
|
||
});
|
||
};
|
||
|
||
function delDetailFun(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 + '/efficiency/constituteConfigureDetail/dodel.do', {id:id}, function(data) {
|
||
console.log(data);
|
||
if(data.code==1){
|
||
$("#table").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','alertDiv');
|
||
}
|
||
},'json');
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
var addMpointFuns = function () {
|
||
$.post(ext.contextPath + '/efficiency/constituteConfigureDetail/showMPoint4Select.do', {pid:'${constituteConfigure.id}'}, function (data) {
|
||
$("#detailMpDiv").html(data);
|
||
openModal('MPointModel');
|
||
});
|
||
};
|
||
|
||
|
||
</script>
|
||
<div class="box box-primary" style="margin-bottom:0px;">
|
||
<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="${constituteConfigure.id}"/>
|
||
<input id="unitid" name="unitid" type="hidden" value="${constituteConfigure.unitid}"/>
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv1"></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="${constituteConfigure.name }">
|
||
</div>
|
||
<label class="col-sm-2 control-label">上级菜单</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="pname" name ="pname" placeholder="上级菜单" onclick="showMenu4SelectFun()" value="${pname}" readonly>
|
||
<input id="pid" name="pid" type="hidden" value="${constituteConfigure.pid}"/>
|
||
</div>
|
||
</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="unit" name ="unit" placeholder="单位" value="${constituteConfigure.unit}">
|
||
</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="${constituteConfigure.morder}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="3" id ="remark" name ="remark" placeholder="请输入">${constituteConfigure.remark}</textarea>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<c:if test="${constituteConfigure.pid!='-1'}">
|
||
<div class="box box-solid">
|
||
<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="detailDiv"></div>
|
||
<div id="detailMpDiv"></div>
|
||
<div id="mpSelectSubDiv"></div>
|
||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||
<button type="button" class="btn btn-default" onclick="addMpointFuns();"><i class="fa fa-plus"></i> 新增</button>
|
||
</div>
|
||
<table id="table" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</c:if>
|