Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/maintenance/maintainerCompanyEdit.jsp

198 lines
8.8 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<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 now = new Date();
var nowtime = now.getFullYear() + "-" +((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"-"+(now.getDate()<10?"0":"")+now.getDate();
function dosaveMaintainerCompany() {
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/maintenance/maintainer/insertMaintainerCompany.do", $("#subForm").serialize(), function(data) {
if (data == 1) {
closeModal('subCompanyModal');
//数据保存成功后将本条数据勾选
if($.inArray("${companyId}", selectionCompanyIds) == -1){
selectionCompanyIds.push("${companyId}");
}
$("#table_company").bootstrapTable('refresh');
}else if(data.res == 0){
showAlert('d','保存失败');
}else{
showAlert('d',data.res);
}
},'json');
}
}
$("#subForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
/* maintainerleader: {
validators: {
notEmpty: {
message: '运维商负责人不能为空'
}
}
}, */
/* factorycontacter: {
validators: {
notEmpty: {
message: '厂区联系人不能为空'
}
}
}, */
startdate: {
validators: {
notEmpty: {
message: '开始日期不能为空'
},
callback: {
message: '开始日期不能大于结束日期 ',
callback:function(value, validator,$field){
var enddate=$('#enddate').val();
var startdate=$('#startdate').val();
if(enddate==""||startdate==""){
return true;
}else{
return enddate>=startdate;
}
}
}
}
},
enddate: {
validators: {
notEmpty: {
message: '结束日期不能为空'
},
callback: {
message: '结束日期不能小于开始日期 ',
callback:function(value, validator,$field){
var enddate=$('#enddate').val();
var startdate=$('#startdate').val();
if(enddate==""||startdate==""){
return true;
}else{
return enddate>=startdate;
}
}
}
}
},
}
});
//选择运维商负责人
var leadernameSelectsFun = function() {
var userIds= $("#maintainerleader").val();
$.post(ext.contextPath + '/user/userForSelect.do', {formId:"subForm",hiddenId:"maintainerleader",textId:"leadername",userIds:userIds,companyId:"${maintainerId}"} , function(data) {
$("#user4SelectDiv").html(data);
openModal("user4SelectModal");
});
};
//选择厂区联系人
var contacternameSelectsFun = function() {
var userIds= $("#factorycontacter").val();
$.post(ext.contextPath + '/user/userForSelect.do', {formId:"subForm",hiddenId:"factorycontacter",textId:"contactername",userIds:userIds,companyId:"${companyId}"} , function(data) {
$("#user4SelectDiv").html(data);
openModal("user4SelectModal");
});
};
$(function() {
//选择开始时间
$('#startdate').datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format:'yyyy-mm-dd',
}).on('hide',function(e) {
$('#subForm').data('bootstrapValidator')
.updateStatus('startdate', 'NOT_VALIDATED',null)
.validateField('startdate');
});
//选择结束时间
$('#enddate').datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format:'yyyy-mm-dd',
}).on('hide',function(e) {
$('#subForm').data('bootstrapValidator')
.updateStatus('enddate', 'NOT_VALIDATED',null)
.validateField('enddate');
});
});
</script>
<div class="modal fade" id="subCompanyModal">
<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">&times;</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" id="maintainerid" name="maintainerid" value="${maintainerId}" >
<input type="hidden" id="companyid" name="companyid" value="${companyId}" >
<div class="form-group">
<label class="col-sm-2 control-label">运维商负责人</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="leadername" name ="leadername" placeholder="请选择负责人" style="width: 220px;" value="${leadername}" onclick="leadernameSelectsFun();">
<input id="maintainerleader" name="maintainerleader" type="hidden" value="${maintainerCompany.maintainerleader}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">厂区联系人</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="contactername" name ="contactername" placeholder="请选择联系人" style="width: 220px;" value="${contactername}" onclick="contacternameSelectsFun();">
<input id="factorycontacter" name="factorycontacter" type="hidden" value="${maintainerCompany.factorycontacter}"/>
</div>
</div>
<div class="form-group " >
<label class="control-label col-sm-2">*开始日期</label>
<div class="col-sm-10">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control" id="startdate" name="startdate" style="width: 182px;" placeholder="请选择" value="${maintainerCompany.startdate.substring(0,10)}"/>
</div>
</div>
</div>
<div class="form-group " >
<label class="control-label col-sm-2">*结束日期</label>
<div class="col-sm-10">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control" id="enddate" name="enddate" style="width: 182px;" placeholder="请选择" value="${maintainerCompany.enddate.substring(0,10)}"/>
</div>
</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="dosaveMaintainerCompany()" id="btn_saveMaintainerCompany">保存</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>