processClassify.js 1.2 KB

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