提交 | 用户 | 时间
|
71e81e
|
1 |
layui.use(['table', 'admin', 'ax', 'func', 'form', 'layer'], 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 |
var form = layui.form; |
|
8 |
var layer = layui.layer; |
|
9 |
|
|
10 |
/** |
|
11 |
* 物料档案管理 |
|
12 |
*/ |
|
13 |
var MaterialArchives = { |
|
14 |
tableId: "materialArchivesTable" |
|
15 |
}; |
|
16 |
|
|
17 |
/** |
|
18 |
* 初始化表格的列 |
|
19 |
*/ |
|
20 |
MaterialArchives.initColumn = function () { |
|
21 |
return [[ |
|
22 |
{type: 'checkbox'}, |
|
23 |
{field: 'id', hide: true, title: 'id'}, |
|
24 |
{field: 'maintainContentCode', title: '编号'}, |
|
25 |
{field: 'maintainContentName', title: '名称'}, |
|
26 |
{field: 'maintainContentType', title: '类型'}, |
|
27 |
{field: 'maintainContent', title: '保养内容描述'}, |
|
28 |
]]; |
|
29 |
}; |
|
30 |
|
|
31 |
/** |
|
32 |
* 点击查询按钮 |
|
33 |
*/ |
|
34 |
MaterialArchives.search = function () { |
|
35 |
var queryData = {}; |
|
36 |
|
|
37 |
queryData['maintainContentCode'] = $('#maintainContentCode').val(); |
|
38 |
queryData['maintainContentName'] = $('#maintainContentName').val(); |
|
39 |
|
|
40 |
table.reload(MaterialArchives.tableId, { |
|
41 |
where: queryData, page: {curr: 1} |
|
42 |
}); |
|
43 |
}; |
|
44 |
|
|
45 |
// 渲染表格 |
|
46 |
var tableResult = table.render({ |
|
47 |
elem: '#' + MaterialArchives.tableId, |
|
48 |
url: Feng.ctxPath + '/equipmentMaintainContentConf/list', |
|
49 |
page: true, |
|
50 |
height: "full-158", |
|
51 |
cellMinWidth: 100, |
|
52 |
cols: MaterialArchives.initColumn() |
|
53 |
}); |
|
54 |
|
|
55 |
// 搜索按钮点击事件 |
|
56 |
$('#btnSearch').click(function () { |
|
57 |
MaterialArchives.search(); |
|
58 |
}); |
|
59 |
|
|
60 |
// 确定按钮点击事件 |
|
61 |
$('#btnAdd').click(function () { |
|
62 |
MaterialArchives.infoToFath(); |
|
63 |
}); |
|
64 |
|
|
65 |
/** |
|
66 |
* 传递选择的数据 |
|
67 |
*/ |
|
68 |
MaterialArchives.infoToFath = function () { |
|
69 |
var checkRows = table.checkStatus(MaterialArchives.tableId); |
|
70 |
if (checkRows.data.length === 0) { |
|
71 |
Feng.error("请选择物料!"); |
|
72 |
} else { |
|
73 |
//给父页面传值 |
|
74 |
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 |
|
75 |
parent.layui.$('#materialList').val(JSON.stringify(checkRows.data)); |
|
76 |
parent.layer.close(index); |
|
77 |
} |
|
78 |
}; |
|
79 |
|
|
80 |
}); |