fix: bug#10975

This commit is contained in:
xieyonghong 2023-03-30 21:13:11 +08:00
parent 73828ec03a
commit e48a9ba24f
3 changed files with 18 additions and 5 deletions

View File

@ -95,7 +95,7 @@ import {openKeysByTree} from "@/utils/comm";
type Emit = {
(e: 'update:value', data: ValueType): void
(e: 'update:source', data: string): void
(e: 'select', data: any, label?: string, labelObj?: Record<number, any>): void
(e: 'select', data: any, label?: string, labelObj?: Record<number, any>, option?: any): void
(e: 'tabChange', data: any): void
}
@ -143,7 +143,7 @@ const onSelect = (e: string, option: any) => {
visible.value = false
label.value = option[props.labelName]
emit('update:value', e)
emit('select', e, label.value, { 0: label.value })
emit('select', e, label.value, { 0: label.value }, option)
}
const timeChange = (e: any) => {

View File

@ -146,7 +146,8 @@ const paramsValue = reactive<TermsType>({
column: props.value?.column,
type: props.value?.type,
termType: props.value?.termType,
value: props.value?.value
value: props.value?.value,
metric: undefined
})
const showDelete = ref(false)
@ -167,6 +168,7 @@ const handOptionByColumn = (option: any) => {
tabsOptions.value[0].component = option.dataType
if (option.metrics && option.metrics.length) {
tabsOptions.value.push(
{ label: '指标值', key: 'metric', component: 'select' }
)
@ -289,8 +291,18 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
}
const valueSelect = (v: any, label: string, labelObj: Record<number, any>) => {
emit('update:value', { ...paramsValue })
const valueSelect = (v: any, label: string, labelObj: Record<number, any>, option: any) => {
if (isMetric.value) {
paramsValue.metric = option?.id
}
const newValues = { ...paramsValue }
if (!isMetric.value) {
delete newValues.metric
}
emit('update:value', { ...newValues })
formItemContext.onFieldChange()
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.name][2] = labelObj
}

View File

@ -203,6 +203,7 @@ export type TermsType = {
terms?: TermsType[];
key?: string;
error?: boolean
metric?: string
};
export type PlatformRelation = {