From 3031809692d07c43b21981869211ef11a9bbcfb0 Mon Sep 17 00:00:00 2001 From: fyy <2717885210@qq.com> Date: Sat, 5 Jul 2025 09:11:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/property/reportStatistics/index.ts | 70 +++++++++++++++++++ .../api/property/reportStatistics/model.d.ts | 7 ++ .../reportStatistics/index.vue | 51 ++++++++++++-- 3 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 apps/web-antd/src/api/property/reportStatistics/index.ts create mode 100644 apps/web-antd/src/api/property/reportStatistics/model.d.ts diff --git a/apps/web-antd/src/api/property/reportStatistics/index.ts b/apps/web-antd/src/api/property/reportStatistics/index.ts new file mode 100644 index 00000000..c3e0b5d9 --- /dev/null +++ b/apps/web-antd/src/api/property/reportStatistics/index.ts @@ -0,0 +1,70 @@ +import type { statisticsByTimeQuery } from './model'; + +import type { ID, IDS } from '#/api/common'; +import type { PageResult } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +// /** +// * 查询绿植租赁-租赁方案列表 +// * @param params +// * @returns 绿植租赁-租赁方案列表 +// */ +// export function rentalPlanList(params?: RentalPlanQuery) { +// return requestClient.get>('/property/rentalPlan/list', { params }); +// } + +// /** +// * 导出绿植租赁-租赁方案列表 +// * @param params +// * @returns 绿植租赁-租赁方案列表 +// */ +// export function rentalPlanExport(params?: RentalPlanQuery) { +// return commonExport('/property/rentalPlan/export', params ?? {}); +// } + +// /** +// * 查询绿植租赁-租赁方案详情 +// * @param id id +// * @returns 绿植租赁-租赁方案详情 +// */ +// export function rentalPlanInfo(id: ID) { +// return requestClient.get(`/property/rentalPlan/${id}`); +// } + +// /** +// * 新增绿植租赁-租赁方案 +// * @param data +// * @returns void +// */ +// export function rentalPlanAdd(data: RentalPlanForm) { +// return requestClient.postWithMsg('/property/rentalPlan', data); +// } + +// /** +// * 更新绿植租赁-租赁方案 +// * @param data +// * @returns void +// */ +// export function rentalPlanUpdate(data: RentalPlanForm) { +// return requestClient.putWithMsg('/property/rentalPlan', data); +// } + +// /** +// * 删除绿植租赁-租赁方案 +// * @param id id +// * @returns void +// */ +// export function rentalPlanRemove(id: ID | IDS) { +// return requestClient.deleteWithMsg(`/property/rentalPlan/${id}`); +// } + +/** + * 查询订单数量趋势 + * @param timeUnit + * @returns void + */ +export function statisticsByTime(params:statisticsByTimeQuery) { + return requestClient.get('/property/rentalOrder/statisticsByTime', { params }); +} diff --git a/apps/web-antd/src/api/property/reportStatistics/model.d.ts b/apps/web-antd/src/api/property/reportStatistics/model.d.ts new file mode 100644 index 00000000..2f16cdbc --- /dev/null +++ b/apps/web-antd/src/api/property/reportStatistics/model.d.ts @@ -0,0 +1,7 @@ +export interface statisticsByTimeQuery { + /** + * 日期范围参数(1日 2周 3月) + * + */ + timeUnit?: number; +} diff --git a/apps/web-antd/src/views/property/greenPlantRentalManagement/reportStatistics/index.vue b/apps/web-antd/src/views/property/greenPlantRentalManagement/reportStatistics/index.vue index 7e65cb3b..d5fd0d37 100644 --- a/apps/web-antd/src/views/property/greenPlantRentalManagement/reportStatistics/index.vue +++ b/apps/web-antd/src/views/property/greenPlantRentalManagement/reportStatistics/index.vue @@ -7,6 +7,8 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { Button } from 'ant-design-vue'; +import { statisticsByTime } from '#/api/property/reportStatistics'; + const orderLineRef = ref(); const leasePieRef = ref(); const customerTypesBarRef = ref(); @@ -27,14 +29,18 @@ const { renderEcharts: renderConservationTasksBar } = useEcharts( const { renderEcharts: renderMaintenanceQualityScoresPei } = useEcharts( maintenanceQualityScoresPeiRef, ); +const timeUnit = ref(1) -onMounted(() => { +onMounted(async () => { + // 查询订单数量趋势 + const res = await statisticsByTime({ timeUnit: timeUnit.value }); + const xAxisData = res?.time ?? []; + const seriesData = res?.counts ?? []; renderEcharts({ - title: { text: '订单数量趋势' }, tooltip: { trigger: 'axis' }, xAxis: { type: 'category', - data: ['1月', '2月', '3月', '4月', '5月', '6月'], + data: xAxisData, boundaryGap: false, }, yAxis: { type: 'value' }, @@ -42,7 +48,7 @@ onMounted(() => { { name: '订单数', type: 'line', - data: [120, 132, 101, 134, 90, 230], + data: seriesData, smooth: true, }, ], @@ -199,6 +205,15 @@ onMounted(() => { ], }); }); +const nodeOptions = [ + { label: '日', value: 1 }, + { label: '周', value: 2 }, + { label: '月', value: 3 }, +]; +function handleAssociationChange(e: any) { + console.log(e); + timeUnit.value = e.target.value; +}