194 lines
8.3 KiB
Plaintext
194 lines
8.3 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8" %>
|
||
<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() {
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('sdt', 'NOT_VALIDATED', null)
|
||
.validateField('sdt');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('edt', 'NOT_VALIDATED', null)
|
||
.validateField('edt');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('grouptypeName', 'NOT_VALIDATED', null)
|
||
.validateField('grouptypeName');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/work/groupTime/doupdate.do", $("#subForm").serialize(), function (data) {
|
||
if (data.code == 1) {
|
||
// showAlert('s', '保存成功');
|
||
closeModal('subModal')
|
||
$("#table").bootstrapTable('refresh');
|
||
} else if (data.code == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
//选择设备,根据厂区id和工艺段id选择厂内设备,可多选
|
||
var showEquipment4SelectsFun = function (formId, hiddenId, textId) {
|
||
$.post(ext.contextPath + '/work/groupType/showGroupType4Select.do', {
|
||
formId: formId,
|
||
hiddenId: hiddenId,
|
||
textId: textId
|
||
}, function (data) {
|
||
$("#equ4SelectDiv").html(data);
|
||
openModal("menu4SelectModal");
|
||
});
|
||
};
|
||
|
||
$(function () {
|
||
$('#sdt').timepicker({
|
||
showMeridian: false
|
||
}).on('hide', function (e) {
|
||
//当日期选择框关闭时,执行刷新校验
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('sdt', 'NOT_VALIDATED', null)
|
||
.validateField('sdt');
|
||
});
|
||
//日期格式需对齐,不然会不准
|
||
$('#edt').timepicker({
|
||
showMeridian: false
|
||
}).on('hide', function (e) {
|
||
//当日期选择框关闭时,执行刷新校验
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('edt', 'NOT_VALIDATED', null)
|
||
.validateField('edt');
|
||
});
|
||
});
|
||
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
sdt: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '开始时间不能为空'
|
||
}
|
||
}
|
||
},
|
||
edt: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '结束时间不能为空'
|
||
}
|
||
}
|
||
},
|
||
grouptypeName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '班组类型不能为空'
|
||
}
|
||
}
|
||
},
|
||
edtadd: {
|
||
validators: {
|
||
callback: {
|
||
callback: function (value, validator, $field) {
|
||
if (Number(value) == 0 || Number(value) == 1) {
|
||
return true
|
||
} else {
|
||
return {
|
||
valid: false,
|
||
message: '只能输入0或者1!'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
</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>
|
||
<input type="hidden" class="form-control" id="id" name="id" value="${groupTime.id}">
|
||
<input type="hidden" class="form-control" id="unitId" name="unitId" value="${groupTime.unitId}">
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*名称</label>
|
||
<div class="col-sm-4">
|
||
<input class="form-control" type="text" id="name" name="name" value="${groupTime.name}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">*班组类型</label>
|
||
<div class="col-sm-4">
|
||
<input class="form-control" id="grouptypeId" name="grouptypeId" type="hidden"
|
||
value="${groupTime.grouptypeId}"/>
|
||
<input class="form-control" type="text" id="grouptypeName" name="grouptypeName"
|
||
value="${groupTime.groupType.name}"
|
||
onclick="showEquipment4SelectsFun('subForm','grouptypeId','grouptypeName');"
|
||
placeholder="选择班组类型">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*开始时间</label>
|
||
<div class="col-sm-4">
|
||
<input class="form-control" type="text" id="sdt" name="sdt" value="${groupTime.sdt}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">*结束时间</label>
|
||
<div class="col-sm-4">
|
||
<div class="col-sm-7" style="padding-left: 0px;">
|
||
<input class="form-control" type="text" id="edt" name="edt" value="${groupTime.edt}">
|
||
</div>
|
||
<div class="col-sm-5" style="padding-left: 0px;padding-right: 0px;">
|
||
<div style="float: left;width: 80%;">
|
||
<input class="form-control" type="number" id="edtadd" name="edtadd"
|
||
value="${groupTime.edtadd}">
|
||
</div>
|
||
<div style="float: left;width: 20%;line-height: 34px;"> 天</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">延长时间</label>
|
||
<div class="col-sm-4">
|
||
<div style="float: left;width: 80%;">
|
||
<input class="form-control" type="number" id="timeexpand" name="timeexpand"
|
||
value="${groupTime.timeexpand}">
|
||
</div>
|
||
<div style="float: left;width: 20%;line-height: 34px;"> 分钟</div>
|
||
</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="dosave()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|