소스 검색

站端数据列表时间格式化显示到分钟

xusl 6 달 전
부모
커밋
3c419ac154

+ 2 - 1
cpp-ui/package.json

@@ -61,7 +61,8 @@
     "vuex": "3.6.0",
     "vuex": "3.6.0",
     "vxe-table": "^2.11.0",
     "vxe-table": "^2.11.0",
     "xe-utils": "^3.5.30",
     "xe-utils": "^3.5.30",
-    "echarts": "^5.3.1"
+    "echarts": "^5.3.1",
+    "moment": "^2.24.0"
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@vue/cli-plugin-babel": "4.4.6",
     "@vue/cli-plugin-babel": "4.4.6",

+ 2 - 0
cpp-ui/src/main.js

@@ -49,6 +49,8 @@ import DictData from '@/components/DictData'
 import {getToken} from "@/utils/auth";
 import {getToken} from "@/utils/auth";
 import cache from "@/plugins/cache";
 import cache from "@/plugins/cache";
 Vue.prototype.$axios = request
 Vue.prototype.$axios = request
+import moment from 'moment'
+Vue.prototype.$moment = moment
 
 
 import 'xe-utils'
 import 'xe-utils'
 import VXETable from 'vxe-table'
 import VXETable from 'vxe-table'

+ 4 - 1
cpp-ui/src/views/stationDataQuery/inverterstatusdata/index.vue

@@ -55,8 +55,8 @@
         :radio-config="{trigger: 'row'}">
         :radio-config="{trigger: 'row'}">
         <vxe-table-column field="stationCode" title="所属场站" :formatter="stationCodeFormat"></vxe-table-column>
         <vxe-table-column field="stationCode" title="所属场站" :formatter="stationCodeFormat"></vxe-table-column>
         <vxe-table-column field="equipmentId" title="设备名称" :formatter="nameFormat"></vxe-table-column>
         <vxe-table-column field="equipmentId" title="设备名称" :formatter="nameFormat"></vxe-table-column>
+        <vxe-table-column field="time" title="时间" width="150" :formatter="timeFormat"></vxe-table-column>
         <vxe-table-column field="status" title="状态" :formatter="statusFormat"></vxe-table-column>
         <vxe-table-column field="status" title="状态" :formatter="statusFormat"></vxe-table-column>
-        <vxe-table-column field="time" title="时间" width="150"></vxe-table-column>
         <vxe-table-column field="activePower" title="有功(KW)"></vxe-table-column>
         <vxe-table-column field="activePower" title="有功(KW)"></vxe-table-column>
         <vxe-table-column field="reactivePower" title="无功(KVar)"></vxe-table-column>
         <vxe-table-column field="reactivePower" title="无功(KVar)"></vxe-table-column>
         <vxe-table-column field="voltage" title="电压(V)"></vxe-table-column>
         <vxe-table-column field="voltage" title="电压(V)"></vxe-table-column>
@@ -150,6 +150,9 @@ export default {
         this.$message.error('获取逆变器设备出错' + error)
         this.$message.error('获取逆变器设备出错' + error)
       })
       })
     },
     },
+    timeFormat({ cellValue, row, column }) {
+      return this.$moment(cellValue).format('YYYY-MM-DD HH:mm')
+    },
     nameFormat({cellValue, row, column}) {
     nameFormat({cellValue, row, column}) {
       const item = this.nameList.find(item => item.value === cellValue)
       const item = this.nameList.find(item => item.value === cellValue)
       return item ? item.label : ''
       return item ? item.label : ''

+ 4 - 1
cpp-ui/src/views/stationDataQuery/nwpdata/index.vue

@@ -47,7 +47,7 @@
             :data="tableData.slice((currentPage-1) * pageSize,currentPage * pageSize)">
             :data="tableData.slice((currentPage-1) * pageSize,currentPage * pageSize)">
             <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat" width="200px"
             <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat" width="200px"
                               fixed="left"></vxe-table-column>
                               fixed="left"></vxe-table-column>
-                          <vxe-table-column  field="time" title="预测时间" width="180" min-width="150" fixed="left"></vxe-table-column>
+                          <vxe-table-column  field="time" title="预测时间" width="180" min-width="150" fixed="left" :formatter="timeFormat"></vxe-table-column>
                           <vxe-table-column field="t" title="温度" min-width="90" ></vxe-table-column>
                           <vxe-table-column field="t" title="温度" min-width="90" ></vxe-table-column>
                           <vxe-table-column field="rh" title="湿度" min-width="90" ></vxe-table-column>
                           <vxe-table-column field="rh" title="湿度" min-width="90" ></vxe-table-column>
                           <vxe-table-column field="globalRadiation" title="总辐射" min-width="90" ></vxe-table-column>
                           <vxe-table-column field="globalRadiation" title="总辐射" min-width="90" ></vxe-table-column>
@@ -731,6 +731,9 @@ export default {
         this.loading = false
         this.loading = false
       })
       })
     },
     },
