de/frontend/src/views/chart/components/drag-item/utils.js
2022-02-14 12:27:33 +08:00

34 lines
953 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export function getItemType(dimensionData, quotaData, item) {
// 将item的字段在数据集维度、指标字段中查询一遍如果遇到id不存在、字段类型不一致、维度指标不一致则提示
const status = item.groupType
let checked = false
if (status === 'd') {
for (let i = 0; i < dimensionData.length; i++) {
const ele = dimensionData[i]
if (ele.id === item.id && ele.deType === item.deType && ele.groupType === item.groupType) {
checked = true
break
}
}
}
if (status === 'q') {
for (let i = 0; i < quotaData.length; i++) {
const ele = quotaData[i]
if (ele.id === item.id && ele.deType === item.deType && ele.groupType === item.groupType) {
checked = true
break
}
}
}
if (checked) {
if (status === 'd') {
return ''
} else if (status === 'q') {
return 'success'
}
} else {
return 'danger'
}
}