| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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)
- }
- },
- },
- }
|