123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <template>
- <el-row class="mianBox-af">
- <el-row class="headerBox">
- <el-col class="title">
- <img src="../../../assets/image-af/title1.png" alt="" />
- 设备工况
- </el-col>
- </el-row>
- <el-row class="contentBox">
- <el-col>
- <div ref="echartD1" class="echartD"></div>
- <div class="equipmentNumber greenNumber">{{resList.deviceTotal}}</div>
- <div class="equipmentName">设备总数</div>
- </el-col>
- <el-col>
- <div ref="echartD2" class="echartD"></div>
- <div class="equipmentNumber yellowNumber">{{resList.alarmTotal}}</div>
- <div class="equipmentName">告警次数</div>
- </el-col>
- <el-col>
- <div ref="echartD3" class="echartD"></div>
- <div class="equipmentNumber blueNumber">{{resList.unOnline}}</div>
- <div class="equipmentName">离线总数</div>
- </el-col>
- </el-row>
- </el-row>
- </template>
- <script>
- import * as echarts from "echarts";
- import echartsGet from "./echart";
- export default {
- props:['resInfo'],
- data() {
- return {
- isCheck: "info",
- option: null,
- resList:{}
- };
- },
- watch: {
- "$store.state.windowWidth"() {
- echarts.init(this.$refs.echartD1).resize();
- echarts.init(this.$refs.echartD2).resize();
- echarts.init(this.$refs.echartD3).resize();
- },
- resInfo(){
- this.getData()
- }
- },
- mounted(){
- this.getData()
- },
- methods: {
- async getData(){
- console.log(this.resInfo.apiAddr)
- let res = await this.$axios.get(this.resInfo.apiAddr + '?' +this.$qs.stringify({
- applicationCode: this.resInfo.applicationCode
- }))
- if(res.success){
- console.log(res)
- this.resList = res.data
- this.resList.alarmChart = (res.data.alarmList.reduce((next,res)=>{
- next.findIndex(val=>val.registerDeviceId === res.registerDeviceId) === -1 && next.push(res)
- return next
- },[]).length / this.resList.deviceTotal ).toFixed(2)
- this.enidCheck()
- }
- },
- enidCheck(){
- echarts.init(this.$refs.echartD1).setOption(echartsGet(1- this.resList.unOnline/this.resList.deviceTotal, ['rgba(47,255,91,0)',`rgba(47,255,91,.4)`,'rgba(47,255,91,1)',],'在线率'));
- echarts.init(this.$refs.echartD2).setOption(echartsGet(this.resList.alarmChart, ['rgba(225,199,47,0)','rgba(225,199,47,.4)','rgba(225,199,47,1)',],'告警率'));
- echarts.init(this.$refs.echartD3).setOption(echartsGet(this.resList.unOnline/this.resList.deviceTotal, ['rgba(5,60,125,0)','rgba(47,174,225,.4)', 'rgba(47,174,225,1)'],'离线率'));
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .mianBox-af {
- .contentBox{
- flex: 1;
- width: 100%;
- display: flex;
- justify-content: space-between;
- padding: 10px 0;
- overflow: hidden;
- .el-col{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- overflow: hidden;
- .echartD{
- flex: 1;
- width: 100%;
- height: 100%;
- min-height: 95px;
- }
- .equipmentNumber{
- width: 115px;
- height: 35px;
- font-size: 30px;
- font-weight: 700;
- color: #FFF;
- font-family: "DS", "DS-B", "DS-BB", "DS-BS";
- text-align: center;
- line-height: 35px;
- }
- .equipmentName{
- font-size: 14px;
- }
- .equipmentNumber.greenNumber{
- border-bottom: 2px solid #2FFF5B;
- background: linear-gradient(to bottom, transparent 0%,#2fff5b5c 100%);
- }
- .equipmentNumber.yellowNumber{
- border-bottom: 2px solid #FFC72F;
- background: linear-gradient(to bottom, transparent 0%,#e1c72f66 100%);
- }
- .equipmentNumber.blueNumber{
- border-bottom: 2px solid #2FAEFF;
- background: linear-gradient(to bottom, transparent 0%,#2faee166 100%);
- }
- }
- }
- }
- </style>
|