304 lines
14 KiB
Plaintext
304 lines
14 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 + "/process/equipmentAdjustment/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');
|
||
}
|
||
}
|
||
|
||
//提交
|
||
function dosubmit() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/process/equipmentAdjustment/dosubmit.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');
|
||
}
|
||
}
|
||
|
||
$(function () {
|
||
$("#table_outStockDetail").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/process/equipmentAdjustmentDetail/getlist.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
search_name: $('#search_name').val(),
|
||
pid: $('#id').val(),
|
||
// pSectionId: $("#processSection").val(),
|
||
// statusSelect:$("#statusSelect").val(),
|
||
}
|
||
},
|
||
// onClickRow: function (row) {//单击行事件,执行查看功能
|
||
// viewFun(row.id);
|
||
// },
|
||
sortName: 'insdt', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
},{
|
||
field: 'equipmentCard.equipmentname', // 返回json数据中的name
|
||
title: '设备名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle'
|
||
},{
|
||
field: 'adjustMode', // 返回json数据中的name
|
||
title: '调节方式', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},{
|
||
field: 'adjustValue', // 返回json数据中的name
|
||
title: '设定值', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},{
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: 120, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts="";
|
||
|
||
buts+= '<button class="btn btn-default btn-sm" title="编辑" onclick="editDetailFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"></span></button>';
|
||
buts+='<button class="btn btn-default btn-sm" title="删除" onclick="deleteDetailFun(\''+row.id+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg"></span></button';
|
||
|
||
buts='<div class="btn-group" >'+buts+'</div>';
|
||
return buts;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function(){ //加载成功时执行
|
||
adjustBootstrapTableView("table");
|
||
|
||
},
|
||
onLoadError: function(){ //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
var addDetailFun = function() {
|
||
$.post(ext.contextPath + '/process/equipmentAdjustmentDetail/doadd.do', {pid:$('#id').val()} , function(data) {
|
||
$("#subDiv4equipmentAdjustmentDetail").html(data);
|
||
openModal('subModal4equipmentAdjustmentDetail');
|
||
});
|
||
};
|
||
var editDetailFun = function(id) {
|
||
$.post(ext.contextPath + '/process/equipmentAdjustmentDetail/doedit.do', {id:id} , function(data) {
|
||
$("#subDiv4equipmentAdjustmentDetail").html(data);
|
||
openModal('subModal4equipmentAdjustmentDetail');
|
||
});
|
||
};
|
||
|
||
var deleteDetailFun = function(id) {
|
||
swal({
|
||
text: "您确定要删除此记录?",
|
||
dangerMode: true,
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
className: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
className: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(function(willDelete){
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/process/equipmentAdjustmentDetail/dodelete.do', {id : id}, function(data) {
|
||
if(data.code=="1"){
|
||
$("#table_outStockDetail").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','mainAlertdiv');
|
||
}
|
||
},'json');
|
||
|
||
}
|
||
});
|
||
};
|
||
var deletesDetailFun = function() {
|
||
var checkedItems = $("#table_outStockDetail").bootstrapTable('getSelections');
|
||
var datas="";
|
||
$.each(checkedItems, function(index, item){
|
||
datas+=item.id+",";
|
||
});
|
||
if(datas==""){
|
||
showAlert('d','请先选择记录','mainAlertdiv');
|
||
}else{
|
||
swal({
|
||
text: "您确定要删除此记录?",
|
||
dangerMode: true,
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
className: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
className: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(function(willDelete) {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/process/equipmentAdjustmentDetail/dodeletes.do', {ids:datas} , function(data) {
|
||
if(data.code>0){
|
||
$("#table_outStockDetail").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','mainAlertdiv');
|
||
}
|
||
},'json');
|
||
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
applyContent: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '申请内容不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
</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 ="${equipmentAdjustment.id}">
|
||
<input type="hidden" class="form-control" id="unitId" name ="unitId" value ="${equipmentAdjustment.unitId}">
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*申请人</label>
|
||
<div class="col-sm-4">
|
||
<input type="hidden" class="form-control" id="applyUser" name="applyUser" value="${equipmentAdjustment.applyUser}"/>
|
||
<input type="text" class="form-control" id="applyName" name="applyName"
|
||
value="${equipmentAdjustment.user.caption}" readonly>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*申请时间</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="applyTime" name="applyTime"
|
||
style="width: 132px;" value="${equipmentAdjustment.applyTime.substring(0, 10)}" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*厂区</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="unitName" name="unitName" value="${equipmentAdjustment.company.sname}"
|
||
readonly>
|
||
</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 ="applyContent" name ="applyContent" placeholder="申请内容">${equipmentAdjustment.applyContent}</textarea>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="box box-primary">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">调整详情</h3>
|
||
<div class="box-tools pull-right">
|
||
<a onclick="addDetailFun()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
||
<a onclick="deletesDetailFun()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="删除"><i class="glyphicon glyphicon-minus"></i></a>
|
||
</div>
|
||
</div>
|
||
<!-- /.box-header -->
|
||
<div class="box-body ">
|
||
<table id="table_outStockDetail"></table>
|
||
</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="dosave()" id="btn_save">保存</button>
|
||
<button type="button" class="btn btn-primary" onclick="dosubmit()" >提交</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|