168 lines
6.6 KiB
Plaintext
168 lines
6.6 KiB
Plaintext
<%@page import="com.sipai.tools.CommString"%>
|
||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||
<%request.setAttribute("MainPageType_Produce", CommString.MainPageType_Produce); %>
|
||
<%request.setAttribute("MainPageType_Security", CommString.MainPageType_Security); %>
|
||
<%request.setAttribute("MainPageType_Efficiency", CommString.MainPageType_Efficiency); %>
|
||
|
||
<%request.setAttribute("ChartType_Base", CommString.ChartType_Base); %>
|
||
<%request.setAttribute("ChartType_Gauge", CommString.ChartType_Gauge); %>
|
||
<%request.setAttribute("ChartType_Bar", CommString.ChartType_Bar); %>
|
||
<%request.setAttribute("ChartType_Line", CommString.ChartType_Line); %>
|
||
<script type="text/javascript">
|
||
var selectMPint = function (pid) {
|
||
$.post(ext.contextPath + '/work/mpoint/showlistForSelect.do', { formId: 'subForm', hiddenId: 'mpointId', textId: 'mpointName', mpid: $("#mpointId").val() }, function (data) {
|
||
$("#mpSubDiv").html(data);
|
||
openModal('mpSubModal');
|
||
});
|
||
};
|
||
|
||
function dosave() {
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('mpointName', 'NOT_VALIDATED',null)
|
||
.validateField('mpointName');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/base/mainPage/save.do", $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
closeModal('subModal')
|
||
// $("#table").bootstrapTable('refresh');
|
||
$("#table_mainpage").bootstrapTable('refresh');
|
||
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
|
||
}
|
||
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '用户名不能为空'
|
||
}
|
||
}
|
||
},
|
||
mpointName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '测量点不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
|
||
|
||
|
||
$(function(){
|
||
|
||
$.post(ext.contextPath + "/base/mainPageType/getType4Select.do", {bizId:$('#bizId').val(),mainPageTypeId:$('#mainPageTypeId').val()}, function(data) {
|
||
var selelct =$("#type").select2({
|
||
data: data,
|
||
placeholder:'请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
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;} // 函数用于呈现当前的选择
|
||
});
|
||
|
||
|
||
/*
|
||
$("#type").select2({minimumResultsForSearch: 10});
|
||
fixSelect2ToTool('type');
|
||
$("#showWay").select2({minimumResultsForSearch: 10});
|
||
fixSelect2ToTool('showWay');
|
||
*/
|
||
},'json');
|
||
|
||
})
|
||
</script>
|
||
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog">
|
||
<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 class="modal-body">
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subForm">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">所属公司</label>
|
||
<div class="col-sm-10">
|
||
<input id="bizId" name="bizId" type="hidden" value="${company.id}" />
|
||
<input id="mainPageTypeId" name="mainPageTypeId" type="hidden" value="${mainPageTypeId}" />
|
||
|
||
<p class="form-control-static">${company.name}</p>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">类型</label>
|
||
<div class="col-sm-5">
|
||
<select class="form-control select2" id="type" name="type" style="width:220px;">
|
||
<!--
|
||
<c:forEach items="${list}" var="item">
|
||
<c:if test="${mainPageTypeId eq item.id}">
|
||
<option value="${item.id}" selected="selected">${item.title}</option>
|
||
</c:if>
|
||
</c:forEach>
|
||
-->
|
||
</select>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*测量点</label>
|
||
<div class="col-sm-5">
|
||
<input type="text" class="form-control" style="cursor: pointer" id="mpointName" name="mpointName"
|
||
onclick="selectMPint()" placeholder="单击选择" />
|
||
<input type="hidden" id="mpointId" name="mpointId" />
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">展示样式</label>
|
||
<div class="col-sm-5">
|
||
<select class="form-control select2" id="showWay" name="showWay">
|
||
<option value="${ChartType_Base}" selected="selected">基础</option>
|
||
<option value="${ChartType_Gauge}">仪表</option>
|
||
<option value="${ChartType_Bar}">柱状图</option>
|
||
<option value="${ChartType_Line}">折线</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">顺序</label>
|
||
|
||
<div class="col-sm-5">
|
||
<input type="number" class="form-control" id="morder" name="morder" placeholder="顺序">
|
||
</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="dosave()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|
||
<!-- 新增 -->
|
||
<div id="mpSubDiv"></div>
|
||
|