YYC
2023-06-19 0b27b9263ce721844d124ec4541a83b0f6db6c13
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
var url = null;
var recordData = null;
var recordList = null;
var data = {
    "interfaceId": "5205",
    "sign": "10205",
    "outId": "10205",
    "reqDateTime": new Date(),
    "tokenAuth": "",
    "data": {
        "deptId": ""
    }
};
 
//初始化数据
function init() {
    var user = JSON.parse(localStorage.getItem('user'));
    var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
    url = user.url + "/api-phone/v35/gateway";
    data.tokenAuth = user.tokenAuth;
    data.data.deptId = selectDeptId;
 
    //获取实时出入库信息
    getRecordList();
}
 
//查询入库记录
function getRecordList() {
    recordData = null;
 
    //请求
    mui.ajax(url, {
        type: "POST",
        dataType: "json",
        crossDomain: true,
        contentType: "application/json;charset=utf-8",
        data: JSON.stringify(data),
        success: function(result) {
            if (result.code == "0000") {
                console.log(JSON.stringify(result))
                recordData = result.data;
                renderData();
            } else {
                renderData();
                mui.toast(result.mag);
            }
        },
        error: function() {
            mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div")
        }
    })
}
 
//渲染页面
function renderData() {
    var html = '';
    console.log(JSON.stringify(recordData))
    if (recordData) {
        $("#inSumNum").html(recordData.inSumNum);
        $("#inCompleteNum").html(recordData.inCompleteNum);
        $("#perInComplete").html(recordData.perInComplete);
        $("#outSumNum").html(recordData.outSumNum);
        $("#outCompleteNum").html(recordData.outCompleteNum);
        $("#perOutComplete").html(recordData.perOutComplete);
        $("#time").html("更新时间:" + recordData.time);
        var listInout = recordData.listInout;
        if (listInout && listInout.length > 0) {
            $.each(listInout, function(index, item) {
                html += '<div class="item">';
                html += '<div class="id">单据号: ' + item.id + '<span class="status enter">' + item.type +
                    '</span></div>';
                html += '<ul class="g-listb2">';
                html += '<li><div class="con" style="background-image: url(images/icons/g-i24.png);">';
                html += '车牌号:<b>' + (item.plateNum == null ? "-" : item.plateNum) + '</b></div></li>';
                html += '<li><div class="con" style="background-image: url(images/icons/g-i25.png);">';
                html += '仓库名称:<b>' + (item.depotName == null ? "-" : item.depotName) + '</b></div></li>';
                html += '<li><div class="con" style="background-image: url(images/icons/g-i32.png);">';
                html += '粮食品种:<b>' + (item.foodVarietyName == null ? "-" : item.foodVarietyName) + '</b></div></li>';
                html += '<li><div class="con" style="background-image: url(images/icons/g-i24.png);">';
                html += '当前流程:<span>' + (item.progressName == null ? "-" : item.progressName) +
                    '</span></div></li>';
                html += '</ul></div>';
            })
        } else {
            html += '<div class="id" style="text-align: center;">暂无实时信息</div>';
        }
    } else {
        $("#inSumNum").html("0");
        $("#inCompleteNum").html("0");
        $("#perInComplete").html("0");
        $("#outSumNum").html("0");
        $("#outCompleteNum").html("0");
        $("#perOutComplete").html("0");
        $("#time").html("更新时间:2023-01-01 00:00:00");
        html += '<div class="id" style="text-align: center;">暂无实时信息</div>';
    }
    $("#listInout").html(html);
}
 
//滑动
mui('.mui-scroll-wrapper').scroll({
    indicators: false, //是否显示滚动条
    deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
    bounce: false, //是否启用回弹
    deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
});