Browse Source

运行评价首页图优化

guoxiaohuan 4 years ago
parent
commit
7322d7f73f

+ 2 - 21
src/utils/query.js

@@ -11,27 +11,8 @@ function query(search) {
     return obj
 }
 
-function shutDown(num, type, len) {
-    if (num == '-9998') {
-        if (type) {
-            num = 0
-        } else {
-            num = '--'
-        }
-        return num
-    } else if (num == '-9999') {
-        num = 'x'
-        return num
-    } else {
-        if ((num || num === 0) && !type && len) {
-            num = num.toFixed(len)
-        } else {
-            num = '--'
-        }
-        return num
-    }
-}
+
 
 export {
-    query, shutDown
+    query
 }

+ 1 - 3
src/views/evaluate/evCard.vue

@@ -82,7 +82,6 @@
 <script>
 import EvSnapshotsDialog from './evSnapshotsDialog'
 import { queryWorkflow } from '@/api/appeal/appeal.js'
-import { shutDown } from '@/utils/query.js'
 
 export default {
     data() {
@@ -90,8 +89,7 @@ export default {
             viewSnapshots: false,
             ids: [],
             titles: [],
-            time: '',
-            shutDown: shutDown
+            time: ''
         }
     },
     props: ['cardList', 'date'],

+ 0 - 79
src/views/evaluate/evEnergySavingRate.vue

@@ -1,79 +0,0 @@
-<template>
-    <div id='box3' style='width:100%;height:100%;'></div>
-</template>
-<script>
-import echarts from 'echarts'
-
-export default {
-    data() {
-        return {}
-    },
-    mounted() {
-        this.$nextTick(function() {
-            this.pie(this.energySavingRate, '#box3', ['#00D6B9', '#D5F6F2'])
-        })
-    },
-    props: ['energySavingRate'],
-    watch: {
-        energySavingRate(val, old) {
-            if (val) {
-                this.pie(val, '#box3', ['#00D6B9', '#D5F6F2'])
-            }
-        }
-    },
-    methods: {
-        pie(pieData, box, colors) {
-            const that = this
-            const myChart = echarts.init(document.querySelector(box))
-            const data = pieData
-            const option = {
-                grid: {
-                    top: 5,
-                    bottom: 5
-                },
-                color: colors,
-                series: [
-                    {
-                        name: 'valueOfMarket',
-                        type: 'pie',
-                        center: ['50%', '50%'],
-                        radius: ['60%', '70%'],
-                        avoidLabelOverlap: false,
-                        hoverAnimation: false,
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'center',
-                                color: '#000000',
-                                fontSize: 20,
-                                lineHeight: 0,
-                                formatter: '{b}\n{c}%'
-                            }
-                        },
-                        data: [
-                            {
-                                value: data,
-                                label: {
-                                    normal: {
-                                        show: true
-                                    }
-                                }
-                            },
-                            {
-                                value: 100 - data,
-                                name: '',
-                                label: {
-                                    normal: {
-                                        show: false
-                                    }
-                                }
-                            }
-                        ]
-                    }
-                ]
-            }
-            myChart.setOption(option)
-        }
-    }
-}
-</script>

+ 0 - 79
src/views/evaluate/evImplementationRate.vue

