zenglf
2023-09-28 997835429a1d66643364091e8437ebbbeb8ff97a
src/views/mdc/base/modules/equipmentAvailCompare/equipmentAvailCompareMain.vue
@@ -1,4 +1,5 @@
<template>
  <a-spin :spinning="loading">
  <a-card :bordered="false" class="device_list">
    <div class="com_box">
      <!-- 查询区域 -->
@@ -38,7 +39,6 @@
      </div>
      <!-- table区域-begin -->
      <div id="DeviceList">
        <div style="padding: 5px;width: 100%;height: 100%">
          <div style="width: 100%;height: 100%" id="dayAvailBar"></div>
          <!--<div id="dayAvailLine"></div>-->
@@ -47,6 +47,7 @@
      <!-- table区域-end -->
    </div>
  </a-card>
  </a-spin>
</template>
<script>
@@ -68,6 +69,7 @@
  import Tooltip from 'ant-design-vue/es/tooltip'
  import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
  import AFormItem from 'ant-design-vue/es/form/FormItem'
  export default {
    name: 'equipmentAvailCompareMain',
    // mixins: [JeecgListMixin],
@@ -86,13 +88,13 @@
    data() {
      return {
        activeKey: '1',
        typeTree:"",
        typeTree: '',
        typeParent:1,
        typeEquipment:1,
        spaceTime:[],
        useingRates:[],
        dates: [],
        xianshi:"",
        xianshi: '',
        readOnly:true,
        queryParam: {
          // dateTime:undefined,
@@ -107,12 +109,13 @@
          getEquipmentByPid: '/mdc/mdcEquipment/getEquipmentByPid',
          getEquipmentByDepPid:'/mdc/mdcEquipment/getEquipmentByDepPid'
        },
        AnalysisList:{}
        AnalysisList: {},
        loading: false
      }
    },
    watch:{
      Type(valmath){
        this.dataList = [];
        this.dataList = []
        this.queryParams.typeTree = valmath
        // console.log(this.queryParams.typeTree)
      },
@@ -120,7 +123,7 @@
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            // this.$set(this.queryParam, 'tierName', val.title)
            this.queryParamEquip.parentId =  ""
            this.queryParamEquip.parentId = ''
            this.queryParams.equipmentId = val.equipmentId
            this.queryParamEquip.equipmentId = val.equipmentId
            this.searchQuery()
@@ -131,14 +134,13 @@
            this.initEquipment(val.key)
          }
        }
      },
      nodePeople(val){
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            // this.$set(this.queryParam, 'tierName', val.title)
            this.queryParamEquip.parentId =  ""
            this.queryParamEquip.parentId = ''
            this.queryParams.equipmentId = val.equipmentId
            this.queryParamEquip.equipmentId = val.equipmentId
            this.searchQuery()
@@ -154,7 +156,7 @@
    },
    methods: {
      drawTu(){
        let dayAvailBar = this.$echarts.init(document.getElementById('dayAvailBar'), 'macarons');
        let dayAvailBar = this.$echarts.init(document.getElementById('dayAvailBar'), 'macarons')
        //dayAvailLine = echarts.init(document.getElementById('dayAvailLine'));
        let dayAvailBarOption = {
          title: {
@@ -163,12 +165,12 @@
            textStyle: {
              fontSize: 18,
              fontWeight: 'bolder',
              color: "#151414"
              color: '#151414'
            }
          },
          tooltip: {
            trigger: 'axis',
            formatter: "{a} <br/>{b} :({c}%)"
            formatter: '{a} <br/>{b} :({c}%)'
          },
          toolbox: {
            show: true,
@@ -214,8 +216,8 @@
              }
            }
          ]
        };
        dayAvailBar.setOption(dayAvailBarOption);
        }
        dayAvailBar.setOption(dayAvailBarOption)
      },
      moment,
      onChangeStart(time, timeString) {
@@ -228,10 +230,10 @@
      },
      disabledDate(current){
        //Can not slect days before today and today
        return current && current > moment().subtract('days', 1);
        return current && current > moment().subtract('days', 1)
      },
      dataChange(val) {
        this.queryParam.dateTime = val.format('YYYYMMDD')
        if (val) this.queryParam.dateTime = val.format('YYYYMMDD')
      },
      handleChange(value) {
        this.queryParam.timeType = value
@@ -247,6 +249,7 @@
        // console.log(v2[0],v2[1])
      },
      loadAnalysis(){
        this.loading = true
        getAction(this.url.dayUtilizationRateContrast,this.queryParam).then(res => {
          if (res.success) {
            this.spaceTime.push(res.result.dataList)
@@ -269,21 +272,22 @@
        }
      },
      searchQuery(){
        if (this.queryParam.startTime && this.queryParam.endTime && this.dates && this.dates.length > 0) {
          this.loading = true
        this.spaceTime = []
        this.useingRates = []
        if(this.queryParams.typeTree == "1"){
          if (this.queryParams.typeTree == '1') {
          this.queryParams.parentId =  this.queryParamEquip.parentId
          // this.queryParams.equipmentId =  this.queryParamEquip.equipmentId
        }else{
          this.queryParams.parentId = this.queryParamEquip.parentId
          // this.queryParams.equipmentId = ""
        }
        this.AnalysisList = [];
          this.AnalysisList = []
        //获取查询条件
        this.queryParam.parentId = this.queryParams.parentId;
        this.queryParam.equipmentId = this.queryParams.equipmentId;
          this.queryParam.parentId = this.queryParams.parentId
          this.queryParam.equipmentId = this.queryParams.equipmentId
        this.queryParam.typeTree = this.queryParams.typeTree
        getAction(this.url.dayUtilizationRateContrast,this.queryParam).then((res) => {
          if(res.success){
@@ -298,16 +302,23 @@
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
              })
          }
        }).finally(() => {
          this.loading = false
        })
        } else {
          this.$notification.warning({
            message: '消息',
            description: '请选择时间或时间段'
          })
        }
      },
      searchReset() {
        this.loading = true
        this.spaceTime = []
        this.useingRates = []
        if(this.queryParams.typeTree == "1"){
        if (this.queryParams.typeTree == '1') {
          this.typeTree = this.queryParams.typeTree
          this.typeParent =  this.queryParams.parentId
          this.typeEquipment = this.queryParams.equipmentId
@@ -315,8 +326,8 @@
          this.queryParam = {}
          this.queryParams.typeTree = this.typeTree
          this.queryParams.parentId = this.typeParent
          if(this.queryParams.parentId !=  ""){
            this.queryParams.equipmentId =  ""
          if (this.queryParams.parentId != '') {
            this.queryParams.equipmentId = ''
            this.initEquipment()
          }else{
            if(this.queryParams.equipmentId == this.queryParamEquip.equipmentId){
@@ -337,7 +348,7 @@
              this.$notification.warning({
                message:'消息',
                description:res.message
              });
              })
            }
          }).finally(() => {
            this.loading = false
@@ -351,8 +362,8 @@
          this.dates = []
          this.queryParams.typeTree = this.typeTree
          this.queryParams.parentId = this.typeParent
          if(this.queryParams.parentId !=  ""){
            this.queryParams.equipmentId =  ""
          if (this.queryParams.parentId != '') {
            this.queryParams.equipmentId = ''
            this.initEquipment()
          }else{
            if(this.queryParams.equipmentId == this.queryParamEquip.equipmentId){
@@ -373,7 +384,7 @@
              this.$notification.warning({
                message:'消息',
                description:res.message
              });
              })
            }
          }).finally(() => {
            this.loading = false
@@ -399,14 +410,14 @@
              _this.$notification.warning({
                message:'消息',
                description:'请联系管理员,开放设备权限!'
              });
              })
            }
          }else{
            // this.$message.warning(res.message)
            _this.$notification.warning({
              message:'消息',
              description:res.message
            });
            })
          }
        })
      },
