Browse Source

+ 装机容量改为系统配置项读取

chen.cheng 1 month ago
parent
commit
27e240cc07
2 changed files with 122 additions and 62 deletions
  1. 87 60
      ems-ui-cloud/src/views/mgr/powergrid.vue
  2. 35 2
      ems-ui-cloud/src/views/mgr/powerstore.vue

+ 87 - 60
ems-ui-cloud/src/views/mgr/powergrid.vue

@@ -9,17 +9,12 @@
         </el-statistic>
         <el-statistic title="光伏总装机">
           <template slot="formatter">
-            1265.85kW
+            {{ pvCfg.total }}kW
           </template>
         </el-statistic>
-        <el-statistic title="光伏南区装机">
+        <el-statistic :title="`光伏${item.name}装机`" v-for="item in pvCfg.areas">
           <template slot="formatter">
-            660.8kW
-          </template>
-        </el-statistic>
-        <el-statistic title="光伏北区装机">
-          <template slot="formatter">
-            605.05kW
+            {{ numToStr(item.pv) }}kW
           </template>
         </el-statistic>
       </div>
@@ -38,32 +33,33 @@
         </el-row>
         <el-row type="flex" :gutter="20" style="margin-top: 20px">
           <el-col :span="24">
-            <BarChartBlock title="当日供电量柱状图" :opt-cfg="pvSupplyIndex" />
+            <BarChartBlock title="当日供电量柱状图" :opt-cfg="pvSupplyIndex"/>
           </el-col>
         </el-row>
       </el-tab-pane>
       <el-tab-pane label="市电" name="first">
         <el-col :span="4" :xs="24">
           <div class="head-container">
-            <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-              style="margin-bottom: 20px" />
+            <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small"
+                      prefix-icon="el-icon-search"
+                      style="margin-bottom: 20px"/>
           </div>
           <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
             <el-tree :data="areaOptions" :props="defaultProps" :expand-on-click-node="false"
-              :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-              @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;" />
+                     :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
+                     @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"/>
           </div>
         </el-col>
         <el-col :span="20" :xs="24">
           <div class="container-block">
-            <SubTitle :title="`时段供电数据【${selectedLabel}】`" />
-            <BaseChart width="100%" height="300px" :option="elecOptions" />
+            <SubTitle :title="`时段供电数据【${selectedLabel}】`"/>
+            <BaseChart width="100%" height="300px" :option="elecOptions"/>
           </div>
           <div class="container-block">
             <div class="ctl-container">
               <el-date-picker v-model="dateRange" type="datetimerange" @change="getList"
-                value-format="yyyy-MM-dd hh:mm:ss" :picker-options="pickerOptions" range-separator="至"
-                start-placeholder="开始日期" end-placeholder="结束日期" align="right">
+                              value-format="yyyy-MM-dd hh:mm:ss" :picker-options="pickerOptions" range-separator="至"
+                              start-placeholder="开始日期" end-placeholder="结束日期" align="right">
               </el-date-picker>
             </div>
             <el-table v-loading="loading" :data="pgSupplyHList">
@@ -82,37 +78,39 @@
                   <span>{{ getMeterTypeName(scope.row.meterType) }}</span>
                 </template>
               </el-table-column>
-              <el-table-column label="单位电价(¥)" align="center" prop="meterUnitPrice" />
-              <el-table-column label="供电量(kW·h)" align="center" prop="useElecQuantity" />
-              <el-table-column label="供电电费(¥)" align="center" prop="useElecCost" />
+              <el-table-column label="单位电价(¥)" align="center" prop="meterUnitPrice"/>
+              <el-table-column label="供电量(kW·h)" align="center" prop="useElecQuantity"/>
+              <el-table-column label="供电电费(¥)" align="center" prop="useElecCost"/>
             </el-table>
             <pagination :total="total" :page-size.sync="queryParams.pageSize" :page-sizes="[10, 20, 50]"
-              :page.sync="queryParams.pageNum" @pagination="getList" />
+                        :page.sync="queryParams.pageNum" @pagination="getList"/>
           </div>
         </el-col>
       </el-tab-pane>
       <el-tab-pane label="光伏" name="second">
         <el-col :span="4" :xs="24">
           <div class="head-container">
