提交 | 用户 | 时间
|
1ac2bc
|
1 |
layui.use(['table', 'admin', 'ax', 'func'], function () { |
懒 |
2 |
var $ = layui.$; |
|
3 |
var table = layui.table; |
|
4 |
var $ax = layui.ax; |
|
5 |
var admin = layui.admin; |
|
6 |
var func = layui.func; |
|
7 |
|
|
8 |
/** |
|
9 |
* 物料信息管理 |
|
10 |
*/ |
|
11 |
var MaterialInfo = { |
|
12 |
tableId: "materialInfoTable" |
|
13 |
}; |
|
14 |
|
|
15 |
/** |
|
16 |
* 初始化表格的列 |
|
17 |
*/ |
|
18 |
MaterialInfo.initColumn = function () { |
|
19 |
return [[ |
|
20 |
{type: 'checkbox'}, |
|
21 |
{field: 'id', hide: true, title: '主键id'}, |
|
22 |
{field: 'materialCode', sort: true, title: '物料编号',width:130}, |
|
23 |
{field: 'materialName', sort: true, title: '物料名称',width:180}, |
|
24 |
{field: 'materialView', sort: true, title: '视图'}, |
|
25 |
{field: 'typeZ', sort: true, title: '种类'}, |
|
26 |
{field: 'typeL', sort: true, title: '类型'}, |
|
27 |
{field: 'unit', sort: true, title: '单位'}, |
|
28 |
{field: 'matterVersion', sort: true, title: '版本'}, |
|
29 |
{field: 'remarks', sort: true, title: '备注'}, |
|
30 |
{field: 'createUser', sort: true, title: '创建用户',width:120}, |
|
31 |
{field: 'createTime', sort: true, title: '创建时间',width:160}, |
|
32 |
{field: 'updateUser', sort: true, title: '更改用户',width:120}, |
|
33 |
{field: 'updateTime', sort: true, title: '更改时间',width:160}, |
|
34 |
]]; |
|
35 |
}; |
|
36 |
|
|
37 |
/** |
|
38 |
* 点击查询按钮 |
|
39 |
*/ |
|
40 |
MaterialInfo.search = function () { |
|
41 |
var queryData = {}; |
|
42 |
|
|
43 |
queryData['materialCode'] = $('#materialCode').val(); |
|
44 |
queryData['materialName'] = $('#materialName').val(); |
|
45 |
queryData['materialView'] = $('#materialView').val(); |
|
46 |
queryData['typeL'] = $('#typeL').val(); |
|
47 |
|
|
48 |
table.reload(MaterialInfo.tableId, { |
|
49 |
where: queryData, page: {curr: 1} |
|
50 |
}); |
|
51 |
}; |
|
52 |
|
|
53 |
// 渲染表格 |
|
54 |
var tableResult = table.render({ |
|
55 |
elem: '#' + MaterialInfo.tableId, |
|
56 |
url: Feng.ctxPath + '/materialInfo/list', |
|
57 |
page: true, |
|
58 |
height: "full-158", |
|
59 |
cellMinWidth: 100, |
|
60 |
cols: MaterialInfo.initColumn() |
|
61 |
}); |
|
62 |
|
|
63 |
// 搜索按钮点击事件 |
|
64 |
$('#btnSearch').click(function () { |
|
65 |
MaterialInfo.search(); |
|
66 |
}); |
|
67 |
|
|
68 |
/** |
|
69 |
* 点击查询按钮 |
|
70 |
*/ |
|
71 |
MaterialInfo.search = function () { |
|
72 |
var queryData = {}; |
|
73 |
|
|
74 |
queryData['materialCode'] = $('#materialCode').val(); |
|
75 |
queryData['materialName'] = $('#materialName').val(); |
|
76 |
queryData['materialView'] = $('#materialView').val(); |
|
77 |
queryData['typeL'] = $('#typeL').val(); |
|
78 |
|
|
79 |
table.reload(MaterialInfo.tableId, { |
|
80 |
where: queryData, page: {curr: 1} |
|
81 |
}); |
|
82 |
}; |
|
83 |
|
|
84 |
let Msg=''; |
|
85 |
table.on('row(materialInfoTable)',function (data) { |
|
86 |
Msg = data.data; |
|
87 |
}) |
|
88 |
|
|
89 |
$('#btnSubmit').focus(function(){ |
|
90 |
if (Msg !='' ){ |
|
91 |
// 判断是否点击的是确定 |
|
92 |
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 |
|
93 |
window.localStorage.setItem('message',JSON.stringify(Msg)); |
|
94 |
parent.layer.close(index); |
|
95 |
} |
|
96 |
else { |
|
97 |
Feng.error("请选择一条数据!") |
|
98 |
} |
|
99 |
}); |
|
100 |
}); |