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 FormulaChildInfo = {
|
tableId: "formulaChildInfoTable"
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
FormulaChildInfo.initColumn = function () {
|
return [[
|
{type: 'checkbox'},
|
{field: 'id', hide: true, title: 'id'},
|
{field: 'formulaCode', sort: true, title: '配方编码'},
|
{field: 'lineCode', sort: true, title: '产线'},
|
{field: 'locationCode', sort: true, title: '工位'},
|
{field: 'productCode', sort: true, title: '产品编号'},
|
{field: 'operationSteps', sort: true, title: '操作内容'},
|
{field: 'techRequirement', sort: true, title: '技术要求'},
|
{field: 'operationType', sort: true, title: '类型'},
|
{field: 'stepSort', sort: true, title: '排序'},
|
{field: 'paramCode', sort: true, title: '参数编码'},
|
{field: 'materialCode', sort: true, title: '物料编码'},
|
{field: 'picture', sort: true, title: '图片'},
|
{field: 'remarks', sort: true, title: '备注'},
|
{field: 'createUser', sort: true, title: '创建用户'},
|
{field: 'createTime', sort: true, title: '创建时间'},
|
{field: 'updateUser', sort: true, title: '更改用户'},
|
{field: 'updateTime', sort: true, title: '更改时间'},
|
{fixed: 'right',width: 125, minWidth: 125, align: 'center', toolbar: '#tableBar', title: '操作'}
|
]];
|
};
|
|
/**
|
* 点击查询按钮
|
*/
|
FormulaChildInfo.search = function () {
|
var queryData = {};
|
|
queryData['formulaCode'] = $('#formulaCode').val();
|
queryData['lineCode'] = $('#lineCode').val();
|
queryData['locationCode'] = $('#locationCode').val();
|
queryData['productCode'] = $('#productCode').val();
|
queryData['materialCode'] = $('#materialCode').val();
|
|
table.reload(FormulaChildInfo.tableId, {
|
where: queryData, page: {curr: 1}
|
});
|
};
|
|
/**
|
* 跳转到添加页面
|
*/
|
FormulaChildInfo.jumpAddPage = function () {
|
func.open({
|
height: 650,
|
title: '添加配方配置信息',
|
content: Feng.ctxPath + '/formulaChildInfo/add?formulaInfoCode=' + $("#formulaInfoCode").val(),
|
tableId: FormulaChildInfo.tableId,
|
});
|
// window.location.href = Feng.ctxPath + '/formulaChildInfo/add'
|
};
|
|
/**
|
* 跳转到编辑页面
|
*
|
* @param data 点击按钮时候的行数据
|
*/
|
FormulaChildInfo.jumpEditPage = function (data) {
|
func.open({
|
height: 650,
|
title: 'BOM信息',
|
content: Feng.ctxPath + '/formulaChildInfo/edit?id=' + data.id,
|
tableId: FormulaChildInfo.tableId,
|
});
|
// window.location.href = Feng.ctxPath + '/formulaChildInfo/edit?id=' + data.id
|
};
|
|
/**
|
* 导出excel按钮
|
*/
|
FormulaChildInfo.exportExcel = function () {
|
var checkRows = table.checkStatus(FormulaChildInfo.tableId);
|
if (checkRows.data.length === 0) {
|
Feng.error("请选择要导出的数据");
|
} else {
|
table.exportFile(tableResult.config.id, checkRows.data, 'xls');
|
}
|
};
|
|
/**
|
* 点击删除
|
*
|
* @param data 点击按钮时候的行数据
|
*/
|
FormulaChildInfo.onDeleteItem = function (data) {
|
var operation = function () {
|
var ajax = new $ax(Feng.ctxPath + "/formulaChildInfo/delete", function (data) {
|
Feng.success("删除成功!");
|
table.reload(FormulaChildInfo.tableId);
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id", data.id);
|
ajax.start();
|
};
|
Feng.confirm("是否删除?", operation);
|
};
|
|
var queryData = {};
|
queryData['formulaCode'] = $('#formulaInfoCode').val();
|
// 渲染表格
|
var tableResult = table.render({
|
elem: '#' + FormulaChildInfo.tableId,
|
url: Feng.ctxPath + '/formulaChildInfo/list',
|
page: true,
|
height: "full-158",
|
cellMinWidth: 100,
|
where: queryData,
|
cols: FormulaChildInfo.initColumn()
|
});
|
|
// 关闭页面
|
$('#btnBack').click(function () {
|
window.location.href = Feng.ctxPath + "/formulaInfo";
|
});
|
|
// 搜索按钮点击事件
|
$('#btnSearch').click(function () {
|
FormulaChildInfo.search();
|
});
|
|
// 添加按钮点击事件
|
$('#btnAdd').click(function () {
|
|
FormulaChildInfo.jumpAddPage();
|
|
});
|
|
// 导出excel
|
$('#btnExp').click(function () {
|
FormulaChildInfo.exportExcel();
|
});
|
|
// 工具条点击事件
|
table.on('tool(' + FormulaChildInfo.tableId + ')', function (obj) {
|
var data = obj.data;
|
var layEvent = obj.event;
|
|
if (layEvent === 'edit') {
|
FormulaChildInfo.jumpEditPage(data);
|
} else if (layEvent === 'delete') {
|
FormulaChildInfo.onDeleteItem(data);
|
}
|
});
|
});
|