Showing
3 changed files
with
29 additions
and
0 deletions
| ... | ... | @@ -13,6 +13,7 @@ import { ExtraRequestConfigType } from '@/store/external/modules/extraComponentI |
| 13 | 13 | import { DynamicForm } from '../DynamicForm'; |
| 14 | 14 | import { extraPublicInterfaceInfo } from '../DynamicForm/utils'; |
| 15 | 15 | import { isArray } from '@/utils'; |
| 16 | +import { useTargetData } from '../../../../hooks/useTargetData.hook'; | |
| 16 | 17 | |
| 17 | 18 | const publicInterfaceList = ref<PublicInterfaceRecord[]>([]) |
| 18 | 19 | |
| ... | ... | @@ -86,6 +87,31 @@ const handleSelectedInterfaceChange = async (_value: string, option: PublicInter |
| 86 | 87 | headerRef.value = isArray(Header) ? (Header as ParamsItemType[]).reduce((prev, next) => ({ ...prev, [next.key]: next.value }), {}) : {} |
| 87 | 88 | unref(bodyContentEl)?.setConfigurationData(unref(getSelectedInterfaceBody), Body) |
| 88 | 89 | await nextTick() |
| 90 | + console.log(option) | |
| 91 | + /** | |
| 92 | + * FT 修改新增从接口取出filter | |
| 93 | + */ | |
| 94 | + const { filter } = option | |
| 95 | + const { targetData } = useTargetData() | |
| 96 | + targetData.value.filter = filter?? ` | |
| 97 | + const keys = Object.keys(res) | |
| 98 | + const dimensions = ['ts', ...keys] | |
| 99 | + const xAxis = [...new Set(keys.reduce((prev, next) => [...prev, ...res[next].map(item => item.ts)], []))] | |
| 100 | + const source = xAxis.map(ts => { | |
| 101 | + const record = keys.reduce((prev, next) => { | |
| 102 | + const value = res[next].find(item => item.ts === ts) | |
| 103 | + return { ...prev, [next]: value.value || null } | |
| 104 | + }, {}) | |
| 105 | + return { | |
| 106 | + ts, | |
| 107 | + ...record | |
| 108 | + } | |
| 109 | + }) | |
| 110 | + return { | |
| 111 | + dimensions, | |
| 112 | + source | |
| 113 | + } | |
| 114 | + ` | |
| 89 | 115 | setDynamicFormValue(option as unknown as ExtraRequestConfigType) |
| 90 | 116 | } |
| 91 | 117 | ... | ... |