提交 | 用户 | 时间
|
92cffc
|
1 |
|
懒 |
2 |
layui.use(['table'], function () { |
|
3 |
var $ = layui.jquery; |
|
4 |
var table = layui.table; |
|
5 |
|
|
6 |
/** |
|
7 |
* 物料信息管理 |
|
8 |
*/ |
|
9 |
var MaterialInfo = { |
|
10 |
tableId: "materialInfoTable" |
|
11 |
}; |
|
12 |
|
|
13 |
var materialType = parent.materialType; |
|
14 |
console.log(materialType) |
|
15 |
|
|
16 |
$('#serch').click(function(){ |
|
17 |
var queryData = {}; |
|
18 |
queryData['typeZ'] = materialType; |
|
19 |
queryData['materialName'] = $("#materialName").val(); |
|
20 |
queryData['materialCode'] = $("#materialCode").val(); |
|
21 |
table.reload(MaterialInfo.tableId, { |
|
22 |
where: queryData, page: {curr: 1} |
|
23 |
}); |
|
24 |
}); |
|
25 |
/** |
|
26 |
* 缺料报警初始化表格的列 |
|
27 |
*/ |
|
28 |
MaterialInfo.initColumn = function () { |
|
29 |
return [[ |
|
30 |
{type: 'radio'}, |
|
31 |
{field: 'id', hide: true, title: '主键id'}, |
|
32 |
{field: 'materialCode', sort: true, title: '产品编号'}, |
|
33 |
{field: 'materialName', sort: true, title: '产品名称'}, |
|
34 |
{field: 'typeZ', sort: true, title: '种类'}, |
|
35 |
]]; |
|
36 |
}; |
|
37 |
|
|
38 |
table = $.extend(table, {config: {checkName: 'checked'}}); |
|
39 |
|
|
40 |
var queryData = {}; |
|
41 |
queryData['typeZ'] = materialType; |
|
42 |
var tableResult = table.render({ |
|
43 |
elem: '#' + MaterialInfo.tableId, |
|
44 |
url: Feng.ctxPath + '/materialInfo/list', |
|
45 |
page: true, |
|
46 |
where:queryData, |
|
47 |
cellMinWidth: 80, |
|
48 |
cols: MaterialInfo.initColumn() |
|
49 |
}); |
|
50 |
let Msg=''; |
|
51 |
table.on('row(materialInfoTable)',function (data) { |
|
52 |
Msg = data.data; |
|
53 |
}) |
|
54 |
$('#btnSubmit').click(function(){ |
|
55 |
clearType(); |
|
56 |
if (Msg !=='' ){ |
|
57 |
// 判断是否点击的是确定 |
|
58 |
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 |
|
59 |
window.localStorage.setItem('message',JSON.stringify(Msg)); |
|
60 |
parent.layer.close(index); |
|
61 |
} |
|
62 |
else { |
|
63 |
Feng.error("请选择一条数据!") |
|
64 |
} |
|
65 |
}); |
|
66 |
|
|
67 |
$('#reset').click(function(){ |
|
68 |
clearType(); |
|
69 |
Msg = ""; |
|
70 |
window.localStorage.clear(); |
|
71 |
}); |
|
72 |
|
|
73 |
function clearType(){ |
|
74 |
parent.materialType=""; |
|
75 |
} |
|
76 |
|
|
77 |
}); |