Merge branch 'feature/feature-20250430-h5' of https://e.coding.yili.com/yldc/ylst/ylst-survey-h5 into feature/feature-20250430-h5

This commit is contained in:
Huangzhe
2025-05-26 10:20:11 +08:00
2 changed files with 27 additions and 10 deletions

View File

@@ -123,7 +123,7 @@ function tooptipFormatter(data: { row: any; column: any; cellValue: any }): VNod
:row-class-name="setStripeColor" :row-class-name="setStripeColor"
:data="data" :data="data"
:empty-text="emptyText" :empty-text="emptyText"
style="width: 100%" style="width: 100%; padding-right: 10px"
> >
<el-table-column <el-table-column
v-for="item in props" v-for="item in props"
@@ -131,7 +131,6 @@ function tooptipFormatter(data: { row: any; column: any; cellValue: any }): VNod
:width="item.width" :width="item.width"
:prop="item.prop" :prop="item.prop"
:label="item.label" :label="item.label"
show-overflow-tooltip
> >
<template #default="scope"> <template #default="scope">
<slot name="column-default" :scope="scope"> <slot name="column-default" :scope="scope">
@@ -148,9 +147,14 @@ function tooptipFormatter(data: { row: any; column: any; cellValue: any }): VNod
</template> </template>
<style> <style>
.table-view-html { .table-view-html {
display: flex;
//align-items: center;
flex-direction: row;
& img { & img {
width: 50px; width: 50px;
height: 100%; height: 100%;
margin-right: 10px;
} }
} }
</style> </style>

View File

@@ -21,11 +21,12 @@ export const series = ref({
} }
}); });
export function formatData(data: any, index: number) { export function formatData(data: any, index: number, isEmpty: boolean = true) {
const _series = JSON.parse(JSON.stringify(series.value)); const _series = JSON.parse(JSON.stringify(series.value));
// 当内容为单选的时候处理方式 // 当内容为单选的时候处理方式
if (data.question_type === 1 || data.question_type === 2) { if (data.question_type === 1 || data.question_type === 2) {
const { option } = data; let { option } = data;
_series.data = option.map((item: any) => { _series.data = option.map((item: any) => {
return { return {
...item, ...item,
@@ -34,14 +35,26 @@ export function formatData(data: any, index: number) {
questionItem: { ...data } questionItem: { ...data }
}; };
}); });
if (isEmpty) {
_series.data = _series.data.filter((item) => item.value != 0);
}
} }
if ( if (
data.question_type === 5 data.question_type === 5 ||
|| data.question_type === 9 data.question_type === 9 ||
|| data.question_type === 106 data.question_type === 106 ||
|| data.question_type === 10 data.question_type === 10
) { ) {
const copyData = setDimensionData(data); let copyData = setDimensionData(data);
// copyData 删除 value 为0 的数据
if (isEmpty) {
copyData = copyData.map((item) => {
return item.filter((item) => item.value !== 0);
});
}
_series.data = copyData[index || 0]?.map((item) => { _series.data = copyData[index || 0]?.map((item) => {
return { return {
...item, ...item,
@@ -54,7 +67,7 @@ export function formatData(data: any, index: number) {
return _series; return _series;
} }
export function getTableData(data: any) { export function getTableData(data: any, isEmpty = true) {
const analysis = JSON.parse(JSON.stringify(data)); const analysis = JSON.parse(JSON.stringify(data));
const rows = analysis.option || []; const rows = analysis.option || [];
return rows.map((rowItem: any) => { return rows.map((rowItem: any) => {