fix: bug#10956
This commit is contained in:
parent
6f8f77bcd6
commit
1d782a1231
|
@ -1,6 +1,7 @@
|
|||
import type { Slots } from 'vue'
|
||||
import { TOKEN_KEY } from '@/utils/variable'
|
||||
import { message } from 'jetlinks-ui-components';
|
||||
import {cloneDeep} from "lodash-es";
|
||||
|
||||
/**
|
||||
* 静态图片资源处理
|
||||
|
@ -133,4 +134,15 @@ export const handleParamsToString = (terms:SearchItemData[] = []) => {
|
|||
})
|
||||
|
||||
return JSON.stringify({ terms: _terms})
|
||||
}
|
||||
|
||||
export const treeFilter = (data: any[], value: any, key: string = 'name'): any[] => {
|
||||
return data?.filter(item => {
|
||||
if (item.children && item.children.length) {
|
||||
item.children = treeFilter(item.children || [], value, key)
|
||||
return !!item.children.length
|
||||
} else {
|
||||
return item[key] === value
|
||||
}
|
||||
}) || []
|
||||
}
|
|
@ -83,8 +83,9 @@ import ParamsDropdown, { DoubleParamsDropdown } from '../../components/ParamsDro
|
|||
import { inject } from 'vue'
|
||||
import { useSceneStore } from 'store/scene'
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { flattenDeep, set } from 'lodash-es'
|
||||
import {cloneDeep, flattenDeep, set} from 'lodash-es'
|
||||
import { Form } from 'jetlinks-ui-components'
|
||||
import {treeFilter} from "@/utils/comm";
|
||||
|
||||
const sceneStore = useSceneStore()
|
||||
const { data: formModel } = storeToRefs(sceneStore)
|
||||
|
@ -160,7 +161,7 @@ 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 valueColumnOptions = ref([])
|
||||
const valueColumnOptions = ref<any[]>([])
|
||||
|
||||
const tabsOptions = ref<Array<TabsOption>>(
|
||||
[
|
||||
|
@ -183,7 +184,7 @@ const handOptionByColumn = (option: any) => {
|
|||
} else{
|
||||
valueOptions.value = option.options || []
|
||||
}
|
||||
valueColumnOptions.value = columnOptions.value
|
||||
valueColumnOptions.value = treeFilter(cloneDeep(columnOptions.value), option.type, 'type')
|
||||
} else {
|
||||
termTypeOptions.value = []
|
||||
valueOptions.value = []
|
||||
|
|
Loading…
Reference in New Issue