zhanghua
2023-11-13 4c6f2df21a29048440a85e34dadcd4f1c75c179c
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
<template>
    <div>
        <div style="width: 100%; overflow-x: scroll">
            <el-table
                border
                stripe
                ref="multipleTable"
                :header-cell-style="{
                    background: '#F5F5F5',
                    'font-weight': '650',
                    'line-height': '45px'
                }"
                :data="tableData"
                :row-class-name="tableRowClassName"
            >
                <el-table-column label="序号" type="index" width="60px">
                </el-table-column>
                <el-table-column
                    prop="acquit_at_str"
                    label="采集时间"
                    min-width="150px"
                >
                </el-table-column>
                <el-table-column
                    prop="fan_status_str"
                    label="风机状态"
                    min-width="120px"
                >
                </el-table-column>
                <el-table-column
                    prop="hydrocarbon_conc"
                    label="风机电流(A)"
                    min-width="120px"
                >
                </el-table-column>
                <el-table-column
                    prop="filter_status"
                    label="净化器状态"
                    min-width="95px"
                >
                </el-table-column>
                <el-table-column
                    prop="emissions_conc"
                    label="油烟浓度(mg/m³)"
                    min-width="180px"
                >
                </el-table-column>
                <el-table-column
                    prop="granule_conc"
                    label="颗粒物浓度(mg/m³)"
                    min-width="180px"
                >
                </el-table-column>
                <el-table-column
                    prop="hydrocarbon_conc"
                    label="非甲烷总烃浓度(mg/m³)"
                    min-width="190px"
                >
                </el-table-column>
                <el-table-column prop="status" label="设备状态" width="120px">
                </el-table-column>
            </el-table>
        </div>
        <div class="tools">
            <div class="pagination">
                <el-pagination
                    background
                    @prev-click="handlePrev"
                    @next-click="handleNext"
                    :current-page="currentPage"
                    layout="prev, pager, next"
                    :total="totalNum"
                    :page-size="pageSize"
                    @current-change="changeCurrentPage"
                >
                </el-pagination>
            </div>
        </div>
    </div>
</template>
 
<script>
import statisticsApi from "@/api/smoke/statistics";
export default {
    data() {
        return {
            currentPage: 1,
            pageSize: 20,
            totalNum: 0,
            tableData: []
        }
    },
    created() {
        this.getRealTimeList();
    },
    methods: {
        getRealTimeList() {
            let param = {
                field: "intimeData",
                localeId: this.inTimeData.Lid
            }
            statisticsApi.getDocument(param).then(jsonStr => {
                const res = JSON.parse(jsonStr)
                let list = res.Data.content
                list.forEach(o => {
                    o.acquit_at_str = this.dateFormat(
                        "YYYY-mm-dd HH:MM:SS",
                        new Date(o.acquit_at * 1000)
                    );
                    o.fan_status_str = o.fan_status == '1' ? '开' : '关'
                    o.status = '达标'
                });
                this.tableData = list
                this.totalNum = res.Data.total
            })
 
        },
        // 设置表格斑马纹
        tableRowClassName({ row, rowIndex }) {
            if ((rowIndex + 1) % 2 === 0) {
                return "warning-row";
            } else {
                return "success-row";
            }
        },
        // 当前页改变触发事件
        changeCurrentPage(page) {
            this.currentPage = page;
            this.getRealTimeList();
        },
        // 上一页点击事件
        handlePrev(page) {
            this.currentPage = page;
            this.getRealTimeList();
        },
        // 下一页点击事件
        handleNext(page) {
            this.currentPage = page;
            this.getRealTimeList();
        },
        dateFormat(fmt, date) {
            let ret;
            const opt = {
                "Y+": date.getFullYear().toString(), // 年
                "m+": (date.getMonth() + 1).toString(), // 月
                "d+": date.getDate().toString(), // 日
                "H+": date.getHours().toString(), // 时
                "M+": date.getMinutes().toString(), // 分
                "S+": date.getSeconds().toString(), // 秒
                // 有其他格式化字符需求可以继续添加,必须转化成字符串
            };
            for (let k in opt) {
                ret = new RegExp("(" + k + ")").exec(fmt);
                if (ret) {
                    fmt = fmt.replace(
                        ret[1],
                        ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
                    );
                }
            }
            return fmt;
        },
    },
    props: ['inTimeData']
}
</script>
 
<style>
</style>