first commit
This commit is contained in:
256
WebRoot/JS/workorder/workorderAchievement.js
Normal file
256
WebRoot/JS/workorder/workorderAchievement.js
Normal file
@ -0,0 +1,256 @@
|
||||
/**
|
||||
* 加载工时附表(可编辑)
|
||||
* @param pid
|
||||
*/
|
||||
function getWorkAchievements(pid) {
|
||||
$("#table_achievements").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderAchievement/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,
|
||||
pid: pid
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
width: '40px'
|
||||
}, {
|
||||
field: '1', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '14%',
|
||||
formatter: function (value, row, index) {
|
||||
if (row.user != null && row.user != '') {
|
||||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.user.caption + "'>" + row.user.caption + "</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '2', // 返回json数据中的name
|
||||
title: '项目角色', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '16%',
|
||||
formatter: function (value, row, index) {
|
||||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.projectRole + "'>" + row.projectRole + "</span>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '3', // 返回json数据中的name
|
||||
title: '参与内容', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
formatter: function (value, row, index) {
|
||||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.participateContent + "'>" + row.participateContent + "</span>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '4', // 返回json数据中的name
|
||||
title: '绩效工时(小时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
formatter: function (value, row, index) {
|
||||
return row.workTime;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '5', // 返回json数据中的name
|
||||
title: '说明', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
formatter: function (value, row, index) {
|
||||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.explain + "'>" + row.explain + "</span>";
|
||||
}
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '10%', // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts = '';
|
||||
buts += '<button class="btn btn-default btn-sm" onclick="doAchievementEdit(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit "></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||||
buts = '<div class = "btn-group">' + buts + '</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_achievements");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载工时附表(浏览)
|
||||
* @param pid
|
||||
*/
|
||||
function getWorkAchievementsView(pid) {
|
||||
$("#table_achievements").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderAchievement/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,
|
||||
pid: pid
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'user.caption', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
// width: '20%',
|
||||
// formatter: function (value, row, index) {
|
||||
// if (row.user != null && row.user != '') {
|
||||
// return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.user.caption + "'>" + row.user.caption + "</span>";
|
||||
// }
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'projectRole', // 返回json数据中的name
|
||||
title: '项目角色', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
// width: '20%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.projectRole + "'>" + row.projectRole + "</span>";
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'workTime', // 返回json数据中的name
|
||||
title: '绩效工时(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
// width: '20%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return row.workTime;
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'participateContent', // 返回json数据中的name
|
||||
title: '参与内容', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
// width: '20%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.participateContent + "'>" + row.participateContent + "</span>";
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'explain', // 返回json数据中的name
|
||||
title: '说明', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
// width: '20%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.explain + "'>" + row.explain + "</span>";
|
||||
// }
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_achievements");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除
|
||||
*/
|
||||
var deleteAchievementFun = function () {
|
||||
var checkedItems = $("#table_achievements").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'alertDiv');
|
||||
} 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 + '/workorder/workorderAchievement/dodeletes.do', {ids: datas}, function (data) {
|
||||
var datastr = eval('(' + data + ')');
|
||||
if (datastr.code == 1) {
|
||||
|
||||
//计算总工时及剩余工时
|
||||
// doCountWorkingHours();
|
||||
|
||||
$("#table_achievements").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv2');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var doAchievementAdd = function (pid) {
|
||||
$.post(ext.contextPath + '/workorder/workorderAchievement/doadd.do', {pid: pid}, function (data) {
|
||||
$("#subDiv_achievement").html(data);
|
||||
openModal('subModalAchievement');
|
||||
});
|
||||
}
|
||||
|
||||
var doAchievementEdit = function (id) {
|
||||
$.post(ext.contextPath + '/workorder/workorderAchievement/doedit.do', {id: id}, function (data) {
|
||||
$("#subDiv_achievement").html(data);
|
||||
openModal('subModalAchievement');
|
||||
});
|
||||
}
|
||||
240
WebRoot/JS/workorder/workorderConsume.js
Normal file
240
WebRoot/JS/workorder/workorderConsume.js
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* 加载消耗品(可编辑)
|
||||
* @param pid
|
||||
*/
|
||||
function getWorkConsume(pid) {
|
||||
$('#table_outStockDetail').bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderConsume/getlist.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
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: pid,
|
||||
}
|
||||
}, sortName: 'insdt', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
width: '40px'
|
||||
}, {
|
||||
field: 'goods.name', // 返回json数据中的name
|
||||
title: '物品名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '25%',
|
||||
}, {
|
||||
field: 'goods.model', // 返回json数据中的name
|
||||
title: '规格型号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '20%',
|
||||
}, {
|
||||
field: 'number', // 返回json数据中的name
|
||||
title: '消耗数量', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '15%', // editable: { //编辑列元素
|
||||
// type: 'text',
|
||||
// title: '消耗数量',
|
||||
// validate: function (v) {
|
||||
// if (!v) return '数量不能为空';
|
||||
|
||||
// }
|
||||
// }
|
||||
}, {
|
||||
field: 'price', // 返回json数据中的name
|
||||
title: '单价(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '15%',
|
||||
}, {
|
||||
field: 'totalPrice', // 返回json数据中的name
|
||||
title: '合计(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '15%',
|
||||
}, {
|
||||
title: "操作", align: 'center', valign: 'middle', width: '10%', formatter: function (value, row, index) {
|
||||
var buts = '';
|
||||
buts += '<button class="btn btn-default btn-sm" onclick="editDetailFun(\'' + row.id + '\')" data-toggle="tooltip" title="修改"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 修改</span></button>'
|
||||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||||
return buts;
|
||||
}
|
||||
}], //保存列修改后的数据
|
||||
onEditableSave: function (field, row, oldValue, $el) {
|
||||
$.post(ext.contextPath + "/equipment/OutStockRecordDetailConsume/updateOutStockDetailConsume.do", {
|
||||
id: row.id, number: row.consumeNumber
|
||||
}, function (data) {
|
||||
if (data.res == 1) {
|
||||
$("#table_outStockDetail").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '编辑失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
$("#table_outStockDetail").bootstrapTable('refresh');
|
||||
}
|
||||
}, 'json');
|
||||
}, onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_outStockDetail");
|
||||
}, onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载消耗品(浏览)
|
||||
* @param pid
|
||||
*/
|
||||
function getWorkConsumeView(pid) {
|
||||
$('#table_outStockDetail').bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderConsume/getlist.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
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: pid,
|
||||
}
|
||||
}, sortName: 'insdt', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [{
|
||||
field: 'goods.name', // 返回json数据中的name
|
||||
title: '物品名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '20%',
|
||||
}, {
|
||||
field: 'goods.model', // 返回json数据中的name
|
||||
title: '规格型号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '20%',
|
||||
}, {
|
||||
field: 'number', // 返回json数据中的name
|
||||
title: '消耗数量', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '20%',
|
||||
}, {
|
||||
field: 'price', // 返回json数据中的name
|
||||
title: '单价(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '20%',
|
||||
}, {
|
||||
field: 'totalPrice', // 返回json数据中的name
|
||||
title: '合计(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '20%',
|
||||
}], onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_outStockDetail");
|
||||
}, onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动选择物资弹窗
|
||||
* @param entityId
|
||||
*/
|
||||
var addDetailFun = function (entityId) {
|
||||
$.post(ext.contextPath + '/sparepart/subscribe/selectGoodsForSubscribeDetail.do', {pid: entityId}, function (data) {
|
||||
$("#consume4SelectsDiv").html(data);
|
||||
openModal('subDetailModal');
|
||||
});
|
||||
};
|
||||
|
||||
var doFinishSelectSubscribeDetail = function (datas, pid, equipmentId) {
|
||||
console.log(datas + '------' + pid + '------' + equipmentId);
|
||||
$.post(ext.contextPath + '/workorder/workorderConsume/saves.do', {
|
||||
goodsIds: datas, worksheetId: pid, number: 0, price: 0, id: ''
|
||||
}, function (data) {
|
||||
if (data.res) {
|
||||
$("#table_outStockDetail").bootstrapTable('refresh');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
/*var editDetailFun = function (OutStockRecordDetailIds) {
|
||||
$.post(ext.contextPath + '/workorder/workorderConsume/showConsumeFromUser.do', {OutStockRecordDetailIds: OutStockRecordDetailIds}, function (data) {
|
||||
$("#consume4SelectsDiv").html(data);
|
||||
openModal('subPDetailModal');
|
||||
});
|
||||
};*/
|
||||
|
||||
var editDetailFun = function (id) {
|
||||
$.post(ext.contextPath + '/workorder/workorderConsume/doedit.do', {id: id}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
};
|
||||
|
||||
var addConsume4Library = function (entityId) {
|
||||
$.post(ext.contextPath + '/workorder/workorderConsume/showConsumeFromUser.do', {entityId: entityId}, function (data) {
|
||||
$("#consume4SelectsDiv").html(data);
|
||||
openModal('subPDetailModal');
|
||||
});
|
||||
}
|
||||
|
||||
var doFinishSelects = function (data, num, price, id, entityId) {
|
||||
$.post(ext.contextPath + '/workorder/workorderConsume/save.do', {
|
||||
goodsIds: data, worksheetId: entityId, number: num, price: price, id: id
|
||||
}, function (data) {
|
||||
if (data.res) {
|
||||
$("#table_outStockDetail").bootstrapTable('refresh');
|
||||
}
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
var deletesDetailFun = function () {
|
||||
var checkedItems = $("#table_outStockDetail").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'alertDiv');
|
||||
} 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 + '/workorder/workorderConsume/dodeletes.do', {ids: datas}, function (data) {
|
||||
if (data.code > 0) {
|
||||
$("#table_outStockDetail").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'alertDiv');
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
312
WebRoot/JS/workorder/workorderMaintainContent.js
Normal file
312
WebRoot/JS/workorder/workorderMaintainContent.js
Normal file
@ -0,0 +1,312 @@
|
||||
/*
|
||||
* 加载维修内容附表(可编辑)
|
||||
*/
|
||||
function getRepairContent(pid) {
|
||||
//附表内容
|
||||
$("#table_repair_detail").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderRepairContent/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,
|
||||
pid: pid
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'cs',
|
||||
checkbox: true, // 显示一个勾选框
|
||||
width: '40px'
|
||||
}, {
|
||||
field: '工作内容', // 返回json数据中的name
|
||||
title: '工作内容', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '18%',
|
||||
formatter: function (value, row, index) {
|
||||
return row.repairName;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '工时定额(时)', // 返回json数据中的name
|
||||
title: '工时定额(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '16%',
|
||||
formatter: function (value, row, index) {
|
||||
return row.selfQuotaHour;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'selfActualHour', // 返回json数据中的name
|
||||
title: '实际工时(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '16%',
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '实际工时(时)',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '委外费定额(元)', // 返回json数据中的name
|
||||
title: '委外费定额(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
formatter: function (value, row, index) {
|
||||
return row.outsourceQuotaFee;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'outsourceActualFee', // 返回json数据中的name
|
||||
title: '实际委外费(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '实际委外费(元)',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '10%', // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts = '';
|
||||
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun_Content(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_repair_detail");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
},
|
||||
//保存列修改后的数据
|
||||
onEditableSave: function (field, row, oldValue, $el) {
|
||||
$.post(ext.contextPath + "/workorder/workorderRepairContent/updateNumber.do", {
|
||||
id: row.id,
|
||||
selfActualHour: row.selfActualHour,
|
||||
outsourceActualFee: row.outsourceActualFee
|
||||
}, function (data) {
|
||||
if (data.res == 1) {
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '编辑失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 加载维修内容附表(浏览)
|
||||
*/
|
||||
function getRepairContentView(pid) {
|
||||
//附表内容
|
||||
$("#table_repair_detail").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderRepairContent/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,
|
||||
pid: pid
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'repairName', // 返回json数据中的name
|
||||
title: '工作内容', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return row.repairName;
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'selfQuotaHour', // 返回json数据中的name
|
||||
title: '工时定额(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '18%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return row.selfQuotaHour;
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'selfActualHour', // 返回json数据中的name
|
||||
title: '实际工时(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '18%'
|
||||
},
|
||||
{
|
||||
field: 'outsourceQuotaFee', // 返回json数据中的name
|
||||
title: '委外定额(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '22%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return row.outsourceQuotaFee;
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'outsourceActualFee', // 返回json数据中的name
|
||||
title: '实际委外(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '22%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_repair_detail");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
},
|
||||
//保存列修改后的数据
|
||||
onEditableSave: function (field, row, oldValue, $el) {
|
||||
$.post(ext.contextPath + "/workorder/workorderRepairContent/updateNumber.do", {
|
||||
id: row.id,
|
||||
selfActualHour: row.selfActualHour,
|
||||
outsourceActualFee: row.outsourceActualFee
|
||||
}, function (data) {
|
||||
if (data.res == 1) {
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '编辑失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 从库中导入维修内容
|
||||
* @param id
|
||||
* @param unitId
|
||||
*/
|
||||
var addFun4Library_Content = function (id, unitId) {
|
||||
$.post(ext.contextPath + '/workorder/workorderRepairContent/showlist4Content.do', {
|
||||
detailId: id,
|
||||
unitId: unitId
|
||||
}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param id 表单id
|
||||
* @param unitId 厂id
|
||||
*/
|
||||
var addFun_Content = function (id, unitId) {
|
||||
$.post(ext.contextPath + '/workorder/workorderRepairContent/doadd.do', {id: id, unitId: unitId}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param id 表单id
|
||||
*/
|
||||
var editFun_Content = function (id) {
|
||||
$.post(ext.contextPath + '/workorder/workorderRepairContent/doedit.do', {id: id}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除
|
||||
*/
|
||||
var deleteFun_Content = function () {
|
||||
var checkedItems = $("#table_repair_detail").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'alertDiv');
|
||||
} 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 + '/workorder/workorderRepairContent/dodeletes.do', {ids: datas}, function (data) {
|
||||
var datastr = eval('(' + data + ')');
|
||||
if (datastr.code == 1) {
|
||||
|
||||
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv2');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
328
WebRoot/JS/workorder/workorderRepairContent.js
Normal file
328
WebRoot/JS/workorder/workorderRepairContent.js
Normal file
@ -0,0 +1,328 @@
|
||||
/*
|
||||
* 加载维修内容附表(可编辑)
|
||||
*/
|
||||
function getRepairContent(pid) {
|
||||
//附表内容
|
||||
$("#table_repair_detail").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderRepairContent/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,
|
||||
pid: pid
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'cs',
|
||||
checkbox: true, // 显示一个勾选框
|
||||
width: '40px'
|
||||
}, {
|
||||
field: '工作内容', // 返回json数据中的name
|
||||
title: '工作内容', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '18%',
|
||||
formatter: function (value, row, index) {
|
||||
return row.repairName;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '工时定额(时)', // 返回json数据中的name
|
||||
title: '工时定额(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '16%',
|
||||
formatter: function (value, row, index) {
|
||||
return row.selfQuotaHour;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'selfActualHour', // 返回json数据中的name
|
||||
title: '实际工时(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '16%',
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '实际工时(时)',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '委外费定额(元)', // 返回json数据中的name
|
||||
title: '委外费定额(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
formatter: function (value, row, index) {
|
||||
return row.outsourceQuotaFee;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'outsourceActualFee', // 返回json数据中的name
|
||||
title: '实际委外费(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '实际委外费(元)',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '10%', // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts = '';
|
||||
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun_Content(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_repair_detail");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
},
|
||||
//保存列修改后的数据
|
||||
onEditableSave: function (field, row, oldValue, $el) {
|
||||
$.post(ext.contextPath + "/workorder/workorderRepairContent/updateNumber.do", {
|
||||
id: row.id,
|
||||
selfActualHour: row.selfActualHour,
|
||||
outsourceActualFee: row.outsourceActualFee
|
||||
}, function (data) {
|
||||
if (data.res == 1) {
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '编辑失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 加载维修内容附表(浏览)
|
||||
*/
|
||||
function getRepairContentView(pid) {
|
||||
//附表内容
|
||||
$("#table_repair_detail").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/workorder/workorderRepairContent/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,
|
||||
pid: pid
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'repairName', // 返回json数据中的name
|
||||
title: '工作内容', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '20%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return row.repairName;
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'selfQuotaHour', // 返回json数据中的name
|
||||
title: '工时定额(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '18%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return row.selfQuotaHour;
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'selfActualHour', // 返回json数据中的name
|
||||
title: '实际工时(时)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '18%'
|
||||
},
|
||||
{
|
||||
field: 'outsourceQuotaFee', // 返回json数据中的name
|
||||
title: '委外定额(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '22%',
|
||||
// formatter: function (value, row, index) {
|
||||
// return row.outsourceQuotaFee;
|
||||
// }
|
||||
},
|
||||
{
|
||||
field: 'outsourceActualFee', // 返回json数据中的name
|
||||
title: '实际委外(元)', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
width: '22%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_repair_detail");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
},
|
||||
//保存列修改后的数据
|
||||
onEditableSave: function (field, row, oldValue, $el) {
|
||||
$.post(ext.contextPath + "/workorder/workorderRepairContent/updateNumber.do", {
|
||||
id: row.id,
|
||||
selfActualHour: row.selfActualHour,
|
||||
outsourceActualFee: row.outsourceActualFee
|
||||
}, function (data) {
|
||||
if (data.res == 1) {
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '编辑失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 从库中导入维修内容
|
||||
* @param id
|
||||
* @param unitId
|
||||
*/
|
||||
var addFun4Library_Content = function (id, unitId) {
|
||||
$.post(ext.contextPath + '/workorder/workorderRepairContent/showlist4Content.do', {
|
||||
detailId: id,
|
||||
unitId: unitId
|
||||
}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 从库中导入维修内容
|
||||
* @param id
|
||||
* @param unitId
|
||||
*/
|
||||
var addFun4Library_Content1= function (id, unitId, eqId) {
|
||||
$.post(ext.contextPath + '/workorder/workorderRepairContent/showlist4Content.do', {
|
||||
detailId: id,
|
||||
unitId: unitId,
|
||||
eqId: eqId,
|
||||
}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param id 表单id
|
||||
* @param unitId 厂id
|
||||
*/
|
||||
var addFun_Content = function (id, unitId) {
|
||||
$.post(ext.contextPath + '/workorder/workorderRepairContent/doadd.do', {id: id, unitId: unitId}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param id 表单id
|
||||
*/
|
||||
var editFun_Content = function (id) {
|
||||
$.post(ext.contextPath + '/workorder/workorderRepairContent/doedit.do', {id: id}, function (data) {
|
||||
$("#subDivDetail").html(data);
|
||||
openModal('subModalDetail');
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除
|
||||
*/
|
||||
var deleteFun_Content = function () {
|
||||
var checkedItems = $("#table_repair_detail").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'alertDiv');
|
||||
} 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 + '/workorder/workorderRepairContent/dodeletes.do', {ids: datas}, function (data) {
|
||||
var datastr = eval('(' + data + ')');
|
||||
if (datastr.code == 1) {
|
||||
|
||||
|
||||
$("#table_repair_detail").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv2');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user