305 lines
13 KiB
Plaintext
305 lines
13 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@page import="com.sipai.tools.CommString"%>
|
||
<%@page import="com.sipai.entity.valueEngineering.EquipmentModel"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<%request.setAttribute("Active_False", CommString.Active_False); %>
|
||
<%request.setAttribute("Active_True", CommString.Active_True); %>
|
||
<%request.setAttribute("Flag_Reset_Param1", EquipmentModel.Flag_Reset_Param1); %>
|
||
<%request.setAttribute("Flag_Reset_Param2", EquipmentModel.Flag_Reset_Param2); %>
|
||
<%request.setAttribute("Flag_Reset_Param3", EquipmentModel.Flag_Reset_Param3); %>
|
||
<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 refreshActiveSelect = function() {
|
||
var select = $("#status").select2({
|
||
data: null,
|
||
placeholder:'请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
});
|
||
select.val('${equipmentModel.status}').trigger("change");
|
||
|
||
};
|
||
$(function(){
|
||
refreshActiveSelect();
|
||
})
|
||
function doupdate() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
setTimeout(function(){
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/valueEngineering/equipmentModel/update.do",$("#subForm").serialize(), function(data) {
|
||
console.log($("#subForm").serialize());
|
||
if (data.res == 1){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败','alertDiv');
|
||
}else{
|
||
showAlert('d',data.res,'alertDiv');
|
||
}
|
||
},'json');
|
||
}
|
||
}, 100);
|
||
|
||
}
|
||
//残值率重置
|
||
function doresetGama() {
|
||
var flag = $("#gama").data("flag");
|
||
var value = $("#gama").val();
|
||
var id = $("#id").val();
|
||
setTimeout(function(){
|
||
showAlert('s','正在重置','alertDiv');
|
||
$.post(ext.contextPath + "/valueEngineering/equipmentModel/reset.do", {flag:flag,id:id,value:value}, function(data) {
|
||
console.log($("#subForm").serialize());
|
||
|
||
if (data.res == 1){
|
||
/* closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh'); */
|
||
$.post(ext.contextPath + "/valueEngineering/equipmentModel/update.do",$("#subForm").serialize(), function(data) {
|
||
console.log($("#subForm").serialize());
|
||
if (data.res == 1){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败','alertDiv');
|
||
}else{
|
||
showAlert('d',data.res,'alertDiv');
|
||
}
|
||
},'json');
|
||
}else if(data.res == 0){
|
||
showAlert('d','重置失败','alertDiv');
|
||
}else{
|
||
showAlert('d',data.res,'alertDiv');
|
||
}
|
||
},'json');
|
||
}, 100);
|
||
}
|
||
//设备物理寿命设置
|
||
function doresetParam2() {
|
||
var flag = $("#param2").data("flag");
|
||
var value = $("#param2").val();
|
||
var id = $("#id").val();
|
||
setTimeout(function(){
|
||
showAlert('s','正在重置','alertDiv');
|
||
$.post(ext.contextPath + "/valueEngineering/equipmentModel/reset.do", {flag:flag,id:id,value:value}, function(data) {
|
||
console.log($("#subForm").serialize());
|
||
if (data.res == 1){
|
||
/* closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh'); */
|
||
$.post(ext.contextPath + "/valueEngineering/equipmentModel/update.do",$("#subForm").serialize(), function(data) {
|
||
console.log($("#subForm").serialize());
|
||
if (data.res == 1){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败','alertDiv');
|
||
}else{
|
||
showAlert('d',data.res,'alertDiv');
|
||
}
|
||
},'json');
|
||
}else if(data.res == 0){
|
||
showAlert('d','重置失败','alertDiv');
|
||
}else{
|
||
showAlert('d',data.res,'alertDiv');
|
||
}
|
||
},'json');
|
||
}, 100);
|
||
}
|
||
//设备技术寿命重置
|
||
function doresetParam3() {
|
||
var flag = $("#param3").data("flag");
|
||
var value = $("#param3").val();
|
||
var id = $("#id").val();
|
||
setTimeout(function(){
|
||
showAlert('s','正在重置','alertDiv');
|
||
$.post(ext.contextPath + "/valueEngineering/equipmentModel/reset.do", {flag:flag,id:id,value:value}, function(data) {
|
||
console.log($("#subForm").serialize());
|
||
if (data.res == 1){
|
||
/* closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh'); */
|
||
$.post(ext.contextPath + "/valueEngineering/equipmentModel/update.do",$("#subForm").serialize(), function(data) {
|
||
console.log($("#subForm").serialize());
|
||
if (data.res == 1){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败','alertDiv');
|
||
}else{
|
||
showAlert('d',data.res,'alertDiv');
|
||
}
|
||
},'json');
|
||
}else if(data.res == 0){
|
||
showAlert('d','重置失败','alertDiv');
|
||
}else{
|
||
showAlert('d',data.res,'alertDiv');
|
||
}
|
||
},'json');
|
||
}, 100);
|
||
}
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
x1: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '经济指标权重不能为空'
|
||
},
|
||
},
|
||
},
|
||
x2: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '效率指标权重不能为空'
|
||
},
|
||
},
|
||
},
|
||
x3: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '质量指标权重不能为空'
|
||
},
|
||
},
|
||
},
|
||
gama: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '残值率不能为空'
|
||
},
|
||
},
|
||
},
|
||
param1: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '报警时限(年)不能为空'
|
||
},
|
||
},
|
||
},
|
||
param2: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备技术寿命(年)不能为空'
|
||
},
|
||
},
|
||
},
|
||
param3: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备技术寿命(年)不能为空'
|
||
},
|
||
},
|
||
},
|
||
}
|
||
});
|
||
|
||
function domoney(txtvalue) {
|
||
var value=1-parseFloat($("#x1").val())-parseFloat($("#x2").val());
|
||
$("#x3").val(value.toFixed(2));
|
||
}
|
||
</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">
|
||
<input class="form-control" name="id" type="hidden" value="${equipmentModel.id }">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*经济指标权重</label>
|
||
<div class="col-sm-6">
|
||
<input class="form-control" id="x1" name="x1" type="number" step="0.01" maxlength="4" value="${equipmentModel.x1 }" min="0" onkeyup="domoney(this.value)"
|
||
onblur="domoney(this.value)">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*效率指标权重</label>
|
||
<div class="col-sm-6">
|
||
<input class="form-control" id="x2" name="x2" type="number" step="0.01" maxlength="4" value="${equipmentModel.x2 }" min="0" onkeyup="domoney(this.value)"
|
||
onblur="domoney(this.value)">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*质量指标权重</label>
|
||
<div class="col-sm-6">
|
||
<input class="form-control" id="x3" name="x3" type="number" step="0.01" maxlength="4" min="0" value="${equipmentModel.x3 }">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*残值率</label>
|
||
<div class="col-sm-6">
|
||
<input class="form-control" id="gama" name="gama" type="number" step="0.01" maxlength="4" min="0" data-flag="${Flag_Reset_Param1}" value="${equipmentModel.gama }">
|
||
</div>
|
||
<c:if test="${equipmentModel.status == Active_True }">
|
||
<div class="col-sm-1">
|
||
<button type="button" class=" btn btn-primary" onclick="doresetGama()" id="btn_save">重置所有设备</button>
|
||
</div>
|
||
</c:if>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*报警时限(年)</label>
|
||
<div class="col-sm-6 ">
|
||
<input class="form-control " id="param1" name="param1" type="number" step="0.1" maxlength="4" min="0" value="${equipmentModel.param1 }">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*设备物理寿命(年)</label>
|
||
<div class="col-sm-6 ">
|
||
<input class="form-control " id="param2" name="param2" type="number" step="0.1" maxlength="4" min="0" data-flag="${Flag_Reset_Param2}" value="${equipmentModel.param2 }">
|
||
</div>
|
||
<c:if test="${equipmentModel.status == Active_True }">
|
||
<div class="col-sm-1">
|
||
<button type="button" class=" btn btn-primary" onclick="doresetParam2()" id="btn_save">重置所有设备</button>
|
||
</div>
|
||
</c:if>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*设备技术寿命(年)</label>
|
||
<div class="col-sm-6 ">
|
||
<input class="form-control " id="param3" name="param3" type="number" step="0.1" maxlength="4" min="0" data-flag="${Flag_Reset_Param3}" value="${equipmentModel.param3 }">
|
||
</div>
|
||
<c:if test="${equipmentModel.status == Active_True }">
|
||
<div class="col-sm-1">
|
||
<button type="button" class=" btn btn-primary" onclick="doresetParam3()" id="btn_save">重置所有设备</button>
|
||
</div>
|
||
</c:if>
|
||
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">状态</label>
|
||
<div class="col-sm-6">
|
||
<select id= "status" name="status" class="form-control select2">
|
||
<option value="${Active_True}">启用</option>
|
||
<option value="${Active_False}">禁用</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default " data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|