| | |
| | | <!-- |
| | | * @Author: daidai |
| | | * @Date: 2022-02-28 16:16:42 |
| | | * @LastEditors: Please set LastEditors |
| | | * @LastEditTime: 2022-07-20 17:57:11 |
| | | * @FilePath: \web-pc\src\pages\big-screen\view\indexs\left-center.vue |
| | | --> |
| | | <template> |
| | | <ul class="user_Overview flex" v-if="pageflag"> |
| | | <li class="user_Overview-item" style="color: #00fdfa"> |
| | | <li class="user_Overview-item" style="color: #b3d1ff"> |
| | | <div class="user_Overview_nums allnum "> |
| | | <dv-digital-flop :config="inboundConfig" style="width:100%;height:100%;" /> |
| | | </div> |
| | | <p>æåå
¥åº</p> |
| | | <p>æåå
¥åºå æ¯</p> |
| | | <br> |
| | | <!-- <p>{{stationstate[0].station_state}}</p> --> |
| | | <!-- <p v-if="stationstate[0].station_state == 'æ£ä¿®ä¸'">{{stationstate[0].station_checkName}}</p> --> |
| | | </li> |
| | | <li class="user_Overview-item" style="color: #07f7a8"> |
| | | <li class="user_Overview-item" style="color: #f8c8dc"> |
| | | <div class="user_Overview_nums online"> |
| | | <dv-digital-flop :config="outboundConfig" style="width:100%;height:100%;" /> |
| | | </div> |
| | | <p>æååºåº</p> |
| | | <p>æååºåºå æ¯</p> |
| | | <br> |
| | | <!-- <p>{{stationstate[1].station_state}}</p> --> |
| | | <!-- <p v-if="stationstate[1].station_state == 'æ£ä¿®ä¸'">{{stationstate[1].station_checkName}}</p> --> |
| | | </li> |
| | | <li class="user_Overview-item" style="color: #E6A23C"> |
| | | <div class="user_Overview_nums offline"> |
| | | <dv-digital-flop :config="backConfig" style="width:100%;height:100%;" /> |
| | | </div> |
| | | <p>æååæ¡</p> |
| | | <p>æåè°æ¨å æ¯</p> |
| | | <br> |
| | | <!-- <p>{{stationstate[1].station_state}}</p> --> |
| | | <!-- <p v-if="stationstate[1].station_state == 'æ£ä¿®ä¸'">{{stationstate[1].station_checkName}}</p> --> |
| | | </li> |
| | | <li class="user_Overview-item" style="color: #f56c6c"> |
| | | <div class="user_Overview_nums laramnum"> |
| | | <dv-digital-flop :config="surplusConfig" style="width:100%;height:100%;" /> |
| | | </div> |
| | | <p>æåéåº</p> |
| | | <p>æåéæå æ¯</p> |
| | | <br> |
| | | <!-- <p>{{stationstate[1].station_state}}</p> --> |
| | | <!-- <p v-if="stationstate[1].station_state == 'æ£ä¿®ä¸'">{{stationstate[1].station_checkName}}</p> --> |
| | | </li> |
| | | <!-- <li class="user_Overview-item" style="color: #e3b337"> |
| | | <div class="user_Overview_nums offline"> |
| | | <dv-digital-flop :config="offlineconfig" style="width:100%;height:100%;" /> |
| | | </div> |
| | | <p>3å·æ£ä¿®å°</p> |
| | | <br> |
| | | <p>{{stationstate[2].station_state}}</p> |
| | | <p v-if="stationstate[2].station_state == 'æ£ä¿®ä¸'">{{stationstate[2].station_checkName}}</p> |
| | | </li> |
| | | <li class="user_Overview-item" style="color: #e3b337"> |
| | | <div class="user_Overview_nums offline"> |
| | | <dv-digital-flop :config="offlineconfig" style="width:100%;height:100%;" /> |
| | | </div> |
| | | <p>4å·æ£ä¿®å°</p> |
| | | <br> |
| | | <p>{{stationstate[3].station_state}}</p> |
| | | <p v-if="stationstate[3].station_state == 'æ£ä¿®ä¸'">{{stationstate[3].station_checkName}}</p> |
| | | </li> --> |
| | | </ul> |
| | | <Reacquire v-else @onclick="getData" line-height="200px"> |
| | | éæ°è·å |
| | |
| | | |
| | | <script> |
| | | import { currentGET } from 'api/modules' |
| | | import {Floorfault} from "@/api/http.js" |
| | | import { Floorfault } from "@/api/http.js" |
| | | let style = { |
| | | fontSize: 24 |
| | | } |
| | |
| | | onlineNum: 5, |
| | | totalNum: 10, |
| | | }, |
| | | stationstate:[], |
| | | stationstate: [], |
| | | pageflag: true, |
| | | timer: null, |
| | | backConfig: { //æååæ¡ |
| | | number: [9999], |
| | | content: '{nt}', |
| | | backConfig: { // æååæ¡ |
| | | number: [0], |
| | | content: '{nt}%', |
| | | style: { |
| | | ...style, |
| | | // stroke: "#00fdfa", |
| | | fill: "#E6A23C", |
| | | fill: "#b3d1ff", |
| | | }, |
| | | }, |
| | | surplusConfig: { //æå使 |
| | | number: [100], |
| | | content: '{nt}', |
| | | surplusConfig: { // æå使 |
| | | number: [0], |
| | | content: '{nt}%', |
| | | style: { |
| | | ...style, |
| | | // stroke: "#00fdfa", |
| | | fill: "#f56c6c", |
| | | }, |
| | | }, |
| | | inboundConfig: { //æåå
¥åº |
| | | number: [100], |
| | | content: '{nt}', |
| | | inboundConfig: { // æåå
¥åº |
| | | number: [0], |
| | | content: '{nt}%', |
| | | style: { |
| | | ...style, |
| | | // stroke: "#00fdfa", |
| | | fill: "#00fdfa", |
| | | }, |
| | | }, |
| | | outboundConfig: { //æååºåº |
| | | outboundConfig: { // æååºåº |
| | | number: [0], |
| | | content: '{nt}', |
| | | content: '{nt}%', |
| | | style: { |
| | | ...style, |
| | | // stroke: "#07f7a8", |
| | | fill: "#07f7a8", |
| | | }, |
| | | }, |
| | |
| | | }, |
| | | beforeDestroy() { |
| | | this.clearData() |
| | | |
| | | }, |
| | | methods: { |
| | | clearData() { |
| | |
| | | }, |
| | | async getData() { |
| | | this.pageflag = true; |
| | | // currentGET("big2").then((res) => { |
| | | // if (!this.timer) { |
| | | // console.log("è®¾å¤æ»è§2", res); |
| | | // } |
| | | // if (res.success) { |
| | | // this.userOverview = res.data; |
| | | // this.onlineconfig = { |
| | | // ...this.onlineconfig, |
| | | // number: [1] |
| | | // } |
| | | // this.config = { |
| | | // ...this.config, |
| | | // number: [7] |
| | | // } |
| | | // this.offlineconfig = { |
| | | // ...this.offlineconfig, |
| | | // number: [4] |
| | | // } |
| | | // this.laramnumconfig = { |
| | | // ...this.laramnumconfig, |
| | | // number: [10] |
| | | // } |
| | | // this.switper(); |
| | | // } else { |
| | | // this.pageflag = false; |
| | | // this.$Message.warning(res.msg); |
| | | // } |
| | | // }); |
| | | var rep = await Floorfault(); |
| | | try { |
| | | const rep = await Floorfault(); |
| | | |
| | | // æåå个类åçæ°é |
| | | const values = [ |
| | | rep.inboundCount || 0, |
| | | rep.outboundCount || 0, |
| | | rep.allocateCount || 0, |
| | | rep.surplusCount || 0 |
| | | ]; |
| | | |
| | | // è®¡ç®æ»å |
| | | const total = values.reduce((sum, value) => sum + value, 0); |
| | | |
| | | // 计ç®åç±»åç¾åæ¯ï¼ç¡®ä¿æ»å为100%ï¼ |
| | | let percentSum = 0; |
| | | const percentages = values.map((value, index) => { |
| | | // æåä¸ä¸ªç¾åæ¯éè¿åæ³ç¡®ä¿æ»å为100% |
| | | const isLast = index === values.length - 1; |
| | | const percent = isLast |
| | | ? 100 - percentSum |
| | | : total > 0 ? parseFloat(((value / total) * 100).toFixed(1)) : 0; |
| | | |
| | | this.inboundConfig={ |
| | | ...this.inboundConfig, |
| | | number: [rep.inboundCount] |
| | | } |
| | | this.outboundConfig={ |
| | | ...this.outboundConfig, |
| | | number: [rep.outboundCount] |
| | | } |
| | | this.backConfig={ |
| | | ...this.backConfig, |
| | | number: [rep.backboundCount] |
| | | } |
| | | this.surplusConfig={ |
| | | ...this.surplusConfig, |
| | | number: [rep.surplusCount] |
| | | } |
| | | // this.onlineconfig = { |
| | | // ...this.onlineconfig, |
| | | // number: [rep[0].station_qty] |
| | | // } |
| | | // this.config = { |
| | | // ...this.config, |
| | | // number: [rep[1].station_qty] |
| | | // } |
| | | // this.offlineconfig = { |
| | | // ...this.offlineconfig, |
| | | // number: [rep[2].station_qty] |
| | | // } |
| | | // this.offlineconfig = { |
| | | // ...this.offlineconfig, |
| | | // number: [rep[3].station_qty] |
| | | // } |
| | | this.switper(); |
| | | percentSum += percent; |
| | | return percent; |
| | | }); |
| | | |
| | | // æ´æ°æ°åç¿»çå¨é
ç½® |
| | | this.inboundConfig = { ...this.inboundConfig, number: [percentages[0]] }; |
| | | this.outboundConfig = { ...this.outboundConfig, number: [percentages[1]] }; |
| | | this.backConfig = { ...this.backConfig, number: [percentages[3]] }; |
| | | this.surplusConfig = { ...this.surplusConfig, number: [percentages[3]] }; |
| | | |
| | | this.switper(); |
| | | } catch (error) { |
| | | this.pageflag = false; |
| | | console.error("è·åæ°æ®å¤±è´¥ï¼", error); |
| | | this.$Message.warning("æ°æ®è·å失败ï¼è¯·éè¯"); |
| | | } |
| | | }, |
| | | //轮询 |
| | | // 轮询 |
| | | switper() { |
| | | if (this.timer) { |
| | | return |
| | | } |
| | | let looper = (a) => { |
| | | let looper = () => { |
| | | this.getData() |
| | | }; |
| | | this.timer = setInterval(looper, this.$store.state.setting.echartsAutoTime); |
| | |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang='scss' scoped> |
| | | .user_Overview { |
| | | li { |
| | |
| | | text-align: center; |
| | | height: 16px; |
| | | font-size: 16px; |
| | | white-space: nowrap; // 鲿¢æåæ¢è¡ |
| | | margin: 5px 0; // è°æ´é´è· |
| | | } |
| | | |
| | | .user_Overview_nums { |
| | |
| | | } |
| | | |
| | | .allnum { |
| | | |
| | | // background-image: url("../../assets/img/left_top_lan.png"); |
| | | &::before { |
| | | background-image: url("../../assets/img/left_top_lan.png"); |
| | | |
| | | } |
| | | } |
| | | |
| | | .online { |
| | | &::before { |
| | | background-image: url("../../assets/img/left_top_lv.png"); |
| | | |
| | | } |
| | | } |
| | | |
| | | .offline { |
| | | &::before { |
| | | background-image: url("../../assets/img/left_top_huang.png"); |
| | | |
| | | } |
| | | } |
| | | |
| | | .laramnum { |
| | | &::before { |
| | | background-image: url("../../assets/img/left_top_hong.png"); |
| | | |
| | | } |
| | | } |
| | | } |