forked from github/dataease
feat(指标卡): 指标增加限制: 只能拖数值类型指标
This commit is contained in:
parent
ebca9aa36a
commit
5eaa291bb2
@ -1081,6 +1081,7 @@ export default {
|
|||||||
conform_below: '符合以下',
|
conform_below: '符合以下',
|
||||||
addition: '条件',
|
addition: '条件',
|
||||||
drill_field_error: '下钻起始字段需在维度中',
|
drill_field_error: '下钻起始字段需在维度中',
|
||||||
|
error_not_number: '不支持拖拽非数值类型指标',
|
||||||
error_q_2_d: '不支持拖拽指标至维度',
|
error_q_2_d: '不支持拖拽指标至维度',
|
||||||
error_d_2_q: '不支持拖拽维度至指标',
|
error_d_2_q: '不支持拖拽维度至指标',
|
||||||
only_input_number: '请输入正确数值',
|
only_input_number: '请输入正确数值',
|
||||||
|
@ -442,6 +442,27 @@ const addAxis = (e, axis: AxisType) => {
|
|||||||
if (type) {
|
if (type) {
|
||||||
typeValid = dragCheckType(view.value[axis], 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) {
|
if (!duplicate) {
|
||||||
dup = dragMoveDuplicate(view.value[axis], e, 'chart')
|
dup = dragMoveDuplicate(view.value[axis], e, 'chart')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user