洞察报告;
This commit is contained in:
@@ -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) {
|
||||
column.children.forEach((child) => {
|
||||
child.align = 'center'
|
||||
@@ -257,6 +268,22 @@ function updateSelectionChange(record) {
|
||||
function getPopupContainer(el) {
|
||||
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>
|
||||
|
||||
<template>
|
||||
@@ -273,7 +300,8 @@ function getPopupContainer(el) {
|
||||
#[column.dataIndex]="{record}">
|
||||
<template v-if="props.barTable" data-desc="显示条形图">
|
||||
<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] }}
|
||||
</span>
|
||||
|
||||
@@ -317,8 +345,12 @@ function getPopupContainer(el) {
|
||||
</template>
|
||||
|
||||
<template v-else data-desc="显示文字">
|
||||
<span>{{ record[column.dataIndex] }}</span>
|
||||
<span class="danger-text">{{ record[column.dataIndex + 'Type'] || '' }}</span>
|
||||
<span :class="cellClass(record, column, columns)">
|
||||
{{ record[column.dataIndex] }}
|
||||
</span>
|
||||
<span class="danger-text" :class="cellClass(record, column, columns)">
|
||||
{{ record[column.dataIndex + 'Type'] || '' }}
|
||||
</span>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
@@ -337,6 +369,14 @@ function getPopupContainer(el) {
|
||||
color: #70B936;
|
||||
}
|
||||
|
||||
.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.stroke {
|
||||
-webkit-text-stroke-width: 0.5px;
|
||||
}
|
||||
|
||||
.cell-bar {
|
||||
position: relative;
|
||||
min-width: 1px;
|
||||
|
||||
Reference in New Issue
Block a user