factory_web/src/views/bigScreen/enpComponents/cems2.vue

89 lines
3.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<el-container>
<el-header class="panel_title">
<div class="left-panel">
CEMS监测预警
</div>
<div class="right-panel">
<el-button @click="getTableData">刷新</el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable :data="tableData" style="width: 100%;" size="large" row-key="id" v-loading="tableLoading">
<el-table-column type="index" width="50" />
<el-table-column prop="equipment_number" label="设备编号" width="120" />
<el-table-column prop="drain_name" label="排口名称" width="180" />
<el-table-column prop="metric_0" label="0分钟" />
<el-table-column prop="metric_5" label="5分钟" />
<el-table-column prop="metric_10" label="10分钟" />
<el-table-column prop="metric_15" label="15分钟" />
<el-table-column prop="metric_20" label="20分钟" />
<el-table-column prop="metric_25" label="25分钟" />
<el-table-column prop="metric_30" label="30分钟" />
<el-table-column prop="metric_35" label="35分钟" />
<el-table-column prop="metric_40" label="40分钟" />
<el-table-column prop="metric_45" label="45分钟" />
<el-table-column prop="metric_50" label="50分钟" />
<el-table-column prop="metric_55" label="55分钟" />
<el-table-column prop="metric_hour" label="小时均值" width="110" />
<el-table-column prop="dust_alarm" label="预警值" />
<el-table-column label="是否达标" width="120">
<template #default="scope">
<span v-if="scope.row.metric_hour < scope.row.dust_alarm"
style="color:green;font-weight: bold;">达标</span>
<span v-else style="color:red;font-weight: bold;">未达标</span>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</template>
<script>
export default {
data() {
return {
tableData: [],
tableLoading: false,
query: {
"day": 18,
"hour": 15,
"year": 2024,
"month": 1,
"metric": "dust_rtd",
"drain_type": 10
}
}
},
mounted() {
this.getTableData()
},
methods: {
initDate() {
let now = new Date();
this.query.year = now.getFullYear();
this.query.month = now.getMonth() + 1; // 注意getMonth() 的返回值是 0-11所以需要加 1
this.query.day = now.getDate();
this.query.hour = now.getHours();
console.log(this.query)
},
getTableData() {
this.initDate()
this.tableLoading = true
this.$API.bi.dataset.exec.req('enp_edata_metric', { query: this.query, raise_exception: true }).then(res => {
let data = res.data2.ds0
for (let i = 0, y = data.length; i < y; i++) {
for (let key in data[i]) {
if (key.includes('metric_')) {
if (data[i][key]) {
data[i][key] = data[i][key].toFixed(3)
}
}
}
}
this.tableData = data
}).then(() => { this.tableLoading = false })
},
},
}
</script>