@@ -428,14 +439,14 @@
              _this.$notification.warning({
                message:'消息',
                description:'请联系管理员,开放设备权限!'
              });
              })
            }
          }else{
            // this.$message.warning(res.message)
            _this.$notification.warning({
              message:'消息',
              description:res.message
            });
            })
          }
        })
      }
@@ -445,14 +456,13 @@
      this.queryParam.startDate = moment(this.dates[0]).format('YYYYMMDD')
      this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
      this.queryParam.startTime = '00:00'
      this.queryParam.endTime = "08:00"
      this.queryParams.typeTree = "1";
      this.queryParam.endTime = '08:00'
      this.queryParams.typeTree = '1'
    },
    mounted() {
      this.initEquipment()
    },
    }
  }
</script>
@@ -465,30 +475,35 @@
      overflow: scroll;
    }
  }
  @media screen and (min-width: 1680px) and (max-width: 1920px){
    .device_list{
      height: 811px!important;
      overflow: scroll;
    }
  }
  @media screen and (min-width: 1400px) and (max-width: 1680px){
    .device_list{
      height: 663px!important;
      overflow: scroll;
    }
  }
  @media screen and (min-width: 1280px) and (max-width: 1400px){
    .device_list{
      height: 564px!important;
      overflow: scroll;
    }
  }
  @media screen and (max-width: 1280px){
    .device_list{
      height: 564px!important;
      overflow: scroll;
    }
  }
  /*.device_list{*/
  /*display: flex;*/
  /*}*/
@@ -498,14 +513,17 @@
  /deep/ .ant-card-body{
    height: 100%!important;
  }
  .device_list .com_box{
    display: flex!important;
    height: 100%!important;
    flex-direction: column!important;
  }
  .device_list .table-page-search-wrapper{
    height: 6%!important;
  }
  .device_list #DeviceList{
    height: 90%!important;
  }