zhanghua
2023-11-13 2b6f255b97dba15d22b86319e2f38f6efac417cc
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<template>
  <div class="body">
    <el-descriptions>
      <el-descriptions-item label="餐饮企业名称">{{
        localeInfo.customer.Name
      }}</el-descriptions-item>
      <el-descriptions-item label="联系人">{{
        localeInfo.customer.Contact
      }}</el-descriptions-item>
      <el-descriptions-item label="联系电话">{{
        localeInfo.customer.Mobile
      }}</el-descriptions-item>
      <el-descriptions-item label="详细地址">
        {{ localeInfo.customer.Address }}
      </el-descriptions-item>
      <el-descriptions-item label="监测点类型">
        {{
          localeInfo.customer.Typ == 4 ? "一般检测点" : "其他"
        }}</el-descriptions-item
      >
      <el-descriptions-item label="所属单位">
        {{ localeInfo.customer.Org }}</el-descriptions-item
      >
      <el-descriptions-item label="菜系">
        {{ this.getCuisineName(localeInfo.locale.Cuisine) }}
      </el-descriptions-item>
      <el-descriptions-item label="风速">
        {{ localeInfo.locale.FanSpeed }}m/s
      </el-descriptions-item>
      <el-descriptions-item label="风量">
        {{ localeInfo.locale.FanQuantity }}m³/h</el-descriptions-item
      >
      <el-descriptions-item label="管道截面面积">
        {{ localeInfo.locale.PipeArea }}m²</el-descriptions-item
      >
      <el-descriptions-item label="灶头数量">
        {{ localeInfo.locale.StoveNum }}个</el-descriptions-item
      >
      <el-descriptions-item label="集气罩面积">
        {{ localeInfo.locale.StoveArea }}m²</el-descriptions-item
      >
    </el-descriptions>
 
    <div class="title">一、技术指导:</div>
    <el-table :data="tableData1" style="width: 100%">
      <el-table-column prop="cuisine" label="菜系" width="180">
      </el-table-column>
      <el-table-column prop="name" label="建议使用的净化设施" width="180">
      </el-table-column>
      <el-table-column prop="img" label="净化器图片">
        <template slot-scope="scope">
          <img ref="scope.img" />
        </template>
      </el-table-column>
      <el-table-column prop="model" label="商家净化器款式"> </el-table-column>
      <el-table-column prop="status" label="油烟排放情况"> </el-table-column>
    </el-table>
 
    <div class="title">二、餐饮企业在线监测情况汇总:</div>
 
    <div id="myChart1" class="echart-foot"></div>
 
    <div id="myChart2" class="echart-foot"></div>
 
    <div class="title">三、餐饮企业健康情况展示:</div>
    <el-table :data="tableData2" style="width: 100%">
      <el-table-column prop="localeName" label="监测点" width="180">
      </el-table-column>
      <el-table-column prop="mn" label="设备编号" width="180">
      </el-table-column>
      <el-table-column prop="complianceDays" label="达标天数">
      </el-table-column>
      <el-table-column prop="excessDays" label="超标天数"> </el-table-column>
      <el-table-column prop="filterAbnormallyUsedDays" label="净化器不正常天数">
      </el-table-column>
      <el-table-column prop="abnormalOfflineDays" label="店家原因离线天数">
      </el-table-column>
      <el-table-column prop="healthCodeColor" label="油烟健康码">
      </el-table-column>
    </el-table>
 
    <div class="title small_title">净化器需清洗黄码报警提示:</div>
    <el-table :data="tableData3" style="width: 100%">
      <el-table-column prop="localeName" label="监测点" width="180">
      </el-table-column>
      <el-table-column prop="mn" label="设备编号" width="180">
      </el-table-column>
      <el-table-column prop="dayttt" label="净化器需清洗"> </el-table-column>
      <el-table-column prop="dayttt" label="净化器未清洗导致超标">
      </el-table-column>
      <el-table-column prop="dayttt" label="净化器清洗天数"> </el-table-column>
      <el-table-column prop="dayttt" label="净化器已洗天数"> </el-table-column>
    </el-table>
 
    <div class="title small_title">超标,设备损坏红码报警提示:</div>
    <el-table :data="tableData4" style="width: 100%">
      <el-table-column prop="localeName" label="监测点" width="180">
      </el-table-column>
      <el-table-column prop="mn" label="设备编号" width="180">
      </el-table-column>
      <el-table-column prop="dayttt2" label="超标原因"> </el-table-column>
      <el-table-column prop="dayttt2" label="设备损坏原因"> </el-table-column>
      <el-table-column prop="dayttt2" label="管理部门"> </el-table-column>
      <el-table-column prop="dayttt2" label="商家进行整改"> </el-table-column>
      <el-table-column prop="dayttt2" label="整改完成"> </el-table-column>
    </el-table>
    <div class="title">四、现场照片:</div>
    <div>未上传现场照片</div>
    <div class="title">五、净化设备清洗维保记录:</div>
 
    <el-table :data="tableData5" style="width: 100%">
      <el-table-column prop="cuisine" label="监测点" width="180">
      </el-table-column>
      <el-table-column prop="name" label="安装地址" width="180">
      </el-table-column>
      <el-table-column prop="cuisine" label="提交日期" width="180">
      </el-table-column>
      <el-table-column prop="name" label="起始日期" width="180">
      </el-table-column>
      <el-table-column prop="img" label="终止日期"> </el-table-column>
      <el-table-column prop="model" label="清洗照片"> </el-table-column>
    </el-table>
    <div class="title">六、整改记录:</div>
 
    <el-table :data="tableData6" style="width: 100%">
      <el-table-column prop="cuisine" label="监测点" width="180">
      </el-table-column>
      <el-table-column prop="name" label="安装地址" width="180">
      </el-table-column>
      <el-table-column prop="cuisine" label="整改开始日期" width="180">
      </el-table-column>
      <el-table-column prop="name" label="整改结束日期" width="180">
      </el-table-column>
      <el-table-column prop="img" label="整改结果"> </el-table-column>
      <el-table-column prop="model" label="详情"> </el-table-column>
    </el-table>
    <div class="title">七、执法管理记录:</div>
 
    <el-table :data="tableData7" style="width: 100%">
      <el-table-column prop="cuisine" label="监测点" width="180">
      </el-table-column>
      <el-table-column prop="name" label="安装地址" width="180">
      </el-table-column>
      <el-table-column prop="img" label="处理日期"> </el-table-column>
      <el-table-column prop="model" label="管理类型"> </el-table-column>
      <el-table-column prop="status" label="处理人员"> </el-table-column>
      <el-table-column prop="status" label="处理结果"> </el-table-column>
      <el-table-column prop="status" label="详情"> </el-table-column>
    </el-table>
  </div>
