CZT
2023-10-20 3631219246be48aec1e745e94e5b28ff4e8799c8
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
var layer;
var chartLine;
$(function() {
    layui.use([ 'layer', 'laydate', 'form' ], function() {
        var form = layui.form; // 只有执行了这一步,部分表单元素才会自动修饰成功
        layer = layui.layer;
        layDate = layui.laydate;
 
        form.render();
 
        // 日期
        layDate.render({
            elem : '#start'
        });
        // 日期
        layDate.render({
            elem : '#end'
        });
    });
 
    // 根据页面自动计算余下款低-选择框的高度
    var bodyHeight = window.innerHeight;
    var headerHeight = $("#header-condition").height();
    $("#container").css("height", bodyHeight - headerHeight - 40);
    // 初始化显示走势图
    chartLine = initChartLine();
});
 
// 执行查询
function query() {
    var data = {};
    var t = $('#form-query').serializeArray();
    $.each(t, function() {
        data[this.name] = this.value;
    });
    var index = layer.load(0);
    $.ajax({
        type : "POST",
        url : "../../basic/gas/list-chart",
        dataType : "json",
        contentType : "application/json;charset=UTF-8",
        data : JSON.stringify(data),
        success : function(result) {
            layer.close(index);
            if(result){
                renderChart(result);
            }else{
                layer.msg("没有获取到检测结果信息!");
            }
        },
        error : function(result) {
            layer.close(index);
            layer.msg("获取数据失败,请重新尝试!");
        }
    });
};
 
function renderChart(result) {
    var txt = $("#depotId").find("option:selected").text();
    chartLine.option.title.text = txt + "气体检测走势";
    chartLine.option.xAxis[0].data = result.listDate;
    chartLine.option.series[0].data = result.o2Ave;
    chartLine.option.series[1].data = result.o2Max;
    chartLine.option.series[2].data = result.o2Min;
    
    chartLine.option.series[3].data = result.n2Ave;
    chartLine.option.series[4].data = result.n2Max;
    chartLine.option.series[5].data = result.n2Min;
    
    chartLine.option.series[6].data = result.co2Ave;
    chartLine.option.series[7].data = result.co2Max;
    chartLine.option.series[8].data = result.co2Min;
    
    chartLine.option.series[9].data = result.ph3Ave;
    chartLine.option.series[10].data = result.ph3Max;
    chartLine.option.series[11].data = result.ph3Min;
 
    chartLine.chart.setOption(chartLine.option, true);
};
 
function initChartLine() {
    var option = {
        title : {
            text : '气体检测走势',
            show : true
        },
        tooltip : {
            trigger : 'axis',
            axisPointer : {
                type : 'cross',
                label : {
                    backgroundColor : '#6a7985'
                }
            }
        },
        color : [ '#FF00FF', '#0000FF', '#00FFFF', '#00FF00', '#FFFF00',
                '#FF7D00', '#FF0000', '#4472C5', '#ED7C30', '#80FF80',
                '#FF8096', '#800080' ],
        legend : {
            data : [ 'O2最高', 'O2平均', 'O2最低', 'CO2最高', 'CO2平均', 'CO2最低',
                    'PH3最高', 'PH3平均', 'PH3最低', 'N2最高', 'N2平均', 'N2最低' ],
            bottom : '10',
            top : 'bottom',
            selected : {
                'O2最高' : false,
                'O2平均' : true,
                'O2最低' : false,
                'CO2最高' : false,
                'CO2平均' : true,
                'CO2最低' : false,
                'PH3最高' : false,
                'PH3平均' : true,
                'PH3最低' : false,
                'N2最高' : false,
                'N2平均' : true,
                'N2最低' : false,
            }
        },
        grid : {
            left : '3%',
            right : '3%',
            bottom : '3%',
            containLabel : true
        },
        xAxis : [ {
            data : [ '01:00', '02:00', '03:00', '04:00', '05:00', '06:00',
                    '07:00', '08:00', '09:00', '10:00', '11:00', '12:00' ]
        } ],
        yAxis : [ {
            name : 'O2/N2 气体单位(%)',
            type : 'value'
        }, {
            name : 'PH3/CO2 气体单位(PPM)',
            type : 'value'
        } ],
        series : [
                {
                    name : 'O2平均',
                    type : 'line',
                    itemStyle : {
                        normal : {
                            color : '#FF7D00',
                            borderColor : '#FF7D00'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'O2最低',
                    type : 'line',
                    itemStyle : {
                        normal : {
                            color : '#0000FF',
                            borderColor : '#0000FF'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'O2最高',
                    type : 'line',
                    itemStyle : {
                        normal : {
                            color : '#00FFFF',
                            borderColor : '#00FFFF'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'N2平均',
                    type : 'line',
                    itemStyle : {
                        normal : {
                            color : '#FF7D00',
                            borderColor : '#FF7D00'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'N2最低',
                    type : 'line',
                    itemStyle : {
                        normal : {
                            color : '#0000FF',
                            borderColor : '#0000FF'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'N2最高',
                    type : 'line',
                    itemStyle : {
                        normal : {
                            color : '#00FFFF',
                            borderColor : '#00FFFF'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'CO2最高',
                    type : 'line',
                    yAxisIndex : 1,
                    itemStyle : {
                        normal : {
                            color : '#00FF00',
                            borderColor : '#00FF00'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'CO2平均',
                    type : 'line',
                    yAxisIndex : 1,
                    itemStyle : {
                        normal : {
                            color : '#FF0000',
                            borderColor : '#FF0000'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
 
                {
                    name : 'CO2最低',
                    type : 'line',
                    yAxisIndex : 1,
                    itemStyle : {
                        normal : {
                            color : '#FF00FF',
                            borderColor : '#FF00FF'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'PH3最高',
                    type : 'line',
                    yAxisIndex : 1,
                    itemStyle : {
                        normal : {
                            color : '#FFFF00',
                            borderColor : '#FFFF00'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'PH3平均',
                    type : 'line',
                    yAxisIndex : 1,
                    itemStyle : {
                        normal : {
                            color : '#000000',
                            borderColor : '#000000'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                },
                {
                    name : 'PH3最低',
                    yAxisIndex : 1,
                    type : 'line',
                    itemStyle : {
                        normal : {
                            color : '#4472C5',
                            borderColor : '#4472C5'
                        }
                    },
                    data : [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.0 ]
                }
 
        ]
    };
    var myChart = echarts.init(document.getElementById("container"), "light");
    myChart.setOption(option, true);
    return {
        "chart" : myChart,
        "option" : option
    };
};