浏览代码

优化问题

luogang 10 月之前
父节点
当前提交
147e76551e
共有 2 个文件被更改,包括 92 次插入115 次删除
  1. 4 1
      ems-ui/src/views/devmgr/meterRead/index.vue
  2. 88 114
      ems-ui/src/views/mgr/powergrid.vue

+ 4 - 1
ems-ui/src/views/devmgr/meterRead/index.vue

@@ -48,7 +48,7 @@
           <el-table-column label="上次抄表示数" align="center" prop="lastReading" />
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
-              <el-button size="mini" type="text" icon="el-icon-info" @click="handleRecord(scope.row)">
+              <el-button size="mini" type="text" :disabled="!canFill(scope.row.lastTime)" icon="el-icon-info" @click="handleRecord(scope.row)">
                 填报</el-button>
               <el-button size="mini" type="text"  icon="el-icon-document" @click="handleViewRec(scope.row)">
                 查看</el-button>
@@ -350,6 +350,9 @@ export default {
     canEdit(meterMonth) {
       return meterMonth === this.currentMonth
     },
+    canFill (lastTime) {
+      return dateFormat(new Date(lastTime),'yyyyMM')!==this.currentMonth
+    },
     updateRecord(row) {
       this.ifAdd = false
       this.fillFormOpen = true

+ 88 - 114
ems-ui/src/views/mgr/powergrid.vue

@@ -4,10 +4,7 @@
       <el-tab-pane label="总览" name="summery">
         <el-row type="flex" :gutter="20" style="margin-top: 20px">
           <el-col :span="12">
-            <PieChartBlock
-                title="当日供电量(单位:kw·h)"
-                :opt-cfg="elecQuantity"
-            />
+            <PieChartBlock title="当日供电量(单位:kw·h)" :opt-cfg="elecQuantity" />
           </el-col>
           <el-col :span="12">
             <PieChartBlock title="当日电费(单位:元)" :opt-cfg="elecCost"></PieChartBlock>
@@ -15,10 +12,7 @@
         </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>
@@ -29,7 +23,7 @@
               <el-select v-model="queryParams.areaCode" placeholder="请选择服务区" @change="handleQuery">
                 <el-option label="汇总" value="" />
                 <el-option v-for="item in areaOptions" :key="item.areaCode" :label="item.areaName"
-                           :value="item.areaCode" />
+                  :value="item.areaCode" />
               </el-select>
             </el-form-item>
           </el-form>
@@ -37,14 +31,9 @@
         </div>
         <div class="container-block">
           <div class="ctl-container">
-            <el-date-picker
-                v-model="dateRange"
-                type="datetimerange"
-                :picker-options="pickerOptions"
-                range-separator="至"
-                start-placeholder="开始日期"
-                end-placeholder="结束日期"
-                align="right">
+            <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">
             </el-date-picker>
           </div>
           <el-table v-loading="loading" :data="pgSupplyHList">
@@ -68,10 +57,8 @@
             <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" />
+          <pagination :total="total" :page-size.sync="queryParams.pageSize" :page-sizes="[10, 20, 50]"
+            :page.sync="queryParams.pageNum" @pagination="getList" />
         </div>
       </el-tab-pane>
       <el-tab-pane label="光伏" name="second">
@@ -81,7 +68,7 @@
               <el-select v-model="queryParams.areaCode" placeholder="请选择服务区" @change="handleQuery">
                 <el-option label="汇总" value="" />
                 <el-option v-for="item in areaOptions" :key="item.areaCode" :label="item.areaName"
-                           :value="item.areaCode" />
+                  :value="item.areaCode" />
               </el-select>
             </el-form-item>
           </el-form>
@@ -89,14 +76,9 @@
         </div>
         <div class="container-block">
           <div class="ctl-container">
-            <el-date-picker
-                v-model="dateRange"
-                type="datetimerange"
-                :picker-options="pickerOptions"
-                range-separator="至"
-                start-placeholder="开始日期"
-                end-placeholder="结束日期"
-                align="right">
+            <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">
             </el-date-picker>
           </div>
           <el-table v-loading="loading" :data="pvSupplyHList">
@@ -116,10 +98,8 @@
             <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" />
+          <pagination :total="total" :page-size.sync="queryParams.pageSize" :page-sizes="[10, 20, 50]"
+            :page.sync="queryParams.pageNum" @pagination="getList" />
         </div>
       </el-tab-pane>
     </el-tabs>
@@ -128,15 +108,15 @@
 </template>
 
 <script>
-import { ApiCode } from '@/api/apiEmums';
+import {ApiCode} from '@/api/apiEmums';
 import * as areaApi from '@/api/basecfg/area';
-import { areaWithFacsCategory } from '@/api/basecfg/area';
-import { get } from '@/api/commonApi';
-import { listPgSupplyH, listPvSupplyH } from '@/api/mgr/pgSupplyH';
+import {areaWithFacsCategory} from '@/api/basecfg/area';
+import {get} from '@/api/commonApi';
+import {listPgSupplyH, listPvSupplyH} from '@/api/mgr/pgSupplyH';
 import BaseChart from '@/components/BaseChart';
 import BarChartBlock from '@/components/Block/charts/BarChartBlock.vue';
 import PieChartBlock from '@/components/Block/charts/PieChartBlock.vue';
-import { DateTool } from '@/utils/DateTool';
+import {DateTool} from '@/utils/DateTool';
 import dayjs from 'dayjs';
 import data from "@/views/system/dict/data.vue";
 
@@ -148,7 +128,7 @@ export default {
     PieChartBlock,
     BaseChart,
   },
-  data() {
+  data () {
     return {
       activeName: 'summery',
       // 遮罩层
@@ -169,12 +149,12 @@ export default {
       },
       areaOptions: [],
       elecData: [],
-      dateRange: [dayjs().subtract(1, 'day'), dayjs()],
+      dateRange: [dayjs().format(DateTool.DateFormat.YYYY_MM_DD_00_00_00), dayjs().format(DateTool.DateFormat.YYYY_MM_DD_23_59_59)],
       pickerOptions: {
         shortcuts: [
           {
             text: '最近一周',
-            onClick(picker) {
+            onClick (picker) {
               const end = new Date();
               const start = new Date();
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
@@ -182,7 +162,7 @@ export default {
             },
           }, {
             text: '最近一个月',
-            onClick(picker) {
+            onClick (picker) {
               const end = new Date();
               const start = new Date();
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
@@ -190,7 +170,7 @@ export default {
             },
           }, {
             text: '最近三个月',
-            onClick(picker) {
+            onClick (picker) {
               const end = new Date();
               const start = new Date();
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
@@ -226,7 +206,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);
@@ -288,7 +268,7 @@ export default {
       };
       return option;
     },
-    pvOptions() {
+    pvOptions () {
       const option = {
         tooltip: {
           trigger: 'axis',
@@ -384,25 +364,13 @@ export default {
       return option;
     },
   },
-  watch: {
-    dateRange: function (newVal, oldVal) {
-      if (newVal.length === 0) {
-        return;
-      }
-      this.queryParams.startRecTime = dayjs(newVal[0]).format(DateTool.DateFormat.YYYY_MM_DD_HH_mm_ss);
-      this.queryParams.endRecTime = dayjs(newVal[1]).format(DateTool.DateFormat.YYYY_MM_DD_HH_mm_ss);
-      this.getList();
-    },
-  },
-  async created() {
-    // this.facsCategory = 'W';
+  async created () {
     await this.getAreaList();
     await this.getSummery();
-    // this.getList();
   },
   methods: {
-   // 查询区域列表
-    async getAreaList() {
+    // 查询区域列表
+    async getAreaList () {
       const {
         rows,
         total,
@@ -410,29 +378,26 @@ export default {
         pageNum: 1,
         pageSize: 10,
       });
-      console.log("列表!!!!!!!!!!!!!!",rows)
+      console.log("列表!!!!!!!!!!!!!!", rows)
       this.areaOptions = rows;
     },
-    tabClick() {
+    tabClick () {
       if (this.activeName !== 'summery') {
-        this.dateRange = [dayjs().subtract(1, 'month'), dayjs()];
-        this.queryParams = {
-          startRecTime: dayjs().subtract(1, 'month').format(DateTool.DateFormat.YYYY_MM_DD_HH_mm),
-          endRecTime: dayjs().format(DateTool.DateFormat.YYYY_MM_DD_HH_mm),
-          areaCode: '',
-          pageNum: 1,
-          pageSize: 10,
-        };
+        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 = ''
+        this.queryParams.pageNum = 1
+        this.getTodayList()
         this.getList();
-        return;
+      } else {
+        this.getSummery();
       }
-      this.getSummery();
+
     },
-    async getSummery() {
+    async getSummery () {
       await this.getHSummery();
       await this.getThisDaySummery();
     },
-    async getThisDaySummery() {
+    async getThisDaySummery () {
       const {
         data,
         code,
@@ -451,7 +416,7 @@ export default {
           value: supply?.quantity,
           name: '市电',
           itemStyle: {
-              color: '#6395FA',
+            color: '#6395FA',
           },
 
         },
@@ -459,7 +424,7 @@ export default {
           value: pv?.useQuantity,
           name: '光伏',
           itemStyle: {
-              color: '#8CDF6C',
+            color: '#8CDF6C',
           },
         },
       ];
@@ -469,20 +434,20 @@ export default {
           value: supply?.cost,
           name: '实际电费',
           itemStyle: {
-              color: '#6395FA',
+            color: '#6395FA',
           },
         },
         {
           value: pv?.upEarn,
           name: '节省电费',
           itemStyle: {
-              color: '#8CDF6C',
+            color: '#8CDF6C',
           },
         },
       ];
 
     },
-    async getHSummery() {
+    async getHSummery () {
       const {
         data,
         code,
@@ -497,55 +462,46 @@ export default {
       } = data;
       const series = [
         {
-          name: '光伏',
+          name: '市电',
           type: 'bar',
           barWidth: '30%', // 调整柱状图宽度
           data: [],
           itemStyle: {
-            color: '#8CDF6C',
+            color: '#6395FA',
           },
         },
         {
-          name: '市电',
+          name: '光伏',
           type: 'bar',
           barWidth: '30%', // 调整柱状图宽度
           data: [],
           itemStyle: {
-            color: '#6395FA',
+            color: '#8CDF6C',
           },
         },
+
       ];
       xaxis.forEach((item, index) => {
         let timeIndex = index + 1;
         if (!pv || !pv[timeIndex]) {
-          series[0].data.push(0);
+          series[1].data.push(0);
         } else {
-          series[0].data.push(pv[timeIndex].useQuantity);
+          series[1].data.push(pv[timeIndex].useQuantity);
         }
         if (!supply || !supply[timeIndex]) {
-          series[1].data.push(0);
+          series[0].data.push(0);
         } else {
-          series[1].data.push(supply[timeIndex].quantity);
+          series[0].data.push(supply[timeIndex].quantity);
         }
       });
-      this.pvSupplyIndex.series =series;
+      this.pvSupplyIndex.series = series;
       this.pvSupplyIndex.xAxis.data = xaxis;
     },
-
-    getList() {
-      this.loading = true;
+    getTodayList () {
       if (this.activeName === 'first') {
-        // areaWithFacsCategory('W', '');
-         areaWithFacsCategory('W', this.facsSubCategory).then(response => {
+        areaWithFacsCategory('W', this.facsSubCategory).then(response => {
           this.areaOptions = response.data
-          console.log("源网列表1111111111",this.areaOptions)
         })
-        listPgSupplyH(this.queryParams).then(response => {
-          this.pgSupplyHList = response.rows;
-          console.log("rows",this.pgSupplyHList)
-          this.total = response.total;
-          this.loading = false;
-        });
         listPgSupplyH({
           startRecTime: dayjs().format(DateTool.DateFormat.YYYY_MM_DD_00_00_00),
           endRecTime: dayjs().format(DateTool.DateFormat.YYYY_MM_DD_23_59_59),
@@ -556,18 +512,10 @@ export default {
           this.pgSupplyTodayList = response.rows;
         });
       } else {
-        // areaWithFacsCategory('E', '');
         areaWithFacsCategory('E', this.facsSubCategory).then(response => {
           this.areaOptions = response.data
-          console.log("源网列表2222222",this.areaOptions)
+          console.log("源网列表2222222", this.areaOptions)
         })
-        listPvSupplyH(this.queryParams).then(response => {
-          this.pvSupplyHList = response.rows;
-          console.log("rows",this.pvSupplyHList)
-          this.total = response.total;
-          this.loading = false;
-        });
-
         listPvSupplyH({
           startRecTime: dayjs().format(DateTool.DateFormat.YYYY_MM_DD_00_00_00),
           endRecTime: dayjs().format(DateTool.DateFormat.YYYY_MM_DD_23_59_59),
@@ -579,11 +527,38 @@ export default {
         });
       }
     },
+    getList () {
+      this.loading = true;
+      this.queryParams.startRecTime = ''
+      this.queryParams.endRecTime = ''
+      if (this.dateRange && this.dateRange.length) {
+        const [startRecTime, endRecTime] = this.dateRange
+        this.queryParams.startRecTime = startRecTime
+        this.queryParams.endRecTime = endRecTime
+      }
+      if (this.activeName === 'first') {
+        listPgSupplyH(this.queryParams).then(response => {
+          this.pgSupplyHList = response.rows;
+          console.log("rows", this.pgSupplyHList)
+          this.total = response.total;
+          this.loading = false;
+        });
+      } else {
+        listPvSupplyH(this.queryParams).then(response => {
+          this.pvSupplyHList = response.rows;
+          console.log("rows", this.pvSupplyHList)
+          this.total = response.total;
+          this.loading = false;
+        });
+      }
+    },
     /** 搜索按钮操作 */
-    handleQuery() {
+    handleQuery () {
+      this.queryParams.pageNum = 1
+      this.getTodayList()
       this.getList();
     },
-    getMeterTypeName(meterType) {
+    getMeterTypeName (meterType) {
       const meterTypeMap = {
         '-1': '低谷电',
         '0': '平峰电',
@@ -602,5 +577,4 @@ export default {
   }
 }
 </style>
-<style lang="scss" src="./index.scss">
-</style>
+<style lang="scss" src="./index.scss"></style>