fix: bug#11261、10943、10942

This commit is contained in:
xieyonghong 2023-03-31 13:41:07 +08:00
parent 4b08712c61
commit e56be3212a
3 changed files with 17 additions and 4 deletions

View File

@ -160,7 +160,7 @@ const showDelete = ref(false)
const columnOptions: any = inject('filter-params') //
const termTypeOptions = ref<Array<{ id: string, name: string}>>([]) //
const valueOptions = ref<any[]>([]) //
const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin']
const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin', 'contains_all', 'contains_any', 'not_contains']
const valueColumnOptions = ref<any[]>([])
const tabsOptions = ref<Array<TabsOption>>(

View File

@ -77,7 +77,7 @@ import DropdownButton from '../DropdownButton'
import { getOption } from '../DropdownButton/util'
import ParamsDropdown, { DoubleParamsDropdown } from '../ParamsDropdown'
import { inject } from 'vue'
import { ContextKey } from './util'
import { ContextKey, arrayParamsKey, timeTypeKeys } from './util'
import { useSceneStore } from 'store/scene'
import { storeToRefs } from 'pinia';
import { Form } from 'jetlinks-ui-components'
@ -157,7 +157,6 @@ const valueOptions = ref<any[]>([]) // 默认手动输入下拉
const metricOption = ref<any[]>([]) // termType
const isMetric = ref<boolean>(false) //
const tabsOptions = ref<Array<TabsOption>>([{ label: '手动输入', key: 'manual', component: 'string' }])
const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin']
const metricsCacheOption = ref<any[]>([]) //
const handOptionByColumn = (option: any) => {
@ -280,7 +279,18 @@ const columnSelect = (option: any) => {
const termsTypeSelect = (e: { key: string, name: string }) => {
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
const value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
let value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
// timeTypeKeys
if (timeTypeKeys.includes(e.key)) {
if (tabsOptions.value[0].component !== 'int') {
value = undefined
}
tabsOptions.value[0].component = 'int'
} else if (!timeTypeKeys.includes(e.key) && tabsOptions.value[0].component == 'int') {
value = undefined
tabsOptions.value[0].component = 'date'
}
paramsValue.value = {
source: paramsValue.value?.source || tabsOptions.value[0].key,
value: value

View File

@ -1,6 +1,9 @@
import { BranchesThen } from '@/views/rule-engine/Scene/typings'
export const ContextKey = 'columnOptions'
export const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin', 'contains_all', 'contains_any', 'not_contains']
export const timeTypeKeys = ['time_gt_now', 'time_lt_now']
export const handleParamsData = (data: any[], key: string = 'column'): any[] => {
return data?.map(item => {