201 lines
8.8 KiB
Plaintext
201 lines
8.8 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").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/administration/index/save.do", $("#subForm").serialize(), function(data) {
|
||
if (data.res == 1){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
}
|
||
}
|
||
|
||
var showUser4SelectsFun = function(hiddenId,textId) {
|
||
var userIds= $("#"+hiddenId).val();
|
||
$.post(ext.contextPath + '/user/userForSelect.do', {formId:"subForm",hiddenId:hiddenId,textId:textId,userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
$(function(){
|
||
//选择部门
|
||
$.post(ext.contextPath + "/user/getDeptByBizId4Select.do", {companyId:'${param.companyId}'}, function(data) {
|
||
var selelct = $("#deptid").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");
|
||
},'json');
|
||
});
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '指标名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
code: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '指标编号不能为空'
|
||
}
|
||
}
|
||
},
|
||
userid: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '责任人不能为空'
|
||
}
|
||
}
|
||
},
|
||
/* deptid: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '责任部门不能为空'
|
||
}
|
||
}
|
||
}, */
|
||
budget: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '年度预算总额不能为空'
|
||
}
|
||
}
|
||
},
|
||
classid: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '指标类型不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
//选择物品类别
|
||
var showIndexClass4SelectFun = function() {
|
||
$.post(ext.contextPath + '/administration/indexClass/showList4Select.do', {formId:"subForm",hiddenId:"pid",textId:"pname"} , function(data) {
|
||
$("#fault4SelectDiv").html(data);
|
||
openModal('fault4SelectModal');
|
||
});
|
||
};
|
||
|
||
//初始化部门
|
||
var refreshSelect = function(companyId) {
|
||
$.post(ext.contextPath + "/user/getDeptByBizId4Select.do", {companyId:companyId}, function(data) {
|
||
//$("#deptId").empty();
|
||
var selelct_ =$("#deptId").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('${index.deptId}').trigger("change");
|
||
},'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">×</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" name ="id" value="${index.id}">
|
||
<input id="unitId" name="unitId" type="hidden" value="${param.companyId}">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*指标编号</label>
|
||
<div class="col-sm-6">
|
||
<input type="text" class="form-control" id="code" name ="code" placeholder="编号" autocomplete="off" value="${index.code}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*指标名称</label>
|
||
<div class="col-sm-6">
|
||
<input type="text" class="form-control" id="name" name ="name" placeholder="名称" value="${index.name}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*指标类型</label>
|
||
<div class="col-sm-6">
|
||
<input type="text" class="form-control" id="pname" placeholder="请选择" onclick="showIndexClass4SelectFun();" value="${index.indexClass.name}" readonly>
|
||
<input id="pid" name="classid" type="hidden" value="${index.classid}"/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-md-2 col-sm-2 control-label">责任部门</label>
|
||
<div class="col-sm-6">
|
||
<select class="form-control" id="deptid" name ="deptid" style="width: 100%;" >
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-md-2 col-sm-2 control-label">*责任人</label>
|
||
<div class="col-sm-6">
|
||
<input type="text" class="form-control" id="userName" name ="userName" placeholder="点击选择"
|
||
onclick="showUser4SelectsFun('userid','userName');" value="${index.userName}">
|
||
<input type="hidden" class="form-control" id="userid" name ="userid" value="${index.userid}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*年度预算总额(元)</label>
|
||
<div class="col-sm-6">
|
||
<input type="text" class="form-control" id="budget" name ="budget" placeholder="年度预算总额" value="${index.budget}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="2" id ="remarks" name ="remarks" placeholder="备注...">${index.remarks}</textarea>
|
||
</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>
|