fix: 修复图标显示异常

- 数据源修改, 从组件自动通过 sn 获取问卷变成从上级接受数据
This commit is contained in:
Huangzhe
2025-05-21 12:44:25 +08:00
parent 6d7f1a31e7
commit e21770134c
2 changed files with 4 additions and 13 deletions

View File

@@ -27,7 +27,7 @@ const { currentSurvey } = fetchSingleSurvey(sn.value);
// 重置 message 信息 // 重置 message 信息
aiInsightsConfig.value.message = ''; aiInsightsConfig.value.message = '';
useFetchAnalysis(sn.value); const { questionAnalysis } = useFetchAnalysis(sn.value);
</script> </script>
<template> <template>
@@ -77,7 +77,7 @@ useFetchAnalysis(sn.value);
<!-- 图表分析部分 --> <!-- 图表分析部分 -->
<van-cell class="analysis"> <van-cell class="analysis">
<template #extra> <template #extra>
<analysis-info :sn="sn" /> <analysis-info :sn="sn" :questionAnalysis="questionAnalysis" />
</template> </template>
</van-cell> </van-cell>
</section> </section>

View File

@@ -1,7 +1,7 @@
<template> <template>
<div style="width: 100%"> <div style="width: 100%">
<!-- 优先去上级传递的数值 --> <!-- 优先去上级传递的数值 -->
<section v-for="analysis in analysis" :key="analysis.stem" class="mt10"> <section v-for="analysis in questionAnalysis" :key="analysis.stem" class="mt10">
<!-- {{ analysis }} --> <!-- {{ analysis }} -->
<!-- 问题标题 --> <!-- 问题标题 -->
<el-tag type="success" size="small">{{ <el-tag type="success" size="small">{{
@@ -33,7 +33,6 @@
<script setup lang="ts"> <script setup lang="ts">
// 空白容器 // 空白容器
import EmptyContainer from '@/views/Survey/components/EmptyContainer.vue'; import EmptyContainer from '@/views/Survey/components/EmptyContainer.vue';
import { useFetchAnalysis } from '../../hooks/useAnalysis';
import { questionTypeMap } from '@/utils/question/typeMapping'; import { questionTypeMap } from '@/utils/question/typeMapping';
import ChartMsg from '@/components/Analysis/Index.vue'; import ChartMsg from '@/components/Analysis/Index.vue';
import { getTableData } from './hooks/pieSeries'; import { getTableData } from './hooks/pieSeries';
@@ -41,17 +40,9 @@ import YlTable from '@/components/YlTable/Index.vue';
import { ref } from 'vue'; import { ref } from 'vue';
// questionTypeMap 自己去对应 // questionTypeMap 自己去对应
const showChart = ref([1, 2, 5, 106, 9, 10]); const showChart = ref([1, 2, 5, 106, 9, 10]);
const sn = defineModel('sn', { required: true });
// 接受上级传递的 questionAnalysis 数据 // 接受上级传递的 questionAnalysis 数据
const analysis = defineModel<any[]>('questionAnalysis'); const questionAnalysis = defineModel<any[]>('questionAnalysis');
// 如果没有接收到数据,那么就去请求
if (!analysis.value) {
console.log('repeat fetch analysis');
const { questionAnalysis } = useFetchAnalysis(sn.value as string);
analysis.value = questionAnalysis.value;
}
// 构建表头 // 构建表头
const getTableHeadProps = (values: any[], option: any[]) => { const getTableHeadProps = (values: any[], option: any[]) => {