diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue b/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue index 705449db..53433a86 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue @@ -159,6 +159,7 @@ const paramsValue = reactive({ const formItemContext = Form.useInjectFormItemContext() const showDelete = ref(false) const columnOptions: any = inject('filter-params') // +const columnType = ref() const termTypeOptions = ref>([]) // 条件值 const valueOptions = ref([]) // 默认手动输入下拉 const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin', 'contains_all', 'contains_any', 'not_contains'] @@ -175,6 +176,7 @@ const handOptionByColumn = (option: any) => { if (option) { termTypeOptions.value = option.termTypes || [] tabsOptions.value[0].component = option.type + columnType.value = option.type const _options = isArray(option.options) ? option.options : [] if (option.type === 'boolean') { valueOptions.value = _options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [ @@ -289,14 +291,16 @@ const termsTypeSelect = (e: { key: string, name: string }) => { let value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue // 如果上次的值 在 timeTypeKeys中 则不变 - if (timeTypeKeys.includes(e.key)) { - if (tabsOptions.value[0].component !== 'int') { + if (columnType.value ==='date') { + 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' } - 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 = { diff --git a/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue b/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue index 0584fa46..c84abc93 100644 --- a/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue +++ b/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue @@ -152,6 +152,7 @@ const paramsValue = reactive({ const showDelete = ref(false) const columnOptions: any = inject(ContextKey) // +const columnType = ref() const termTypeOptions = ref>([]) // 条件值 const valueOptions = ref([]) // 默认手动输入下拉 const metricOption = ref([]) // 根据termType获取对应指标值 @@ -165,7 +166,7 @@ const handOptionByColumn = (option: any) => { metricsCacheOption.value = option.metrics?.map((item: any) => ({...item, label: item.name})) || [] tabsOptions.value.length = 1 tabsOptions.value[0].component = option.dataType - + columnType.value = option.dataType if (option.metrics && option.metrics.length) { tabsOptions.value.push( @@ -281,14 +282,16 @@ const termsTypeSelect = (e: { key: string, name: string }) => { const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value let value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue // 如果上次的值 在 timeTypeKeys中 则不变 - if (timeTypeKeys.includes(e.key)) { - if (tabsOptions.value[0].component !== 'int') { + if (columnType.value === 'date') { + 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' } - 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 = { diff --git a/yarn.lock b/yarn.lock index 5dcb1134..7ff4dfe5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3: jetlinks-ui-components@^1.0.5: version "1.0.5" - resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#c71ecae61776bff738f43efe46aac7264f092736" - integrity sha512-+1a/4nA5RCiInRFyyaVCMEWSBzNU8lzxOYTTpY0GiNhuJuhGE5AbBsVp9CXXF0lFECK2iqaAElY+QN4Wjms1Dw== + resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#8cbd59900e692dd931d289f3d5a6f4541485fd9f" + integrity sha512-ytX39qMt3kkEisURoIKlv2rAhGSvI74/WLLqkP6dJdz4q1k3UpANDtcnrz9rGRwTAKszVQ6kCga6VL6kGJiteQ== dependencies: "@vueuse/core" "^9.12.0" ant-design-vue "^3.2.15"