layui.use(['table', 'admin', 'ax', 'func'], function () {
|
var $ = layui.$;
|
var table = layui.table;
|
var $ax = layui.ax;
|
var admin = layui.admin;
|
var func = layui.func;
|
|
/**
|
* 返修管理表管理
|
*/
|
var RepairManageInfo = {
|
tableId: "repairManageInfoTable"
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
RepairManageInfo.initColumn = function () {
|
return [[
|
{type: 'checkbox'},
|
{field: 'id', hide: true, title: 'id'},
|
{field: 'sfc', sort: true, title: '总成编码',width:200},
|
{field: 'productionLine', sort: true, title: '产线编号',width:100},
|
{field: 'locationCode', sort: true, title: '工位编号',width:100},
|
{field: 'workOrderNo', sort: true, title: '工单编号',width:150},
|
{field: 'productCode', sort: true, title: '产品编号',width:130},
|
{field: 'productName', sort: true, title: '产品名称',width:280},
|
{field: 'manageType', sort: true, title: '类型'},
|
// {field: 'upPlc', sort: true, title: '上传plc(1是、0否 默认为0)'},
|
{field: 'operateTime', sort: true, title: '操作时间',width:165},
|
{field: 'operateUser', sort: true, title: '操作人'},
|
// {field: 'spareField1', sort: true, title: '预留字段1'},
|
// {field: 'spareField2', sort: true, title: '预留字段2'},
|
// {field: 'spareField3', sort: true, title: '预留字段3'},
|
// {field: 'spareField4', sort: true, title: '预留字段4'},
|
{align: 'center', toolbar: '#tableBar', title: '操作',width:120}
|
]];
|
};
|
|
/**
|
* 点击查询按钮
|
*/
|
RepairManageInfo.search = function () {
|
var queryData = {};
|
|
queryData['sfc'] = $('#sfc').val();
|
queryData['productionLine'] = $('#productionLine').val();
|
queryData['locationCode'] = $('#locationCode').val();
|
queryData['workOrderNo'] = $('#workOrderNo').val();
|
queryData['productCode'] = $('#productCode').val();
|
queryData['manageType'] = $('#manageType').val();
|
|
|
table.reload(RepairManageInfo.tableId, {
|
where: queryData, page: {curr: 1}
|
});
|
};
|
|
/**
|
* 跳转到添加页面
|
*/
|
RepairManageInfo.jumpAddPage = function () {
|
window.location.href = Feng.ctxPath + '/repairManageInfo/add'
|
};
|
|
/**
|
* 跳转到编辑页面
|
*
|
* @param data 点击按钮时候的行数据
|
*/
|
RepairManageInfo.jumpEditPage = function (data) {
|
window.location.href = Feng.ctxPath + '/repairManageInfo/edit?id=' + data.id
|
};
|
|
/**
|
* 导出excel按钮
|
*/
|
RepairManageInfo.exportExcel = function () {
|
var checkRows = table.checkStatus(RepairManageInfo.tableId);
|
if (checkRows.data.length === 0) {
|
Feng.error("请选择要导出的数据");
|
} else {
|
table.exportFile(tableResult.config.id, checkRows.data, 'xls');
|
}
|
};
|
|
/**
|
* 点击删除
|
*
|
* @param data 点击按钮时候的行数据
|
*/
|
RepairManageInfo.onDeleteItem = function (data) {
|
var operation = function () {
|
var ajax = new $ax(Feng.ctxPath + "/repairManageInfo/delete", function (data) {
|
Feng.success("删除成功!");
|
table.reload(RepairManageInfo.tableId);
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id", data.id);
|
ajax.start();
|
};
|
Feng.confirm("是否删除?", operation);
|
};
|
|
// 渲染表格
|
var tableResult = table.render({
|
elem: '#' + RepairManageInfo.tableId,
|
url: Feng.ctxPath + '/repairManageInfo/list',
|
page: true,
|
height: "full-158",
|
cellMinWidth: 100,
|
cols: RepairManageInfo.initColumn()
|
});
|
|
// 搜索按钮点击事件
|
$('#btnSearch').click(function () {
|
RepairManageInfo.search();
|
});
|
|
// 添加按钮点击事件
|
$('#btnAdd').click(function () {
|
|
RepairManageInfo.jumpAddPage();
|
|
});
|
|
// 导出excel
|
$('#btnExp').click(function () {
|
RepairManageInfo.exportExcel();
|
});
|
|
// 工具条点击事件
|
table.on('tool(' + RepairManageInfo.tableId + ')', function (obj) {
|
var data = obj.data;
|
var layEvent = obj.event;
|
|
if (layEvent === 'edit') {
|
RepairManageInfo.jumpEditPage(data);
|
} else if (layEvent === 'delete') {
|
RepairManageInfo.onDeleteItem(data);
|
}
|
});
|
});
|