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