265 lines
8.6 KiB
Plaintext
265 lines
8.6 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@page import="com.sipai.entity.equipment.EquipmentCommStr"%>
|
||
<%request.setAttribute("EquipmentLife_Standard_Trade", EquipmentCommStr.EquipmentLife_Standard_Trade); %>
|
||
<%request.setAttribute("EquipmentLife_Standard_Supplier", EquipmentCommStr.EquipmentLife_Standard_Supplier); %>
|
||
<%request.setAttribute("EquipmentLife_Standard_Enterprise", EquipmentCommStr.EquipmentLife_Standard_Enterprise); %>
|
||
<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">
|
||
|
||
function dosave(){
|
||
|
||
var equipmentCodeRuleForm = $("#subForm").serialize();
|
||
console.log({equipmentCodeRuleForm});
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
var isExistMark=isExistEquipmentCodeRule(equipmentCodeRuleForm);
|
||
//如果不存在就调用保存的方法
|
||
if(false===isExistMark){
|
||
var saveMark=saveEquipmentCodeRule(equipmentCodeRuleForm);
|
||
//console.log("saveMark=============="+saveMark);
|
||
if(true===saveMark){
|
||
//保存设备编码成功提示
|
||
showAlert('s', '设备编码保存成功');
|
||
setTimeout(function(){ closeModal('subModal'); },300);
|
||
$("#table").bootstrapTable('refresh');
|
||
}else{
|
||
//保存设备编码失败提示
|
||
showAlert('d', '设备编码保存失败');
|
||
}
|
||
}else{
|
||
//如果存在就提示
|
||
showAlert('d', '设备编码已存在');
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
function isExistEquipmentCodeRule(data){
|
||
|
||
var isExistMark=false;
|
||
$.ajax({
|
||
url : ext.contextPath
|
||
+ "/equipment/equipmentCodeRule/isExistEquipmentCodeRule.do",
|
||
type : "post",
|
||
cache : false,
|
||
data:data,
|
||
dataType : "json",
|
||
async:false,
|
||
success : function(result) {
|
||
var message=result['message'];
|
||
if(message===1){
|
||
//console.log("isExistEquipmentCode=========调用了我====================");
|
||
isExistMark=true;
|
||
}
|
||
}
|
||
});
|
||
return isExistMark;
|
||
}
|
||
|
||
function saveEquipmentCodeRule(data){
|
||
var saveMark=false;
|
||
$.ajax({
|
||
url : ext.contextPath
|
||
+ "/equipment/equipmentCodeRule/saveEquipmentCodeRule.do",
|
||
type : "post",
|
||
cache : false,
|
||
data:data,
|
||
dataType : "json",
|
||
async:false,
|
||
success : function(result) {
|
||
var message=result['message'];
|
||
if(message===1){
|
||
//console.log("saveEquipmentCode 调用了我=================");
|
||
saveMark=true;
|
||
}
|
||
|
||
}
|
||
});
|
||
return saveMark;
|
||
}
|
||
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
//live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
aliasName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '名称不能为空'
|
||
},
|
||
|
||
}
|
||
},
|
||
codeName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '编码名称不能为空'
|
||
},
|
||
|
||
}
|
||
},
|
||
|
||
codeNum: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '编码长度不能为空'
|
||
},
|
||
|
||
}
|
||
},
|
||
|
||
morder: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '顺序不能为空'
|
||
},
|
||
|
||
}
|
||
},
|
||
}
|
||
});
|
||
|
||
|
||
/* function dosave() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
setTimeout(function () {
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/equipment/equipmentClass/dosave.do", $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
$("#equipmentClassId").val(data.id);
|
||
$.post(ext.contextPath + "/equipment/equipmentClass/doSaveProp.do", $("#propForm").serialize(), function (datap) {
|
||
if (datap.res == 1) {
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
} else if (datap.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', datap.res);
|
||
}
|
||
}, 'json');
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}, 100);
|
||
} */
|
||
|
||
//输入框验证
|
||
/* $("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备等级名称不能为空'
|
||
},
|
||
remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值,获得一个json数据。例表示正确:{"valid",true}
|
||
url: ext.contextPath + '/equipment/equipmentClass/checkExist.do',//验证地址
|
||
message: '名称已存在',//提示消息
|
||
type: 'POST',//请求方式
|
||
data: function (validator) {
|
||
return {
|
||
name: $('#name').val()
|
||
};
|
||
}
|
||
},
|
||
}
|
||
},
|
||
}
|
||
}); */
|
||
|
||
/* $(function () {
|
||
$("#ecoLifeSetRes").select2({ minimumResultsForSearch: 10 }).val('${EquipmentLife_Standard_Trade}').trigger("change");
|
||
$("#maintainceFeeSetRes").select2({ minimumResultsForSearch: 10 }).val('${EquipmentLife_Standard_Trade}').trigger("change");
|
||
}) */
|
||
|
||
//从设备编码库寻找设备编码名称
|
||
var selectEquipmentCodeName = function() {
|
||
$.post(ext.contextPath + '/equipment/equipmentCodeLibrary/selectEquipmentCodeName.do', {id:$('#codeFieldId').val()} , function(data) {
|
||
$("#equipmentCodeNameSubDiv").html(data);
|
||
openModal('equipmentCodeNameSubModal');
|
||
});
|
||
};
|
||
|
||
</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-6">
|
||
<input class="form-control" type="text" id="aliasName" name="aliasName" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">编码名称</label>
|
||
<div class="col-sm-6">
|
||
<input class="form-control" type="text" id="codeName" name="codeName" onclick="selectEquipmentCodeName()" readonly placeholder="点击选择"/>
|
||
<input type="hidden" id="tableName" name="tableName" />
|
||
<input type="hidden" id="tableColumn" name="tableColumn" />
|
||
<input type="hidden" id="codeField" name="codeField" />
|
||
<input type="hidden" id="codeFieldId" name="codeFieldId" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">编码长度</label>
|
||
<div class="col-sm-6">
|
||
<input class="form-control" type="number" id="codeNum" name="codeNum" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">编码归属</label>
|
||
<div class="col-sm-6">
|
||
<select id="name" name="type" class="form-control">
|
||
<option value="0" selected>设备编码</option>
|
||
<option value="1">物资编码</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">顺序</label>
|
||
<div class="col-sm-6">
|
||
<input class="form-control" type="number" id="morder" name="morder" />
|
||
</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> |