Explorar el Código

修改负荷平均功率

luogang hace 9 meses
padre
commit
cd84c0b8a2

+ 15 - 0
ems-ui/src/api/mgr/elecUseH.js

@@ -67,3 +67,18 @@ export function delH(id) {
     method: 'delete'
   })
 }
+
+export function getPowerData(query) {
+  return request({
+    url: '/ems/object/loadIndex/min/15/list',
+    method: 'get',
+    params: query
+  })
+}
+export function getPowerMaxLoad(query) {
+  return request({
+    url: '/ems/object/loadIndex/min/15/getMaxLoad',
+    method: 'get',
+    params: query
+  })
+}

+ 22 - 6
ems-ui/src/components/Block/charts/BarChartBlock.vue

@@ -14,7 +14,7 @@
 <script>
 
 import Block from '@/components/Block/block.vue';
-import { copyObj, uuid } from '@/utils';
+import {copyObj, uuid} from '@/utils';
 import * as echarts from 'echarts';
 import SwitchTag from '../../SwitchTag/index.vue';
 
@@ -27,6 +27,22 @@ const basicSerie = {
   data: [],
 };
 const opts = {
+  toolbox: {
+    itemGap: 10,
+    itemSize: 16,
+    right: 10,
+    top: 0,
+    show: true,
+    feature: {
+      magicType: {
+        show: true,
+        type: ['bar', 'line']
+      },
+      saveAsImage: {
+        show: true
+      }
+    }
+  },
   tooltip: {
     trigger: 'axis',
     axisPointer: {
@@ -75,25 +91,25 @@ export default {
   },
   watch: {
     optCfg: {
-      handler(val) {
+      handler (val) {
         this.initChart();
       },
       deep: true,
     },
   },
-  data() {
+  data () {
     return {
       id: uuid(),
       refCharts: null,
     };
   },
-  mounted() {
+  mounted () {
     this.$nextTick(this.initChart);
   },
-  created() {
+  created () {
   },
   methods: {
-    initChart() {
+    initChart () {
       this.refCharts && this.refCharts.clear();
       const chartDom = document.getElementById(this.id);
       this.refCharts = echarts.init(chartDom);

+ 1 - 8
ems-ui/src/views/index.vue

@@ -45,7 +45,7 @@
             </div>
           </div>
           <div class="summay-chart">
-            <SubTitle title="费用" style="padding-left: 30px;"/>
+            <SubTitle title="费用【单位:元】" style="padding-left: 30px;"/>
             <div class="cost">
               <span>总费用</span>
               <span>344元</span>
@@ -202,17 +202,10 @@ export default {
           top: 0,
           show: true,
           feature: {
-            dataView: {
-              show: true,
-              readOnly: false
-            },
             magicType: {
               show: true,
               type: ['bar', 'line']
             },
-            restore: {
-              show: true
-            },
             saveAsImage: {
               show: true
             }

+ 18 - 4
ems-ui/src/views/largeScreen/index.vue

@@ -7,8 +7,8 @@
       <div class="top-info-area">
         <div class="info-block">
           <img src="@/assets/images/home/tianqi.svg" alt="">
-          <span>晴转多云</span>
-          <span>4°C~20°C</span>
+          <span>{{weather.text}}</span>
+          <span>{{weather.temperature}}</span>
         </div>
       </div>
       <router-view class="sidebar-router-view" name="left"></router-view>
@@ -34,7 +34,8 @@
 <script>
 import autofit from 'autofit.js'
 import Footer from './footer.vue';
-import { dateFormat} from '@/utils/index.js'
+import {dateFormat} from '@/utils/index.js'
+import axios from 'axios';
 export default {
   name: 'LargeScreen',
   data () {
@@ -43,7 +44,11 @@ export default {
         currentTime: '',
         week: '',
       },
-      timer:null
+      timer: null,
+      weather: {
+        text: '',
+        temperature:''
+      }
     };
   },
   components: {
@@ -58,6 +63,7 @@ export default {
       resize: true
     })
     this.getDate();
+    this.getWeather()
     this.timer = setInterval(() => {
       this.getDate();
     }, 1000);
@@ -72,6 +78,14 @@ export default {
       this.nowDay.week = "星期" + "日一二三四五六".charAt(nowTime.getDay());
       this.nowDay.currentTime =dateFormat(nowTime,'yyyy-MM-dd HH:mm:ss')
     },
+    getWeather () {
+      axios.get('https://api.seniverse.com/v3/weather/now.json?key=SoZVeNXSD1AlWok1V&location=nanjing&language=zh-Hans&unit=c').then(({data: { results}}) => {
+        if (results && results.length) {
+          this.weather.text = results[0].now.text
+          this.weather.temperature = `${results[0].now.temperature}°C`
+        }
+      })
+    }
   }
 }
 </script>

+ 26 - 20
ems-ui/src/views/mgr/powergrid.vue

@@ -1,5 +1,27 @@
 <template>
   <div class="app-container">
+    <div class="tips">
+      <el-statistic title="国网接入">
+        <template slot="formatter">
+          10kV
+        </template>
+      </el-statistic>
+      <el-statistic title="光伏总装机">
+        <template slot="formatter">
+          1265.85kW
+        </template>
+      </el-statistic>
+      <el-statistic title="光伏南区装机">
+        <template slot="formatter">
+          660.8kW
+        </template>
+      </el-statistic>
+      <el-statistic title="光伏北区装机">
+        <template slot="formatter">
+          605.05kW
+        </template>
+      </el-statistic>
+    </div>
     <el-tabs v-model="activeName" @tab-click="tabClick">
       <el-tab-pane label="总览" name="summery">
         <el-row type="flex" :gutter="20" style="margin-top: 20px">
@@ -237,26 +259,6 @@ export default {
           }
         ]
       },
-
-
-      // elecQuantity: {
-      //   series: [
-      //     {
-      //       type: 'pie',
-      //       data: []
-      //     }
-      //   ]
-      // },
-      // elecCost: {
-      //   series: [
-      //     {
-      //       type: 'pie',
-      //       data: []
-      //     }
-      //   ]
-      // },
-
-
       pvSupplyIndex: {
         unit: '  ',
         xAxis: {
@@ -680,9 +682,13 @@ export default {
 </script>
 <style lang="scss" scoped>
 .app-container {
+  padding-top: 10px;
   ::v-deep .el-tabs__content {
     overflow: initial;
   }
 }
+.tips{
+  display: flex;
+}
 </style>
 <style lang="scss" scoped src="./index.scss"></style>

+ 27 - 1
ems-ui/src/views/mgr/powerstore.vue

@@ -1,5 +1,12 @@
 <template>
   <div class="app-container">
+    <div class="tips">
+      <el-statistic title="总装机">
+        <template slot="formatter">
+          400kW·h
+        </template>
+      </el-statistic>
+    </div>
     <el-tabs v-model="activeName" @tab-click="tabClick">
       <el-tab-pane label="总览" name="summary">
         <div class="chartGroup">
@@ -144,6 +151,22 @@ export default {
       const chargeQuantity = this.todayList.map(item => item.chargeElecQuantity)
       const dischargeQuantity = this.todayList.map(item => item.dischargeElecQuantity)
       const option = {
+        toolbox: {
+          itemGap: 10,
+          itemSize: 16,
+          right: 10,
+          top: 0,
+          show: true,
+          feature: {
+            magicType: {
+              show: true,
+              type: ['bar', 'line']
+            },
+            saveAsImage: {
+              show: true
+            }
+          }
+        },
         tooltip: {
           trigger: 'axis',
           axisPointer: {
@@ -344,11 +367,14 @@ export default {
 @import './index.scss';
 
 .app-container {
+  padding-top: 10px;
   ::v-deep .el-tabs__content {
     overflow: initial;
   }
 }
-
+.tips{
+  display: flex;
+}
 .chartGroup {
   display: flex;
 

+ 310 - 14
ems-ui/src/views/mgr/poweruse.vue

@@ -28,6 +28,19 @@
             </div>
           </div>
         </div>
+        <div>
+          <div class="ctl-container">
+            <SubTitle title="平均功率【15min】" />
+            <el-date-picker v-model="powerDate" type="datetimerange" @change="getPowerChart"
+                  :picker-options="pickerOptions" value-format="yyyy-MM-dd hh:mm:ss" range-separator="至"
+                  start-placeholder="开始日期" end-placeholder="结束日期" align="right">
+                </el-date-picker>
+          </div>
+          <!--柱状图-->
+          <div class="container-block" style="margin-top: 20px;">
+            <BaseChart width="100%" height="350px" :option="powerLineOptions" />
+          </div>
+        </div>
 
       </el-tab-pane>
       <el-tab-pane v-for="item in facsCategoryOptions" :key="item.code" :label="item.name" :name="item.code">
@@ -44,7 +57,7 @@
         </el-col>
         <el-col :span="20" :xs="24">
           <div class="container-block">
-            <div class="ctl-container" style="display: flex; justify-content: space-between;">
+            <div class="ctl-container">
               <SubTitle :title="`设施汇总电耗【${selectedLabel}】`" />
               <div>
                 <el-select v-model="objCode" placeholder="选择设施" clearable @visible-change="handleObjSelectClick"
@@ -55,7 +68,7 @@
                 </el-select>
                 <el-date-picker v-model="dateRange" type="datetimerange" @change="getList"
                   :picker-options="pickerOptions" value-format="yyyy-MM-dd hh:mm:ss" range-separator="至"
-                  start-placeholder="开始日期" end-placeholder="结束日期" align="right">
+                  start-placeholder="开始日期" end-placeholder="结束日期" :clearable="false" align="right">
                 </el-date-picker>
               </div>
             </div>
@@ -82,8 +95,17 @@
             <div class="container-block" style="margin-top: 20px;">
               <BaseChart width="100%" height="300px" :option="barChartOptions" />
             </div>
+            <div>
+              <div class="ctl-container">
+                <SubTitle title="平均功率【15min】" />
+              </div>
+              <!--柱状图-->
+              <div class="container-block" style="margin-top: 20px;">
+                <BaseChart width="100%" height="350px" :option="equipPowerLineOptions" />
+              </div>
+            </div>
             <!--表格-->
-            <el-table v-loading="loading" :data="hList">
+            <!-- <el-table v-loading="loading" :data="hList">
               <el-table-column label="设施" align="center" prop="objName">
                 <template slot-scope="scope">
                   <span>{{ scope.row.objName }}</span>
@@ -104,7 +126,7 @@
             </el-table>
 
             <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-              :limit.sync="queryParams.pageSize" @pagination="getList" />
+              :limit.sync="queryParams.pageSize" @pagination="getList" /> -->
           </div>
         </el-col>
       </el-tab-pane>
@@ -114,21 +136,21 @@
 
 <script>
 import * as echarts from 'echarts/core';
-import {listHSum, sumByFacsH, sumBySubCategoryH} from '@/api/mgr/elecUseH'
+import {listHSum, sumByFacsH, sumBySubCategoryH, getPowerData, getPowerMaxLoad} from '@/api/mgr/elecUseH'
 import {getFacsCategorygetByCode} from '@/api/basecfg/emsfacs'
 import {areaWithFacsCategoryAsTree} from '@/api/basecfg/area'
 import {listAllFacs} from '@/api/basecfg/emsfacs'
 import dayjs from 'dayjs'
 import {DateTool} from '@/utils/DateTool'
+import {dateFormat} from '@/utils';
 import BaseChart from '@/components/BaseChart/index.vue'
 import SubTitle from '@/components/SubTitle'
 import Block from '@/components/Block/block.vue'
 import Treeselect from '@riophae/vue-treeselect'
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
-import {right} from '@antv/x6/lib/registry/port-layout/line';
 
 export default {
-  name: 'H',
+  name: 'PowerUse',
   components: {
     Treeselect,
     BaseChart,
@@ -136,6 +158,7 @@ export default {
     SubTitle
   },
   data () {
+    const today = dateFormat(new Date(), 'yyyy-MM-dd')
     return {
       activeName: 'summery',
       // 遮罩层
@@ -228,10 +251,12 @@ export default {
       },
       // 表单参数
       form: {},
-      tableData: [{
-        name: '照明设施',
-        value: '122'
-      }]
+      tableData: [],
+      powerDate: [`${today} 00:00:00`, `${today} 23:59:59`],
+      powerChartData: [],
+      powerMaxLoad: '',
+      equipPowerChartData: [],
+      equipPowerMaxLoad:''
     }
   },
   watch: {
@@ -248,12 +273,29 @@ export default {
     this.getList()
     this.getsumByFacsH()
     this.getSumBySubCategoryH();
+    this.getPowerChart()
   },
   computed: {
     barChartOptions () {
       const xAxisData = this.hList.map(item => item.time);
       const seriesData = this.hList.map(item => item.elecQuantity);
       return {
+        toolbox: {
+          itemGap: 10,
+          itemSize: 16,
+          right: 10,
+          top: 0,
+          show: true,
+          feature: {
+            magicType: {
+              show: true,
+              type: ['bar', 'line']
+            },
+            saveAsImage: {
+              show: true
+            }
+          }
+        },
         tooltip: {
           trigger: 'axis',
           axisPointer: {
@@ -283,9 +325,257 @@ export default {
           }
         }]
       };
+    },
+    powerLineOptions () {
+      const xAxisData = this.powerChartData.map(item => `${item.date.substr(5)} ${item.time.substr(0,5)} `);
+      const yData = this.powerChartData.map(item => item.p);
+      return {
+        toolbox: {
+          itemGap: 10,
+          itemSize: 16,
+          right: 10,
+          top: 0,
+          show: true,
+          feature: {
+            magicType: {
+              show: true,
+              type: ['bar', 'line']
+            },
+            saveAsImage: {
+              show: true
+            }
+          }
+        },
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            type: 'shadow'
+          }
+        },
+        legend: {
+          data: ['平均功率']
+        },
+        xAxis: {
+          type: 'category',
+          // axisLabel: {
+          //   interval: 0,
+          //   // margin: 50, //刻度标签与轴线之间的距离。
+          // },
+          data: xAxisData
+        },
+        yAxis: {
+          name: 'kW(千瓦)',
+          type: 'value',
+        },
+        dataZoom: [
+          {
+            type: "slider",
+            start: 0,
+            end: 100,
+            height: 10,
+            bottom: '10%',
+            showDetail: false,
+            showDataShadow: false,
+            borderColor: "transparent"
+          },
+          {
+            type: "inside",
+            // realtime: true,
+            start: 0,
+            end: 100,
+          },
+        ],
+        series: [{
+          name: '平均功率',
+          type: 'line',
+          data: yData,
+          itemStyle: {
+            normal: {
+              color: '#6395FA'
+            }
+          },
+          markLine: {
+            symbol: 'none',
+            silent: true,
+            lineStyle: {normal: {type: 'dashed'}},
+            label: {position: 'start'},
+            data: [
+              {
+                yAxis: this.powerMaxLoad,
+                lineStyle: {width: 1.656, color: '#ff6367'},
+                label: {show: false}
+              },
+            ]
+          },
+          markPoint: {
+            silent: true,
+            data: [
+              {
+                yAxis: this.powerMaxLoad,
+                x: '100%',
+                symbolSize: 0.1,
+                label: {
+                  textStyle: {color: '#F59A23'},
+                  fontSize: 12,
+                  position: 'left',
+                  formatter: '最高负荷'
+                }
+              },
+            ]
+          },
+        }]
+      };
+    },
+    equipPowerLineOptions () {
+      const xAxisData = this.equipPowerChartData.map(item => `${item.date.substr(5)} ${item.time.substr(0,5)} `);
+      const yData = this.equipPowerChartData.map(item => item.p);
+      return {
+        toolbox: {
+          itemGap: 10,
+          itemSize: 16,
+          right: 10,
+          top: 0,
+          show: true,
+          feature: {
+            magicType: {
+              show: true,
+              type: ['bar', 'line']
+            },
+            saveAsImage: {
+              show: true
+            }
+          }
+        },
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            type: 'shadow'
+          }
+        },
+        legend: {
+          data: ['平均功率']
+        },
+        xAxis: {
+          type: 'category',
+          data: xAxisData
+        },
+        yAxis: {
+          name: 'kW(千瓦)',
+          type: 'value',
+        },
+        dataZoom: [
+          {
+            type: "slider",
+            start: 0,
+            end: 100,
+            height: 10,
+            bottom: '10%',
+            showDetail: false,
+            showDataShadow: false,
+            borderColor: "transparent"
+          },
+          {
+            type: "inside",
+            start: 0,
+            end: 100,
+          },
+        ],
+        series: [{
+          name: '平均功率',
+          type: 'line',
+          data: yData,
+          itemStyle: {
+            normal: {
+              color: '#6395FA'
+            }
+          },
+          markLine: {
+            symbol: 'none',
+            silent: true,
+            lineStyle: {normal: {type: 'dashed'}},
+            label: {position: 'start'},
+            data: [
+              {
+                yAxis: this.equipPowerMaxLoad,
+                lineStyle: {width: 1.656, color: '#ff6367'},
+                label: {show: false}
+              },
+            ]
+          },
+          markPoint: {
+            silent: true,
+            data: [
+              {
+                yAxis: this.equipPowerMaxLoad,
+                x: '100%',
+                symbolSize: 0.1,
+                label: {
+                  textStyle: {color: '#F59A23'},
+                  fontSize: 12,
+                  position: 'left',
+                  formatter: '最高负荷'
+                }
+              },
+            ]
+          },
+        }]
+      };
     }
   },
   methods: {
+    getPowerChart () {
+      this.powerMaxLoad = ''
+      this.powerChartData=[]
+      const [ startTime,endTime] = this.powerDate
+      const params = {
+        startTime,
+        endTime,
+        areaCode: '-1',
+        ObjType: '1',
+      }
+      getPowerData({
+        ...params,
+        pageNum: 1,
+        pageSize: 999
+      }).then(({code, rows}) => {
+        if (code === 200) {
+          this.powerChartData = rows
+        }
+      })
+      getPowerMaxLoad(params).then(({code, data}) => {
+        if (code === 200) {
+          this.powerMaxLoad = data
+        }
+      })
+    },
+    getEquipPowerChart () {
+      this.equipPowerMaxLoad = ''
+      this.equipPowerChartData=[]
+      const [ startTime,endTime] = this.dateRange
+      const params = {
+        startTime,
+        endTime,
+        areaCode: '-1',
+        ObjType: '1',
+        facsCategory: 'Z',
+        subCategory: this.activeName,
+        objCode:this.objCode
+      }
+      getPowerData({
+        ...params,
+        pageNum: 1,
+        pageSize: 999
+      }).then(({code, rows}) => {
+        if (code === 200) {
+          this.equipPowerChartData = rows
+        }
+      })
+      getPowerMaxLoad(params).then(({code, data}) => {
+        if (code === 200) {
+          this.equipPowerMaxLoad = data
+        }
+      })
+    },
     /** 查询用能计量-小时列表 */
     getList () {
       this.loading = true
@@ -296,6 +586,7 @@ export default {
         this.loading = false
       })
       this.getsumByFacsH()
+      this.getEquipPowerChart()
     },
     /**根据设施查询能耗统计 */
     getsumByFacsH () {
@@ -492,10 +783,13 @@ export default {
 }
 </script>
 <style lang="scss" scoped>
-.is-active {
+.time-range-buttons{
+  .is-active {
   background-color: #409eff;
   color: white;
 }
+}
+
 
 .first-content {
   display: flex;
@@ -512,9 +806,11 @@ export default {
 
 .container-block {
   padding-left: 20px;
-  // .panel-title{
+}
 
-  // }
+.ctl-container {
+  display: flex;
+  justify-content: space-between;
 }
 </style>