36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
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['gisbiName']
|
|
return pre
|
|
}, {})
|
|
|
|
const nameTypeMap = fields.reduce((pre, next) => {
|
|
pre[next['gisbiName']] = next['deType']
|
|
return pre
|
|
}, {})
|
|
|
|
const nameDateStyleMap = fields.reduce((pre, next) => {
|
|
pre[next['gisbiName']] = next['dateStyle']
|
|
return pre
|
|
}, {})
|
|
|
|
params.dimensionList.forEach(dimension => {
|
|
const gisbiName = idNameMap[dimension.id]
|
|
// deType === 1 表示是时间类型
|
|
if (nameTypeMap[gisbiName] === 1) {
|
|
dimension['timeValue'] = getRange(dimension.value, nameDateStyleMap[gisbiName])
|
|
}
|
|
})
|
|
}
|
|
}
|