From 134f812bf70a2451272d8f3cf5c4437528fc88b1 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期四, 25 七月 2024 21:18:34 +0800 Subject: [PATCH] hide --- src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue | 16 ++++++++-------- src/components/chat/chatComponents/summaryCom/components/recordSet/types.ts | 11 ++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue index a56c08f..8bde5d2 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue @@ -1,9 +1,9 @@ <template> <div class="w-full"> - <div class="flex space-x-2 mb-4" v-if="data?.params && data?.params.length > 0"> + <div class="flex space-x-2 mb-4" v-if="visibleParams && visibleParams.length > 0"> <component v-model="paramsValueList[index].value" - v-for="(item, index) in data?.params" + v-for="(item, index) in visibleParams as any" :key="item.id" :id="item.id" :is="recordSetMapCom[item.type]" @@ -23,7 +23,7 @@ import type * as echarts from 'echarts'; import _ from 'lodash'; import type { PropType } from 'vue'; -import { ref, watch } from 'vue'; +import { computed, ref, watch } from 'vue'; import { SCATTER_SYMBOL_SIZE, chatComProps, getChatChartOption } from '../../../common'; import { useDrawChatChart } from '../../../hooks/useDrawChatChart'; import type { RecordSet, RecordSetParamsItem } from './types'; @@ -54,8 +54,9 @@ data: RecordSet; }; const chartLoading = ref(false); -const paramsValueList = ref(deepClone(props.data?.params)); +const visibleParams = computed(()=>(props.data?.params?.filter((item) => !item?.hide) ?? [])) +const paramsValueList = ref(deepClone(visibleParams.value)); let groupedValues = null; let timeIndex = undefined; let valueIndex = undefined; @@ -169,7 +170,7 @@ const { chartContainerResize, chartInstance } = useDrawChatChart({ chartRef, drawChart }); // 鏇存崲鍒楄〃 -const changeMap = new Map<string,string>(null); +const changeMap = new Map<string, string>(null); const handleQueryChange = async (val: string, item: RecordSetParamsItem) => { if (!val) return; @@ -178,10 +179,9 @@ let res = null; try { - - changeMap.set(item.id,val); + changeMap.set(item.id, val); const paramsObj = {}; - for (const [key,value] of changeMap) { + for (const [key, value] of changeMap) { paramsObj[key] = value; } const params = { diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/types.ts b/src/components/chat/chatComponents/summaryCom/components/recordSet/types.ts index 2926828..f624f4d 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/types.ts +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/types.ts @@ -5,24 +5,25 @@ List = 'list', } -export type TimestampParam = { +export type BaseParam = { id: string; title: string; + hide?: boolean; +}; +export type TimestampParam = { type: RecordSetParamsType.Timestamp; value: string; -}; +} & BaseParam; export type ListParamListItem = { title: string; value: string; }; export type ListParam = { - id: string; - title: string; type: RecordSetParamsType.List; value: string; list: ListParamListItem[]; -}; +} & BaseParam; export type RecordSetParamsItem = TimestampParam | ListParam; export type RecordSet = { -- Gitblit v1.9.3