Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/data/dataCurve_MPointAdd.jsp
2026-01-16 14:13:44 +08:00

219 lines
8.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ 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">
var addFun = function() {
var mpid= $("#mpid").val();
$.post(ext.contextPath + '/work/scadaPic/addMPointExpression.do', {formId:'addsubForm',hiddenId:'mpid',codeId:'mpid',textId:'txt',valueId :'value',mpid:$("#mpid").val()} , function(data) {
$("#expSubDiv").html(data);
openModal('expSubModal');
//ComponentsDateTimePickers.init();
});
};
var selectMPint = function(pid) {
$.post(ext.contextPath + '/work/mpoint/showlistForSelect.do', {formId:'addsubForm',hiddenId:'mpid',codeId:'mpcode',unitId:'unitId',textId:'txt',valueId :'value',mpid:$("#mpid").val()} , function(data) {
$("#mpSubDiv").html(data);
openModal('mpSubModal');
});
};
$(function() {
$("#box").hide();
showExpression();
})
$('#expressionflag').on("change",function(data){
if($('#expressionflag').val()=='1'){
if($("#mpid").val()==''){
showAlert('d','请选择测量点');
}else{
$("#box").show();
$("#table_express").bootstrapTable('refresh');
}
}else{
$("#box").hide();
}
});
var MpPics;
function showExpression(){
MpPics =JSON.parse(getMpPic());
//$('#grid').datagrid({url:ext.contextPath + '/work/scadaPic/getMPoint_ExpressionList.do?mpid='+mpid});
$table=$("#table_express").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/work/scadaPic/getMPoint_ExpressionList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped : true,
rownumbers : true,
/* singleSelect: false,
ctrlSelect:true,
selectOnCheck: false,
checkOnSelect: false, */
idField : 'id',
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
mpid: $("#mpid").val(),
}
},
//queryParamsType: "limit",
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
/* showColumns: true,
showRefresh: true, */
idField : 'id',
columns : [ [
{checkbox:true },
{width : '160', title : '表达式', field : 'expression', sortable : true, halign:'center'},
{width : '100', title : '显示图标', field : 'expressionway', sortable : true, align:'center',formatter : function(value,row){
//console.log(MpPics[value].path)
var pic='<img src=../../'+MpPics[value].path+' style="width:20px;height:20px;" ></img>';
return pic;
}},
] ],
onLoadSuccess: function(){ //加载成功时执行
adjustBootstrapTableView("table_mpoint");
},
onLoadError: function(){ //加载失败时执行
console.info("加载数据失败");
}
})
}
var deletesFun = function() {
var checkedItems = $("#table_express").bootstrapTable('getSelections');
var datas="";
$.each(checkedItems, function(index, item){
datas+=item.id+",";
});
if(datas==""){
showAlert('d','请先选择要删除的表达式','alertDiv');
}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 + '/work/scadaPic/deleteMPointExpression.do', {ids:datas} , function(data) {
if(data>0){
$("#table_express").bootstrapTable('refresh');
}else{
showAlert('d','删除失败','mainAlertdiv');
}
});
}
});
}
};
function doMpsave() {
$("#addsubForm").bootstrapValidator('validate');//提交验证
if ($("#addsubForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/data/saveMPoint.do", $("#addsubForm").serialize(), function(data) {
if (data.code == 1) {
closeModal('subModal');
$("#box").show();
$("#table").bootstrapTable('refresh');
}else if(data.code == 0){
showAlert('d','保存失败');
}else{
showAlert('d',data.res);
}
},'json');
}
}
$("#addsubForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
mpid: {
validators: {
notEmpty: {
message: '测量点不能为空'
}
}
},
}
});
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">添加测量点</h4>
</div>
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<div class="modal-body">
<!-- 新增界面formid强制为addsubForm -->
<form class="form-horizontal" id="addsubForm">
<div class="form-group">
<label class="col-sm-3 control-label">曲线组合</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="pname" placeholder="上级菜单" onclick="showMenu4SelectFun();" value="${pname}">
<input id="dataCurveId" name="dataCurveId" type="hidden" value="${param.pid}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">测量点编号</label>
<div class="col-sm-7">
<input type="hidden" class="form-control" style="cursor: pointer" id="unitId" name="unitId" value="" >
<input type="hidden" class="form-control" style="cursor: pointer" id="mpcode" >
<input type="text" class="form-control" id="mpid" name ="mpointId" onclick="selectMPint('${param.pid}')" placeholder="单击选择" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">文本内容</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="txt" >
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">顺序</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="morder" name ="morder" value="1">
</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="doMpsave()" >保存</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>