| | |
| | | :header-cell-style="tableHeaderCellStyle" |
| | | :data="chunkTableData[pager.index - 1]" |
| | | @row-click="recordSelectChange" |
| | | rowClassName="cursor-pointer" |
| | | :spanMethod="objectSpanMethod" |
| | | class="w-full h-full" |
| | | highlightCurrentRow |
| | | :rowClassName="tableRowClassName" |
| | | cellClassName="text-sm" |
| | | headerCellClassName="text-sm" |
| | | > |
| | |
| | | totalRow[rateColIndex] = '100%'; |
| | | // 合计总数 |
| | | totalRow[valueColIndex] = sumValue + ''; |
| | | |
| | | (totalRow as any).isTotal = true; |
| | | current.push(totalRow); |
| | | } |
| | | } |
| | | return current; |
| | | }; |
| | | |
| | | const tableRowClassName = ({ row, rowIndex }) => { |
| | | let className = 'cursor-pointer'; |
| | | if (row.isTotal) { |
| | | const bgColor = '!bg-[#c5d9f1]'; |
| | | className += ` font-bold ${bgColor} hover:${bgColor} active:${bgColor}`; |
| | | } |
| | | return className; |
| | | }; |
| | | // 统计表格,需要增加累计值行,以及比例列 |
| | | const tableValues = ref(getTableValues(props.data)); |
| | |
| | | groupTitle = groupCols[groupCols.length - 1].title; |
| | | |
| | | const data = groupValues.map((item) => { |
| | | const groupName = item.filter((item, index) => !excludeIndex.includes(index) && index !== valueColIndex).join(','); |
| | | const groupName = item.filter((item, index) => !excludeIndex.includes(index) && index !== valueColIndex).join('_'); |
| | | const value = item[valueColIndex]; |
| | | return { |
| | | value, |
| | |
| | | return data; |
| | | }; |
| | | |
| | | const getTooltip = () => { |
| | | return { |
| | | trigger: 'item', |
| | | valueFormatter: (value) => `${value} / ${toPercent(sumValue === 0 ? 0 : (value as number) / sumValue, true, 2)}`, |
| | | } as any; |
| | | }; |
| | | |
| | | const getCommonOption = () => { |
| | | return { |
| | |
| | | // orient:'vertical', |
| | | top: 33, |
| | | left: 'center', |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item', |
| | | valueFormatter: (value) => `${value} / ${toPercent(sumValue === 0 ? 0 : (value as number) / sumValue, true, 2)}`, |
| | | }, |
| | | } as echarts.EChartsOption; |
| | | }; |
| | |
| | | // return value; |
| | | // } |
| | | // }, |
| | | width:86, |
| | | overflow:'truncate', |
| | | width: 86, |
| | | overflow: 'truncate', |
| | | // nameTruncate: { |
| | | // maxWidth: 52, |
| | | // }, |
| | |
| | | } |
| | | |
| | | const option: echarts.EChartsOption = { |
| | | ...getCommonOption, |
| | | tooltip: getTooltip(), |
| | | ...getCommonOption(), |
| | | |
| | | toolbox: { |
| | | show: true, |
| | | feature: { |
| | |
| | | activeChartType = ChartTypeEnum.Bar; |
| | | chartInstance.value.setOption( |
| | | { |
| | | ...getCommonOption, |
| | | tooltip: getTooltip(), |
| | | ...getCommonOption(), |
| | | |
| | | toolbox: option.toolbox, |
| | | ...getBarOption(chartData), |
| | |
| | | activeChartType = ChartTypeEnum.Pie; |
| | | chartInstance.value.setOption( |
| | | { |
| | | ...getCommonOption, |
| | | tooltip: getTooltip(), |
| | | ...getCommonOption(), |
| | | toolbox: option.toolbox, |
| | | ...getPieOption(chartData), |
| | | }, |