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 MaterialInfo = {
|
tableId: "materialInfoTable"
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
MaterialInfo.initColumn = function () {
|
return [[
|
{type: 'checkbox'},
|
{field: 'id', hide: true, title: '主键id'},
|
{field: 'materialCode', sort: true, title: '物料编号',width:130},
|
{field: 'materialName', sort: true, title: '物料名称',width:180},
|
{field: 'materialView', sort: true, title: '视图'},
|
{field: 'typeZ', sort: true, title: '种类'},
|
{field: 'typeL', sort: true, title: '类型'},
|
{field: 'unit', sort: true, title: '单位'},
|
{field: 'matterVersion', sort: true, title: '版本'},
|
{field: 'remarks', sort: true, title: '备注'},
|
{field: 'createUser', sort: true, title: '创建用户',width:120},
|
{field: 'createTime', sort: true, title: '创建时间',width:160},
|
{field: 'updateUser', sort: true, title: '更改用户',width:120},
|
{field: 'updateTime', sort: true, title: '更改时间',width:160},
|
]];
|
};
|
|
/**
|
* 点击查询按钮
|
*/
|
MaterialInfo.search = function () {
|
var queryData = {};
|
|
queryData['materialCode'] = $('#materialCode').val();
|
queryData['materialName'] = $('#materialName').val();
|
queryData['materialView'] = $('#materialView').val();
|
queryData['typeL'] = $('#typeL').val();
|
|
table.reload(MaterialInfo.tableId, {
|
where: queryData, page: {curr: 1}
|
});
|
};
|
|
// 渲染表格
|
var tableResult = table.render({
|
elem: '#' + MaterialInfo.tableId,
|
url: Feng.ctxPath + '/materialInfo/list',
|
page: true,
|
height: "full-158",
|
cellMinWidth: 100,
|
cols: MaterialInfo.initColumn()
|
});
|
|
// 搜索按钮点击事件
|
$('#btnSearch').click(function () {
|
MaterialInfo.search();
|
});
|
|
/**
|
* 点击查询按钮
|
*/
|
MaterialInfo.search = function () {
|
var queryData = {};
|
|
queryData['materialCode'] = $('#materialCode').val();
|
queryData['materialName'] = $('#materialName').val();
|
queryData['materialView'] = $('#materialView').val();
|
queryData['typeL'] = $('#typeL').val();
|
|
table.reload(MaterialInfo.tableId, {
|
where: queryData, page: {curr: 1}
|
});
|
};
|
|
let Msg='';
|
table.on('row(materialInfoTable)',function (data) {
|
Msg = data.data;
|
})
|
|
$('#btnSubmit').focus(function(){
|
if (Msg !='' ){
|
// 判断是否点击的是确定
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
window.localStorage.setItem('message',JSON.stringify(Msg));
|
parent.layer.close(index);
|
}
|
else {
|
Feng.error("请选择一条数据!")
|
}
|
});
|
});
|