|
layui.use(['table'], function () {
|
var $ = layui.jquery;
|
var table = layui.table;
|
|
/**
|
* 物料信息管理
|
*/
|
var MaterialInfo = {
|
tableId: "materialInfoTable"
|
};
|
|
var materialType = parent.materialType;
|
console.log(materialType)
|
|
$('#serch').click(function(){
|
var queryData = {};
|
queryData['typeZ'] = materialType;
|
queryData['materialName'] = $("#materialName").val();
|
queryData['materialCode'] = $("#materialCode").val();
|
table.reload(MaterialInfo.tableId, {
|
where: queryData, page: {curr: 1}
|
});
|
});
|
/**
|
* 缺料报警初始化表格的列
|
*/
|
MaterialInfo.initColumn = function () {
|
return [[
|
{type: 'radio'},
|
{field: 'id', hide: true, title: '主键id'},
|
{field: 'materialCode', sort: true, title: '产品编号'},
|
{field: 'materialName', sort: true, title: '产品名称'},
|
{field: 'typeZ', sort: true, title: '种类'},
|
]];
|
};
|
|
table = $.extend(table, {config: {checkName: 'checked'}});
|
|
var queryData = {};
|
queryData['typeZ'] = materialType;
|
var tableResult = table.render({
|
elem: '#' + MaterialInfo.tableId,
|
url: Feng.ctxPath + '/materialInfo/list',
|
page: true,
|
where:queryData,
|
cellMinWidth: 80,
|
cols: MaterialInfo.initColumn()
|
});
|
let Msg='';
|
table.on('row(materialInfoTable)',function (data) {
|
Msg = data.data;
|
})
|
$('#btnSubmit').click(function(){
|
clearType();
|
if (Msg !=='' ){
|
// 判断是否点击的是确定
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
window.localStorage.setItem('message',JSON.stringify(Msg));
|
parent.layer.close(index);
|
}
|
else {
|
Feng.error("请选择一条数据!")
|
}
|
});
|
|
$('#reset').click(function(){
|
clearType();
|
Msg = "";
|
window.localStorage.clear();
|
});
|
|
function clearType(){
|
parent.materialType="";
|
}
|
|
});
|