1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
| var pageCurr;
| layui.config({
| base: baseUrl + "/static/layui/lay/modules/"
| }).use(['table', 'laydate', 'form'], function () {
| var table = layui.table;
| var $ = layui.jquery;
| var layer = layui.layer;
| var form = layui.form;
|
| // 数据渲染(只读模式,无增删改操作)
| var tableIns = table.render({
| elem: '#inventoryReserveLog',
| headers: { token: localStorage.getItem('token') },
| url: baseUrl + '/inventoryReserveLog/list/auth',
| page: true,
| limit: 15,
| limits: [15, 30, 50, 100, 200],
| cellMinWidth: 50,
| height: 'full-150',
| cols: [[
| { type: 'numbers', title: '#' },
| { field: 'matnr', align: 'center', title: '物料编码' },
| { field: 'maktx', align: 'center', title: '物料名称' },
| { field: 'orderNo', align: 'center', title: '订单号', width: 150 },
| { field: 'batch', align: 'center', title: '批次', width: 120 },
| { field: 'quantity', align: 'center', title: '数量', width: 100 },
| { field: 'expiceTime$', align: 'center', title: '过期时间', width: 180 },
| { field: 'createTime$', align: 'center', title: '原创建时间', width: 180 },
| { field: 'updateTime$', align: 'center', title: '转移时间', width: 180 },
| { field: 'memo', align: 'center', title: '过期原因', width: 180 }
| ]],
| request: {
| pageName: 'curr',
| pageSize: 'limit'
| },
| parseData: function (res) {
| return {
| 'code': res.code,
| 'msg': res.msg,
| 'count': res.data.total,
| 'data': res.data.records
| }
| },
| response: {
| statusCode: 200
| },
| done: function (res, curr, count) {
| if (res.code === 403) {
| top.location.href = baseUrl + "/";
| }
| pageCurr = curr;
| }
| });
|
| // 搜索
| form.on('submit(search)', function (data) {
| pageCurr = 1;
| tableReload();
| });
|
| // 重置
| form.on('submit(reset)', function (data) {
| pageCurr = 1;
| clearFormVal($('#search-box'));
| tableReload();
| });
|
| // 表格重载
| function tableReload() {
| var searchData = {};
| $.each($('#search-box [name]').serializeArray(), function () {
| searchData[this.name] = this.value;
| });
| tableIns.reload({
| where: searchData,
| page: { curr: pageCurr }
| });
| }
|
| // 清空表单
| function clearFormVal(el) {
| $(':input', el)
| .val('')
| .removeAttr('checked')
| .removeAttr('selected');
| }
|
| });
|
|