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