zhuzhuanzhuan
2023-08-25 487754376a1eb675d430a64b7a4aa9e7ffeb405b
src/views/mdc/base/modules/StatisticalAnalysis/StatisticalAnalysisMain.vue
@@ -41,7 +41,7 @@
        <div  class="PowerOnRate_text" style="width: 8%">
          <table width="85px;" align="center">
            <tr>
              <td align="right"><div style="width: 15px;height: 15px;background-color: #4169E1;position: static;"/></td>
              <td align="right"><div style="width: 15px;height: 15px;background-color: #6496e9;position: static;"/></td>
              <td align="left">开机</td>
            </tr>
            <tr>
@@ -49,7 +49,7 @@
              <td align="left">关机</td>
            </tr>
            <tr>
              <td align="right"><div style="width: 15px;height: 15px;background-color: #00ee00"/></td>
              <td align="right"><div style="width: 15px;height: 15px;background-color: #4ecee1"/></td>
              <td align="left">运行</td>
            </tr>
            <tr>
@@ -63,19 +63,19 @@
    <!--利用率和开动率-->
    <div class="UtilizationStartup">
      <div class="Utilization Line-box">
        <!--<div class="title">-->
        <div class="title">
          <!--<div class="circle"></div>-->
          <!--<div class="text">开机率</div>-->
        <!--</div>-->
          <!--<div class="text"></div>-->
        </div>
        <div class="Utilization-box box-bottom">
          <div class="Utilization-right" ref="UtilizationLine" id="UtilizationLine"></div>
        </div>
      </div>
      <div class="Startup Line-box">
        <!--<div class="title">-->
        <div class="title">
          <!--<div class="circle"></div>-->
          <!--<div class="text">开动率</div>-->
        <!--</div>-->
          <!--<div class="text"></div>-->
        </div>
        <div class="Startup-box box-bottom">
          <div class="Startup-right" ref="StartupLine" id="StartupLine"></div>
        </div>
@@ -169,13 +169,13 @@
            top: 60,
            containLabel: true
          },
          toolbox: {
            show : true,
            padding: 15,
            feature : {
              saveAsImage : {show: true,title:'保存图片',name :'设备效率统计报表'}
            }
          },
          // toolbox: {
          //   show : true,
          //   padding: 15,
          //   feature : {
          //     saveAsImage : {show: true,title:'保存图片',name :'设备效率统计报表'}
          //   }
          // },
          xAxis :{
            type : 'category',
            data:['开机时长','关机时长','运行时长','待机时长'],
@@ -266,6 +266,7 @@
              name:'柱状图',
              type: 'bar',
              data: [this.openingLong, this.closedLong, this.processLong,this.waitingLong],
              // data:[22,3,4,5],
              barWidth: 25,
              label:{
                show:true,
@@ -280,9 +281,10 @@
                  color: function(params) {
                    let colorList = [
                      ["#6496e9","#6bded3"],
                      ["#ffbb65","#fdc68b"],
                      ["#849db8","#b4b8cc"],
                      ["#4fe1c5","#4ecee1"],
                      ["#9978fa","#88a1fa"],
                      // ["#9978fa","#88a1fa"],
                      ["#ffbb65","#fdc68b"],
                    ];
                    // return colorList[params.dataIndex];
                    let colorItem = colorList[params.dataIndex];
@@ -304,18 +306,23 @@
        //开机时间\关机时间
        let UtilizationLine = this.$echarts.init(document.getElementById('UtilizationLine'), 'macarons');
        let  statChartPieOption1 = {
          title: {
            x: 'left',
            subtext: '开机效率'
          },
          // title: {
          //   x: 'left',
          //   subtext: '开机效率',
          //   textStyle: {
          //     color: '#268e80',
          //     fontSize: 20,
          //
          //   },
          // },
          tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
          },
          legend: {
            orient: 'vertical',
            x: 'left',
            y: 'bottom',
            x: '85%',
            y: '50%',
            data: ['开机时间', '关机时间']
          },
          calculable: true,
@@ -327,7 +334,7 @@
            itemStyle: {
              normal: {
                color: function (params) {
                  let colorList = ['#4169E1', '#A8A8A8'];
                  let colorList = [ '#6496e9','#849db8'];
                  return colorList[params.dataIndex]
                },
                label: {
@@ -346,18 +353,18 @@
        //运行时间\待机时间
        let StartupLine = this.$echarts.init(document.getElementById('StartupLine'), 'macarons');
        let statChartPieOption2 = {
          title: {
            x: 'left',
            subtext: '运行效率'
          },
          // title: {
          //   x: 'left',
          //   subtext: '运行效率'
          // },
          tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
          },
          legend: {
            orient: 'vertical',
            x: 'left',
            y: 'bottom',
            x: '85%',
            y: '50%',
            data: ['运行时间', '待机时间']
          },
          calculable: true,
@@ -369,7 +376,7 @@
            itemStyle: {
              normal: {
                color: function (params) {
                  var colorList = ['#00ee00', '#FCCE10'];
                  var colorList = ['#4ecee1', '#FCCE10'];
                  return colorList[params.dataIndex]
                },
                label: {
@@ -387,7 +394,7 @@
      },
      queryStatistical(){
        getAction(this.url.dayStatisticalRate,this.queryParams).then(res =>{
          if(res.success){
          if(res.success) {
            // console.log(res);
            this.StatCharOpeningRate = res.result.openRate;
            //利用率
@@ -402,6 +409,8 @@
            this.closedLong = this.getTime(res.result.closeLong);
            this.totalLong = parseInt(this.openingLong) + parseInt(this.closedLong);
            this.draw();
          }else{
            this.draw()
          }
        })
      },
@@ -415,12 +424,18 @@
        let _this = this
        getAction(this.url.getBaseTree).then((res) => {
          if (res.success) {
            if(res.result[0]){
              _this.$set(this.queryParam, 'tierName', res.result[0].title)
              _this.$set(this.queryParams, 'parentId', res.result[0].key)
              _this.queryStatistical()            }
            // console.log(res.result[0].entity.tierName)
            _this.$set(this.queryParam, 'tierName', res.result[0].title)
            _this.$set(this.queryParams, 'parentId', res.result[0].key)
            _this.queryStatistical()
          } else {
            this.$message.warn(res.message)
            // this.$message.warn(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
@@ -457,11 +472,11 @@
          this.$set(this.queryParam, 'tierName', val.title)
          this.$set(this.queryParam, 'equipmentId', val.equipmentId)
          this.queryParams.parentId = ''
          this.queryParams.equipmentIds = val.equipmentId
          this.queryParams.equipmentId = val.equipmentId
          this.searchQuery()
        }else{
          this.queryParams.parentId = val.key
          this.queryParams.equipmentIds = ''
          this.queryParams.equipmentId = ''
          this.$set(this.queryParam, 'tierName', val.title)
          this.searchQuery()
        }