From a1fb7d5473505c08cd0a20f68d3007c6efd383ff Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期五, 10 十一月 2023 13:40:46 +0800 Subject: [PATCH] 油烟 --- src/views/smoke/report/components/reduceEmissions.vue | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 270 insertions(+), 3 deletions(-) diff --git a/src/views/smoke/report/components/reduceEmissions.vue b/src/views/smoke/report/components/reduceEmissions.vue index 17bcab3..4f2b7f7 100644 --- a/src/views/smoke/report/components/reduceEmissions.vue +++ b/src/views/smoke/report/components/reduceEmissions.vue @@ -1,13 +1,280 @@ <template> - + <div> + <MyHeader + @getList="getRealTimeList" + @exportTable="exportInTime" + ></MyHeader> + <!-- 鏁版嵁灞曠ず --> + <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="AcquitAtStr" label="鐩戞祴鐐�" min-width="10%"> + </el-table-column> + <el-table-column prop="Addr" label="瀹夎鍦板潃" min-width="20%"> + </el-table-column> + <el-table-column + prop="FanStatusStr" + label="璁惧缂栫爜" + min-width="15%" + > + </el-table-column> + <el-table-column + prop="AAA" + label="PM2.5鍑忔帓閲忥紙Kg锛�" + min-width="10%" + > + </el-table-column> + <el-table-column + prop="EmissionsConc" + label="PM10鍑忔帓閲忥紙Kg锛�" + min-width="10%" + > + </el-table-column> + <el-table-column + prop="CEmissions" + label="娌圭儫鍑忔帓锛圞g锛�" + min-width="10%" + > + </el-table-column> + <el-table-column + prop="GranuleConc" + label="vocs鍑忔帓閲忥紙Kg锛�" + min-width="10%" + > + </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 MyHeader from "./header/header1.vue"; +import realTimeApi from "@/api/smoke/realTime"; export default { + data() { + return { + tableData: [], + totalNum: 0, + pageSize: 10, + currentPage: 1, + }; + }, + components: { MyHeader }, + created() { + this.getRealTimeList(); + }, + methods: { + getRealTimeList(seachData) { + let params; + if (seachData) { + params = this.getParam(seachData) + } else { + params = { + pageNum: this.currentPage, + pageSize: this.pageSize, + }; + } -} + realTimeApi + .findInTimeList(params) + .then(({ list, total }) => { + list.forEach(e => { + e.AcquitAtStr = this.dateFormat("YYYY-mm-dd HH:MM", new Date(e.AcquitAt)); + e.FanStatusStr = this.FanStatusStr(e.FanStatus) + e.FilterStatusStr = this.FanStatusStr(e.FilterStatus) + e.OnlineStatusStr = this.OnlineStatusStr(e.OnlineStatus) + e.StatusStr = this.StatusStr(e.Status) + }); + this.tableData = list; + this.totalNum = total; + }) + .catch((err) => this.$message.error(err)); + }, + exportInTime(seachData) { + let params; + if (seachData) { + params = this.getParam(seachData) + } + realTimeApi + .exportInTime(params) + .then((res) => { + debugger + let time = new Date(); + let deathdate = time.toLocaleDateString(); + const blob = new Blob([res.data], { + type: "application/vnd.ms-excel;charset=utf-8", + }); + if (window.navigator.msSaveBlob) { + window.navigator.msSaveBlob( + blob, + deathdate + "鐩戞祴鎬讳綋鎯呭喌鎶ヨ〃" + ".xls" + ); + } else { + const url = window.URL.createObjectURL(blob); + const link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + link.download = deathdate + "鐩戞祴鎬讳綋鎯呭喌鎶ヨ〃" + ".xls"; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + this.$message.success("鎿嶄綔鎴愬姛"); + }) + .catch((err) => this.$message.error(err)); + }, + getParam(seachData) { + let params; + if (seachData) { + const seachParams = seachData.seachData + params = { + owner: + seachParams.owner == undefined + ? null + : seachParams.owner, + onlineStatus: + seachParams.onlineStatus == undefined + ? null + : seachParams.onlineStatus, + status: seachParams.status == undefined + ? null + : seachParams.status, + type: + seachParams.type == undefined + ? null + : seachParams.type, + startTime: + seachParams.alarmTime == undefined + ? null + : this.dateFormat("YYYY-mm-dd HH:MM:SS", seachParams.alarmTime[0]), + endTime: + seachParams.alarmTime == undefined + ? null + : this.dateFormat("YYYY-mm-dd HH:MM:SS", seachParams.alarmTime[1]), + }; + } + return params; + }, + + FanStatusStr(FanStatus) { + switch (FanStatus) { + case 1: + return "寮�" + case 2: + return "鍏�" + default: + return "寮傚父" + } + }, + OnlineStatusStr(Status) { + switch (Status) { + case 1: + return "鍦ㄧ嚎" + case 2: + return "绂荤嚎" + default: + return "寮傚父绂荤嚎" + } + }, + StatusStr(Status) { + switch (Status) { + case "NORMAL": + return "姝e父" + case "ALARM": + return "棰勮" + case "EXCESS": + return "瓒呮爣" + case "DOWN": + return "绂荤嚎" + default: + return "寮傚父绂荤嚎" + } + }, + // 璁剧疆琛ㄦ牸鏂戦┈绾� + 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; + }, + } +}; </script> -<style> +<style lang="scss" scoped> +.el-table { + .operation { + display: flex; + color: var(--operation-color); + .line { + padding: 0 5px; + } + span:hover { + cursor: pointer; + } + } +} </style> \ No newline at end of file -- Gitblit v1.8.0