400 lines
17 KiB
Plaintext
400 lines
17 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.data.DataCurve" %>
|
||
<% request.setAttribute("Type_group", DataCurve.Type_group);%>
|
||
<% request.setAttribute("Type_sys", DataCurve.Type_sys);%>
|
||
<% request.setAttribute("Type_user", DataCurve.Type_user);%>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 34px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
var unitId = '${param.unitId}'
|
||
var showMenu4SelectFun = function () {
|
||
$.post(ext.contextPath + '/data/showMenu4Select.do', {
|
||
formId: "subForm",
|
||
hiddenId: "pid",
|
||
textId: "pname",
|
||
ownId: '${curve.id}'
|
||
}, function (data) {
|
||
$("#menu4SelectDiv").html(data);
|
||
openModal("menu4SelectModal")
|
||
});
|
||
};
|
||
|
||
function doFAsave() {
|
||
$.post(ext.contextPath + "/data/updateCurve.do", $("#subForm").serialize(), function (result) {
|
||
var data = $.parseJSON(result);
|
||
if (data.code == 1) {
|
||
initTreeView();
|
||
//showAlert('s','保存成功');
|
||
} else {
|
||
showAlert('d', data.msg);
|
||
}
|
||
});
|
||
}
|
||
|
||
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 + '/data/deleteCurve.do', $("#subForm").serialize(), function (result) {
|
||
// var data= $.parseJSON(result);
|
||
if (result.code == 1) {
|
||
initTreeView();
|
||
} else {
|
||
showAlert('d', result.msg);
|
||
}
|
||
}, 'json');
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
function delMpointFun(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 + '/data/deleteMPoint.do', {id: id}, function (data) {
|
||
|
||
if (data.code == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'alertDiv');
|
||
}
|
||
}, 'json');
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
//多删
|
||
var delMpointFuns = function () {
|
||
var checkedItems = $("#table").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").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
var addMpointFun = function () {
|
||
$.post(ext.contextPath + '/data/addMPoint.do', {pid: '${curve.id}'}, function (data) {
|
||
$("#subDiv").html(data);
|
||
openModal('subModal');
|
||
//ComponentsDateTimePickers.init();
|
||
|
||
});
|
||
};
|
||
|
||
var addMpointFuns = function (pid) {
|
||
$.post(ext.contextPath + '/data/showlistForSelects.do', {pid: '${curve.id}'}, function (data) {
|
||
$("#mpSubDiv").html(data);
|
||
openModal('mpSubModal');
|
||
});
|
||
};
|
||
|
||
var editMpointFun = function (id) {
|
||
$.post(ext.contextPath + '/data/editMPoint.do', {unitId: unitId, id: id, pid: '${curve.id}'}, function (data) {
|
||
$("#subDiv").html(data);
|
||
openModal('subModal');
|
||
//ComponentsDateTimePickers.init();
|
||
});
|
||
};
|
||
|
||
function addProgrammeFun() {
|
||
$.post(ext.contextPath + '/data/addSYSCurve.do', {unitId: unitId, pid: '${curve.id}'}, function (data) {
|
||
$("#subDiv").html(data);
|
||
openModal('programmeSubModal');
|
||
});
|
||
}
|
||
|
||
|
||
$(function () {
|
||
$("#table").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/data/getMPointList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
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, // 排序规则
|
||
id: '${curve.id}',
|
||
unitId: unitId
|
||
}
|
||
},
|
||
sortName: 'morder', // 要排序的字段
|
||
sortOrder: 'asc', // 排序规则
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
},
|
||
{
|
||
field: 'mPoint', // 返回json数据中的name
|
||
title: '测量点编号', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
return value == null ? '' : value.mpointcode;
|
||
},
|
||
}, {
|
||
field: 'mPoint', // 返回json数据中的name
|
||
title: '测量点名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
return value == null ? '' : value.parmname;
|
||
},
|
||
}, {
|
||
field: 'morder', // 返回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="editMpointFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>' +
|
||
'<button class="btn btn-default btn-sm" onclick="delMpointFun(\'' + 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); //调试用代码
|
||
var ids = "";
|
||
for (let index = 0; index < newData.length; index++) {
|
||
const element = newData[index];
|
||
ids += element.id + ",";
|
||
}
|
||
$.post(ext.contextPath + '/data/docurveMpointsort.do', {ids: ids},//将整张表数据 不能分页
|
||
function (data) {
|
||
if (data == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '数据错误', 'mainAlertdiv');
|
||
}
|
||
});
|
||
}
|
||
})
|
||
$("#table").tableDnD();
|
||
});
|
||
</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="doFAsave()" 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>
|
||
<c:if test="${curve.type==Type_group}">
|
||
<a onclick="addProgrammeFun()" style="cursor: pointer;" class="fa fa-cloud-download"
|
||
data-toggle="tooltip" title="系统曲线"></a>
|
||
</c:if>
|
||
</div>
|
||
</div>
|
||
<!-- /.box-header -->
|
||
<div class="box-body ">
|
||
<form class="form-horizontal " id="subForm">
|
||
<input id="id" name="id" type="hidden" value="${curve.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="${curve.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();"
|
||
<c:if test="${curve.pid=='-1'}">value="-1" </c:if>
|
||
<c:if test="${curve.pid!='-1'}">value="${curve.pname}"</c:if> readonly>
|
||
<input id="pid" name="pid" type="hidden" value="${curve.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="morder" name="morder" placeholder="顺序"
|
||
value="${curve.morder}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="type" name="type" class="form-control select2">
|
||
<option value="${Type_group}" <c:if test="${curve.type==Type_group }">selected</c:if>>分组
|
||
</option>
|
||
<option value="${Type_sys}" <c:if test="${curve.type==Type_sys }">selected</c:if>>系统曲线</option>
|
||
<!-- <option value="${Type_user}" <c:if test="${curve.type==Type_user }">selected</c:if>>用户曲线</option> -->
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<c:if test="${curve.type!=Type_group}">
|
||
<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>
|
||
</c:if>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="remark" name="remark" value="${curve.remark}">
|
||
</div>
|
||
</div>
|
||
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<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="alertDiv_power"></div>
|
||
<div class="btn-group" style="width: 280px;padding-bottom:10px;">
|
||
<c:if test="${curve.type!=Type_group}">
|
||
<%-- <button type="button" class="btn btn-default" onclick="addMpointFun();"><i class="fa fa-plus"></i>--%>
|
||
<%-- 新增--%>
|
||
<%-- </button>--%>
|
||
<button type="button" class="btn btn-default" style="margin-left: 10px;" onclick="addMpointFuns();">
|
||
<i class="fa fa-plus"></i>新增
|
||
</button>
|
||
<button type="button" class="btn btn-default" style="margin-left: 10px;" onclick="delMpointFuns();">
|
||
<i class="fa fa-trash-o"></i>删除
|
||
</button>
|
||
</c:if>
|
||
<!-- <button type="button" class="btn btn-default" onclick="saveDefault();"><i class="fa fa-plus-square"></i> 默认</button> -->
|
||
|
||
</div>
|
||
<div id="powerDiv"></div>
|
||
<div id="menu4SelectDiv_func"></div>
|
||
<br>
|
||
<table id="table" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|