118 lines
4.7 KiB
Plaintext
118 lines
4.7 KiB
Plaintext
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
|||
|
|
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
/*
|
|||
|
|
* 通用和仪表库附表
|
|||
|
|
*/
|
|||
|
|
function getWorkConsume(pid,unitId){
|
|||
|
|
$("#table_consume").bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/maintenance/WorkorderConsume/getOutStockDetailConsumeList.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,
|
|||
|
|
maintenanceDetailId: pid
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'id', // 要排序的字段
|
|||
|
|
sortOrder: 'desc', // 排序规则
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
checkbox: true, // 显示一个勾选框
|
|||
|
|
},{
|
|||
|
|
field: 'goods.name', // 返回json数据中的name
|
|||
|
|
title: '物品名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'goods.model', // 返回json数据中的name
|
|||
|
|
title: '规格型号', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'goods.brand', // 返回json数据中的name
|
|||
|
|
title: '品牌', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'goods.unit', // 返回json数据中的name
|
|||
|
|
title: '单位', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'consumeNumber', // 返回json数据中的name
|
|||
|
|
title: '消耗数量', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
editable: { //编辑列元素
|
|||
|
|
type: 'text',
|
|||
|
|
title: '消耗数量',
|
|||
|
|
validate: function (v) {
|
|||
|
|
if (!v) return '数量不能为空';
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
//保存列修改后的数据
|
|||
|
|
onEditableSave: function (field, row, oldValue, $el) {
|
|||
|
|
$.post(ext.contextPath + "/maintenance/WorkorderConsume/updateOutStockDetailConsume.do", {id:row.id,number:row.consumeNumber}, function(data) {
|
|||
|
|
if (data.res == 1){
|
|||
|
|
$("#table_consume").bootstrapTable('refresh');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','编辑失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
$("#table_consume").bootstrapTable('refresh');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
},
|
|||
|
|
onLoadSuccess: function () { //加载成功时执行
|
|||
|
|
adjustBootstrapTableView("table_consume");
|
|||
|
|
},
|
|||
|
|
onLoadError: function () { //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var doConsumeAdd = function(workorderId) {
|
|||
|
|
var allTableData = $("#table_consume").bootstrapTable('getData');
|
|||
|
|
var OutStockRecordDetailIds="";
|
|||
|
|
$.each(allTableData,function(index,item){
|
|||
|
|
if(OutStockRecordDetailIds!=""){
|
|||
|
|
OutStockRecordDetailIds+=",";
|
|||
|
|
}
|
|||
|
|
OutStockRecordDetailIds+=item.outstockRecordDetailId;
|
|||
|
|
})
|
|||
|
|
$.post(ext.contextPath + '/maintenance/WorkorderConsume/selectStockForOutStockDetails.do', {OutStockRecordDetailIds:OutStockRecordDetailIds,workorderId:workorderId},
|
|||
|
|
function(data) {
|
|||
|
|
$("#subDiv_consume").html(data);
|
|||
|
|
openModal('subPDetailModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var doConsumeEdit = function() {
|
|||
|
|
//
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var doFinishSelects = function(data,workorderId) {
|
|||
|
|
$.post(ext.contextPath + '/maintenance/WorkorderConsume/saveOutStockRecordDetails.do', {maintenanceDetailId:workorderId,
|
|||
|
|
OutStockRecordDetailIds:data} , function(data) {
|
|||
|
|
if(data.res){
|
|||
|
|
$("#table_consume").bootstrapTable('refresh');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
</script>
|