提交 | 用户 | 时间
|
71e81e
|
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 RepairManageInfo = { |
|
12 |
tableId: "repairManageInfoTable" |
|
13 |
}; |
|
14 |
|
|
15 |
/** |
|
16 |
* 初始化表格的列 |
|
17 |
*/ |
|
18 |
RepairManageInfo.initColumn = function () { |
|
19 |
return [[ |
|
20 |
{type: 'checkbox'}, |
|
21 |
{field: 'id', hide: true, title: 'id'}, |
|
22 |
{field: 'sfc', sort: true, title: '总成编码',width:200}, |
|
23 |
{field: 'productionLine', sort: true, title: '产线编号',width:100}, |
|
24 |
{field: 'locationCode', sort: true, title: '工位编号',width:100}, |
|
25 |
{field: 'workOrderNo', sort: true, title: '工单编号',width:150}, |
|
26 |
{field: 'productCode', sort: true, title: '产品编号',width:130}, |
|
27 |
{field: 'productName', sort: true, title: '产品名称',width:280}, |
|
28 |
{field: 'manageType', sort: true, title: '类型'}, |
|
29 |
// {field: 'upPlc', sort: true, title: '上传plc(1是、0否 默认为0)'}, |
|
30 |
{field: 'operateTime', sort: true, title: '操作时间',width:165}, |
|
31 |
{field: 'operateUser', sort: true, title: '操作人'}, |
|
32 |
// {field: 'spareField1', sort: true, title: '预留字段1'}, |
|
33 |
// {field: 'spareField2', sort: true, title: '预留字段2'}, |
|
34 |
// {field: 'spareField3', sort: true, title: '预留字段3'}, |
|
35 |
// {field: 'spareField4', sort: true, title: '预留字段4'}, |
|
36 |
{align: 'center', toolbar: '#tableBar', title: '操作',width:120} |
|
37 |
]]; |
|
38 |
}; |
|
39 |
|
|
40 |
/** |
|
41 |
* 点击查询按钮 |
|
42 |
*/ |
|
43 |
RepairManageInfo.search = function () { |
|
44 |
var queryData = {}; |
|
45 |
|
|
46 |
queryData['sfc'] = $('#sfc').val(); |
|
47 |
queryData['productionLine'] = $('#productionLine').val(); |
|
48 |
queryData['locationCode'] = $('#locationCode').val(); |
|
49 |
queryData['workOrderNo'] = $('#workOrderNo').val(); |
|
50 |
queryData['productCode'] = $('#productCode').val(); |
|
51 |
queryData['manageType'] = $('#manageType').val(); |
|
52 |
|
|
53 |
|
|
54 |
table.reload(RepairManageInfo.tableId, { |
|
55 |
where: queryData, page: {curr: 1} |
|
56 |
}); |
|
57 |
}; |
|
58 |
|
|
59 |
/** |
|
60 |
* 跳转到添加页面 |
|
61 |
*/ |
|
62 |
RepairManageInfo.jumpAddPage = function () { |
|
63 |
window.location.href = Feng.ctxPath + '/repairManageInfo/add' |
|
64 |
}; |
|
65 |
|
|
66 |
/** |
|
67 |
* 跳转到编辑页面 |
|
68 |
* |
|
69 |
* @param data 点击按钮时候的行数据 |
|
70 |
*/ |
|
71 |
RepairManageInfo.jumpEditPage = function (data) { |
|
72 |
window.location.href = Feng.ctxPath + '/repairManageInfo/edit?id=' + data.id |
|
73 |
}; |
|
74 |
|
|
75 |
/** |
|
76 |
* 导出excel按钮 |
|
77 |
*/ |
|
78 |
RepairManageInfo.exportExcel = function () { |
|
79 |
var checkRows = table.checkStatus(RepairManageInfo.tableId); |
|
80 |
if (checkRows.data.length === 0) { |
|
81 |
Feng.error("请选择要导出的数据"); |
|
82 |
} else { |
|
83 |
table.exportFile(tableResult.config.id, checkRows.data, 'xls'); |
|
84 |
} |
|
85 |
}; |
|
86 |
|
|
87 |
/** |
|
88 |
* 点击删除 |
|
89 |
* |
|
90 |
* @param data 点击按钮时候的行数据 |
|
91 |
*/ |
|
92 |
RepairManageInfo.onDeleteItem = function (data) { |
|
93 |
var operation = function () { |
|
94 |
var ajax = new $ax(Feng.ctxPath + "/repairManageInfo/delete", function (data) { |
|
95 |
Feng.success("删除成功!"); |
|
96 |
table.reload(RepairManageInfo.tableId); |
|
97 |
}, function (data) { |
|
98 |
Feng.error("删除失败!" + data.responseJSON.message + "!"); |
|
99 |
}); |
|
100 |
ajax.set("id", data.id); |
|
101 |
ajax.start(); |
|
102 |
}; |
|
103 |
Feng.confirm("是否删除?", operation); |
|
104 |
}; |
|
105 |
|
|
106 |
// 渲染表格 |
|
107 |
var tableResult = table.render({ |
|
108 |
elem: '#' + RepairManageInfo.tableId, |
|
109 |
url: Feng.ctxPath + '/repairManageInfo/list', |
|
110 |
page: true, |
|
111 |
height: "full-158", |
|
112 |
cellMinWidth: 100, |
|
113 |
cols: RepairManageInfo.initColumn() |
|
114 |
}); |
|
115 |
|
|
116 |
// 搜索按钮点击事件 |
|
117 |
$('#btnSearch').click(function () { |
|
118 |
RepairManageInfo.search(); |
|
119 |
}); |
|
120 |
|
|
121 |
// 添加按钮点击事件 |
|
122 |
$('#btnAdd').click(function () { |
|
123 |
|
|
124 |
RepairManageInfo.jumpAddPage(); |
|
125 |
|
|
126 |
}); |
|
127 |
|
|
128 |
// 导出excel |
|
129 |
$('#btnExp').click(function () { |
|
130 |
RepairManageInfo.exportExcel(); |
|
131 |
}); |
|
132 |
|
|
133 |
// 工具条点击事件 |
|
134 |
table.on('tool(' + RepairManageInfo.tableId + ')', function (obj) { |
|
135 |
var data = obj.data; |
|
136 |
var layEvent = obj.event; |
|
137 |
|
|
138 |
if (layEvent === 'edit') { |
|
139 |
RepairManageInfo.jumpEditPage(data); |
|
140 |
} else if (layEvent === 'delete') { |
|
141 |
RepairManageInfo.onDeleteItem(data); |
|
142 |
} |
|
143 |
}); |
|
144 |
}); |