Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/work/KPIPointAdd.jsp
2026-01-16 14:13:44 +08:00

217 lines
9.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ 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">
var selectMPint = function(pid) {
$.post(ext.contextPath + '/work/mpoint/showlistForSelect.do', {formId:'subForm',hiddenId:'mpid',codeId:'mpcode',textId:'txt',valueId :'value',mpid:$("#mpid").val()} , function(data) {
$("#mpSubDiv").html(data);
openModal('mpSubModal');
});
};
function dosave() {
$("#subForm").bootstrapValidator('validate');//提交验证
setTimeout(function(){
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$("#hidden_bizid").val(unitId);
$.post(ext.contextPath + "/work/kpipoint/save.do", $("#subForm").serialize(), function(data) {
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);
}
//输入框验证
$("#subForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
mpointid: {
validators: {
notEmpty: {
message: '测量点不能为空'
},
},
},
bizid: {
validators: {
notEmpty: {
message: '厂区不能为空'
},
},
},
processsectionid: {
validators: {
notEmpty: {
message: '工艺段不能为空'
},
},
},
grade: {
validators: {
notEmpty: {
message: '重要等级不能为空'
}
}
},
/* processsectionid: {
validators: {
notEmpty: {
message: '工艺段不能为空'
}
}
}, */
}
});
//初始化工艺段选择框
var refreshSelect = function() {
$("#processsectionid").select2({
data: null,
placeholder:'请先选择厂区',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
});
};
$(function(){
console.log(unitId);
//选择厂区
$.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
//选择厂区为一个厂时隐藏选择框
if(data.length == 1){
$("#bizid").css("display", "none");
$("#input_bizid").val(data[0].text);
$("#hidden_bizid").val(data[0].id);
var companyId = data[0].id;
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
$("#processsectionid").empty();
var selelct_ =$("#processsectionid").select2({
data: data,
cache : false,
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;} // 函数用于呈现当前的选择
});
if(data!=null && data.length>0){
selelct_.val(data[0].id).trigger("change");
}
},'json');
}else{
$("#hidden_bizid").attr("disabled","disabled");
$("#input_bizid").css("display", "none");
refreshSelect();
var selelct =$("#bizid").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;} // 函数用于呈现当前的选择
});
selelct.val('').trigger("change");
selelct.on("change",function(e){
var companyId= $(this).val();
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
$("#processsectionid").empty();
var selelct_ =$("#processsectionid").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;} // 函数用于呈现当前的选择
});
selelct_.val('${kPIPoint.processsectionid}').trigger("change");
},'json');
});
}
},'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">&times;</span></button>
<h4 class="modal-title">新增KPI测量点</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-3 control-label">*所属厂区</label>
<div class="col-sm-7">
<select class="form-control select2" id="bizid" name ="bizid" style="width: 270px;">
</select>
<input class="form-control" id="input_bizid" style="border: none;background: transparent;">
<input type="hidden" id="hidden_bizid" name ="bizid">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">*工艺段</label>
<div class="col-sm-7">
<select class="form-control select2" id="processsectionid" name ="processsectionid" style="width: 270px;">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">*测量点编号</label>
<div class="col-sm-7">
<input type="hidden" class="form-control" style="cursor: pointer"id="mpcode" >
<input type="text" class="form-control" style="cursor: pointer"id="mpid" name="mpointid" onclick="selectMPint('')" placeholder="单击选择" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">测量点名称</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="txt" placeholder="测量点名称" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">*重要等级</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="grade" name ="grade" placeholder="重要等级" value="1">
</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>