Просмотр исходного кода

Merge branch 'test' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-ems into dev

# Conflicts:
#	src/views/centralizedMeterReading/list.vue
tanzx 1 месяц назад
Родитель
Сommit
963d8b7f49

+ 11 - 0
src/api/centralizedMeterReading/index.js

@@ -120,3 +120,14 @@ export async function refreshData(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//获取上期抄表数
+export async function queryBySubstanceId(substanceId,id) {
+  const res = await request.get(
+    `/ems/remote_meter_reading/queryBySubstanceId?substanceId=` + substanceId+'&id='+id
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 2 - 2
src/enum/dict.js

@@ -147,12 +147,12 @@ export const energyConsumingUnitList = [
     unit: [
       { value: '1', label: 'm³' },
       { value: '2', label: 'L' },
-      { value: '3', label: 'T' }
+      { value: '3', label: '吨' }
     ],
     priceUnit: [
       { value: '1', label: '元/m³' },
       { value: '2', label: '元/L' },
-      { value: '3', label: '元/T' }
+      { value: '3', label: '元/吨' }
     ]
   },
   {

+ 7 - 0
src/views/centralizedMeterReading/list.vue

@@ -320,6 +320,13 @@
                 : '-';
             }
           },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            minWidth: 160,
+            showOverflowTooltip: true
+          },
           {
             prop: 'approvalStatus',
             label: '审核状态',

+ 38 - 3
src/views/centralizedMeterReading/meterReadingDialog.vue

@@ -61,6 +61,7 @@
           :disabled="isView"
         ></el-input>
       </el-form-item>
+
       <el-form-item label="本期抄表时间" prop="currentMeterReadingTime">
         <el-date-picker
           v-model="form.currentMeterReadingTime"
@@ -71,12 +72,29 @@
           style="width: 100%"
         ></el-date-picker>
       </el-form-item>
+      <el-form-item label="上次抄表数" prop="lastMeterReadingNum">
+        <el-input
+          v-model.number="form.lastMeterReadingNum"
+          type="number"
+          placeholder="自动获取"
+          disabled
+        ></el-input>
+      </el-form-item>
       <el-form-item label="本期抄表数" prop="currentMeterReadingNum">
         <el-input
           v-model.number="form.currentMeterReadingNum"
           type="number"
           placeholder="请输入本期抄表数"
           :disabled="isView"
+          @input="setQuantity"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="本期用量" prop="quantity">
+        <el-input
+          v-model.number="form.quantity"
+          type="number"
+          placeholder=""
+          :disabled="isView"
         ></el-input>
       </el-form-item>
     </el-form>
@@ -110,7 +128,8 @@
   import {
     save,
     update,
-    getById
+    getById,
+    queryBySubstanceId
   } from '@/api/centralizedMeterReading/index.js';
   import MaterialAdd from '@/components/common/MaterialAdd.vue';
   import dayjs from 'dayjs';
@@ -131,7 +150,9 @@
     meterReadingId: '',
     currentMeterReadingTime: '',
     currentMeterReadingNum: '',
-    meterReadingMethod: 1
+    meterReadingMethod: 1,
+    lastMeterReadingNum: '',
+    quantity: ''
   };
 
   export default {
@@ -165,6 +186,9 @@
           ],
           currentMeterReadingNum: [
             { required: true, message: '请输入本期抄表数', trigger: 'blur' }
+          ],
+          quantity: [
+            { required: true, message: '请输入本期用量', trigger: 'blur' }
           ]
         }
       };