+    timeFormat({ cellValue, row, column }) {
+      return this.$moment(cellValue).format('YYYY-MM-DD HH:mm')
+    },
     getStationCode() {
     getStationCode() {
       this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
       this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
         this.stationList = response.data
         this.stationList = response.data

+ 4 - 1
cpp-ui/src/views/stationDataQuery/weatherstationstatusdata/index.vue

@@ -49,7 +49,7 @@
         :data="tableData.slice((currentPage-1) * pageSize,currentPage * pageSize)">
         :data="tableData.slice((currentPage-1) * pageSize,currentPage * pageSize)">
         <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat" width="200px"
         <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat" width="200px"
                           fixed="left"></vxe-table-column>
                           fixed="left"></vxe-table-column>
-        <vxe-table-column field="time" title="时间" width="150px" fixed="left"></vxe-table-column>
+        <vxe-table-column field="time" title="时间" width="150px" fixed="left" :formatter="timeFormat"></vxe-table-column>
         <vxe-table-column field="globalR" title="总辐射(W/㎡)"></vxe-table-column>
         <vxe-table-column field="globalR" title="总辐射(W/㎡)"></vxe-table-column>
         <vxe-table-column field="directR" title="直接辐射(W/㎡)"></vxe-table-column>
         <vxe-table-column field="directR" title="直接辐射(W/㎡)"></vxe-table-column>
         <vxe-table-column field="diffuseR" title="散射辐射(W/㎡)"></vxe-table-column>
         <vxe-table-column field="diffuseR" title="散射辐射(W/㎡)"></vxe-table-column>
@@ -137,6 +137,9 @@ export default {
   },
   },
   computed: {},
   computed: {},
   methods: {
   methods: {
+    timeFormat({ cellValue, row, column }) {
+      return this.$moment(cellValue).format('YYYY-MM-DD HH:mm')
+    },
     nameFormat({cellValue, row, column}) {
     nameFormat({cellValue, row, column}) {
       const item = this.nameList.find(item => item.value === cellValue)
       const item = this.nameList.find(item => item.value === cellValue)
       return item ? item.label : ''
       return item ? item.label : ''

+ 4 - 1
cpp-ui/src/views/stationDataQuery/windtowerstatusdata/index.vue

@@ -51,7 +51,7 @@
           :data="tableData.slice((currentPage-1) * pageSize,currentPage * pageSize)">
           :data="tableData.slice((currentPage-1) * pageSize,currentPage * pageSize)">
           <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat" width="200px"
           <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat" width="200px"
                             fixed="left"></vxe-table-column>
                             fixed="left"></vxe-table-column>
-          <vxe-table-column field="time" title="时间" width="180px" fixed="left"></vxe-table-column>
+          <vxe-table-column field="time" title="时间" width="180px" fixed="left" :formatter="timeFormat"></vxe-table-column>
           <vxe-table-column field="t" title="温度(℃)" width="180px"></vxe-table-column>
           <vxe-table-column field="t" title="温度(℃)" width="180px"></vxe-table-column>
           <vxe-table-column field="rh" title="湿度(RH%)" width="180px"></vxe-table-column>
           <vxe-table-column field="rh" title="湿度(RH%)" width="180px"></vxe-table-column>
           <vxe-table-column field="pa" title="气压(kPa)" width="180px"></vxe-table-column>
           <vxe-table-column field="pa" title="气压(kPa)" width="180px"></vxe-table-column>
@@ -717,6 +717,9 @@ export default {
   },
   },
   computed: {},
   computed: {},
   methods: {
   methods: {
+    timeFormat({ cellValue, row, column }) {
+      return this.$moment(cellValue).format('YYYY-MM-DD HH:mm')
+    },
     nameFormat({cellValue, row, column}) {
     nameFormat({cellValue, row, column}) {
       const item = this.nameList.find(item => item.value === cellValue)
       const item = this.nameList.find(item => item.value === cellValue)
       return item ? item.label : ''
       return item ? item.label : ''

+ 4 - 1
cpp-ui/src/views/stationDataQuery/windturbinestatusdata/index.vue

@@ -57,7 +57,7 @@
           :radio-config="{trigger: 'row'}">
           :radio-config="{trigger: 'row'}">
         <vxe-table-column field="stationCode" title="所属场站" :formatter="stationCodeFormat"></vxe-table-column>
         <vxe-table-column field="stationCode" title="所属场站" :formatter="stationCodeFormat"></vxe-table-column>
         <vxe-table-column field="equipmentId" title="设备名称" :formatter="nameFormat"></vxe-table-column>
         <vxe-table-column field="equipmentId" title="设备名称" :formatter="nameFormat"></vxe-table-column>
-        <vxe-table-column field="time" title="时间" width="150"></vxe-table-column>
+        <vxe-table-column field="time" title="时间" width="150" :formatter="timeFormat"></vxe-table-column>
         <vxe-table-column field="status" title="状态" :formatter="statusFormat"></vxe-table-column>
         <vxe-table-column field="status" title="状态" :formatter="statusFormat"></vxe-table-column>
         <vxe-table-column field="activePower" title="有功(KW)"></vxe-table-column>
         <vxe-table-column field="activePower" title="有功(KW)"></vxe-table-column>
         <vxe-table-column field="reactivePower" title="无功(KVar)"></vxe-table-column>
         <vxe-table-column field="reactivePower" title="无功(KVar)"></vxe-table-column>
@@ -191,6 +191,9 @@ export default {
         this.$message.error('获取风机设备出错' + error)
         this.$message.error('获取风机设备出错' + error)
       })
       })
     },
     },
+    timeFormat({ cellValue, row, column }) {
+      return this.$moment(cellValue).format('YYYY-MM-DD HH:mm')
+    },
     nameFormat({cellValue, row, column}) {
     nameFormat({cellValue, row, column}) {
       const item = this.nameList.find(item => item.value === cellValue)
       const item = this.nameList.find(item => item.value === cellValue)
       return item ? item.label : ''
       return item ? item.label : ''