From f052d279131a056cb82c178ae195f463caa72c33 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期日, 04 八月 2024 14:01:23 +0800 Subject: [PATCH] 新增表格展示方式 --- src/components/chat/chatComponents/summaryCom/SummaryCom.vue | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/SummaryCom.vue b/src/components/chat/chatComponents/summaryCom/SummaryCom.vue index 1e24205..fde3089 100644 --- a/src/components/chat/chatComponents/summaryCom/SummaryCom.vue +++ b/src/components/chat/chatComponents/summaryCom/SummaryCom.vue @@ -1,8 +1,8 @@ <template> <div class="w-full space-y-3"> - <template v-if="data && data.length > 0"> + <template v-if="parsedData && parsedData.length > 0"> <component - v-for="(item, index) in data" + v-for="(item, index) in parsedData" :key="item.id" :id="item.id" :is="summaryAnswerTypeMapCom[item.type]" @@ -15,8 +15,20 @@ </template> <script setup lang="ts"> +import { computed } from 'vue'; import { chatComProps } from '../common'; -import { summaryAnswerTypeMapCom } from './components/types'; +import { SummaryAnswerType, summaryAnswerTypeMapCom } from './components/types'; + const props = defineProps(chatComProps); + +const parsedData = computed(() => { + const newData = (props.data ?? []).map((item) => { + if (item.type === SummaryAnswerType.RecordSet && item.chart === 'table') { + item.type = SummaryAnswerType.RecordSetTable; + } + return item; + }); + return newData; +}); </script> <style scoped lang="scss"></style> -- Gitblit v1.9.3