From cf0eb9a57cfc625e707899f7268b5778fa11f572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Tue, 27 May 2025 10:55:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(components):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20YlTable=20=E7=BB=84=E4=BB=B6=E7=9A=84=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了原有的 docWidth 判断逻辑 - 当表格列数小于等于 3 时,改为直接使用屏幕宽度减去60 作为表格宽度 - 简化了代码结构,提高了可读性和维护性 --- src/components/YlTable/yl-table-h.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/YlTable/yl-table-h.vue b/src/components/YlTable/yl-table-h.vue index 47d03f4..1375571 100644 --- a/src/components/YlTable/yl-table-h.vue +++ b/src/components/YlTable/yl-table-h.vue @@ -35,10 +35,9 @@ watch( () => data.value, (newVal) => { tableWidth.value = prop.value.length * 100; - // tableWidth.value 判断是否铺满横屏 没有就铺满 - let docWidth = document.documentElement.clientWidth; - if (docWidth - tableWidth.value > 100) { - tableWidth.value = docWidth; + if (prop.value.length <= 3) { + // tableWidth.value 判断是否铺满横屏 没有就铺满 + tableWidth.value = document.documentElement.clientWidth - 60; } }, { From 91d1cbc21b550a4c348c3988c9089f2c7e2eae9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Tue, 27 May 2025 14:12:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(components):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E7=BB=84=E4=BB=B6=E7=9A=84=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -调整 tooltip 内容显示逻辑,优化样式 - 修复饼图数据为空时的显示问题- 优化表格宽度计算逻辑- 修复饼图初始化问题- 优化问卷分析页面样式 --- src/components/Analysis/Index.vue | 11 +++++------ src/components/YlTable/components/Tootips/Index.vue | 4 ++-- src/components/YlTable/yl-table-h.vue | 11 +++++++++++ src/hooks/chart/usePieChart.ts | 8 +++++++- .../components/MineTask/components/QuestionList.vue | 6 +----- src/views/Survey/views/Analysis/Index.vue | 6 +++--- .../views/Analysis/components/LogicInfo/Index.vue | 12 ++++++++++++ 7 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/components/Analysis/Index.vue b/src/components/Analysis/Index.vue index eb21420..9ee725f 100644 --- a/src/components/Analysis/Index.vue +++ b/src/components/Analysis/Index.vue @@ -12,6 +12,7 @@ const tableData = ref([]); const analysis = defineModel('analysis'); // console.log('analysis', analysis.value); +const pieChart = useTemplateRef('pieChart'); const series = ref([]); const dimension = defineModel('dimension'); @@ -47,10 +48,10 @@ watch( // console.log(`图标的高度是`, chartHeight.value); series.value = formatData(dimension.value ? tableData.value : analysis.value, index.value); - const pieChart = useTemplateRef('pieChart'); // console.log(`series value `, series.value); - - if (!series.value?.data?.length) return; + if (series.value.data.length <= 0) { + series.value.data = [{ value: -1, name: '' }]; + } useSetPieChart(pieChart, series, { title: false, legend: false }); }, { immediate: true } @@ -61,9 +62,8 @@ const changeChart = (i: number) => { series.value = formatData(tableData.value, index.value); if (series.value.data.length <= 0) { - series.value.data = [{ value: 0, name: 0 }]; + series.value.data = [{ value: -1, name: '' }]; } - // const pieChart = useTemplateRef('pieChart'); // useSetPieChart(pieChart, series, { title: false, legend: false }); }; @@ -85,7 +85,6 @@ const changeChart = (i: number) => {
- +