355 lines
15 KiB
Plaintext
355 lines
15 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" %>
|
||
<script type="text/javascript">
|
||
|
||
$(function () {
|
||
$("#table_Detail").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/data/getCurveProgrammeMpList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
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: '${curve.id}'
|
||
}
|
||
},
|
||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||
//viewFun(row.id);
|
||
},
|
||
columns: [
|
||
{
|
||
checkbox: true // 显示一个勾选框
|
||
// formatter: stateFormatter
|
||
},
|
||
{
|
||
field: 'mpointId', // 返回json数据中的name
|
||
title: '测量点', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
},{
|
||
field: 'mPoint', // 返回json数据中的name
|
||
title: '名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
return row.mPoint.parmname;
|
||
}
|
||
}, {
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '120', // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts = '';
|
||
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="doPersonMPDEdit(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="doPersonMPDDel(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
|
||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||
return buts;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table_Detail");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
})
|
||
|
||
var doPersonMPDEdit = function (id) {
|
||
event.stopPropagation();
|
||
$.post(ext.contextPath + '/data/editMPoint2.do', {unitId: hiddenUnitId, id: id}, function (data) {
|
||
$("#subDetailDiv").html(data);
|
||
openModal('subModal_CurveMp');
|
||
});
|
||
};
|
||
|
||
function doPersonMPDDel(id) {
|
||
event.stopPropagation();
|
||
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 + '/data/deleteMPoint.do', {id: id}, function (data) {
|
||
if (data.code == 1) {
|
||
$("#table_Detail").bootstrapTable('refresh');
|
||
initProgrammeTreeView();
|
||
} else {
|
||
showAlert('d', '删除失败', 'alertDiv');
|
||
}
|
||
}, 'json');
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
<%--function addDetailFun() {--%>
|
||
<%-- $.post(ext.contextPath + '/data/showlistForSelects.do', {pid: '${curve.id}'}, function (data) {--%>
|
||
<%-- $("#mpSubDiv").html(data);--%>
|
||
<%-- openModal('mpSubModal');--%>
|
||
<%-- });--%>
|
||
<%--}--%>
|
||
|
||
function doupdate() {
|
||
$("#curve_Edit2_subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#curve_Edit2_subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/data/updateCurve.do", $("#curve_Edit2_subForm").serialize(), function (result) {
|
||
// var data= $.parseJSON(result);
|
||
if (result.code == 1) {
|
||
closeModal('personSubModal');
|
||
// $("#box").show();
|
||
initProgrammeTreeView();
|
||
// $("#table").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', result.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
$("#curve_Edit2_subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
|
||
function changeToSysCurve() {
|
||
let id = $('#id').val();
|
||
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 + "/data/changeToSysCurve.do", {id: id}, function (result) {
|
||
if (result.code == 1) {
|
||
closeModal('personSubModal');
|
||
// $("#box").show();
|
||
initProgrammeTreeView();
|
||
// $("#table").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', result.res);
|
||
}
|
||
}, 'json');
|
||
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
function select_edit2_mp_mpids() {
|
||
$.post(ext.contextPath + '/work/mpoint/mpointList4LayerES.do', {
|
||
// mpids: mpids,
|
||
mpids: '',
|
||
fucname: 'do_edit2_mp_select'
|
||
}, function (data) {
|
||
$("#mpSelectDiv").html(data);
|
||
openModal('subModalMpoint');
|
||
});
|
||
}
|
||
|
||
function do_edit2_mp_select() {
|
||
var checkedItem = $("#table_mpoint").bootstrapTable('getAllSelections');
|
||
if (checkedItem != null && checkedItem != "") {
|
||
// console.log(checkedItem);
|
||
var mpointids = "";
|
||
for (var i = 0; i < checkedItem.length; i++) {
|
||
mpointids += checkedItem[i].id + ",";
|
||
}
|
||
$.post(ext.contextPath + '/data/saveMPoints.do', {
|
||
companyId: unitId,
|
||
mpointids: mpointids,
|
||
pid: '${curve.id}'
|
||
}, function (resp) {
|
||
//console.info(checkedItem.id)
|
||
$("#table_Detail").bootstrapTable('refresh');
|
||
initProgrammeTreeView();
|
||
// $("#table").bootstrapTable('refresh');
|
||
closeModal('subModalMpoint');
|
||
}, 'json');
|
||
} else {
|
||
showAlert('d', '尚未选择测量点!', 'mpoint_mainAlertdiv');
|
||
}
|
||
|
||
|
||
}
|
||
|
||
var detail_edit2_mpDetailsFun = function() {
|
||
var checkedItems = $("#table_Detail").bootstrapTable('getSelections');
|
||
var datas="";
|
||
$.each(checkedItems, function(index, item){
|
||
datas+=item.id+",";
|
||
});
|
||
if(datas==""){
|
||
showAlert('d','请先选择记录','mainAlertdiv');
|
||
}else{
|
||
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 + '/data/deleteMPoints.do', {ids:datas} , function(data) {
|
||
if(data>0){
|
||
$("#table_Detail").bootstrapTable('refresh');
|
||
initProgrammeTreeView();
|
||
}else{
|
||
showAlert('d','删除失败','mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
},'json');
|
||
}
|
||
};
|
||
|
||
</script>
|
||
|
||
<div class="modal fade" id="personSubModal">
|
||
<div class="modal-dialog modal-md" style="width: 900px;">
|
||
<div class="modal-content" >
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">编辑个人方案</h4>
|
||
</div>
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
|
||
<div class="modal-body">
|
||
<!-- 新增界面formid强制为curve_Edit2_subForm -->
|
||
<form class="form-horizontal" id="curve_Edit2_subForm">
|
||
<input type="hidden" class="form-control" id="id" name="id" value="${curve.id}">
|
||
<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" value="${curve.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" value="${curve.morder}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">曲线类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="curvetype" name="curvetype" class="select2"
|
||
style="height: 34px;padding: 0px 10px;border-color: #d2d6de;">
|
||
<option value="0" <c:if test="${curve.curvetype==0 }">selected</c:if>>折线图</option>
|
||
<option value="1" <c:if test="${curve.curvetype==1 }">selected</c:if>>柱状图</option>
|
||
<option value="2" <c:if test="${curve.curvetype==2 }">selected</c:if>>散点图</option>
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">轴类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="axistype" name="axistype" class="select2"
|
||
style="height: 34px;padding: 0px 10px;border-color: #d2d6de;">
|
||
<option value="1" <c:if test="${curve.axistype==1 }">selected</c:if>>单Y轴</option>
|
||
<option value="0" <c:if test="${curve.axistype==0 }">selected</c:if>>多Y轴</option>
|
||
<option value="2" <c:if test="${curve.axistype==2 }">selected</c:if>>多表</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="remark" name="remark" value="${curve.remark}">
|
||
</div>
|
||
</div>
|
||
<div class="box box-primary">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">方案点</h3>
|
||
|
||
<div class="box-tools pull-right">
|
||
<a onclick="select_edit2_mp_mpids()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="新增"><i class="fa fa-plus"></i></a>
|
||
<a onclick="detail_edit2_mpDetailsFun()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="删除"><i class="fa fa-minus"></i></a>
|
||
|
||
</div>
|
||
<div class="box-body" style="padding-top: 10px;">
|
||
<table id="table_Detail" ></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="changeToSysCurve()">转为系统方案</button>
|
||
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|