zhaowei
2025-06-25 872362acd0e306bb2150d72cce1b556d272e6ba5
src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue
@@ -38,7 +38,7 @@
          </a-table>
        </div>
        <a-spin :spinning="echartLoading">
        <a-spin :spinning="eChartLoading">
          <div style="width: 100%;height: 100%;display: flex;">
            <div id="MdcEquipmentWarningPie" style="height: 100%;width: 35%;"></div>
            <div id="MdcEquipmentWarningLine" style="height: 100%;width: 65%;"></div>
@@ -51,13 +51,8 @@
<script>
  import moment from 'moment'
  import { putAction, getAction } from '@/api/manage'
  import $ from 'jquery'
  import '@/components/table2excel/table2excel'
  import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import { getAction } from '@/api/manage'
  import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
  const columns = [
    { title: '报警号', dataIndex: 'alarmCode', key: 'alarmCode', align: 'center' },
@@ -98,51 +93,31 @@
  ]
  export default {
    // mixins: [JeecgListMixin],
    name: 'alarmAnalysisMain',
    components: {},
    data() {
      return {
        dataSource: [],
        /* table加载状态 */
        outerDataLoading: false,
        innerDataLoading: false,
        echartLoading: false,
        eChartLoading: false,
        typeTree: '',
        typeParent: 1,
        typeEquipment: 1,
        TreeIDOne: 1,
        TreeIDTwo: 2,
        deviceTypeDict: '',
        dates: [],
        identifying: [],
        queryParam: {},
        queryParams: {},
        queryParamEquip: {},
        queryParamPeople: {},
        efficiencyOptions: [
          { label: '利用率', value: 'lyl' },
          { label: '开机率', value: 'kjl' },
          { label: '开机时间', value: 'kjsj' },
          { label: '加工时间', value: 'jgsj' },
          { label: '待机时间', value: 'djsj' },
          { label: '关机时间', value: 'gjsj' }
        ],
        checkedList: ['lyl'],
        dataList: [],
        url: {
          efficiencyList: '/mdc/alarmAnalyze/alarmList',
          listByType: '/mdc/MdcUtilizationRate/getByType',
          alarmTrend: '/mdc/alarmAnalyze/alarmTrend',
          equipmentAlarmList: '/mdc/alarmAnalyze/equipmentAlarmList'
        },
        tableHeads: [],
        pieDate: [0],
        XData: [0],
        YData: [0],
        columns,
        innerColumns,
        hasRequsetAlarmCodeList: []
        hasRequestAlarmCodeList: []
      }
    },
    props: { nodeTree: '', Type: '', nodePeople: '' },
@@ -155,7 +130,6 @@
      this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
      this.queryParam.typeTree = '1'
      this.loadData1()
    },
    mounted() {
      this.drawWrin()
@@ -196,14 +170,6 @@
      }
    },
    filters: {
      numFilter(value) {
        if (value) {
          return parseFloat((value * 100).toFixed(2))
        } else {
          return '0'
        }
      },
      /**
       * 格式化时间
       * @param seconds 秒数
@@ -243,9 +209,8 @@
      },
      TableDraw(key, val) {
        let that = this
        that.echartLoading = true
        that.eChartLoading = true
        that.queryParam.alarmCode = val.alarmCode
        console.log(this.queryParam)
        getAction(that.url.alarmTrend, that.queryParam)
          .then(res => {
            if (res.success) {
@@ -258,21 +223,12 @@
              that.XData = res.result.dateCountList.map(item => item.key)
              that.YData = res.result.dateCountList.map(item => item.count)
              // this.tableHeads = res.result.dates
              // this.dataList = res.result
              // this.draw()
              // this.checkSameData(this.dataList)
              // this.checkSameData1(this.dataList)
              // this.checkSameData2(this.dataList)
              // this.combineCell();
              // this.initDeviceType(this.dataList)
              that.drawWrin()
            }
          })
          .finally(() => {
            that.echartLoading = false
            that.eChartLoading = false
          })
        console.log(this.YData)
      },
      disabledDate(current) {
@@ -322,20 +278,11 @@
      },
      loadData1() {
        this.outerDataLoading = true
        this.tableHeads = []
        this.dataList = []
        getAction(this.url.efficiencyList, this.queryParam).then(res => {
          if (res.success) {
            // this.tableHeads = res.result.dates
            this.dataList = res.result
            this.hasRequsetAlarmCodeList = []
            // this.draw()
            // this.checkSameData(this.dataList)
            // this.checkSameData1(this.dataList)
            // this.checkSameData2(this.dataList)
            // this.combineCell();
            // this.initDeviceType(this.dataList)
            this.hasRequestAlarmCodeList = []
          }
        }).finally(() => {
          this.outerDataLoading = false
@@ -354,27 +301,21 @@
          },
          tooltip: {
            trigger: 'item',
            formatter: '<br/>{b} : {c} ({d}%)'
            formatter: '{b} : {c} ({d}%)'
          },
          calculable: true,
          series: [{
            type: 'pie',
            radius: '60%',
            label: {
              show: true,
              formatter: '{b}\n{c}',
              color: 'inherit'
            },
            itemStyle: {
              normal: {
                color: function(params) {
                  var colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3']
                  return colorList[params.dataIndex]
                },
                label: {
                  show: true,
                  // position: 'top',
                  formatter: '{b}\n{c}',
                  color: function(params) {
                    var colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3']
                    return colorList[params.dataIndex]
                  }
                }
              color: function(params) {
                const colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3']
                return colorList[params.dataIndex % colorList.length]
              }
            },
            data: this.pieDate
@@ -483,7 +424,7 @@
        let _this = this
        // 当展开时若该行未被展开过才会请求后台数据,展开过的数据会被缓存无需重复请求
        this.queryParam.alarmCode = record.alarmCode
        if (expanded && !this.hasRequsetAlarmCodeList.includes(record.alarmCode)) {
        if (expanded && !this.hasRequestAlarmCodeList.includes(record.alarmCode)) {
          this.innerDataLoading = true
          getAction(this.url.equipmentAlarmList, this.queryParam).then(res => {
            if (res.success) {
@@ -492,7 +433,7 @@
                  item.innerDataList = res.result
                }
              })
              _this.hasRequsetAlarmCodeList.push(record.alarmCode)
              _this.hasRequestAlarmCodeList.push(record.alarmCode)
            }
          })
            .finally(() => {