-            <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-              style="margin-bottom: 20px" />
+            <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small"
+                      prefix-icon="el-icon-search"
+                      style="margin-bottom: 20px"/>
           </div>
           <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
             <el-tree :data="areaOptions" :props="defaultProps" :expand-on-click-node="false"
-              :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-              @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;" />
+                     :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
+                     @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"/>
           </div>
         </el-col>
         <el-col :span="20" :xs="24">
           <div class="container-block">
-            <SubTitle :title="`时段发电数据【${selectedLabel}】`" />
-            <BaseChart width="100%" height="300px" :option="pvOptions" />
+            <SubTitle :title="`时段发电数据【${selectedLabel}】`"/>
+            <BaseChart width="100%" height="300px" :option="pvOptions"/>
           </div>
           <div class="container-block">
             <div class="ctl-container">
               <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">
+                              value-format="yyyy-MM-dd hh:mm:ss" range-separator="至" start-placeholder="开始日期"
+                              end-placeholder="结束日期"
+                              align="right">
               </el-date-picker>
             </div>
             <el-table v-loading="loading" :data="pvSupplyHList">
@@ -126,13 +124,13 @@
                   <span>{{ scope.row.time }}</span>
                 </template>
               </el-table-column>
-              <el-table-column label="总发电量(kW·h)" align="center" prop="genElecQuantity" />
-              <el-table-column label="自用电量(kW·h)" align="center" prop="useElecQuantity" />
-              <el-table-column label="上网电量(kW·h)" align="center" prop="upElecQuantity" />
-              <el-table-column label="上网收益(¥)" align="center" prop="upElecEarn" />
+              <el-table-column label="总发电量(kW·h)" align="center" prop="genElecQuantity"/>
+              <el-table-column label="自用电量(kW·h)" align="center" prop="useElecQuantity"/>
+              <el-table-column label="上网电量(kW·h)" align="center" prop="upElecQuantity"/>
+              <el-table-column label="上网收益(¥)" align="center" prop="upElecEarn"/>
             </el-table>
             <pagination :total="total" :page-size.sync="queryParams.pageSize" :page-sizes="[10, 20, 50]"
-              :page.sync="queryParams.pageNum" @pagination="getList" />
+                        :page.sync="queryParams.pageNum" @pagination="getList"/>
           </div>
         </el-col>
       </el-tab-pane>
@@ -142,7 +140,7 @@
 
 <script>
 import {ApiCode} from '@/api/apiEmums'
-import { areaTreeByFacsCategory } from '@/api/basecfg/area'
+import {areaTreeByFacsCategory} from '@/api/basecfg/area'
 import {get} from '@/api/commonApi'
 import {listPgSupplyH, listPvSupplyH} from '@/api/mgr/pgSupplyH'
 import BaseChart from '@/components/BaseChart'
@@ -151,6 +149,8 @@ import PieChartBlock from '@/components/Block/charts/PieChartBlock.vue'
 import SubTitle from '@/components/SubTitle'
 import {DateTool} from '@/utils/DateTool'
 import dayjs from 'dayjs'