@@ -1,79 +0,0 @@
-<template>
-    <div id='box2' style='width:100%;height:100%;'></div>
-</template>
-<script>
-import echarts from 'echarts'
-
-export default {
-    data() {
-        return {}
-    },
-    props: ['chillerExecuteRate'],
-    mounted() {
-        this.$nextTick(function() {
-            this.pie(this.chillerExecuteRate, '#box2', ['#FFBA6B', '#FEE9D2'])
-        })
-    },
-    watch: {
-        chillerExecuteRate(val, old) {
-            if (val) {
-                this.pie(val, '#box2', ['#FFBA6B', '#FEE9D2'])
-            }
-        }
-    },
-    methods: {
-        pie(pieData, box, colors) {
-            const that = this
-            const myChart = echarts.init(document.querySelector(box))
-            const data = pieData
-            const option = {
-                grid: {
-                    top: 5,
-                    bottom: 5
-                },
-                color: colors,
-                series: [
-                    {
-                        name: 'valueOfMarket',
-                        type: 'pie',
-                        center: ['50%', '50%'],
-                        radius: ['60%', '70%'],
-                        avoidLabelOverlap: false,
-                        hoverAnimation: false,
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'center',
-                                color: '#000000',
-                                fontSize: 20,
-                                lineHeight: 0,
-                                formatter: '{b}\n{c}%'
-                            }
-                        },
-                        data: [
-                            {
-                                value: data,
-                                label: {
-                                    normal: {
-                                        show: true
-                                    }
-                                }
-                            },
-                            {
-                                value: 100 - data,
-                                name: '',
-                                label: {
-                                    normal: {
-                                        show: false
-                                    }
-                                }
-                            }
-                        ]
-                    }
-                ]
-            }
-            myChart.setOption(option)
-        }
-    }
-}
-</script>

+ 12 - 3
src/views/evaluate/evRateTitle.vue

@@ -3,14 +3,20 @@
         <span v-if='tab==1' class='count-bottom-text'>
             <span class='span1'></span>
             <span class='span2 Micbold'>室内温度满足率</span>
-            <span class='span3'>{{rate||'--'}}%</span>
+            <span class='span3'>
+                <font :class='rate=="x"?"red":""'>{{rate||'--'}}</font>%
+            </span>
         </span>
         <span v-if='tab==2' class='count-bottom-text'>
             <span class='span1'></span>
             <span class='span2 Micbold'>节能率</span>
-            <span class='span4'>{{rate}}%</span>
+            <span class='span4'>
+                <font :class='rate=="x"?"red":""'>{{rate}}</font>%
+            </span>
             <span class='span5'>准确率</span>
-            <span class='span6'>{{accuracy}}%</span>
+            <span class='span6'>
+                <font :class='accuracy=="x"?"red":""'>{{accuracy}}</font>%
+            </span>
         </span>
         <span v-if='tab==3' class='count-bottom-text'>
             <span class='span1'></span>
@@ -82,5 +88,8 @@ export default {
             height: 20px;
         }
     }
+    .red {
+        color: #f54e45;
+    }
 }
 </style>

+ 0 - 81
src/views/evaluate/evSatisfactionRate.vue

@@ -1,81 +0,0 @@
-<template>
-    <div id='box1' style='width:100%;height:100%;'></div>
-</template>
-<script>
-import echarts from 'echarts'
-
-export default {
-    data() {
-        return {}
-    },
-    props: ['tindoorFillRate'],
-    mounted() {
-        this.$nextTick(function() {
-            this.pie(this.tindoorFillRate, '#box1', ['#0091FF', '#E1F2FF'])
-        })
-    },
-    methods: {
-        pie(pieData, box, colors) {
-            const that = this
-            const myChart = echarts.init(document.querySelector(box))
-            const data = pieData
-            const option = {
-                grid: {
-                    top: 5,
-                    bottom: 5
-                },
-                color: colors,
-                series: [
-                    {
-                        name: 'valueOfMarket',
-                        type: 'pie',
-                        center: ['50%', '50%'],
-                        radius: ['60%', '70%'],
-                        avoidLabelOverlap: false,
-                        hoverAnimation: false,
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'center',
-                                color: '#000000',
-                                fontSize: 20,
-                                lineHeight: 0,
-                                formatter: '{b}\n{c}%'
-                            }
-                        },
-                        data: [
-                            {
-                                value: data,
-                                label: {
-                                    normal: {
-                                        show: true
-                                    }
-                                }
-                            },
-                            {
-                                value: 100 - data,
-                                name: '',
-                                label: {
-                                    normal: {
-                                        show: false
-                                    }
-                                }
-                            }
-                        ]
-                    }
-                ]
-            }
-            myChart.setOption(option)
-        }
-    },
-    watch: {
-        tindoorFillRate(val, old) {
-            console.log(val)
-            console.log(old)
-            if (val) {
-                this.pie(val, '#box1', ['#0091FF', '#E1F2FF'])
-            }
-        }
-    }
-}
-</script>

