From f3acb8ce787f3df0eda633031473be4e6a9ff448 Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期四, 12 十月 2023 16:56:28 +0800 Subject: [PATCH] 油烟 更新了实时监控页面 --- src/views/ExceedingFume.vue | 288 ++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 182 insertions(+), 106 deletions(-) diff --git a/src/views/ExceedingFume.vue b/src/views/ExceedingFume.vue index 1e65022..279424f 100644 --- a/src/views/ExceedingFume.vue +++ b/src/views/ExceedingFume.vue @@ -12,7 +12,6 @@ </ExceptionType> <TimeSelect @submit-time="giveTime"></TimeSelect> - <!-- </div> --> </div> <div ref="h2" @@ -21,8 +20,9 @@ <el-button type="primary" plain - @click="showTable" style="margin-left: 20px" + :loading="button.queryButton" + @click="showTable" >鏌ヨ</el-button > @@ -45,7 +45,7 @@ </div> <div style="display: flex; justify-content: right; margin-right: 40px"> <span class="collapse-header-text"> - 闈欏畨鍖� {{ beginTime }} 鈥斺�� {{ endTime }} 娌圭儫妫�娴嬪紓甯镐俊鎭眹鎬�</span + 闈欏畨鍖� {{ beginTime }} 鈥斺�� {{ endTime }} 娌圭儫鐩戞祴寮傚父淇℃伅姹囨��</span > </div> <br /> @@ -94,15 +94,20 @@ <div class="box-card-label"> <el-scrollbar> - <span class="box-card-label">搴楅摵鏁伴噺锛�</span> + <span class="box-card-label">寮傚父搴楅摵鍗犳瘮锛�</span> <span style="font-size: 20px" - >{{ exception0.length }} /{{ shopsTotal }}</span + >{{ exception0.length }} /{{ shopsTotal }} + </span > - <span style="margin-left: 150px; font-size: 14px"> - 鍗犳瘮锛歿{ - ((exception0.length / shopsTotal) * 100).toFixed(1) - }}%</span + <span style="font-size: 17px"> + ({{ + ((exception0.length/shopsTotal)*100).toFixed(1) + }}%)</span > + {{ shopsTotal}} + <span class="right-text"> + 寮傚父鏁板崰姣旓細{{ ((exception0Num/exceptionAllNum) * 100).toFixed(1) }}% + </span> </el-scrollbar> </div> @@ -149,15 +154,18 @@ </div> <div class="box-card-label"> <el-scrollbar> - <span class="box-card-label">搴楅摵鏁伴噺锛�</span> + <span class="box-card-label">寮傚父搴楅摵鍗犳瘮锛�</span> <span style="font-size: 20px" >{{ exception1.length }} /{{ shopsTotal }}</span > - <span style="margin-left: 150px; font-size: 14px"> - 鍗犳瘮锛歿{ - ((exception1.length / shopsTotal) * 100).toFixed(1) - }}%</span + <span style="font-size: 17px"> + ({{ + ((exception1.length/shopsTotal)*100).toFixed(1) + }}%)</span > + <span class="right-text"> + 寮傚父鏁板崰姣旓細{{ ((exception1Num/exceptionAllNum) * 100).toFixed(1) }}% + </span> </el-scrollbar> </div> @@ -200,20 +208,23 @@ margin-top: 5px; margin-left: 4px; " - >鎺夌嚎</span + >鑱旂綉寮傚父</span > </div> <div class="box-card-label"> <el-scrollbar> - <span class="box-card-label">搴楅摵鏁伴噺锛�</span> + <span class="box-card-label">寮傚父搴楅摵鍗犳瘮锛�</span> <span style="font-size: 20px" >{{ exception2.length }} /{{ shopsTotal }}</span > - <span style="margin-left: 150px; font-size: 14px"> - 鍗犳瘮锛歿{ - ((exception2.length / shopsTotal) * 100).toFixed(1) - }}%</span + <span style="font-size: 17px"> + ({{ + (((exception2.length)/shopsTotal)*100).toFixed(1) + }}%)</span > + <span class="right-text"> + 寮傚父鏁板崰姣旓細{{ connectException }}% + </span> </el-scrollbar> </div> <hr /> @@ -244,15 +255,15 @@ </el-card> </el-collapse-item> </el-collapse> - <!-- <hr/> - <br> --> + <h4 class="table-text">寮傚父鏁版嵁</h4> - <!-- --> + </el-col> </el-row> <el-card class="table-page" v-show="!isNoData"> <el-table ref="tableH" + size="small" v-loading="loading" :data="displayData" style="width: 100%" @@ -261,7 +272,7 @@ :cell-class-name="tableCellClassName" > - <el-table-column prop="diName" label="搴楅摵鍚嶇О"> + <el-table-column prop="diName" label="搴楅摵鍚嶇О" align="center"> <template #default="{ row }"> <el-tooltip effect="dark" :content="row.diName"> <div class="cell ellipsis">{{ row.diName }}</div> @@ -269,7 +280,7 @@ </template> </el-table-column> - <el-table-column prop="devId" label="璁惧缂栧彿"> + <el-table-column prop="devId" label="璁惧缂栧彿" align="center"> <template #default="{ row }"> <el-tooltip effect="dark" :content="row.devId"> <div class="cell ellipsis">{{ row.devId }}</div> @@ -277,21 +288,30 @@ </template> </el-table-column> - <el-table-column prop="exception" label="寮傚父鍒嗙被"> + <el-table-column prop="diSupplier" label="渚涘簲鍟�" align="center"> + <template #default="{ row }"> + <el-tooltip effect="dark" :content="row.diSupplier"> + <div class="cell ellipsis">{{ row.diSupplier }}</div> + </el-tooltip> + </template> + </el-table-column> + + + <el-table-column prop="exception" label="寮傚父鍒嗙被" align="center"> <template #default="{ row }"> <el-tooltip effect="dark" :content="row.exception"> <div class="cell ellipsis">{{ row.exception }}</div> </el-tooltip> </template> </el-table-column> - <el-table-column label="寮傚父绫诲瀷"> + <el-table-column label="寮傚父绫诲瀷" align="center"> <template #default="{ row }"> <span v-if="row.exceptionType == '0'">娌圭儫鏁版嵁瓒呮爣</span> <span v-else-if="row.exceptionType == '1'">鐤戜技渚涚數寮傚父</span> <span v-else-if="row.exceptionType == '2'">鎺夌嚎</span> </template> </el-table-column> - <el-table-column prop="region" label="鍦板尯"> + <el-table-column prop="region" label="鍦板尯" align="center"> <template #default="{ row }"> <el-tooltip effect="dark" :content="row.region"> <div class="cell ellipsis">{{ row.region }}</div> @@ -299,21 +319,21 @@ </template> </el-table-column> - <el-table-column prop="beginTime" label="寮�濮嬫椂闂�"> + <el-table-column prop="beginTime" label="寮�濮嬫椂闂�" align="center"> <template #default="{ row }"> <el-tooltip effect="dark" :content="row.beginTime"> <div class="cell ellipsis">{{ row.beginTime }}</div> </el-tooltip> </template> </el-table-column> - <el-table-column prop="endTime" label="缁撴潫鏃堕棿"> + <el-table-column prop="endTime" label="缁撴潫鏃堕棿" align="center"> <template #default="{ row }"> <el-tooltip effect="dark" :content="row.endTime"> <div class="cell ellipsis">{{ row.endTime }}</div> </el-tooltip> </template> </el-table-column> - <el-table-column label="鎿嶄綔"> + <el-table-column label="鎿嶄綔" align="center"> <template #default="{ row }"> <el-button type="primary" @@ -351,16 +371,19 @@ {{ rowEndTime }} </div> </div> + <div class="dialog-button-position"> <el-button type="danger" - :disabled="isPreCantouch" + :loading="button.preButton" + :disabled="isPreCantouch || banTouch" @click="getPreviousRowData" >涓婃潯寮傚父</el-button > <el-button type="danger" - :disabled="isNextCantouch" + :loading="button.afterButton" + :disabled="isNextCantouch || banTouch" @click="getNextRowData" >涓嬫潯寮傚父</el-button > @@ -387,6 +410,7 @@ <ExceptionTypeLineChart :option="option" :is-open-dialog="centerDialogVisible" + v-loading="chartLoading" ></ExceptionTypeLineChart> <!-- --> @@ -397,13 +421,25 @@ border style="margin-top: 25px" > - <el-table-column fixed prop="diName" label="搴楅摵鍚嶇О" /> - <el-table-column prop="mvStatCode" label="璁惧缂栧彿" /> - - <el-table-column prop="mvDataTime" label="閲囬泦鏃堕棿" /> + <el-table-column + type="index" + label="搴忓彿" + width="60px" + align="center" + fixed + :index="indexMethod" + + ></el-table-column> + <el-table-column fixed prop="diName" label="搴楅摵鍚嶇О" show-overflow-tooltip/> + <el-table-column prop="mvStatCode" label="璁惧缂栧彿" align="center" show-overflow-tooltip/> + <el-table-column prop="diSupplier" label="渚涘簲鍟�" align="center" show-overflow-tooltip/> + <el-table-column prop="mvDataTime" label="閲囬泦鏃堕棿" align="center" show-overflow-tooltip/> + <el-table-column prop="mvFumeConcentration2" label="娌圭儫娴撳害(mg/m鲁)" + align="center" + show-overflow-tooltip /> </el-table> </div> @@ -428,6 +464,7 @@ import ExceptionType from '../sfc/ExceptionType.vue'; import TimeSelect from '../sfc/TimeSelect.vue'; import ExceptionText from '../sfc/ExceptionText.vue'; + import * as XLSX from 'xlsx/xlsx.mjs'; import dayjs from 'dayjs'; import axiosInstanceInstance from '../utils/request.js'; @@ -451,6 +488,21 @@ }, data() { return { + exception0Num:0, + exception1Num:0, + exception2Num:0, + // 鎶樼嚎鍥惧姞杞戒腑 + chartLoading:false, + button:{ + // 鏌ヨ鎸夐挳 + queryButton:false, + // 涓婁竴鏉℃寜閽� + preButton:false, + // 涓嬩竴鏉℃寜閽� + afterButton:false, + // + banTouch:0 + }, // 寮傚父鎶樼嚎鍥剧殑閰嶇疆 option: {}, // 鎶樼嚎鍥惧睍绀� @@ -488,7 +540,8 @@ rowEndTime: '', // 寮傚父鐨勮澶囩紪鍙� rowMvStatCode: '', - + // 渚涘簲鍟� + rowDiSupplier:'', // 琛ㄦ牸鐨勪竴琛屾暟鎹� rowTable: [], //鎷兼帴鐨勬墍鏈夋暟鎹� @@ -600,7 +653,21 @@ window.addEventListener('resize', this.updateChart); } }, - + computed:{ + exceptionAllNum(){ + let sum = this.exception0Num+this.exception1Num+this.exception2Num + return sum == 0?1:sum + }, + connectException(){ + let sum = this.exception0Num+this.exception1Num+this.exception2Num + if(sum == 0){ + return 0 + } + else{ + return (100 - ((exception0Num/sum) * 100) - ((exception1Num/sum) * 100)).toFixed(1) + } + } + }, mounted() { // 浠庢帴鍙h幏鍙栧簵閾哄悕绉� 缁欑骇鑱斾笅鎷夋 this.getDeviceInfo(); @@ -612,9 +679,15 @@ window.addEventListener('resize', this.updateChart); }, methods: { + // 鍔熻兘锛氬璇濇琛ㄦ牸搴忓彿閫掑 + // 鏃堕棿锛�2023-8-17 + indexMethod(index) { + return index + 1 ; + }, + // 鍔熻兘锛氭敼鍙樿〃鏍兼煇涓崟鍏冩牸鐨勯鑹� tableCellClassName({ row, column, rowIndex, columnIndex }) { - if(columnIndex == 3){ + if(columnIndex == 4){ if (row.exceptionType == '0') { return 'exceeding-row'; } else if (row.exceptionType == '1') { @@ -659,7 +732,6 @@ let current = timePoints[i]; let next = timePoints[i + 1]; while (this.isTimeDifferenceGreaterThan10Minutes(current, next)) { - console.log('generateTimePoints'); current = dayjs(current) .add(10, 'minute') .format('YYYY-MM-DD HH:mm:ss'); @@ -688,7 +760,6 @@ const year2 = date2.getFullYear(); const month2 = date2.getMonth(); const day2 = date2.getDate(); - console.log(month1, month2); // 鍒ゆ柇涓や釜鏃ユ湡鏄惁鐩稿樊涓�涓湀 if (year1 === year2) { @@ -762,6 +833,7 @@ this.rowBeginTime = this.displayData[index].beginTime; this.rowEndTime = this.displayData[index].endTime; this.rowMvStatCode = this.displayData[index].devId; + this.rowDiSupplier = this.displayData[index].diSupplier }, //鍔熻兘锛� 渚涚數寮傚父鍜屾帀绾挎椂鐨勮〃鏍兼暟鎹� @@ -778,6 +850,7 @@ this.exceedingData.push({ mvStatCode: this.rowMvStatCode, diName: this.rowShopName, + diSupplier:this.rowDiSupplier, mvDataTime: abnormalTimeTenMinute[i], mvFumeConcentration2: '' }); @@ -798,6 +871,9 @@ getNextRowData() { // 涓嶆槸琛ㄦ牸鐨勭涓�琛� if (this.selectedRowIndex !== 0) { + // 鐐瑰嚮杩囩▼涓� 閿佷綇涓婁笅鏉℃寜閽� 鍦ㄨ缃畬鍥惧舰閰嶇疆椤瑰悗瑙i攣 + this.banTouch = 1 + //寰楀埌涓婁竴琛屾暟鎹储寮� this.selectedRowIndex = this.selectedRowIndex - 1; //璇锋眰鏁版嵁 鏀瑰彉exceedingData @@ -813,32 +889,29 @@ if (this.drawerData.endTime) { params['endTime'] = this.displayData[this.selectedRowIndex].endTime; } - + this.button.afterButton = true axiosInstanceInstance .get('/fume/exceed', { params: params }) .then((response) => { // 淇濆瓨杩斿洖鐨勮秴鏍囨暟鎹� this.exceedingData = response.data.data; - // this.chart = null; - // this.drawChart(); this.drawChartTest(); this.exceptionTotal = this.exceedingData.length; + this.button.afterButton = false }); } - //琛ㄦ牸鐨勭涓�琛岋紝鍒欎笂涓�鏉℃棤鏁版嵁 - else { - console.log(null); - } + }, // 鑾峰彇鑾峰彇琛ㄦ牸涓嬩竴琛屾暟鎹� getPreviousRowData() { // 涓嶆槸琛ㄦ牸鐨勭涓�琛� if (this.selectedRowIndex < this.displayData.length - 1) { - //寰楀埌涓婁竴琛屾暟鎹储寮� + // 鐐瑰嚮杩囩▼涓� 閿佷綇涓婁笅鏉℃寜閽� 鍦ㄨ缃畬鍥惧舰閰嶇疆椤瑰悗瑙i攣 + this.banTouch = 1 + //寰楀埌涓婁竴琛屾暟鎹储寮� this.selectedRowIndex = this.selectedRowIndex + 1; - console.log('涓�', this.selectedRowIndex); //璇锋眰鏁版嵁 鏀瑰彉exceedingData this.setinfo(this.selectedRowIndex); @@ -853,19 +926,16 @@ if (this.drawerData.endTime) { params['endTime'] = this.displayData[this.selectedRowIndex].endTime; } + this.button.preButton = true axiosInstanceInstance .get('/fume/exceed', { params: params }) .then((response) => { // 淇濆瓨杩斿洖鐨勮秴鏍囨暟鎹� this.exceedingData = response.data.data; - console.log(this.exceedingData); this.drawChartTest(); this.exceptionTotal = this.exceedingData.length; + this.button.preButton = false }); - } - //琛ㄦ牸鐨勭涓�琛岋紝鍒欎笂涓�鏉℃棤鏁版嵁 - else { - console.log(null); } }, @@ -892,6 +962,7 @@ if (this.drawerData.endTime) { params['endTime'] = this.drawerData.endTime; } + axiosInstanceInstance .get('/fume/exceed', { params: params }) .then((response) => { @@ -916,8 +987,7 @@ if (this.exceptionValue.length != 0) { params['exceptionValue'] = this.exceptionValue.join(); } - console.log('鍘�', this.exceptionValue); - console.log('澶勭悊', this.exceptionValue.join()); + if (this.beginTime) { params['beginTime'] = this.beginTime; } @@ -925,12 +995,15 @@ params['endTime'] = this.endTime; } this.loading = true; + this.button.queryButton = true + axiosInstanceInstance .get('/fume/abnormalthree', { params: params }) .then((response) => { this.abnormalData = response.data.data; this.total = this.abnormalData.length; this.loading = false; + this.button.queryButton = false if (response.data.data.length == 0) { ElMessage('璇ユ椂娈垫棤鏁版嵁'); this.isNoData = true; @@ -939,8 +1012,7 @@ // 绉婚櫎绌烘暟鎹姸鎬� this.isNoData = false; this.handleCurrentChange(1); - console.log('杩斿洖鐨勬暟鎹�', this.abnormalData); - console.log('闀垮害', response.data.data.total); + }); }, handleSizeChange(val) { @@ -964,7 +1036,6 @@ // 璁$畻缁撴潫鏃堕棿鍑忓幓寮�濮嬫椂闂翠腑闂寸浉宸灏戜釜鍗佸垎閽� const diffInMinutes = end.diff(start, 'minute'); const diffInTenMinutes = Math.floor(diffInMinutes / 10); - console.log('鍑犱釜10鍒嗛挓', diffInTenMinutes); return diffInTenMinutes; }, @@ -1279,6 +1350,7 @@ ] }; } + this.banTouch = 0 }, // 鍔熻兘锛氱偣鍑� 鈥樻煡鐪嬭鎯呪�欙紝 鈥樹笅涓�鏉♀�欐寜閽椂浼� 鍏堥�昏緫璁$畻銆傛渶鍚庡睍绀哄浘褰� @@ -1312,18 +1384,18 @@ beforeAndAfterTime[2] ); + // 鎶樼嚎鍥惧姞杞戒腑鏁堟灉 + this.chartLoading = true // 璇锋眰鍓嶅崐娈� axiosInstanceInstance .get('/fume/history', { params: paramsBefore }) .then((result1) => { this.beforeData = result1.data.data; - console.log('beforeData:', this.beforeData); // 璇锋眰鍚庡崐娈� axiosInstanceInstance .get('/fume/history', { params: paramsAfter }) .then((result2) => { this.afterData = result2.data.data; - console.log('afterData:', this.afterData); //淇濆瓨寮傚父鍖洪棿鐨勫�� let tempArr = []; // 淇濆瓨寮傚父鍖洪棿鍓嶅悗鐨勫�� @@ -1351,7 +1423,6 @@ after = this.shallowCopyList(this.afterData); // after = this.afterData - console.log('after:', after); } // 瓒呮爣 else { @@ -1381,7 +1452,6 @@ // 灏嗗墠鍚庡尯闂存暟鎹� 涓� 寮傚父鍖洪棿鏁版嵁 鍚堝苟 this.allExceptionTimeData = [...before, ...tempArr, ...after]; - console.log('缁勫悎鏁版嵁锛�', this.allExceptionTimeData); // x杞存棩鏈熸椂闂� let dateList = []; // y杞� 瓒呮爣娌圭儫娴撳害 @@ -1397,9 +1467,6 @@ dateList = timeAndValue['xAxis']; fumeExceeding = timeAndValue['yAxis']; - - console.log('dateList:', dateList); - console.log('fumeExceeding:', fumeExceeding); // 鎻愬彇寮傚父璧峰鏃堕棿鐐瑰湪鏁翠釜鍖洪棿鍐呯殑鏁版嵁绱㈠紩 let startIndex = dateList.findIndex( @@ -1435,6 +1502,7 @@ endIndex ); } + this.chartLoading = false }); }); }, @@ -1457,7 +1525,6 @@ ] }; }); - console.log(this.optionsShop); }); }, exportDom() { @@ -1511,8 +1578,6 @@ }) .then((result) => { this.exception0 = result.data.data; - console.log('寮傚父0', this.exception0); - console.log('寮傚父0鏁伴噺', this.exception0.length); }); axiosInstanceInstance .get('/fume/shopname', { @@ -1536,18 +1601,52 @@ .then((result) => { this.exception2 = result.data.data; }); + + /* 寮傚父鏁伴噺 */ + axiosInstanceInstance + .get('/fume/exceptionnum', { + params: { + exceptionType: '0', + beginTime: this.beginTime, + endTime: this.endTime + } + }) + .then((result) => { + this.exception0Num = result.data.data; + }); + axiosInstanceInstance + .get('/fume/exceptionnum', { + params: { + exceptionType: '1', + beginTime: this.beginTime, + endTime: this.endTime + } + }) + .then((result) => { + this.exception1Num = result.data.data; + }); + axiosInstanceInstance + .get('/fume/exceptionnum', { + params: { + exceptionType: '2', + beginTime: this.beginTime, + endTime: this.endTime + } + }) + .then((result) => { + this.exception2Num = result.data.data; + }); }, // 椤甸潰鍔犺浇鏃堕粯璁ゅ睍绀�7澶╁紓甯歌〃鏁版嵁 getRecentSevenDays() { // 缁欑骇鑱旈�夋嫨鍣ㄨ缃粯璁ょ殑閫夋嫨椤� this.devId = ['浠樺皬濮愬湪鎴愰兘', 'qinshi_31010320210010']; - console.log(this.currentDateTime, this.oneWeekAgoDateTime); let params = {}; params['beginTime'] = this.beginTime; params['endTime'] = this.endTime; axiosInstanceInstance - .get('/fume/abnormalone', { params: params }) + .get('/fume/abnormalthree', { params: params }) .then((response) => { if (response.data.data.length == 0) { ElMessage('璇ユ椂娈垫棤鏁版嵁'); @@ -1567,13 +1666,7 @@ </script> <style scoped> -/* .exception-root-container { - margin: 20px; - padding: 10px; - border: 1px; - height: 615px; -} */ .header-container { display: flex; margin-left: 20px; @@ -1609,8 +1702,6 @@ /* 寮傚父鍒嗘瀽鏁版嵁涓庢寜閽� */ .exception-container { display: flex; - /* direction: column; */ - /* flex-grow: 2,1; */ } .example-showcase .el-loading-mask { z-index: 9; @@ -1632,7 +1723,6 @@ font-size: 18px; } .collapse-header-text { - /* margin-right: 150px; */ margin-top: 5px; font-size: 14px; color: gray; @@ -1641,11 +1731,17 @@ .box-card-label { font-size: 14px; white-space: nowrap; - /* overflow-x: auto; */ +} + +.right-text { + /* float :right; */ + /* text-align: right; */ + margin-left:80px; } :deep().el-card { border-radius: 9px; } + /* 鈥樻煡鐪嬭鎯呪�� 鐨勫脊鍑烘楂樺害璋冩暣 */ :deep().el-dialog { height: 98%; @@ -1656,9 +1752,7 @@ .table-page { margin-left: 20px; } -:deep().table-page .el-card__body { - /* padding: 0px; */ -} + .table-text { font-size: 18px; margin: 5px 0px 10px 20px; @@ -1697,16 +1791,12 @@ .box-card { height: 190px; } -:deep().box-card .el-card__body { - /* padding: 5px; */ -} + .sub-box-card { height: 100px; border: 0px; } -:deep().sub-box-card .el-card__body { - /* padding: 0px; */ -} + .mx-1 { margin-bottom: 0px; } @@ -1715,16 +1805,6 @@ justify-content: right; margin-bottom: 10px; } -/* :global(.el-table .exceeding-row) { - --el-table-expanded-cell-bg-color: #f53f3f; -} -:global(.el-table .abnormal-power-supply) { - --el-table-expanded-cell-bg-color: #ffcf8b; -} - -:global(.el-table .disconnect) { - --el-table-expanded-cell-bg-color: #ff7d00; -} */ :deep().el-table__row .exceeding-row{ background-color: #F53F3F; @@ -1739,10 +1819,6 @@ .el-table { color: #000000; -} -/* 琛ㄦ牸鐨勫唴杈硅窛 */ -:deep().el-table .el-table__cell { - padding: 2px; } -- Gitblit v1.9.3