wangrong
2026-08-30 761e5c5fa871959f60e15c971c8d83f2b53d0af5
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { computed } from 'vue'
import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
interface DatasetField {
  type?: string
  innerType?: string
  title: string
  id: string
  tableId: string
}
const dvMainStore = dvMainStoreWithOut()
const { componentData, canvasViewInfo } = storeToRefs(dvMainStore)
 
export const comInfo = () => {
  const dfsComponentData = () => {
    let arr = componentData.value.filter(
      com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
    )
    componentData.value.forEach(ele => {
      if (ele.innerType === 'DeTabs') {
        ele.propValue.forEach(itx => {
          arr = [
            ...arr,
            ...itx.componentData.filter(
              com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
            )
          ]
 
          itx.componentData.forEach(element => {
            if (element.component === 'Group') {
              arr = [
                ...arr,
                element.propValue.filter(
                  coms =>
                    !['VQuery', 'DeTabs'].includes(coms.innerType) && coms.component !== 'Group'
                )
              ]
            }
          })
        })
      } else if (ele.component === 'Group') {
        arr = [
          ...arr,
          ele.propValue.filter(
            com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
          )
        ]
        ele.propValue.forEach(element => {
          if (element.innerType === 'DeTabs') {
            element.propValue.forEach(itx => {
              arr = [
                ...arr,
                ...itx.componentData.filter(
                  com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
                )
              ]
            })
          }
        })
      }
    })
 
    return arr.flat()
  }
 
  const datasetFieldList = computed(() => {
    return dfsComponentData()
      .map(ele => {
        const obj = canvasViewInfo.value[ele.id]
        if (!obj) return null
        const { id, title, tableId, type } = obj as DatasetField
        return !!id && !!tableId
          ? {
              id,
              type,
              title,
              tableId
            }
          : null
      })
      .filter(ele => !!ele)
  })
  return {
    datasetFieldList
  }
}