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
import { getRange } from '@/utils/timeUitils'
import { union } from 'lodash-es'
 
export function viewFieldTimeTrans(viewDataInfo, params) {
  if (viewDataInfo && params && params.dimensionList) {
    const fields = viewDataInfo.fields
      ? viewDataInfo.fields
      : viewDataInfo.left?.fields || viewDataInfo.right?.fields
      ? union(viewDataInfo.left?.fields, viewDataInfo.right?.fields)
      : []
 
    const idNameMap = fields.reduce((pre, next) => {
      pre[next['id']] = next['dataeaseName']
      return pre
    }, {})
 
    const nameTypeMap = fields.reduce((pre, next) => {
      pre[next['dataeaseName']] = next['deType']
      return pre
    }, {})
 
    const nameDateStyleMap = fields.reduce((pre, next) => {
      pre[next['dataeaseName']] = next['dateStyle']
      return pre
    }, {})
 
    params.dimensionList.forEach(dimension => {
      const dataeaseName = idNameMap[dimension.id]
      // deType === 1 表示是时间类型
      if (nameTypeMap[dataeaseName] === 1) {
        dimension['timeValue'] = getRange(dimension.value, nameDateStyleMap[dataeaseName])
      }
    })
  }
}
 
export function checkIsSameDs(canvasViewInfo, sourceViewId, targetViewId) {
  return canvasViewInfo[sourceViewId]['tableId'] === canvasViewInfo[targetViewId]['tableId']
}