</template>
 
<script>
import * as echarts from "echarts";
import statisticsApi from "@/api/smoke/statistics";
export default {
  data() {
    return {
      localeInfo: {},
      listLocale: [],
      tableData1: [],
      tableData2: [],
      tableData3: [],
      tableData4: [],
      tableData5: [],
      tableData6: [],
      tableData7: [],
    };
  },
 
  created() {
    this.getData();
  },
  methods: {
    getData() {
      let param = {
        field: "detectorDailySumDays",
        localeId: this.inTimeData.Lid,
      };
      statisticsApi.getDocument(param).then((jsonStr) => {
        const res = JSON.parse(jsonStr);
 
        this.localeInfo = JSON.parse(res.detectorDailySumDays).Data;
        this.listLocale = JSON.parse(res.listLocale).Data.content;
 
        this.listLocale.forEach((l) => {
          this.tableData1.push({
            cuisine: this.getCuisineName(l.Cuisine),
            name: "低空净化器",
            img: "../../../../imgs/normalLocale.png",
            model: "低空净化器",
            status: "达标",
          });
        });
 
        this.tableData2.push(this.localeInfo);
 
        this.localeInfo.dayttt = 0;
        this.tableData3.push(this.localeInfo);
 
        this.localeInfo.dayttt2 = "-";
        this.tableData4.push(this.localeInfo);
 
        let ten_min_data = JSON.parse(res.tenMinData);
        let detector_daily = JSON.parse(res.detectorDaily);
        setTimeout(() => {
          this.initLineChart(ten_min_data.Data);
          this.initColumnarChart(detector_daily.Data);
        }, 3000);
      });
    },
    initLineChart(list) {
      let myecharts = echarts.init(document.getElementById("myChart1"));
 
      let times = this.getTimer("2020-01-01 00:00:00", 10, 144);
      let data1 = []; // 油烟浓度
      let data2 = []; // 颗粒物浓度
      let data3 = []; // 非甲烷总烃浓度
      times.forEach((o, index) => {
        if (list[index]) {
          data1.push(list[index].emissions_conc);
          data2.push(list[index].granule_conc);
          data3.push(list[index].hydrocarbon_conc);
        } else {
          data1.push(0);
          data2.push(0);
          data3.push(0);
        }
      });
      // 绘制图表
      myecharts.setOption({
        title: {
          text: "平均浓度mg/m³",
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["油烟浓度", "颗粒物浓度", "非甲烷总烃浓度"],
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: times,
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            name: "油烟浓度",
            data: data1,
            stack: "Total",
            type: "line",
          },
          {
            name: "颗粒物浓度",
            data: data2,
            stack: "Total",
            type: "line",
          },
          {
            name: "非甲烷总烃浓度",
            stack: "Total",
            data: data3,
            type: "line",
          },
        ],
      });
    },
    initColumnarChart(list) {
      let myecharts = echarts.init(document.getElementById("myChart2"));
      let dataSource = [
        ["product", "油烟浓度", "颗粒物浓度", "非甲烷总烃浓度"],
      ];
      list.forEach((e) => {
        dataSource.push([
          e.AcquitDate.split(' ')[0],
          e.CEmissions,
          e.CGranule,
          e.CHydrocarbon,
        ]);
      });
 
      let option = {
        legend: {},
        tooltip: {},
        dataset: {
          source: dataSource,
        },
        xAxis: { type: "category" },
        yAxis: {},
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }],
      };
      myecharts.setOption(option);
    },
    // 设置表格斑马纹
    tableRowClassName({ row, rowIndex }) {
      if ((rowIndex + 1) % 2 == 0) {
        return "warning-row";
      } else {
        return "success-row";
      }
    },
    getCuisineName(cuisine) {
      switch (cuisine) {
        case 1:
          return "烧烤";
        case 3:
          return "川湘菜";
        case 7:
          return "家常菜";
 
        default:
          return "";
      }
    },
    
    getTimer(start, Timer, length) {
            var lists = [];
            var count = 0; //初始值为0
            for (let j = 0; j < length; j++) {
                count += 1;
                var seconds = Date.parse(start); //标准时间转毫秒数
                var totals = j * Timer * 60 * 1000 + seconds; //固定时间间隔+开始时间的总毫秒数
                var res = new Date(totals).toString().split(' ')[4];//毫秒数转字符串,截取,取值
 
                lists.push(res)
            }
            return lists;
        }
  },
  props: ["inTimeData"],
};
</script>
<style>
.body {
  line-height: 1;
}
.title {
  line-height: 1;
  font-size: 20px;
  text-align: left;
  margin: 10px 0px;
}
.small_title {
  font-size: 18px !important;
}
</style>