+ 33 - 16
src/views/evaluate/evTwoLevelMenu.vue

@@ -110,14 +110,6 @@ export default {
         this.init()
     },
     methods: {
-        // changeSwitch(){
-        //   let getParams = {
-        //     isSatisfy:this.value2
-        //   }
-        //   queryTdbDay({getParams}).then(res=>{
-
-        //   })
-        // },
         init() {
             this.type = this.$route.query.type
             this.date = this.$route.query.name
@@ -127,9 +119,6 @@ export default {
             if (this.date) {
                 this.date = this.formatterStr3(new Date().getFullYear() + this.formatterStr2(this.date))
             }
-            // if (this.num && this.date) {
-            //     this.changeNumMethod(this.date)
-            // }
         },
         // @
         formatterStr2(str) {
@@ -163,7 +152,6 @@ export default {
                         }
                     }
                 })
-                console.log(obj)
                 this.dataList = Object.values(obj).map(i => {
                     // 增加 isExpand 属性
                     i.isExpand = i.children.some(c => c.isSatisfy == false)
@@ -215,14 +203,42 @@ export default {
             }
             this.accuracy = ''
             this.energySavingRate = ''
+            this.chillerExecuteRateReal = ''
             querychiller(params).then(res => {
                 // 节能率
-                this.energySavingRate = res.content[0].energySavingRate != undefined ? res.content[0].energySavingRate.toFixed(1) : '--'
+                if (res.content[0].energySavingRate != undefined) {
+                    if (res.content[0].energySavingRate == -9999) {
+                        this.energySavingRate = 'x'
+                    } else {
+                        this.energySavingRate = res.content[0].energySavingRate.toFixed(1)
+                    }
+                } else {
+                    this.energySavingRate = '--'
+                }
+                console.log('节能率', this.energySavingRate)
                 // 准确率
-                this.accuracy = res.content[0].accuracy != undefined ? res.content[0].accuracy.toFixed(1) : '--'
+                if (res.content[0].accuracy != undefined) {
+                    if (res.content[0].accuracy == -9999) {
+                        this.accuracy = 'x'
+                    } else {
+                        this.accuracy = res.content[0].accuracy.toFixed(1)
+                    }
+                } else {
+                    this.accuracy = '--'
+                }
+                console.log('准确率', this.accuracy)
+
                 //执行率
-                this.chillerExecuteRateReal =
-                    res.content[0].chillerExecuteRateReal != undefined ? res.content[0].chillerExecuteRateReal.toFixed(1) : ''
+                if (res.content[0].chillerExecuteRateReal != undefined) {
+                    if (res.content[0].chillerExecuteRateReal == -9999) {
+                        this.chillerExecuteRateReal = 'x'
+                    } else {
+                        this.chillerExecuteRateReal = res.content[0].chillerExecuteRateReal.toFixed(1)
+                    }
+                } else {
+                    this.chillerExecuteRateReal = '--'
+                }
+                console.log('执行率', this.chillerExecuteRateReal)
             })
         },
         // 点击tab @
@@ -258,6 +274,7 @@ export default {
                 if (res.result == 'success') {
                     // 本日概况
                     this.current = res.current ? res.current : {}
+                    console.log('相似度', this.current.similarity)
                     // 相似日概况
                     this.similarDay = res.similarDay ? res.similarDay : {}
                     // 相似日列表

+ 76 - 40
src/views/evaluate/index.vue

@@ -31,14 +31,10 @@
                     <p class='ev-top Micbold'>室内温度满足率</p>
                     <div class='ev-bottom'>
                         <div class='ev-bottom-left'>
-                            <ev-satisfaction-rate :tindoorFillRate='tindoorFillRate'></ev-satisfaction-rate>
+                            <div id='rate1' style='width:100%;height:100%;'></div>
                         </div>
                         <div class='ev-bottom-right MicrYaHei'>
-                            <p>
-                                <!-- <span>超限时长</span>
-                <span>{{'--'}}</span>
-                                <span>h/日</span>-->
-                            </p>
+                            <p></p>
                             <p>
                                 <span>超限程度</span>
                                 <span>{{tindoorOverrunDegree}}</span>
@@ -51,7 +47,7 @@
                     <p class='ev-top'>节能率</p>
                     <div class='ev-bottom'>
                         <div class='ev-bottom-left'>
-                            <ev-energy-saving-rate :energySavingRate='energySavingRate'></ev-energy-saving-rate>
+                            <div id='rate2' style='width:100%;height:100%;'></div>
                         </div>
                         <div class='ev-bottom-right'>
                             <p>
@@ -66,7 +62,7 @@
                     <p class='ev-top'>策略执行率</p>
                     <div class='ev-bottom'>
                         <div class='ev-bottom-left'>
-                            <ev-implementation-rate :chillerExecuteRate='chillerExecuteRate'></ev-implementation-rate>
+                            <div id='rate3' style='width:100%;height:100%;'></div>
                         </div>
                         <div class='ev-bottom-right'>
                             <p>
@@ -90,10 +86,8 @@
     </div>
 </template>
 <script>
+import echarts from 'echarts'
 import Head from '../main/index'
-import EvEnergySavingRate from './evEnergySavingRate'
-import EvImplementationRate from './evImplementationRate'
-import EvSatisfactionRate from './evSatisfactionRate'
 import EvIndoorTemperature from './evIndoorTemperature'
 import { runDataQury } from '@/api/evaluate/evaluate.js'
 import moment from 'moment'
@@ -129,9 +123,6 @@ export default {
     },
     components: {
         Head,
-        EvEnergySavingRate,
-        EvImplementationRate,
-        EvSatisfactionRate,
         EvIndoorTemperature
     },
     mounted() {
@@ -141,6 +132,57 @@ export default {
         ...mapGetters(['projects', 'projectId'])
     },
     methods: {
+        rate(pieData, box, colors) {
+            const myChart = echarts.init(document.querySelector(box))
+            const data = pieData
+            const option = {
+                grid: {
+                    top: 5,
+                    bottom: 5
+                },
+                color: colors,
+                series: [
+                    {
+                        name: 'valueOfMarket',
+                        type: 'pie',
+                        center: ['50%', '50%'],
+                        radius: ['60%', '70%'],
+                        avoidLabelOverlap: false,
+                        hoverAnimation: false,
+                        label: {
+                            normal: {
+                                show: true,
+                                position: 'center',
+                                color: '#000000',
+                                fontSize: 20,
+                                lineHeight: 0,
+                                formatter: '{b}\n{c}%'
+                            }
+                        },
+                        data: [
+                            {
+                                value: data,
+                                label: {
+                                    normal: {
+                                        show: true
+                                    }
+                                }
+                            },
+                            {
+                                value: 100 - data,
+                                name: '',
+                                label: {
+                                    normal: {
+                                        show: false
+                                    }
+                                }
+                            }
+                        ]
+                    }
+                ]
+            }
+            myChart.setOption(option)
+        },
         formatter(date) {
             return moment.unix(date / 1000).format('YYYYMMDD')
         },
@@ -161,54 +203,48 @@ export default {
             }
             runDataQury(null, { getParams }).then(res => {
                 if (res.result == 'success') {
-                    this.tindoorFillRate = res.tindoorFillRate != undefined ? res.tindoorFillRate.toFixed(1) : 0 //室内温度满足率
+                    this.tindoorFillRate = res.tindoorFillRate != undefined && res.tindoorFillRate != -9999 ? res.tindoorFillRate.toFixed(1) : 0 //室内温度满足率
                     console.log('室内温度满足率', this.tindoorFillRate)
-                    this.energySavingRate = res.energySavingRate != undefined ? res.energySavingRate.toFixed(1) : 0 //节能率
+                    this.energySavingRate = res.energySavingRate != undefined && res.energySavingRate != -9999 ? res.energySavingRate.toFixed(1) : 0 //节能率
                     console.log('节能率', this.energySavingRate)
-                    this.chillerExecuteRate = res.chillerExecuteRate != undefined ? res.chillerExecuteRate.toFixed(1) : 0 //略执行率
+                    this.chillerExecuteRate =
+                        res.chillerExecuteRate != undefined && res.chillerExecuteRate != -9999 ? res.chillerExecuteRate.toFixed(1) : 0 //略执行率
                     console.log('略执行率', this.chillerExecuteRate)
-                    this.energySaving = res.energySaving != undefined ? res.energySaving.toFixed(0) : 0 //节能量
+                    this.energySaving = res.energySaving != undefined && res.energySaving != -9999 ? res.energySaving.toFixed(0) : 0 //节能量
                     console.log('节能量', this.energySaving)
                     this.isExecutedNum = res.isExecutedNum //已执行数量
                     console.log('已执行数量', this.isExecutedNum)
                     this.allReceivedNum = res.allReceivedNum //共收到数量
                     console.log('共收到数量', this.allReceivedNum)
-                    this.tindoorOverrunDegree = res.tindoorOverrunDegree != undefined ? res.tindoorOverrunDegree.toFixed(1) : 0 //超限程度
+                    this.tindoorOverrunDegree =
+                        res.tindoorOverrunDegree != undefined && res.tindoorOverrunDegree != -9999 ? res.tindoorOverrunDegree.toFixed(1) : 0 //超限程度
                     console.log('超限程度', this.tindoorOverrunDegree)
-                    this.energyDataList = res.dataList
+                    this.energyDataList = res.dataList ? res.dataList : []
+                    this.queryRate()
                 }
             })
         },
+        queryRate() {
+            if (this.tindoorFillRate) {
+                this.rate(this.tindoorFillRate, '#rate1', ['#0091FF', '#E1F2FF'])
+            }
+            if (this.energySavingRate) {
+                this.rate(this.energySavingRate, '#rate2', ['#FFBA6B', '#FEE9D2'])
+            }
+            if (this.chillerExecuteRate) {
+                this.rate(this.chillerExecuteRate, '#rate3', ['#00D6B9', '#D5F6F2'])
+            }
+        },
         daterangeLeft() {
             if (this.pickerVal2.length > 0) {
-                // let dateTime = new Date(this.pickerVal2[0]);
-                // let newData = this.formatter(
-                //   new Date(dateTime.setDate(dateTime.getDate() - 1))
-                // );
                 this.pickerVal2[0] = this.pickerVal2[0] - 24 * 60 * 60 * 1000
                 this.pickerVal2[1] = this.pickerVal2[1] - 24 * 60 * 60 * 1000
-                // this.pickerVal2[0] =
-                //   newData.slice(0, 4) +
-                //   "." +
-                //   newData.slice(4, 6) +
-                //   "." +
-                //   newData.slice(6, 8);
                 this.pickerVal2 = [this.pickerVal2[0], this.pickerVal2[1]]
                 this.query(0)
             }
         },
         daterangeRight() {
             if (this.pickerVal2.length > 0) {
-                // let dateTime = new Date(this.pickerVal2[1]);
-                // let newData = this.formatter(
-                //   new Date(dateTime.setDate(dateTime.getDate() + 1))
-                // );
-                // this.pickerVal2[1] =
-                //   newData.slice(0, 4) +
-                //   "." +
-                //   newData.slice(4, 6) +
-                //   "." +
-                //   newData.slice(6, 8);
                 let end = this.formatter(new Date().getTime() - 24 * 60 * 60 * 1000)
                 if (this.formatter(this.pickerVal2[1]) == end) {
                     this.pickerVal2[1] = new Date().getTime() - 24 * 60 * 60 * 1000