264 lines
12 KiB
Plaintext
264 lines
12 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 doupdate() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/administration/index/update.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');
|
||
}
|
||
}
|
||
//输入框验证
|
||
$("#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 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");
|
||
});
|
||
};
|
||
|
||
//初始化部门
|
||
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');
|
||
};
|
||
$(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('${index.deptid}').trigger("change");
|
||
},'json');
|
||
$('#table_indexCycle').bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/administration/indexCycle/getList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [15], // 设置页面可以显示的数据条数
|
||
pageSize: 15, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
pid:'${index.id}',
|
||
}
|
||
},
|
||
sortName: 'morder', // 要排序的字段
|
||
sortOrder: 'asc', // 排序规则
|
||
columns: [
|
||
{
|
||
field: 'name', // 返回json数据中的name
|
||
title: '月份', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
},{
|
||
field: 'money', // 返回json数据中的name
|
||
title: '分解定额', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
editable: { //编辑列元素
|
||
type: 'text',
|
||
title: '分解定额',
|
||
}
|
||
}
|
||
],
|
||
//保存列修改后的数据
|
||
onEditableSave: function (field, row, oldValue, $el) {
|
||
$.post(ext.contextPath + "/administration/index/updateIndexCycle.do", {id:row.id,money:row.money}, function(data) {
|
||
if (data.res == 1){
|
||
$("#table_indexCycle").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','编辑失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
},
|
||
onLoadSuccess: function(){ //加载成功时执行
|
||
adjustBootstrapTableView("table_indexCycle");
|
||
},
|
||
onLoadError: function(){ //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
});
|
||
});
|
||
</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="${index.unitId}">
|
||
<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}" readonly>
|
||
</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 class="box box-primary" >
|
||
<!-- /.box-header -->
|
||
<div class="box-body ">
|
||
<table id="table_indexCycle"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_update">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|