201 lines
7.5 KiB
JavaScript
201 lines
7.5 KiB
JavaScript
|
|
/**
|
|||
|
|
* 加载绩效附表
|
|||
|
|
*/
|
|||
|
|
function getRemark4EquipmentCard(equipmentId, viewType) {
|
|||
|
|
$("#remarktable").bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/equipment/equipmentCardRemark/getRemarkList.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,
|
|||
|
|
equId: equipmentId
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
onClickRow: function (row) {//单击行事件,执行查看功能
|
|||
|
|
// viewMaintainFun(row.id);
|
|||
|
|
},
|
|||
|
|
sortName: 'id', // 要排序的字段
|
|||
|
|
sortOrder: 'desc', // 排序规则
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
field: 'id_c',
|
|||
|
|
checkbox: true, // 显示一个勾选框
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'name', // 返回json数据中的name
|
|||
|
|
title: '备注名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '10%'
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'content', // 返回json数据中的name
|
|||
|
|
title: '备注内容', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '40%',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'userName', // 返回json数据中的name
|
|||
|
|
title: '备注人', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '15%',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'insdt', // 返回json数据中的name
|
|||
|
|
title: '备注时间', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '20%',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "操作",
|
|||
|
|
align: 'center',
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '25%', // 定义列的宽度,单位为像素px
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
var buts = '';
|
|||
|
|
buts += '<button type="button" class="btn btn-default btn-sm" title="查看" onclick="doView(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg"> 浏览</span></button>';
|
|||
|
|
if (viewType != 'view') {
|
|||
|
|
buts += '<button type="button" class="btn btn-default btn-sm" title="编辑" onclick="doEdit(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
|||
|
|
buts += '<button type="button" class="btn btn-default btn-sm" title="删除" onclick="doDeleteOne_remark(\'' + 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 () { //加载成功时执行
|
|||
|
|
if (viewType == 'view') {
|
|||
|
|
$("#remarktable").bootstrapTable('hideColumn', 'id_c');//隐藏上述variablevalue列
|
|||
|
|
}
|
|||
|
|
adjustBootstrapTableView("remarktable");
|
|||
|
|
console.info("加载数据成功_备注");
|
|||
|
|
},
|
|||
|
|
onLoadError: function () { //加载失败时执行
|
|||
|
|
console.info("加载数据失败_备注");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 弹窗备注选择页面
|
|||
|
|
* @param equipmentId
|
|||
|
|
*/
|
|||
|
|
var doAdd_Remark = function (equipmentId) {
|
|||
|
|
$.post(ext.contextPath + '/equipment/equipmentCardRemark/doadd.do', {eqid: equipmentId}, function (data) {
|
|||
|
|
$("#subRemarkAddDiv").html(data);
|
|||
|
|
openModal('SubModal_equipmentRemarkprop');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var doEdit = function (id) {
|
|||
|
|
$.post(ext.contextPath + '/equipment/equipmentCardRemark/doedit.do', {id: id}, function (data) {
|
|||
|
|
$("#subRemarkEditDiv").html(data);
|
|||
|
|
openModal('SubModal_equipmentRemarkEdit');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var doView = function (id) {
|
|||
|
|
$.post(ext.contextPath + '/equipment/equipmentCardRemark/doview.do', {id: id}, function (data) {
|
|||
|
|
$("#subRemarkViewDiv").html(data);
|
|||
|
|
openModal('SubModal_equipmentRemarkView');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 删除关联的备注
|
|||
|
|
*/
|
|||
|
|
var doDelete_remark = function () {
|
|||
|
|
var checkedItems_remark = $("#remarktable").bootstrapTable('getSelections');
|
|||
|
|
var datas = "";
|
|||
|
|
$.each(checkedItems_remark, 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 + '/equipment/equipmentCardRemark/dodeletes.do', {ids: datas}, function (data) {
|
|||
|
|
if (data > 0) {
|
|||
|
|
$("#remarktable").bootstrapTable('refresh');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', '删除失败', 'mainAlertdiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
/**
|
|||
|
|
* 删除关联的备注
|
|||
|
|
*/
|
|||
|
|
var doDeleteOne_remark = 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 + '/equipment/equipmentCardRemark/dodelete.do', {id: id}, function (data) {
|
|||
|
|
if (data > 0) {
|
|||
|
|
$("#remarktable").bootstrapTable('refresh');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', '删除失败', 'mainAlertdiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|