feat(指标卡): 指标增加限制: 只能拖数值类型指标

This commit is contained in:
ulleo 2024-01-25 18:34:05 +08:00
parent ebca9aa36a
commit 5eaa291bb2
2 changed files with 22 additions and 0 deletions

View File

@ -1081,6 +1081,7 @@ export default {
conform_below: '符合以下',
addition: '条件',
drill_field_error: '下钻起始字段需在维度中',
error_not_number: '不支持拖拽非数值类型指标',
error_q_2_d: '不支持拖拽指标至维度',
error_d_2_q: '不支持拖拽维度至指标',
only_input_number: '请输入正确数值',

View File

@ -442,6 +442,27 @@ const addAxis = (e, axis: AxisType) => {
if (type) {
typeValid = dragCheckType(view.value[axis], type)
}
//
if (typeValid && type === 'q' && view.value.type === 'indicator') {
const list = view.value[axis]
if (list && list.length > 0) {
let valid = true
for (let i = 0; i < list.length; i++) {
if (list[i].deType !== 2 && list[i].deType !== 3) {
list.splice(i, 1)
valid = false
}
}
typeValid = valid
if (!typeValid) {
ElMessage({
message: t('chart.error_not_number'),
type: 'warning'
})
}
}
}
if (!duplicate) {
dup = dragMoveDuplicate(view.value[axis], e, 'chart')
}