陈战涛
2023-03-14 c29ed2aa867b00eccfdc7c3a68f431008b13ea7d
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>气体检测</title>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <link href="./css/mui.min.css" rel="stylesheet" />
 
        <style>
            .mui-bar-nav {
                background: #245ca7;
                -webkit-box-shadow: none;
                box-shadow: none;
            }
 
            .mui-title {
                color: #FFFFFF;
            }
 
            .mui-icon-back:before,
            .mui-icon-left-nav:before {
                color: #FFFFFF;
            }
 
            /*气体检测-仓库列表*/
            .gas_depot {
                background: #fff;
                width: 94%;
                margin: auto;
                margin-top: 12px;
                margin-bottom: 10px;
                border-top-left-radius: 5px;
                border-top-right-radius: 5px;
            }
 
            .gas_depot_title {
                background: rgb(68, 189, 245);
                height: 10px;
                border-top-left-radius: 5px;
                border-top-right-radius: 5px;
            }
 
            .gas_depot_body {
                padding-left: 15px;
            }
 
            .gas_depot_body table {
                width: 100%;
            }
 
            .gas_depot_body tr {
                border-bottom: 1px #efefef solid;
                height: 32px;
                line-height: 32px;
            }
 
            .gas_depot_img {
                width: 8px;
                margin-right: 3px;
            }
 
            .gas_depot_one {
                color: rgb(102, 102, 102);
                font-size: 15px;
                width: 35%;
            }
 
            .gas_depot_two {
                color: black;
                font-size: 16px;
                font-weight: 510;
            }
        </style>
    </head>
    <body>
        <header class="mui-bar mui-bar-nav">
            <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
            <h1 class="mui-title">气体检测-仓库列表</h1>
        </header>
        <div class="mui-content">
            <div id="gasList">
                <div class="gas_depot">
                    <div class="gas_depot_title"></div>
                    <div class="gas_depot_body">
                        <table>
                            <tr class="gas_depot_tr">
                                <td class="gas_depot_one">仓库名称:</td>
                                <td class="gas_depot_two">##号仓</td>
                                <td>
                                    <a href="javascript:void(0)" onclick="gasDetail()">
                                        <img class="gas_depot_img" src="./images/ico_arr.png">
                                    </a>
                                </td>
                            </tr>
                            <tr>
                                <td class="gas_depot_one">CO2浓度:</td>
                                <td class="gas_depot_two">## PPM</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="gas_depot_one">PH3浓度:</td>
                                <td class="gas_depot_two">## PPM</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="gas_depot_one">O2浓度:</td>
                                <td class="gas_depot_two">## %</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="gas_depot_one">N2浓度:</td>
                                <td class="gas_depot_two">## %</td>
                                <td></td>
                            </tr>
                            <tr style="border-bottom: 0 #efefef solid;">
                                <td class="gas_depot_one">检测时间:</td>
                                <td class="gas_depot_two">2020-01-01 01:01:01</td>
                                <td></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <script src="./js/mui.js"></script>
        <script src="./js/jquery.min.js"></script>
        <script src="./js/echarts.min.js"></script>
 
        <script type="text/javascript" charset="utf-8">
            var url; //接口路径
            var gasList; //气体仓库列表集合
            var data = {
                "interfaceId": "5301",
                "sign": "10301",
                "outId": "10301",
                "reqDateTime": new Date(),
                "tokenAuth": "",
                "data": {
                    "type": "gas"
                }
            };
            mui.init()
            mui.plusReady(function() {
                var user = JSON.parse(localStorage.getItem('user'));
                data.tokenAuth = user.tokenAuth;
                url = user.url + "/api-phone/gateway";
                getGasList();
            })
 
            //获取仓库信息
            function getGasList() {
                //发送请求获取仓库信息
                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") {
                            gasList = result.data;
                            if (gasList != null && gasList.length > 0) {
                                renderGasList();
                            } else {
                                mui.alert("暂无数据!", '提示',["确定"],function(){},"div");
                            }
                        } else {
                            mui.alert(result.msg, '提示',["确定"],function(){},"div");
                        }
                    },
                    error: function() {
                        mui.alert('系统繁忙,请重试!', '提示',["确定"],function(){},"div");
                    }
                })
            }
 
            //渲染
            function renderGasList() {
                var html = '';
                $.each(gasList, function(index, item) {
                    html += '<div class="gas_depot"><div class="gas_depot_title"></div><div class="gas_depot_body"><table>';
 
                    html += '<tr class="gas_depot_tr"><td class="gas_depot_one">仓库名称:</td><td class="gas_depot_two">' +
                        item.depotName + '</td><td><a href="javascript:void(0)" onclick="gasDetail(\'' + index + '\')">' +
                        '<img class="gas_depot_img" src="./images/ico_arr.png"></a></td></tr>';
 
                    html += '<tr><td class="gas_depot_one">CO2浓度:</td><td class="gas_depot_two">' +
                        item.perCo2 + ' PPM</td><td></td></tr>';
 
                    html += '<tr><td class="gas_depot_one">PH3浓度:</td><td class="gas_depot_two">' +
                        item.perPh3 + ' PPM</td><td></td></tr>';
 
                    html += '<tr><td class="gas_depot_one">O2浓度:</td><td class="gas_depot_two">' +
                        item.perO2 + ' PPM</td><td></td></tr>';
 
                    html += '<tr><td class="gas_depot_one">N2浓度:</td><td class="gas_depot_two">' +
                        item.perN2 + ' PPM</td><td></td></tr>';
 
                    html += '<tr style="border-bottom: 0 #efefef solid;"><td class="gas_depot_one">检测时间:</td>' +
                        '<td class="gas_depot_two">' + (item.receiveDate == null ? '无检测记录' : item.receiveDate) + '</td><td></td></tr>';
                    html += '</table></div></div>';
                })
                $("#gasList").html(html);
            }
 
            function gasDetail(index) {
                mui.openWindow({
                    url: "gas-detail.html",
                    id: "gas-detail",
                    extras: {
                        depotType: gasList[index].depotType, 
                        depotId: gasList[index].depotId, 
                        depotName: gasList[index].depotName
                    }
                })
            }
        </script>
    </body>
</html>