Blame view

frontend/front/src/mixins/processClassify.js 1.17 KB
8ea9c133   陈威   初始化提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import emitter from './emitter.js'
export default {
  mixins: [emitter],
  data() {
    return {
      loading: false,
      currentNodeId: '',
    }
  },
  watch: {
    currentNodeId: function (newVal) {
      this.broadcast('MatterComponent', 'matter-classify-update', [newVal])
    },
  },
  methods: {
    handleTabClick(tab, activeName) {
      this.currentActiveTab = activeName
    },
    handleNodeClick(data) {
      if (data.id == 6) {
        this.currentNodeId = ''
      } else {
        let ids = []
        this.getFlowTrees(data, ids)
        const oldVal = this.currentNodeId
        this.currentNodeId = ids.join(',')
        if (oldVal == this.currentNodeId) {
          this.broadcast('MatterComponent', 'matter-classify-update', [
            this.currentNodeId,
          ])
        }
      }
      this.loading = true
      this.$nextTick(() => {
        this.$refs[`${this.currentActiveTab}Table`].loadData(null, () => {
          this.loading = false
        })
      })
    },
    getFlowTrees(data, ids) {
      ids.push(data.id)
      let arr = data.children
      for (var i = 0; i < arr.length; i++) {
        this.getFlowTrees(arr[i], ids)
      }
    },
  },
}