YYC
2023-10-19 6bd36a38fc587ba39bd50e26257ed6ece71363e7
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
var layer;
var timer;
var table;
var limit = 200;
$(function () {
    layui.use(['layer', 'laydate', 'table'], function () {
        layer = layui.layer;
        table = layui.table;
 
        //页面初始化刷新页面
        flushData();
 
        // 每间隔1分钟执行一次刷新
        if (timer) clearInterval(timer);
        timer = setInterval(function () {
            flushData();
        }, 60 * 1000);
 
    });
});
 
function flushData() {
    var param = {
        deptId: deptId,
        type: type
    };
    $.ajax({
        type: "POST",
        url: "../../basic/inout/list-progress",
        dataType: "json",
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(param),
        success: function (result) {
            if (result.code != "0000") {
                layer.msg(result.msg);
            } else {
                renderTable(result.data);
            }
        },
        error: function () {
            layer.msg("系统获取数据出现异常,重新尝试");
        }
    });
}
 
function renderTable(data) {
    var listProgress = data.listProgress;
    var listComplete = data.listComplete;
 
    renderInoutList(listProgress);
 
    renderCompleteInoutList(listComplete);
}
 
// 渲染出入库列表数据
function renderInoutList(list) {
    if (list.length == 0) {
        return;
    }
    // 清空数据
    $("#inoutList").empty();
    table.render({
        elem: '#inoutList',
        limit: limit,
        even: true,
        width: 952,
        cols: [[
            {field: 'id', title: '单据号', width: '18%'},
            {
                field: 'type', title: '类型', width: '15%', templet: function (d) {
                    return ("IN" == d.type) ? "入库" : "出库"
                }
            },
            {field: 'userName', title: '承运人', width: '16%'},
            {field: 'plateNum', title: '车牌号', width: '16%'},
            {
                field: 'progress', title: '当前流程', width: '16%', templet: function (d) {
                    return mapProgress[d.progress]
                }
            },
            {
                field: 'depotId', title: '装卸仓库', width: '19%', templet: function (d) {
                    return (null == d.depotId) ? "" : mapDept[d.depotId]
                }
            }
        ]],
        data: list
    });
 
    $("thead tr").css({
        "border-bottom": "2px solid #53adce",
        "background": "#eff4f6",
    });
};
 
// 完成列表
function renderCompleteInoutList(list) {
    if (list.length == 0) {
        return;
    }
    // 清空数据
    $("#inoutCompleteList").empty();
    table.render({
        elem: '#inoutCompleteList',
        limit: limit,
        even: true,
        width: 952,
        cols: [[
            {field: 'id', title: '单据号', width: '18%'},
            {
                field: 'type', title: '类型', width: '15%', templet: function (d) {
                    return ("IN" == d.type) ? "入库" : "出库"
                }
            },
            {field: 'userName', title: '承运人', width: '16%'},
            {field: 'plateNum', title: '车牌号', width: '16%'},
            {
                field: 'depotId', title: '装卸仓库', width: '16%', templet: function (d) {
                    return (null == d.depotId) ? "" : mapDept[d.depotId]
                }
            },
            {
                field: 'completeTime', title: '完成时间', width: '19%', templet: function (d) {
                    return (null == d.completeTime) ? "" : d.completeTime
                }
            }
        ]],
        data: list
    });
    $("thead tr").css({
        "border-bottom": "2px solid #53adce",
        "background": "#eff4f6",
    });
};