yangyin
2024-07-15 78137be892b6810b54ba70f27c28a69a7179e603
src/components/chat/chatComponents/summaryCom/SummaryCom.vue
@@ -1,27 +1,33 @@
<template>
   <div style="width: calc(100ch - 28px)">
      <template v-if="summaryList && summaryList.length > 0">
         <div class="w-full" v-for="(item, idx) in summaryList" :key="idx">
            <h3>{{ item.title }}</h3>
            <el-table ref="tableRefList" class="w-full" :data="[{}]">
               <el-table-column v-for="(col, index) in item.values" :label="col.title" :key="index">
                  <template #default="scope">
                     {{ col?.value }}
                  </template>
               </el-table-column>
            </el-table>
      <template v-if="data && data.length > 0">
         <template v-if="summaryList && summaryList.length > 0">
            <div class="w-full" v-for="(item, idx) in summaryList" :key="idx">
               <h3>{{ item.title }}</h3>
               <el-table ref="tableRefList" class="w-full" :data="[{}]">
                  <el-table-column v-for="(col, index) in item.values" :label="col.title" :key="index">
                     <template #default="scope">
                        {{ col?.value }}
                     </template>
                  </el-table-column>
               </el-table>
            </div>
         </template>
         <div
            class="flex-column w-full"
            :class="{ 'mt-10': summaryList && summaryList.length > 0 }"
            v-if="recordSetList && recordSetList.length > 0"
         >
            <div class="min-h-[48rem] flex-auto w-full">
               <div ref="chartRefList" v-for="(item, index) in recordSetList" :key="index"></div>
            </div>
         </div>
         <div v-if="urlList && urlList.length > 0" class="w-full">
            <HTMLCom data="/test"  v-for="(item, index) in urlList" :key="index"></HTMLCom>
         </div>
      </template>
      <div
         class="flex-column w-full"
         :class="{ 'mt-10': summaryList && summaryList.length > 0 }"
         v-if="recordSetList && recordSetList.length > 0"
      >
         <div class="min-h-[48rem] flex-auto w-full">
            <div ref="chartRefList" v-for="(item, index) in recordSetList" :key="index"></div>
         </div>
      </div>
      <div v-else class="text-red-500">{{ error }}</div>
   </div>
</template>
@@ -33,8 +39,9 @@
import { ChartTypeEnum, chartTypeMapEchart, chartTypeMapName } from '../types';
import { axisLabelFormatter } from '/@/utils/chart';
import { timeDataOptionToContent } from '../common';
const props = defineProps(['data']);
import { AnswerType } from '../../model/types';
import HTMLCom from '../htmlCom/HTMLCom.vue';
const props = defineProps(['data', 'error']);
const selectChartType = ref<ChartTypeEnum>(ChartTypeEnum.Line);
@@ -73,8 +80,10 @@
   return refList;
});
const recordSetList = computed(() => props.data.filter((item) => item.type === 'recordset'));
const summaryList = computed(() => props.data.filter((item) => item.type === 'summary'));
const recordSetList = computed(() => props.data.filter((item) => item.type === AnswerType.RecordSet));
const summaryList = computed(() => props.data.filter((item) => item.type === AnswerType.Summary));
const urlList = computed(() => props.data.filter((item) => item.type === AnswerType.Url));
const drawAllChart = () => {
   chartInstanceList.map((item, index) => {
      drawChart(item, recordSetList.value[index]);
@@ -233,7 +242,6 @@
      if (!parent) {
         return;
      } else {
      }
      const parentBound = parent.getBoundingClientRect();