loulijun2021
2024-05-09 b1876ef3cdcb819e4799fe0d5c84f95bdb96529b
src/views/kanbanManager/ckgl.vue
@@ -98,14 +98,7 @@
  data() {
    return {
      onLine: navigator.onLine, // 监听网络是否在线
      headTime: '',
      tableTopTask: null,
      tableBottomTask: null,
      echartsRightTop: null,
      echartsRightBottom: null,
      configTableTop: {
        headerBGC: 'rgba(38, 68 ,139, 0.2)', // 表头背景色
@@ -202,11 +195,6 @@
    }, 1000 * 60 * 120)
  },
  mounted() {
    // 监听网络是否在线
    window.addEventListener('online', this.updateOnlineStatus)
    window.addEventListener('offline', this.updateOnlineStatus)
    this.updateOnlineStatus({ type: this.onLine ? 'online' : 'offline', isFirst: true })
    this.getProcureOutsourcLeftTop()
    setInterval(() => {
      this.getProcureOutsourcLeftTop()
@@ -219,33 +207,8 @@
    this.getEcharts()
  },
  beforeDestroy() {
    window.removeEventListener('online', this.updateOnlineStatus)
    window.removeEventListener('offline', this.updateOnlineStatus)
  },
  methods: {
    // 更新网络状态
    updateOnlineStatus(e) {
      if (e.isFirst) {
        // console.log('x')
      } else {
        const loading = this.$loading({
          lock: true,
          text: '断网了,正在拼命联网中,请检查网络是否正常...',
          spinner: 'el-icon-loading',
          customClass: 'osloading',
          background: 'rgba(0, 0, 0, 0.7)'
        })
        const { type } = e
        this.onLine = type === 'online'
        if (this.onLine) {
          loading.close()
          this.$message.success('网络连接成功!')
        } else {
          this.$message.error('网络掉线,请关注网络状态!')
        }
      }
    },
    // 获取左上table数据
    getProcureOutsourcLeftTop() {
      ProcureOutsourcLeftTop().then(res => {
@@ -299,13 +262,13 @@
        loadEcharts('bar04', bar02(res.data.filter(i => i.qty > 0).map(i => i.qty), res.data.filter(i => i.qty > 0).map(i => i.materiel_name)))
      })
      this.echartsRightTop = setInterval(() => {
      setInterval(() => {
        ProcureOutsourcRightTop().then(res => {
          loadEcharts('bar03', bar02(res.data.filter(i => i.qty > 0).map(i => i.qty), res.data.filter(i => i.qty > 0).map(i => i.materiel_name)))
        })
      }, 1000 * 25)
      this.echartsRightBottom = setInterval(() => {
      setInterval(() => {
        ProductionStockedInRightBottom().then(res => {
          loadEcharts('bar04', bar02(res.data.filter(i => i.qty > 0).map(i => i.qty), res.data.filter(i => i.qty > 0).map(i => i.materiel_name)))
        })