jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
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
var layer = layui.layer;
var table;
//三维模型中的采集点数据
var listPest;
var pestData;
var depotId;
var depotData;
 
(function() {
    layui.use([ 'layer', 'laydate', 'table', 'form' ], function() {
        table = layui.table;
        layer = layui.layer;
        var form = layui.form;
        var layDate = layui.laydate;
 
        //日期
        layDate.render({
            elem : '#checkDate'
        });
 
        //监听仓库选择
        form.on('select(select_depotId)', function(obj) {
            flushData();
        });
    });
 
    // 初始化WebSocket
    initWS(deptId, bizType,null, userId);
 
}).call(this);
 
//socket信息返回處理
function socketOnMessage(pocket) {
    if (pocket.orderResp == "MSG_SUCCESS") {// 信息解析成功刷新当前数据
        flushData();
    }
    window.parent.sysNotify(pocket.data);
};
 
//点击刷新操作
function flushData() {
    depotId = $("#depotId").val();
    var checkDate = $("#checkDate").val();
 
    if (!depotId) {
        layer.msg("请先选择仓库!");
        return;
    }
 
    var data = {
        depotId : depotId,
        checkDate : checkDate
    };
    $.ajax({
        type : "POST",
        url : "../../basic/pest/list-data",
        dataType : "json",
        contentType : "application/json;charset=UTF-8",
        data : JSON.stringify(data),
        success : function(result) {
            if (result.code != "0000") {
                layer.msg(result.msg);
                return;
            }
 
            listPest = result.data;
            pestData = listPest[0];
 
            // 渲染结果
            renderPestInfo();
 
            // 渲染表格
            renderPestTable();
 
            layer.msg("更新成功……");
        },
        error : function() {
            layer.msg("根据当前条件获取虫害数据渲染图标失败!!");
        }
    });
};
 
/**
 * 展示采集点信息
 */
function renderPestTable() {
    var listPoint = pestData.listPoint;
    table.render({
        elem : '#tablePestInfo',
        height : 400,
        data : listPoint,
        page : false,
        limit : 100,
        cols : [ [ {
            field : 'passCode',
            title : '检测点',
            align : 'center',
        }, {
            field : 'pestNum',
            title : '检测头数',
            align : 'center'
        }, {
            field : 'receiveDate',
            title : '检测时间',
            align : 'center'
        }, {
            field : 'remark',
            title : '说明',
            align : 'center'
        } ] ]
    });
};
 
//填写数据
function renderPestInfo() {
    console.log(pestData);
    $("#reciveDate").attr("value", pestData.reciveDate);
    $("#remark").attr("value", pestData.remark);
    $("#pestMax").attr("value", pestData.pestMax);
    $("#checkUser").attr("value", pestData.checkUser);
    $("#checkUser").attr("value", pestData.checkUser);
};
 
//点击采集
function checkPest() {
    layer.msg("虫害采集与气体采集命令一致,避免冲突,暂时关闭该功能!!");
};