洞察报告;

This commit is contained in:
钱冠学
2024-09-26 10:13:05 +08:00
parent e6423bebc3
commit d10eeb2e66

View File

@@ -130,6 +130,17 @@ const columns = computed(() => headers.value.map((column, columnIndex) => {
} }
} }
column.customCell = function(record) {
const style = {}
if(columnIndex > 0 && ['概念编码', '样本基数'].some((key) => record[column.dataIndex]?.indexOf?.(key) > -1)) {
style['font-style'] = 'italic'
}
return {
style
}
}
if(column.children?.length) { if(column.children?.length) {
column.children.forEach((child) => { column.children.forEach((child) => {
child.align = 'center' child.align = 'center'
@@ -257,6 +268,22 @@ function updateSelectionChange(record) {
function getPopupContainer(el) { function getPopupContainer(el) {
return el.parentNode || document.body return el.parentNode || document.body
} }
function cellClass(record, column, cols) {
const columnIndex = cols.flatMap(i => i.children || [i]).findIndex((col) => col.dataIndex === column.dataIndex)
const isStaticCell = ['概念编码', '样本基数'].some((key) => record[cols[0]?.dataIndex].indexOf(key) > -1)
const isStrokeCell = record[cols[0]?.dataIndex].toLowerCase().indexOf('top') > -1 && columnIndex > 0
// console.log('====', record[cols[0]?.dataIndex], columnIndex, column)
return {
italic: isStaticCell,
stroke: isStrokeCell
}
}
</script> </script>
<template> <template>
@@ -273,7 +300,8 @@ function getPopupContainer(el) {
#[column.dataIndex]="{record}"> #[column.dataIndex]="{record}">
<template v-if="props.barTable" data-desc="显示条形图"> <template v-if="props.barTable" data-desc="显示条形图">
<span <span
v-if="[0].includes(columnIndex) || ['概念编码', '样本基数'].includes(record[headers[0]?.dataIndex])"> v-if="[0].includes(columnIndex) || ['概念编码', '样本基数'].includes(record[headers[0]?.dataIndex])"
:class="cellClass(record, column, columns)">
{{ record[column.dataIndex] }} {{ record[column.dataIndex] }}
</span> </span>
@@ -317,8 +345,12 @@ function getPopupContainer(el) {
</template> </template>
<template v-else data-desc="显示文字"> <template v-else data-desc="显示文字">
<span>{{ record[column.dataIndex] }}</span> <span :class="cellClass(record, column, columns)">
<span class="danger-text">{{ record[column.dataIndex + 'Type'] || '' }}</span> {{ record[column.dataIndex] }}
</span>
<span class="danger-text" :class="cellClass(record, column, columns)">
{{ record[column.dataIndex + 'Type'] || '' }}
</span>
</template> </template>
</template> </template>
</a-table> </a-table>
@@ -337,6 +369,14 @@ function getPopupContainer(el) {
color: #70B936; color: #70B936;
} }
.italic {
font-style: italic;
}
.stroke {
-webkit-text-stroke-width: 0.5px;
}
.cell-bar { .cell-bar {
position: relative; position: relative;
min-width: 1px; min-width: 1px;