mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-29 14:46:41 +08:00
feat: add dark mode support in vtable
This commit is contained in:
parent
0e105f32e4
commit
caa686cefd
@ -39,27 +39,30 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<NSpace vertical :size="16">
|
||||
<NCard title="List Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<NCard title="Stacked Dash Area Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<div ref="stackedDashAreaRef" class="h-400px" />
|
||||
</NCard>
|
||||
<NCard title="List Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<NCard title="Bar Mark Point Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<div ref="barMarkPointRef" class="h-400px" />
|
||||
</NCard>
|
||||
<NCard title="List Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<NCard title="Histogram Different Bin Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<div ref="histogramDifferentBinRef" class="h-400px" />
|
||||
</NCard>
|
||||
<NCard title="List Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<NCard title="Ranking Bar Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<div ref="rankingBarRef" class="h-400px" />
|
||||
</NCard>
|
||||
<NCard title="List Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<NCard title="Circular Progress Tick Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<div ref="circularProgressTickRef" class="h-400px" />
|
||||
</NCard>
|
||||
<NCard title="List Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<NCard title="Liquid Chart Smart Invert Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<div ref="liquidChartSmartInvertRef" class="h-400px" />
|
||||
</NCard>
|
||||
<NCard title="List Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<NCard title="Shape Word Cloud Chart" :bordered="false" class="h-full card-wrapper">
|
||||
<div ref="shapeWordCloudRef" class="h-400px" />
|
||||
</NCard>
|
||||
<NCard :bordered="false" class="h-full w-2/3 card-wrapper">
|
||||
<WebSiteLink label="More VChart Demos: " link="https://www.visactor.com/vchart/example" />
|
||||
</NCard>
|
||||
</NSpace>
|
||||
</template>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const listTableRecords = [
|
||||
export const listTableRecords = [
|
||||
{
|
||||
'Row ID': '7981',
|
||||
'Order ID': 'CA-2015-103800',
|
||||
@ -691,4 +691,354 @@ const listTableRecords = [
|
||||
}
|
||||
];
|
||||
|
||||
export { listTableRecords };
|
||||
export const customListRecords = [
|
||||
{
|
||||
bloggerId: 1,
|
||||
bloggerName: 'Virtual Anchor Xiaohua',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/flower.jpg',
|
||||
introduction:
|
||||
'Hi everyone, I am Xiaohua, the virtual host. I am a little fairy who likes games, animation and food. I hope to share happy moments with you through live broadcast.',
|
||||
fansCount: 400,
|
||||
worksCount: 10,
|
||||
viewCount: 5,
|
||||
city: 'Dream City',
|
||||
tags: ['game', 'anime', 'food']
|
||||
},
|
||||
{
|
||||
bloggerId: 2,
|
||||
bloggerName: 'Virtual anchor little wolf',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual anchor Little Wolf. I like music, travel and photography, and I hope to explore the beauty of the world with you through live broadcast.',
|
||||
fansCount: 800,
|
||||
worksCount: 20,
|
||||
viewCount: 15,
|
||||
city: 'City of Music',
|
||||
tags: ['music', 'travel', 'photography']
|
||||
},
|
||||
{
|
||||
bloggerId: 3,
|
||||
bloggerName: 'Virtual anchor bunny',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/rabbit.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual anchor Xiaotu. I like painting, handicrafts and beauty makeup. I hope to share creativity and fashion with you through live broadcast.',
|
||||
fansCount: 600,
|
||||
worksCount: 15,
|
||||
viewCount: 10,
|
||||
city: 'City of Art',
|
||||
tags: ['painting', 'handmade', 'beauty makeup']
|
||||
},
|
||||
{
|
||||
bloggerId: 4,
|
||||
bloggerName: 'Virtual anchor kitten',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/cat.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual host Kitty. I am a lazy cat who likes dancing, fitness and cooking. I hope to live a healthy and happy life with everyone through the live broadcast.',
|
||||
fansCount: 1000,
|
||||
worksCount: 30,
|
||||
viewCount: 20,
|
||||
city: 'Health City',
|
||||
tags: ['dance', 'fitness', 'cooking']
|
||||
},
|
||||
{
|
||||
bloggerId: 5,
|
||||
bloggerName: 'Virtual anchor Bear',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bear.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual host Xiaoxiong. A little wise man who likes movies, reading and philosophy, I hope to explore the meaning of life with you through live broadcast.',
|
||||
fansCount: 1200,
|
||||
worksCount: 25,
|
||||
viewCount: 18,
|
||||
city: 'City of Wisdom',
|
||||
tags: ['Movie', 'Literature']
|
||||
},
|
||||
{
|
||||
bloggerId: 6,
|
||||
bloggerName: 'Virtual anchor bird',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bird.jpeg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual anchor Xiaoniao. I like singing, acting and variety shows. I hope to be happy with everyone through the live broadcast.',
|
||||
fansCount: 900,
|
||||
worksCount: 12,
|
||||
viewCount: 8,
|
||||
city: 'Happy City',
|
||||
tags: ['music', 'performance', 'variety']
|
||||
}
|
||||
];
|
||||
|
||||
export const pivotChartColumns = [
|
||||
{
|
||||
dimensionKey: 'Region',
|
||||
title: 'Region',
|
||||
headerStyle: {
|
||||
textStick: true
|
||||
}
|
||||
},
|
||||
'Category'
|
||||
];
|
||||
export const pivotChartRows = [
|
||||
{
|
||||
dimensionKey: 'Order Year',
|
||||
title: 'Order Year',
|
||||
headerStyle: {
|
||||
textStick: true
|
||||
}
|
||||
},
|
||||
'Ship Mode'
|
||||
];
|
||||
export const pivotChartIndicators = [
|
||||
{
|
||||
indicatorKey: 'Quantity',
|
||||
title: 'Quantity',
|
||||
width: 'auto',
|
||||
cellType: 'chart',
|
||||
chartModule: 'vchart',
|
||||
chartSpec: {
|
||||
stack: true,
|
||||
type: 'bar',
|
||||
data: {
|
||||
id: 'data',
|
||||
fields: {
|
||||
'Sub-Category': {
|
||||
sortIndex: 0,
|
||||
domain: [
|
||||
'Chairs',
|
||||
'Tables',
|
||||
'Bookcases',
|
||||
'Furnishings',
|
||||
'Binders',
|
||||
'Art',
|
||||
'Storage',
|
||||
'Appliances',
|
||||
'Envelopes',
|
||||
'Fasteners',
|
||||
'Paper',
|
||||
'Labels',
|
||||
'Supplies',
|
||||
'Accessories',
|
||||
'Phones',
|
||||
'Copiers',
|
||||
'Machines'
|
||||
]
|
||||
},
|
||||
'Segment-Indicator': {
|
||||
sortIndex: 1,
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
xField: ['Sub-Category'],
|
||||
yField: 'Quantity',
|
||||
seriesField: 'Segment-Indicator',
|
||||
axes: [
|
||||
{ orient: 'left', visible: true, label: { visible: true } },
|
||||
{ orient: 'bottom', visible: true }
|
||||
],
|
||||
bar: {
|
||||
state: {
|
||||
selected: { fill: 'yellow' },
|
||||
selected_reverse: { opacity: 0.2 }
|
||||
}
|
||||
},
|
||||
scales: [
|
||||
{
|
||||
id: 'color',
|
||||
type: 'ordinal',
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
],
|
||||
range: [
|
||||
'#2E62F1',
|
||||
'#4DC36A',
|
||||
'#FF8406',
|
||||
'#FFCC00',
|
||||
'#4F44CF',
|
||||
'#5AC8FA',
|
||||
'#003A8C',
|
||||
'#B08AE2',
|
||||
'#FF6341',
|
||||
'#98DD62',
|
||||
'#07A199',
|
||||
'#87DBDD'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
style: { padding: 1 }
|
||||
},
|
||||
{
|
||||
indicatorKey: 'Sales',
|
||||
title: 'Sales & Profit',
|
||||
cellType: 'chart',
|
||||
chartModule: 'vchart',
|
||||
chartSpec: {
|
||||
type: 'common',
|
||||
series: [
|
||||
{
|
||||
type: 'bar',
|
||||
data: {
|
||||
id: 'data1',
|
||||
fields: {
|
||||
'Sub-Category': {
|
||||
sortIndex: 0,
|
||||
domain: [
|
||||
'Chairs',
|
||||
'Tables',
|
||||
'Bookcases',
|
||||
'Furnishings',
|
||||
'Binders',
|
||||
'Art',
|
||||
'Storage',
|
||||
'Appliances',
|
||||
'Envelopes',
|
||||
'Fasteners',
|
||||
'Paper',
|
||||
'Labels',
|
||||
'Supplies',
|
||||
'Accessories',
|
||||
'Phones',
|
||||
'Copiers',
|
||||
'Machines'
|
||||
]
|
||||
},
|
||||
'Segment-Indicator': {
|
||||
sortIndex: 1,
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: true,
|
||||
xField: ['Sub-Category'],
|
||||
yField: 'Sales',
|
||||
seriesField: 'Segment-Indicator',
|
||||
bar: {
|
||||
state: {
|
||||
selected: { fill: 'yellow' },
|
||||
selected_reverse: { opacity: 0.2 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
data: {
|
||||
id: 'data2',
|
||||
fields: {
|
||||
'Sub-Category': {
|
||||
sortIndex: 0,
|
||||
domain: [
|
||||
'Chairs',
|
||||
'Tables',
|
||||
'Bookcases',
|
||||
'Furnishings',
|
||||
'Binders',
|
||||
'Art',
|
||||
'Storage',
|
||||
'Appliances',
|
||||
'Envelopes',
|
||||
'Fasteners',
|
||||
'Paper',
|
||||
'Labels',
|
||||
'Supplies',
|
||||
'Phones',
|
||||
'Accessories',
|
||||
'Machines',
|
||||
'Copiers'
|
||||
]
|
||||
},
|
||||
'Segment-Indicator': {
|
||||
sortIndex: 1,
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: false,
|
||||
xField: ['Sub-Category'],
|
||||
yField: 'Profit',
|
||||
seriesField: 'Segment-Indicator',
|
||||
line: {
|
||||
state: {
|
||||
selected: { lineWidth: 3 },
|
||||
selected_reverse: { lineWidth: 1 }
|
||||
}
|
||||
},
|
||||
point: {
|
||||
state: {
|
||||
selected: { fill: 'yellow' },
|
||||
selected_reverse: { fill: '#ddd' }
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
scales: [
|
||||
{
|
||||
id: 'color',
|
||||
type: 'ordinal',
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
],
|
||||
range: [
|
||||
'#2E62F1',
|
||||
'#4DC36A',
|
||||
'#FF8406',
|
||||
'#FFCC00',
|
||||
'#4F44CF',
|
||||
'#5AC8FA',
|
||||
'#003A8C',
|
||||
'#B08AE2',
|
||||
'#FF6341',
|
||||
'#98DD62',
|
||||
'#07A199',
|
||||
'#87DBDD'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
style: { padding: 1 }
|
||||
}
|
||||
];
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="tsx">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import {
|
||||
Group,
|
||||
Image,
|
||||
@ -14,20 +14,55 @@ import {
|
||||
PivotTable,
|
||||
Tag,
|
||||
Text,
|
||||
VTable,
|
||||
registerChartModule
|
||||
} from '@visactor/vue-vtable';
|
||||
import VChart from '@visactor/vchart';
|
||||
import { listTableRecords } from './data';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { customListRecords, listTableRecords, pivotChartColumns, pivotChartIndicators, pivotChartRows } from './data';
|
||||
|
||||
registerChartModule('vchart', VChart);
|
||||
const titleColorPool = ['#3370ff', '#34c724', '#ff9f1a', '#ff4050', '#1f2329'];
|
||||
|
||||
const themeStore = useThemeStore();
|
||||
|
||||
// list table
|
||||
const listTableRef = ref(null);
|
||||
const listOptions = computed(() => {
|
||||
const options = {
|
||||
theme: themeStore.darkMode ? VTable.themes.DARK : VTable.themes.DEFAULT
|
||||
};
|
||||
return options;
|
||||
});
|
||||
const listRecords = ref<Record<string, string | number>[]>(listTableRecords);
|
||||
|
||||
// group table
|
||||
const groupTableRef = ref(null);
|
||||
const groupOptions = computed(() => {
|
||||
const options = {
|
||||
groupBy: ['Category', 'Sub-Category'],
|
||||
theme: (themeStore.darkMode ? VTable.themes.DARK : VTable.themes.DEFAULT).extends({
|
||||
groupTitleStyle: {
|
||||
fontWeight: 'bold',
|
||||
bgColor: (args: any) => {
|
||||
const { col, row, table } = args;
|
||||
const index = table.getGroupTitleLevel(col, row);
|
||||
if (index !== undefined) {
|
||||
return titleColorPool[index % titleColorPool.length] as string;
|
||||
}
|
||||
return 'white';
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
return options;
|
||||
});
|
||||
const groupRecords = ref<Record<string, string | number>[]>(listTableRecords);
|
||||
|
||||
// pivot table
|
||||
const pivotTableRef = ref(null);
|
||||
const pivotTableOptions = ref({
|
||||
const pivotTableOptions = computed(() => {
|
||||
return {
|
||||
tooltip: {
|
||||
isShowOverflowTextTooltip: true
|
||||
},
|
||||
@ -39,7 +74,12 @@ const pivotTableOptions = ref({
|
||||
}
|
||||
]
|
||||
},
|
||||
widthMode: 'standard'
|
||||
widthMode: 'standard',
|
||||
theme: themeStore.darkMode ? VTable.themes.DARK : VTable.themes.DEFAULT,
|
||||
emptyTip: {
|
||||
text: 'no data records'
|
||||
}
|
||||
};
|
||||
});
|
||||
const pivotTableIndicators = ref([
|
||||
{
|
||||
@ -96,283 +136,8 @@ const pivotTableRecords = ref([]);
|
||||
|
||||
// pivot chart
|
||||
const pivotChartRef = ref(null);
|
||||
const pivotChartColumns = [
|
||||
{
|
||||
dimensionKey: 'Region',
|
||||
title: 'Region',
|
||||
headerStyle: {
|
||||
textStick: true
|
||||
}
|
||||
},
|
||||
'Category'
|
||||
];
|
||||
const pivotChartRows = [
|
||||
{
|
||||
dimensionKey: 'Order Year',
|
||||
title: 'Order Year',
|
||||
headerStyle: {
|
||||
textStick: true
|
||||
}
|
||||
},
|
||||
'Ship Mode'
|
||||
];
|
||||
const pivotChartIndicators = [
|
||||
{
|
||||
indicatorKey: 'Quantity',
|
||||
title: 'Quantity',
|
||||
width: 'auto',
|
||||
cellType: 'chart',
|
||||
chartModule: 'vchart',
|
||||
chartSpec: {
|
||||
stack: true,
|
||||
type: 'bar',
|
||||
data: {
|
||||
id: 'data',
|
||||
fields: {
|
||||
'Sub-Category': {
|
||||
sortIndex: 0,
|
||||
domain: [
|
||||
'Chairs',
|
||||
'Tables',
|
||||
'Bookcases',
|
||||
'Furnishings',
|
||||
'Binders',
|
||||
'Art',
|
||||
'Storage',
|
||||
'Appliances',
|
||||
'Envelopes',
|
||||
'Fasteners',
|
||||
'Paper',
|
||||
'Labels',
|
||||
'Supplies',
|
||||
'Accessories',
|
||||
'Phones',
|
||||
'Copiers',
|
||||
'Machines'
|
||||
]
|
||||
},
|
||||
'Segment-Indicator': {
|
||||
sortIndex: 1,
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
xField: ['Sub-Category'],
|
||||
yField: 'Quantity',
|
||||
seriesField: 'Segment-Indicator',
|
||||
axes: [
|
||||
{ orient: 'left', visible: true, label: { visible: true } },
|
||||
{ orient: 'bottom', visible: true }
|
||||
],
|
||||
bar: {
|
||||
state: {
|
||||
selected: { fill: 'yellow' },
|
||||
selected_reverse: { opacity: 0.2 }
|
||||
}
|
||||
},
|
||||
scales: [
|
||||
{
|
||||
id: 'color',
|
||||
type: 'ordinal',
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
],
|
||||
range: [
|
||||
'#2E62F1',
|
||||
'#4DC36A',
|
||||
'#FF8406',
|
||||
'#FFCC00',
|
||||
'#4F44CF',
|
||||
'#5AC8FA',
|
||||
'#003A8C',
|
||||
'#B08AE2',
|
||||
'#FF6341',
|
||||
'#98DD62',
|
||||
'#07A199',
|
||||
'#87DBDD'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
style: { padding: 1 }
|
||||
},
|
||||
{
|
||||
indicatorKey: 'Sales',
|
||||
title: 'Sales & Profit',
|
||||
cellType: 'chart',
|
||||
chartModule: 'vchart',
|
||||
chartSpec: {
|
||||
type: 'common',
|
||||
series: [
|
||||
{
|
||||
type: 'bar',
|
||||
data: {
|
||||
id: 'data1',
|
||||
fields: {
|
||||
'Sub-Category': {
|
||||
sortIndex: 0,
|
||||
domain: [
|
||||
'Chairs',
|
||||
'Tables',
|
||||
'Bookcases',
|
||||
'Furnishings',
|
||||
'Binders',
|
||||
'Art',
|
||||
'Storage',
|
||||
'Appliances',
|
||||
'Envelopes',
|
||||
'Fasteners',
|
||||
'Paper',
|
||||
'Labels',
|
||||
'Supplies',
|
||||
'Accessories',
|
||||
'Phones',
|
||||
'Copiers',
|
||||
'Machines'
|
||||
]
|
||||
},
|
||||
'Segment-Indicator': {
|
||||
sortIndex: 1,
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: true,
|
||||
xField: ['Sub-Category'],
|
||||
yField: 'Sales',
|
||||
seriesField: 'Segment-Indicator',
|
||||
bar: {
|
||||
state: {
|
||||
selected: { fill: 'yellow' },
|
||||
selected_reverse: { opacity: 0.2 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
data: {
|
||||
id: 'data2',
|
||||
fields: {
|
||||
'Sub-Category': {
|
||||
sortIndex: 0,
|
||||
domain: [
|
||||
'Chairs',
|
||||
'Tables',
|
||||
'Bookcases',
|
||||
'Furnishings',
|
||||
'Binders',
|
||||
'Art',
|
||||
'Storage',
|
||||
'Appliances',
|
||||
'Envelopes',
|
||||
'Fasteners',
|
||||
'Paper',
|
||||
'Labels',
|
||||
'Supplies',
|
||||
'Phones',
|
||||
'Accessories',
|
||||
'Machines',
|
||||
'Copiers'
|
||||
]
|
||||
},
|
||||
'Segment-Indicator': {
|
||||
sortIndex: 1,
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: false,
|
||||
xField: ['Sub-Category'],
|
||||
yField: 'Profit',
|
||||
seriesField: 'Segment-Indicator',
|
||||
line: {
|
||||
state: {
|
||||
selected: { lineWidth: 3 },
|
||||
selected_reverse: { lineWidth: 1 }
|
||||
}
|
||||
},
|
||||
point: {
|
||||
state: {
|
||||
selected: { fill: 'yellow' },
|
||||
selected_reverse: { fill: '#ddd' }
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
scales: [
|
||||
{
|
||||
id: 'color',
|
||||
type: 'ordinal',
|
||||
domain: [
|
||||
'Consumer-Quantity',
|
||||
'Corporate-Quantity',
|
||||
'Home Office-Quantity',
|
||||
'Consumer-Sales',
|
||||
'Corporate-Sales',
|
||||
'Home Office-Sales',
|
||||
'Consumer-Profit',
|
||||
'Corporate-Profit',
|
||||
'Home Office-Profit'
|
||||
],
|
||||
range: [
|
||||
'#2E62F1',
|
||||
'#4DC36A',
|
||||
'#FF8406',
|
||||
'#FFCC00',
|
||||
'#4F44CF',
|
||||
'#5AC8FA',
|
||||
'#003A8C',
|
||||
'#B08AE2',
|
||||
'#FF6341',
|
||||
'#98DD62',
|
||||
'#07A199',
|
||||
'#87DBDD'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
style: { padding: 1 }
|
||||
}
|
||||
];
|
||||
const pivotChartOptions = ref({
|
||||
const pivotChartOptions = computed(() => {
|
||||
return {
|
||||
rows: pivotChartRows,
|
||||
columns: pivotChartColumns,
|
||||
indicators: pivotChartIndicators,
|
||||
@ -402,7 +167,7 @@ const pivotChartOptions = ref({
|
||||
{ label: 'Home Office-Profit', shape: { fill: '#FF6341', symbolType: 'square' } }
|
||||
]
|
||||
},
|
||||
theme: {
|
||||
theme: (themeStore.darkMode ? VTable.themes.DARK : VTable.themes.DEFAULT).extends({
|
||||
bodyStyle: { borderColor: 'gray', borderLineWidth: [1, 0, 0, 1] },
|
||||
headerStyle: { borderColor: 'gray', borderLineWidth: [0, 0, 1, 1], hover: { cellBgColor: '#CCE0FF' } },
|
||||
rowHeaderStyle: { borderColor: 'gray', borderLineWidth: [1, 1, 0, 0], hover: { cellBgColor: '#CCE0FF' } },
|
||||
@ -414,7 +179,11 @@ const pivotChartOptions = ref({
|
||||
bottomFrozenStyle: { borderColor: 'gray', borderLineWidth: [1, 1, 0, 1], hover: { cellBgColor: '' } },
|
||||
selectionStyle: { cellBgColor: '', cellBorderColor: '' },
|
||||
frameStyle: { borderLineWidth: 0 }
|
||||
}),
|
||||
emptyTip: {
|
||||
text: 'no data records'
|
||||
}
|
||||
};
|
||||
});
|
||||
const pivotChartRecords = ref({} as any);
|
||||
const handleLegendItemClick = (args: { value: any }) => {
|
||||
@ -428,84 +197,15 @@ const handleLegendItemClick = (args: { value: any }) => {
|
||||
|
||||
// custom layout list table
|
||||
const customLayoutListTableRef = ref(null);
|
||||
const customLayoutListTableOptions = ref({
|
||||
defaultRowHeight: 80
|
||||
const customLayoutListTableOptions = computed(() => {
|
||||
return {
|
||||
defaultRowHeight: 80,
|
||||
theme: themeStore.darkMode ? VTable.themes.DARK : VTable.themes.DEFAULT
|
||||
};
|
||||
});
|
||||
const customLayoutListTableRecords = ref([
|
||||
{
|
||||
bloggerId: 1,
|
||||
bloggerName: 'Virtual Anchor Xiaohua',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/flower.jpg',
|
||||
introduction:
|
||||
'Hi everyone, I am Xiaohua, the virtual host. I am a little fairy who likes games, animation and food. I hope to share happy moments with you through live broadcast.',
|
||||
fansCount: 400,
|
||||
worksCount: 10,
|
||||
viewCount: 5,
|
||||
city: 'Dream City',
|
||||
tags: ['game', 'anime', 'food']
|
||||
},
|
||||
{
|
||||
bloggerId: 2,
|
||||
bloggerName: 'Virtual anchor little wolf',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual anchor Little Wolf. I like music, travel and photography, and I hope to explore the beauty of the world with you through live broadcast.',
|
||||
fansCount: 800,
|
||||
worksCount: 20,
|
||||
viewCount: 15,
|
||||
city: 'City of Music',
|
||||
tags: ['music', 'travel', 'photography']
|
||||
},
|
||||
{
|
||||
bloggerId: 3,
|
||||
bloggerName: 'Virtual anchor bunny',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/rabbit.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual anchor Xiaotu. I like painting, handicrafts and beauty makeup. I hope to share creativity and fashion with you through live broadcast.',
|
||||
fansCount: 600,
|
||||
worksCount: 15,
|
||||
viewCount: 10,
|
||||
city: 'City of Art',
|
||||
tags: ['painting', 'handmade', 'beauty makeup']
|
||||
},
|
||||
{
|
||||
bloggerId: 4,
|
||||
bloggerName: 'Virtual anchor kitten',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/cat.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual host Kitty. I am a lazy cat who likes dancing, fitness and cooking. I hope to live a healthy and happy life with everyone through the live broadcast.',
|
||||
fansCount: 1000,
|
||||
worksCount: 30,
|
||||
viewCount: 20,
|
||||
city: 'Health City',
|
||||
tags: ['dance', 'fitness', 'cooking']
|
||||
},
|
||||
{
|
||||
bloggerId: 5,
|
||||
bloggerName: 'Virtual anchor Bear',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bear.jpg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual host Xiaoxiong. A little wise man who likes movies, reading and philosophy, I hope to explore the meaning of life with you through live broadcast.',
|
||||
fansCount: 1200,
|
||||
worksCount: 25,
|
||||
viewCount: 18,
|
||||
city: 'City of Wisdom',
|
||||
tags: ['Movie', 'Literature']
|
||||
},
|
||||
{
|
||||
bloggerId: 6,
|
||||
bloggerName: 'Virtual anchor bird',
|
||||
bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bird.jpeg',
|
||||
introduction:
|
||||
'Hello everyone, I am the virtual anchor Xiaoniao. I like singing, acting and variety shows. I hope to be happy with everyone through the live broadcast.',
|
||||
fansCount: 900,
|
||||
worksCount: 12,
|
||||
viewCount: 8,
|
||||
city: 'Happy City',
|
||||
tags: ['music', 'performance', 'variety']
|
||||
}
|
||||
]);
|
||||
const customLayoutListTableRecords = ref(customListRecords);
|
||||
const customLayoutListTableColumnStyle = ref({ fontFamily: 'Arial', fontSize: 12, fontWeight: 'bold' });
|
||||
|
||||
onMounted(() => {
|
||||
// pivot tablt records
|
||||
fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_Pivot_data.json')
|
||||
@ -529,7 +229,23 @@ onMounted(() => {
|
||||
<div class="h-full">
|
||||
<NSpace vertical :size="16">
|
||||
<NCard title="List Table" :bordered="false" class="h-full w-2/3 card-wrapper">
|
||||
<ListTable ref="listTableRef" :options="{}" :records="listRecords" height="400px">
|
||||
<ListTable ref="listTableRef" :options="listOptions" :records="listRecords" height="400px">
|
||||
<ListColumn field="Order ID" title="Order ID" width="auto" />
|
||||
<ListColumn field="Customer ID" title="Customer ID" width="auto" />
|
||||
<ListColumn field="Product Name" title="Product Name" width="auto" />
|
||||
<ListColumn field="Category" title="Category" width="auto" />
|
||||
<ListColumn field="Sub-Category" title="Sub-Category" width="auto" />
|
||||
<ListColumn field="Region" title="Region" width="auto" />
|
||||
<ListColumn field="City" title="City" width="auto" />
|
||||
<ListColumn field="Order Date" title="Order Date" width="auto" />
|
||||
<ListColumn field="Quantity" title="Quantity" width="auto" />
|
||||
<ListColumn field="Sales" title="Sales" width="auto" />
|
||||
<ListColumn field="Profit" title="Profit" width="auto" />
|
||||
</ListTable>
|
||||
</NCard>
|
||||
|
||||
<NCard title="Group Table" :bordered="false" class="h-full w-2/3 card-wrapper">
|
||||
<ListTable ref="groupTableRef" :options="groupOptions" :records="groupRecords" height="400px">
|
||||
<ListColumn field="Order ID" title="Order ID" width="auto" />
|
||||
<ListColumn field="Customer ID" title="Customer ID" width="auto" />
|
||||
<ListColumn field="Product Name" title="Product Name" width="auto" />
|
||||
@ -594,10 +310,10 @@ onMounted(() => {
|
||||
height="400px"
|
||||
>
|
||||
<!-- Order Number Column -->
|
||||
<ListColumn field="bloggerId" title="order number" width="100" />
|
||||
<ListColumn field="bloggerId" title="Order Number" width="100" />
|
||||
|
||||
<!-- Anchor Nickname Column with Custom Layout -->
|
||||
<ListColumn field="bloggerName" title="anchor nickname" :width="330">
|
||||
<ListColumn field="bloggerName" title="Anchor Nickname" :width="330">
|
||||
<template #customLayout="{ record, height, width }">
|
||||
<Group :height="height" :width="width" display="flex" flex-direction="row" flex-wrap="nowrap">
|
||||
<!-- Avatar Group -->
|
||||
|
Loading…
Reference in New Issue
Block a user