+import {listConfig} from "@/api/system/config";
+import {numToStr} from "@/utils";
 
 export default {
   name: 'PgSupplyH',
@@ -161,7 +161,7 @@ export default {
     BaseChart,
     SubTitle
   },
-  data () {
+  data() {
     return {
       activeName: 'summery',
       // 遮罩层
@@ -180,6 +180,10 @@ export default {
         children: 'children',
         label: 'label'
       },
+      pvCfg: {
+        total: 0,
+        areas: []
+      },
       // 查询参数
       queryParams: {
         areaCode: '-1',
@@ -193,7 +197,7 @@ export default {
         shortcuts: [
           {
             text: '最近一周',
-            onClick (picker) {
+            onClick(picker) {
               const end = new Date()
               const start = new Date()
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
@@ -201,7 +205,7 @@ export default {
             }
           }, {
             text: '最近一个月',
-            onClick (picker) {
+            onClick(picker) {
               const end = new Date()
               const start = new Date()
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
@@ -209,7 +213,7 @@ export default {
             }
           }, {
             text: '最近三个月',
-            onClick (picker) {
+            onClick(picker) {
               const end = new Date()
               const start = new Date()
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
@@ -292,7 +296,7 @@ export default {
             var relVal = params[0].name
             for (var i = 0, l = params.length; i < l; i++) {
               const unit = 'kW·h'
-              relVal =`${relVal}<br/>${params[i].marker}${params[i].seriesName}&nbsp;&nbsp;&nbsp;${params[i].value}${unit}`
+              relVal = `${relVal}<br/>${params[i].marker}${params[i].seriesName}&nbsp;&nbsp;&nbsp;${params[i].value}${unit}`
             }
             return relVal
           }
@@ -305,7 +309,7 @@ export default {
     }
   },
   computed: {
-    elecOptions () {
+    elecOptions() {
       const xData = this.pgSupplyTodayList.map(item => item.time)
       const quantity = this.pgSupplyTodayList.map(item => item.useElecQuantity)
       const cost = this.pgSupplyTodayList.map(item => item.useElecCost)
@@ -321,8 +325,8 @@ export default {
           formatter: (params) => {
             var relVal = params[0].name
             for (var i = 0, l = params.length; i < l; i++) {
-              const unit = params[i].seriesName==='供电电费'?'元':'kW·h'
-              relVal =`${relVal}<br/>${params[i].marker}${params[i].seriesName}&nbsp;&nbsp;&nbsp;${params[i].value}${unit}`
+              const unit = params[i].seriesName === '供电电费' ? '元' : 'kW·h'
+              relVal = `${relVal}<br/>${params[i].marker}${params[i].seriesName}&nbsp;&nbsp;&nbsp;${params[i].value}${unit}`
             }
             return relVal
           }
@@ -382,7 +386,7 @@ export default {
       }
       return option
     },
-    pvOptions () {
+    pvOptions() {
       const option = {
         tooltip: {
           trigger: 'axis',
@@ -395,8 +399,8 @@ export default {
           formatter: (params) => {
             var relVal = params[0].name
             for (var i = 0, l = params.length; i < l; i++) {
-              const unit = params[i].seriesName==='上网收益'?'元':'kW·h'
-              relVal =`${relVal}<br/>${params[i].marker}${params[i].seriesName}&nbsp;&nbsp;&nbsp;${params[i].value}${unit}`
+              const unit = params[i].seriesName === '上网收益' ? '元' : 'kW·h'
+              relVal = `${relVal}<br/>${params[i].marker}${params[i].seriesName}&nbsp;&nbsp;&nbsp;${params[i].value}${unit}`
             }
             return relVal
           }
@@ -488,21 +492,44 @@ export default {
   },
   watch: {
     // 根据名称筛选区域树
-    areaName (val) {
+    areaName(val) {
       this.$refs.tree.filter(val)
     }
   },
-  async created () {
+  async created() {
     await this.getSummery()
+    await this.getPvConfig()
   },
   methods: {
-    getLabelContentForElecQuantity () {
+    numToStr,
+    getLabelContentForElecQuantity() {
       return `总供电{totalSupply|${this.totalSupply} kW·h}`;
     },
-    getLabelContentForElecCost () {
+    getLabelContentForElecCost() {
       return `供电成本{totalCost|${this.totalCost} 元}`;
     },
-    tabClick () {
+    async getPvConfig() {
+      const {rows} = await listConfig({
+        configKey: "storage-equipped-capacity",
+      })
+      if (!rows || !rows.length) {
+        return;
+      }
+      const cfg = JSON.parse(rows[0].remark)
+      const areas = []
+      let equipedStorage = cfg[this.areaType] ? cfg[this.areaType].pv : 0
+      if (!this.areaType || this.areaType === '-1') {
+        for (let item in cfg) {
+          equipedStorage += cfg[item].pv
+          areas.push(cfg[item])
+        }
+      }
+      this.pvCfg = {
+        total: numToStr(equipedStorage),
+        areas: areas
+      }
+    },
+    tabClick() {
       if (this.activeName !== 'summery') {
         this.dateRange = [dayjs().format(DateTool.DateFormat.YYYY_MM_DD_00_00_00), dayjs().format(DateTool.DateFormat.YYYY_MM_DD_23_59_59)]
         this.queryParams.areaCode = '-1'
@@ -514,11 +541,11 @@ export default {
         this.getSummery()
       }
     },
-    async getSummery () {
+    async getSummery() {
       await this.getHSummery()
       await this.getThisDaySummery()
     },
-    async getThisDaySummery () {
+    async getThisDaySummery() {
       const {
         data,
         code
@@ -576,7 +603,7 @@ export default {
       this.totalCost = totalCost;
     },
 
-    async getHSummery () {
+    async getHSummery() {
       const {
         data,
         code
@@ -626,7 +653,7 @@ export default {
       this.pvSupplyIndex.series = series
       this.pvSupplyIndex.xAxis.data = xaxis
     },
-    getTodayList () {
+    getTodayList() {
       if (this.activeName === 'first') {
         areaTreeByFacsCategory('W', this.facsSubCategory, false).then(response => {
           this.areaOptions = [{
@@ -663,7 +690,7 @@ export default {
         })
       }
     },
-    getList () {
+    getList() {
       this.loading = true
       this.queryParams.startRecTime = ''
       this.queryParams.endRecTime = ''
@@ -701,23 +728,23 @@ export default {
       }
     },
     // 筛选节点
-    filterNode (value, data) {
+    filterNode(value, data) {
       if (!value) return true
       return data.label.indexOf(value) !== -1
     },
     // 节点单击事件
-    handleNodeClick (data) {
+    handleNodeClick(data) {
       this.queryParams.areaCode = data.id
       this.selectedLabel = data.label
       this.handleQuery()
     },
     /** 搜索按钮操作 */
-    handleQuery () {
+    handleQuery() {
       this.queryParams.pageNum = 1
       this.getTodayList()
       this.getList()
     },
-    getMeterTypeName (meterType) {
+    getMeterTypeName(meterType) {
       const meterTypeMap = {
         '-1': '低谷电',
         '0': '平峰电',

+ 35 - 2
ems-ui-cloud/src/views/mgr/powerstore.vue

@@ -4,7 +4,12 @@
       <div class="tips">
         <el-statistic title="总装机">
           <template slot="formatter">
-            400kW·h
+            {{ pvCfg.total }}kW·h
+          </template>
+        </el-statistic>
+        <el-statistic :title="`光伏${item.name}装机`" v-for="item in pvCfg.areas">
+          <template slot="formatter">
+            {{ numToStr(item.pv) }}kW
           </template>
         </el-statistic>
       </div>
@@ -74,7 +79,7 @@
 <script>
 import {listElecStoreH, dayStatistics} from '@/api/mgr/elecStoreH'
 import { areaTreeByFacsCategory } from '@/api/basecfg/area'
-import {dateFormat} from '@/utils/index.js'
+import {dateFormat, numToStr} from '@/utils/index.js'
 import dayjs from 'dayjs'
 import {DateTool} from '@/utils/DateTool'
 import BaseChart from '@/components/BaseChart'
@@ -82,6 +87,7 @@ 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 {listConfig} from "@/api/system/config";
 
 export default {
   name: 'ElecStoreH',
@@ -105,6 +111,10 @@ export default {
         children: "children",
         label: "label"
       },
+      pvCfg: {
+        total: 0,
+        areas: []
+      },
       selectedLabel: '',
       // 查询参数
       queryParams: {
@@ -295,8 +305,31 @@ export default {
     this.facsCategory = 'C'
     await this.getAreaList()
     this.tabClick()
+    await this.getPvConfig()
   },
   methods: {
+    numToStr,
+    async getPvConfig() {
+      const {rows} = await listConfig({
+        configKey: "storage-equipped-capacity",
+      })
+      if (!rows || !rows.length) {
+        return;
+      }
+      const cfg = JSON.parse(rows[0].remark)
+      const areas = []
+      let equipedStorage = cfg[this.areaType] ? cfg[this.areaType].store : 0
+      if (!this.areaType || this.areaType === '-1') {
+        for (let item in cfg) {
+          equipedStorage += cfg[item].store
+          areas.push(cfg[item])
+        }
+      }
+      this.pvCfg = {
+        total: numToStr(equipedStorage),
+        areas: areas
+      }
+    },
     // 查询区域列表
     async getAreaList () {
       await areaTreeByFacsCategory(this.facsCategory, this.facsSubCategory, false).then(response => {