wujingjing
2024-11-05 022a757742c70b3106d817461464e821b537e794
src/components/chat/chatComponents/summaryCom/SummaryCom.vue
@@ -2,7 +2,7 @@
   <div class="w-full space-y-3">
      <template v-if="parsedData && parsedData.length > 0">
         <template v-for="(item, index) in parsedData" :key="item.id">
            <!-- <el-button v-if="showReportIndex.includes(index)" @click="showAgentReport(index)">报告</el-button> -->
            <el-button v-if="showReportIndex.includes(index) && conclusion.length > 0" @click="showAgentReport(index)">报告</el-button>
            <component
               ref="componentRef"
               :id="item.id"
@@ -16,7 +16,7 @@
            ></component>
         </template>
      </template>
      <!-- <AmisPageTest /> -->
      <ReportDlg v-model="infoDlgIsShow" :report="report" :agentKey="agentKey"></ReportDlg>
   </div>
</template>
@@ -25,6 +25,8 @@
import { chatComProps } from '../common';
import { SummaryAnswerType, summaryAnswerTypeMapCom } from './components/types';
// import AmisPageTest from './components/amisPage/AmisPageTest.vue';
import ReportDlg from './ReportDlg.vue';
const props = defineProps(chatComProps);
const tableLimitHeight = document.body.clientHeight * 0.7;
@@ -39,19 +41,19 @@
});
// 需要展示 report 的 索引
const showReportIndex = computed(()=>{
const showReportIndex = computed(() => {
   const agentKeySet = new Set();
   const indexList = [];
   parsedData.value.forEach((value,index)=>{
      if(value?.agent_key ){
         if(!agentKeySet.has(value.agent_key)){
   parsedData.value.forEach((value, index) => {
      if (value?.agent_key) {
         if (!agentKeySet.has(value.agent_key)) {
            agentKeySet.add(value.agent_key);
            indexList.push(index)
            indexList.push(index);
         }
      }
   })
   });
   return indexList;
})
});
const componentRef = ref<any[]>(null);
@@ -60,13 +62,19 @@
      item?.updateAll(triggerIndex, res);
   }
};
const infoDlgIsShow = ref(false);
const report = ref(null);
const agentKey = ref('');
const conclusion = computed(() => props.originData?.content?.origin?.conclusion ?? []);
const showAgentReport = (agentStartIndex) => {
   const agent = parsedData.value[agentStartIndex];
   const agentKey = agent.agent_key;
   console.log("🚀 ~ showAgentReport:", props.originData)
   agentKey.value = agent.agent_key;
   const foundReport = conclusion.value.find((item) => item.agent_key === agentKey.value);
   report.value = foundReport;
   
   infoDlgIsShow.value = true;
};
</script>
<style scoped lang="scss"></style>