feat:【ele】【crm】statistics 的部分(performance)

This commit is contained in:
YunaiV
2025-11-19 09:42:23 +08:00
parent 9dbfe579e2
commit 99cd094cb0
4 changed files with 30 additions and 31 deletions

View File

@@ -1,11 +1,10 @@
import type { VbenFormSchema } from '#/adapter/form';
import { useUserStore } from '@vben/stores';
import { beginOfDay, endOfDay, formatDateTime, handleTree } from '@vben/utils';
import { handleTree } from '@vben/utils';
import { getSimpleDeptList } from '#/api/system/dept';
import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils';
const userStore = useUserStore();
@@ -28,21 +27,15 @@ export const customerSummaryTabs = [
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'times',
label: '时间范围',
component: 'RangePicker',
// TODO @AI这里有问题只选择年份
fieldName: 'time',
label: '选择年份',
component: 'DatePicker',
componentProps: {
...getRangePickerDefaultProps(),
presets: {},
picker: 'year',
showTime: false,
format: 'YYYY',
valueFormat: 'YYYY',
},
defaultValue: [
formatDateTime(beginOfDay(new Date(new Date().getFullYear(), 0, 1))),
formatDateTime(endOfDay(new Date(new Date().getFullYear(), 11, 31))),
],
defaultValue: new Date().getFullYear().toString(),
},
{
fieldName: 'deptId',

View File

@@ -8,6 +8,7 @@ import { onMounted, ref } from 'vue';
import { ContentWrap, Page } from '@vben/common-ui';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { beginOfDay, endOfDay, formatDateTime } from '@vben/utils';
import { Tabs } from 'ant-design-vue';
@@ -68,6 +69,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
async function handleTabChange(key: any) {
activeTabName.value = key;
const queryParams = (await formApi.getValues()) as any;
// 将年份转换为年初和年末的日期时间
const selectYear = Number.parseInt(queryParams.time);
queryParams.times = [];
queryParams.times[0] = formatDateTime(beginOfDay(new Date(selectYear, 0, 1)));
queryParams.times[1] = formatDateTime(endOfDay(new Date(selectYear, 11, 31)));
let data: any[] = [];
const columnsData: any[] = [];
let tableData: any[] = [];

View File

@@ -1,11 +1,10 @@
import type { VbenFormSchema } from '#/adapter/form';
import { useUserStore } from '@vben/stores';
import { beginOfDay, endOfDay, formatDate, handleTree } from '@vben/utils';
import { handleTree } from '@vben/utils';
import { getSimpleDeptList } from '#/api/system/dept';
import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils';
const userStore = useUserStore();
@@ -28,26 +27,15 @@ export const customerSummaryTabs = [
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'times',
label: '时间范围',
component: 'RangePicker',
fieldName: 'time',
label: '选择年份',
component: 'DatePicker',
componentProps: {
...getRangePickerDefaultProps(),
shortcuts: [],
// TODO @AI这里有问题只选择年份
type: 'year',
format: 'YYYY',
valueFormat: 'YYYY',
},
defaultValue: [
formatDate(
beginOfDay(new Date(new Date().getFullYear(), 0, 1)),
'YYYY-MM-DD HH:mm:ss',
),
formatDate(
endOfDay(new Date(new Date().getFullYear(), 11, 31)),
'YYYY-MM-DD HH:mm:ss',
),
],
defaultValue: new Date().getFullYear().toString(),
},
{
fieldName: 'deptId',

View File

@@ -8,6 +8,7 @@ import { onMounted, ref } from 'vue';
import { ContentWrap, Page } from '@vben/common-ui';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { beginOfDay, endOfDay, formatDate } from '@vben/utils';
import { ElTabPane, ElTabs } from 'element-plus';
@@ -68,6 +69,17 @@ const [Grid, gridApi] = useVbenVxeGrid({
async function handleTabChange(key: any) {
activeTabName.value = key;
const queryParams = (await formApi.getValues()) as any;
// 将年份转换为年初和年末的日期时间
const selectYear = Number.parseInt(queryParams.time);
queryParams.times = [];
queryParams.times[0] = formatDate(
beginOfDay(new Date(selectYear, 0, 1)),
'YYYY-MM-DD HH:mm:ss',
);
queryParams.times[1] = formatDate(
endOfDay(new Date(selectYear, 11, 31)),
'YYYY-MM-DD HH:mm:ss',
);
let data: any[] = [];
const columnsData: any[] = [];
let tableData: any[] = [];