@@ -175,6 +199,12 @@
       }
     },
     methods: {
+      setQuantity() {
+        if (this.form.currentMeterReadingNum && this.form.lastMeterReadingNum) {
+          this.form.quantity =
+            this.form.currentMeterReadingNum - this.form.lastMeterReadingNum;
+        }
+      },
       // 打开弹窗
       async open(row, type = 'add') {
         this.activeComp = 'main';
@@ -231,7 +261,7 @@
         console.log(data, 'data');
       },
       // 选择设备回调
-      handleChooseEquipment(row) {
+      async handleChooseEquipment(row) {
         console.log('选择设备:', row);
         this.form.substanceId = row.id;
         this.form.substanceName = row?.category?.name;
@@ -246,6 +276,11 @@
         this.form.energyTypeName = row.energyTypeName || '';
         this.form.energyTypeId = row.energyTypeId || '';
         this.form.energyTypeCode = row.energyTypeCode || '';
+        console.log(this.form, ' this.form');
+        const data = await queryBySubstanceId(row.id, this.form.id);
+        this.form.lastMeterReadingNum = data.currentMeterReadingNum;
+
+        this.setQuantity();
 
         this.form.unit = energyConsumingUnitList
           .find((item) => item.value == row.energyClassificationCode)

+ 71 - 73
src/views/home/index.vue

@@ -159,8 +159,8 @@
                 >
 
                 <span
-                  :class="['tab_item', active2 === '3' ? 'active' : '']"
-                  @click="switchAreaBar('4', 'active2', 'usageTrend')"
+                  :class="['tab_item', active2 === '5' ? 'active' : '']"
+                  @click="switchAreaBar('5', 'active2', 'usageTrend')"
                   >煤</span
                 >
               </div>
@@ -190,29 +190,36 @@
             </div>
           </div>
 
-          <!-- 中间:用能预警分析 -->
+          <!-- 中间:区域用能对比 -->
           <div class="panel panel_center_warning">
             <div class="panel_header">
               <img src="@/assets/home/icon.png" alt="" />
-              <span>用能预警分析</span>
+              <span>区域用能对比</span>
             </div>
-            <div class="panel_content warning_content">
-              <div class="warning_main">
-                <dv-scroll-board
-                  :config="alertConfig"
-                  style="width: 100%; height: 100%"
-                />
-              </div>
-              <div class="warning_stats">
-                <div
-                  class="stat_item"
-                  v-for="(item, index) in warningStats"
-                  :key="index"
+            <div class="panel_content">
+              <div class="chart_tabs">
+                <span
+                  :class="['tab_item', active === '1' ? 'active' : '']"
+                  @click="switchAreaBar('1', 'active', 'regionBarChart')"
+                  >水</span
+                >
+                <span
+                  :class="['tab_item', active === '2' ? 'active' : '']"
+                  @click="switchAreaBar('2', 'active', 'regionBarChart')"
+                  >电</span
+                >
+                <span
+                  :class="['tab_item', active === '5' ? 'active' : '']"
+                  @click="switchAreaBar('5', 'active', 'regionBarChart')"
+                  >煤</span
                 >
-                  <div class="stat_value">{{ item.value }}</div>
-                  <div class="stat_label">{{ item.label }}</div>
-                </div>
               </div>
+              <v-chart
+                ref="areaBarRef"
+                style="height: 100%"
+                :option="areaBarOption"
+                @click="onBarClick"
+              />
             </div>
           </div>
 
@@ -236,8 +243,8 @@
                 >
 
                 <span
-                  :class="['tab_item', active3 === '4' ? 'active' : '']"
-                  @click="switchAreaBar('4', 'active3', 'costTrend')"
+                  :class="['tab_item', active3 === '5' ? 'active' : '']"
+                  @click="switchAreaBar('5', 'active3', 'costTrend')"
                   >煤</span
                 >
               </div>
@@ -252,7 +259,7 @@
 
         <!-- 第三行 -->
         <div class="row row_3">
-          <!-- 左侧:区域用能对比 -->
+          <!-- 左侧:用能预警分析 -->
           <div class="panel panel_half">
             <div class="panel_header">
               <img
@@ -260,33 +267,25 @@
                 alt=""
                 style="width: 25px; height: 25px"
               />
-              <span>区域用能对比</span>
+              <span>用能预警分析</span>
             </div>
-            <div class="panel_content">
-              <div class="chart_tabs">
-                <span
-                  :class="['tab_item', active === '1' ? 'active' : '']"
-                  @click="switchAreaBar('1', 'active', 'regionBarChart')"
-                  >水</span
-                >
-                <span
-                  :class="['tab_item', active === '2' ? 'active' : '']"
-                  @click="switchAreaBar('2', 'active', 'regionBarChart')"
-                  >电</span
-                >
-
-                <span
-                  :class="['tab_item', active === '4' ? 'active' : '']"
-                  @click="switchAreaBar('4', 'active', 'regionBarChart')"
-                  >煤</span
+            <div class="panel_content warning_content">
+              <div class="warning_main">
+                <dv-scroll-board
+                  :config="alertConfig"
+                  style="width: 100%; height: 100%"
+                />
+              </div>
+              <div class="warning_stats">
+                <div
+                  class="stat_item"
+                  v-for="(item, index) in warningStats"
+                  :key="index"
                 >
+                  <div class="stat_value">{{ item.value }}</div>
+                  <div class="stat_label">{{ item.label }}</div>
+                </div>
               </div>
-              <v-chart
-                ref="areaBarRef"
-                style="height: 100%"
-                :option="areaBarOption"
-                @click="onBarClick"
-              />
             </div>
           </div>
 
@@ -314,8 +313,8 @@
                 >
 
                 <span
-                  :class="['tab_item', active1 === '4' ? 'active' : '']"
-                  @click="switchAreaBar('4', 'active1', 'regionCostBarChart')"
+                  :class="['tab_item', active1 === '5' ? 'active' : '']"
+                  @click="switchAreaBar('5', 'active1', 'regionCostBarChart')"
                   >煤</span
                 >
               </div>
@@ -631,24 +630,24 @@
               icon: require('@/assets/home/leftitem.png'),
               value: res.electricityCost,
               unit: '元',
-              label: '用电费用'
+              label: '电费用'
             },
             {
               icon: require('@/assets/home/leftitem.png'),
               value: res.waterUsage,
-              unit: 'm³',
+              unit: '吨',
               label: '用水量'
             },
             {
               icon: require('@/assets/home/leftitem.png'),
               value: res.waterCost,
               unit: '元',
-              label: '用水费用(元)'
+              label: '用水费用'
             },
             {
               icon: require('@/assets/home/leftitem.png'),
               value: res.coalUsage,
-              unit: 'm³',
+              unit: '吨',
               label: '用煤量'
             },
             {
@@ -1177,27 +1176,27 @@
           statisticsCycle: this.statisticsCycle
         }).then((res) => {
           console.log(res, 'res');
-          // 专业配色方案 - 科技风渐变
+          // 专业配色方案 - 高对比度
           const electricityColors = [
             '#00d4ff',
-            '#00a8ff',
-            '#0099ff',
-            '#0077ff',
-            '#0055ff'
+            '#ff6b6b',
+            '#ffd93d',
+            '#6bcb77',
+            '#9b59b6'
           ];
           const waterColors = [
             '#00f5a0',
-            '#00d4aa',
-            '#00b894',
-            '#009e7d',
-            '#008b6b'
+            '#ff6b6b',
+            '#ffd93d',
+            '#4d96ff',
+            '#ff9f43'
           ];
           const coalColors = [
             '#ff9f43',
-            '#ff8c42',
-            '#ff7b38',
-            '#ff6b35',
-            '#ff5722'
+            '#ff6b6b',
+            '#ffd93d',
+            '#6bcb77',
+            '#00d4ff'
           ];
 
           this.areaCompareOption = {
@@ -1311,22 +1310,22 @@
         }).then((res) => {
           this.todayList = [
             {
-              label: '今日用电量(kWh)',
+              label: '上月用电量(kWh)',
               value: res.todayElectricityUsage,
               chartOption: {}
             },
             {
-              label: '今日用水量(m³)',
+              label: '昨日用水量(吨)',
               value: res.todayWaterUsage,
               chartOption: {}
             },
             {
-              label: '今日用煤量(T)',
-              value: res.todaycoalUsage,
+              label: '昨日用煤量(吨)',
+              value: res.todayCoalUsage,
               chartOption: {}
             },
             {
-              label: '今日能源费用(元)',
+              label: '本月能源费用(元)',
               value: res.todayTotalCost,
               chartOption: {}
             }
@@ -1490,7 +1489,6 @@
             },
             yAxis: {
               type: 'value',
-              name: '单位:kWh',
               nameTextStyle: {
                 color: '#0099ff',
                 align: 'left',
@@ -1934,7 +1932,7 @@
     display: flex;
     flex-direction: column;
     justify-content: space-around;
-    padding: 8px 15px 15px 25px;
+    padding: 8px 15px 15px 3%;
     height: 100%;
     box-sizing: border-box;
     .overview_row {
@@ -2007,7 +2005,7 @@
       padding: 8px;
       box-sizing: border-box;
       .today_value {
-        font-size: 34px;
+        font-size: 1.4vw;
         font-weight: bold;
         font-family: 'DS-Digital';
         color: #fff;