feat: 首页数据对接

This commit is contained in:
fyy
2025-09-06 00:49:44 +08:00
parent 9bd24de458
commit 6f987f29ef
11 changed files with 388 additions and 349 deletions

View File

@@ -1,4 +1,9 @@
import type { MeterRecordVO, MeterRecordForm, MeterRecordQuery, MeterRecordTrend } from './model'; import type {
MeterRecordVO,
MeterRecordForm,
MeterRecordQuery,
MeterRecordTrend,
} from './model';
import type { ID, IDS } from '#/api/common'; import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common'; import type { PageResult } from '#/api/common';
@@ -7,12 +12,15 @@ import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request'; import { requestClient } from '#/api/request';
/** /**
* 查询抄表记录列表 * 查询抄表记录列表
* @param params * @param params
* @returns 抄表记录列表 * @returns 抄表记录列表
*/ */
export function meterRecordList(params?: MeterRecordQuery) { export function meterRecordList(params?: MeterRecordQuery) {
return requestClient.get<PageResult<MeterRecordVO>>('/property/meterRecord/list', { params }); return requestClient.get<PageResult<MeterRecordVO>>(
'/property/meterRecord/list',
{ params },
);
} }
/** /**
@@ -62,10 +70,10 @@ export function meterRecordRemove(id: ID | IDS) {
/** /**
* 获取用电/气/水趋势分析数据 * 获取用电/气/水趋势分析数据
* *
* @param params * @param params
* @returns 用电/气/水趋势分析数据 * @returns 用电/气/水趋势分析数据
*/ */
export function meterRecordTrend(params: MeterRecordTrend) { export function meterRecordTrend(params: MeterRecordTrend) {
return requestClient.get<void>('/property/meterRecord/trend', { params }); return requestClient.get<any>('/property/meterRecord/trend', { params });
} }

View File

@@ -1,182 +1,179 @@
import type { PageQuery, BaseEntity } from '#/api/common' import type { PageQuery, BaseEntity } from '#/api/common';
export interface MeterRecordVO { export interface MeterRecordVO {
/** /**
* 记录ID * 记录ID
*/ */
id: string | number id: string | number;
/** /**
* 仪表编号 * 仪表编号
*/ */
meterId: string | number meterId: string | number;
/** /**
* 仪表类型 * 仪表类型
*/ */
meterType: string | number meterType: string | number;
/** /**
* 抄表员ID * 抄表员ID
*/ */
readerId: string | number readerId: string | number;
/** /**
* 抄表时间 * 抄表时间
*/ */
readingTime: string readingTime: string;
/** /**
* 当前读数 * 当前读数
*/ */
currentReading: number currentReading: number;
/** /**
* 上次读数 * 上次读数
*/ */
previousReading: number previousReading: number;
/** /**
* 用量 * 用量
*/ */
consumption: number consumption: number;
/** /**
* 抄表方式(1手动 2自动 3用户上报) * 抄表方式(1手动 2自动 3用户上报)
*/ */
readingMethod: number readingMethod: number;
/** /**
* 抄表照片 * 抄表照片
*/ */
imgOssid: string | number imgOssid: string | number;
} }
export interface MeterRecordForm extends BaseEntity { export interface MeterRecordForm extends BaseEntity {
/** /**
* 记录ID * 记录ID
*/ */
id?: string | number id?: string | number;
/** /**
* 仪表编号 * 仪表编号
*/ */
meterId?: string | number meterId?: string | number;
/** /**
* 抄表员ID * 抄表员ID
*/ */
readerId?: string | number readerId?: string | number;
/** /**
* 抄表时间 * 抄表时间
*/ */
readingTime?: string readingTime?: string;
/** /**
* 当前读数 * 当前读数
*/ */
currentReading?: number currentReading?: number;
/** /**
* 上次读数 * 上次读数
*/ */
previousReading?: number previousReading?: number;
/** /**
* 用量 * 用量
*/ */
consumption?: number consumption?: number;
/** /**
* 抄表方式(1手动 2自动 3用户上报) * 抄表方式(1手动 2自动 3用户上报)
*/ */
readingMethod?: number readingMethod?: number;
/** /**
* 抄表照片 * 抄表照片
*/ */
imgOssid?: string | number imgOssid?: string | number;
} }
export interface MeterRecordQuery extends PageQuery { export interface MeterRecordQuery extends PageQuery {
/** /**
* 仪表编号 * 仪表编号
*/ */
meterId?: string | number meterId?: string | number;
/** /**
* 抄表员ID * 抄表员ID
*/ */
readerId?: string | number readerId?: string | number;
/** /**
* 抄表时间 * 抄表时间
*/ */
readingTime?: string readingTime?: string;
/** /**
* 当前读数 * 当前读数
*/ */
currentReading?: number currentReading?: number;
/** /**
* 上次读数 * 上次读数
*/ */
previousReading?: number previousReading?: number;
/** /**
* 用量 * 用量
*/ */
consumption?: number consumption?: number;
/** /**
* 抄表方式(1手动 2自动 3用户上报) * 抄表方式(1手动 2自动 3用户上报)
*/ */
readingMethod?: number readingMethod?: number;
/** /**
* 抄表照片 * 抄表照片
*/ */
imgOssid?: string | number imgOssid?: string | number;
/** /**
* 日期范围参数 * 日期范围参数
*/ */
params?: any params?: any;
} }
export interface MeterRecordTrend { export interface MeterRecordTrend {
/** /**
* 仪表类型 * 仪表类型
*/ */
meterType?: string | number meterType?: string | number;
/** /**
* 仪表ID * 仪表ID
*/ */
meterId: string | number meterId: any;
/** /**
* 楼层ID * 楼层ID
*/ */
floorId: string | number floorId: any;
/** /**
* 日期 * 日期
*/ */
day?: string day?: string;
/** /**
* 月份 * 月份
*/ */
month?: string month?: string;
/** /**
* 年份 * 年份
*/ */
year?: string year?: string;
} }

View File

@@ -2,43 +2,32 @@
import type { EchartsUIType } from '@vben/plugins/echarts'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref, defineExpose } from 'vue';
import { meterRecordTrend } from '#/api/property/energyManagement/meterRecord'; import { meterRecordTrend } from '#/api/property/energyManagement/meterRecord';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);
// 添加日期选择相关逻辑 // 添加日期选择相关逻辑
const selectedDate = ref<string>(dayjs().format('YYYY-MM')); const selectedDate = ref<string>(dayjs().format('YYYY-MM'));
// 获取当月天数 // 获取当月天数
const getDaysInMonth = (date: string) => { const getDaysInMonth = (date: any) => {
const year = parseInt(date.split('-')[0]); const year = parseInt(date.split('-')[0]);
const month = parseInt(date.split('-')[1]); const month = parseInt(date.split('-')[1]);
const daysInMonth = new Date(year, month, 0).getDate(); const daysInMonth = new Date(year, month, 0).getDate();
return Array.from({ length: daysInMonth }, (_, i) => i + 1); return Array.from({ length: daysInMonth }, (_, i) => i + 1);
}; };
const getMeterRecordTrend = async (selectedDate: any) => {
const handleDateChange = () => { const res = await meterRecordTrend({
console.log('selectedDate', selectedDate.value); day: dayjs().format('YYYY-MM-DD'),
month: selectedDate.value,
getMeterRecordTrend();
};
const getMeterRecordTrend = async () => {
const res = await meterRecordTrend(
{
day: dayjs().format('YYYY-MM-DD'),
month: selectedDate.value || dayjs().format('YYYY-MM'),
year: dayjs().format('YYYY'), year: dayjs().format('YYYY'),
meterType: 1, meterType: 1,
meterId: null, meterId: null,
floorId: null, floorId: null,
} });
);
console.log(res);
// 处理返回的数据 // 处理返回的数据
const chartData = res.day.nowMonth.data || []; const chartData = res.day.nowMonth.data || [];
console.log(chartData);
// 创建一个映射,将日期和数值对应起来 // 创建一个映射,将日期和数值对应起来
const dataMap: Record<string, string> = {}; const dataMap: Record<string, string> = {};
@@ -50,7 +39,7 @@ console.log(chartData);
const days = getDaysInMonth(selectedDate.value); const days = getDaysInMonth(selectedDate.value);
// 为没有数据的日期填充0构建完整的数据数组 // 为没有数据的日期填充0构建完整的数据数组
const seriesData = days.map(day => { const seriesData = days.map((day) => {
return parseFloat(dataMap[day.toString()] || '0'); return parseFloat(dataMap[day.toString()] || '0');
}); });
renderEcharts({ renderEcharts({
@@ -70,7 +59,7 @@ console.log(chartData);
}, },
smooth: true, smooth: true,
type: 'line', type: 'line',
} },
], ],
tooltip: { tooltip: {
axisPointer: { axisPointer: {
@@ -120,13 +109,16 @@ console.log(chartData);
}); });
}; };
onMounted(async () => { onMounted(async () => {
getMeterRecordTrend(); getMeterRecordTrend(selectedDate);
});
// 暴露方法给父组件调用
defineExpose({
getMeterRecordTrend,
}); });
</script> </script>
<template> <template>
<div> <div>
<EchartsUI ref="chartRef" /> <EchartsUI ref="chartRef" />
</div> </div>
</template> </template>

View File

@@ -2,12 +2,35 @@
import type { EchartsUIType } from '@vben/plugins/echarts'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { watch, onMounted, ref, defineProps, computed } from 'vue';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);
const props = defineProps<{
statisticsData?: any[]; // 根据实际数据结构调整类型
}>();
// 在组件顶层定义 computed 属性
const chartData = computed(() => {
if (!props.statisticsData) return [];
return props.statisticsData.map((item) => ({
name: item.typeName,
value: item.total,
}));
});
onMounted(() => { // 监听数据变化,重新渲染图表
watch(
() => props.statisticsData,
(newData) => {
if (newData) {
updateChart();
}
},
{ immediate: true },
);
// 封装图表更新逻辑
const updateChart = () => {
renderEcharts({ renderEcharts({
legend: { legend: {
bottom: '2%', bottom: '2%',
@@ -22,12 +45,7 @@ onMounted(() => {
animationType: 'scale', animationType: 'scale',
avoidLabelOverlap: false, avoidLabelOverlap: false,
color: ['#5ab1ef', '#b6a2de', '#67e0e3', '#2ec7c9'], color: ['#5ab1ef', '#b6a2de', '#67e0e3', '#2ec7c9'],
data: [ data: chartData.value,
{ name: '搜索引擎', value: 1048 },
{ name: '直接访问', value: 735 },
{ name: '邮件营销', value: 580 },
// { name: '联盟广告', value: 484 },
],
emphasis: { emphasis: {
label: { label: {
fontSize: '12', fontSize: '12',
@@ -42,7 +60,7 @@ onMounted(() => {
labelLine: { labelLine: {
show: false, show: false,
}, },
name: '访问来源', name: '预警类型',
type: 'pie', type: 'pie',
}, },
], ],
@@ -50,6 +68,13 @@ onMounted(() => {
trigger: 'item', trigger: 'item',
}, },
}); });
};
onMounted(() => {
// 组件挂载时尝试更新图表
if (props.statisticsData) {
updateChart();
}
}); });
</script> </script>

View File

@@ -2,12 +2,34 @@
import type { EchartsUIType } from '@vben/plugins/echarts'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { watch, onMounted, ref, defineProps, computed } from 'vue';
const props = defineProps<{
workData?: any[]; // 根据实际数据结构调整类型
}>();
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);
const chartData = computed(() => {
if (!props.workData) return [];
return props.workData.map((item) => ({
name: item.type,
value: item.quantity,
}));
});
onMounted(() => { // 监听数据变化,重新渲染图表
watch(
() => props.workData,
(newData) => {
if (newData) {
updateChart();
}
},
{ immediate: true },
);
// 封装图表更新逻辑
const updateChart = () => {
renderEcharts({ renderEcharts({
series: [ series: [
{ {
@@ -18,15 +40,8 @@ onMounted(() => {
animationType: 'scale', animationType: 'scale',
center: ['50%', '50%'], center: ['50%', '50%'],
color: ['#5ab1ef', '#b6a2de', '#67e0e3', '#2ec7c9'], color: ['#5ab1ef', '#b6a2de', '#67e0e3', '#2ec7c9'],
data: [ data: chartData.value,
{ name: '外包', value: 500 }, name: '工单类型',
{ name: '定制', value: 310 },
{ name: '技术支持', value: 274 },
{ name: '远程', value: 400 },
].sort((a, b) => {
return a.value - b.value;
}),
name: '商业占比',
radius: '80%', radius: '80%',
roseType: 'radius', roseType: 'radius',
type: 'pie', type: 'pie',
@@ -37,6 +52,13 @@ onMounted(() => {
trigger: 'item', trigger: 'item',
}, },
}); });
};
onMounted(() => {
// 组件挂载时尝试更新图表
if (props.workData) {
updateChart();
}
}); });
</script> </script>

View File

@@ -2,12 +2,41 @@
import type { EchartsUIType } from '@vben/plugins/echarts'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { watch, onMounted, ref, defineProps, computed } from 'vue';
const props = defineProps<{
statusData?: any[]; // 根据实际数据结构调整类型
}>();
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);
const chartData = computed(() => {
if (!props.statusData) return [];
return props.statusData.map((item) => ({
name:
item.state == 0
? '使用中'
: item.state == 1
? '停用中'
: item.state == 2
? '已报废'
: '闲置中',
value: item.quantity,
}));
});
onMounted(() => { // 监听数据变化,重新渲染图表
watch(
() => props.statusData,
(newData) => {
if (newData) {
updateChart();
}
},
{ immediate: true },
);
// 封装图表更新逻辑
const updateChart = () => {
renderEcharts({ renderEcharts({
legend: { legend: {
bottom: '2%', bottom: '2%',
@@ -22,12 +51,7 @@ onMounted(() => {
animationType: 'scale', animationType: 'scale',
avoidLabelOverlap: false, avoidLabelOverlap: false,
color: ['#5ab1ef', '#b6a2de', '#67e0e3', '#2ec7c9'], color: ['#5ab1ef', '#b6a2de', '#67e0e3', '#2ec7c9'],
data: [ data: chartData.value,
{ name: '搜索引擎', value: 1048 },
{ name: '直接访问', value: 735 },
{ name: '邮件营销', value: 580 },
// { name: '联盟广告', value: 484 },
],
emphasis: { emphasis: {
label: { label: {
fontSize: '12', fontSize: '12',
@@ -47,7 +71,7 @@ onMounted(() => {
labelLine: { labelLine: {
show: false, show: false,
}, },
name: '访问来源', name: '设备状态',
radius: ['40%', '65%'], radius: ['40%', '65%'],
type: 'pie', type: 'pie',
}, },
@@ -56,6 +80,14 @@ onMounted(() => {
trigger: 'item', trigger: 'item',
}, },
}); });
};
onMounted(() => {
console.log('Child component mounted, props:', props.statusData);
// 组件挂载时尝试更新图表
if (props.statusData) {
updateChart();
}
}); });
</script> </script>

View File

@@ -1,12 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { AnalysisOverviewItem } from '@vben/common-ui'; import { AnalysisChartCard, AnalysisOverview } from '@vben/common-ui';
import type { TabOption } from '@vben/types';
import {
AnalysisChartCard,
AnalysisChartsTabs,
AnalysisOverview,
} from '@vben/common-ui';
import { import {
SvgBellIcon, SvgBellIcon,
SvgCakeIcon, SvgCakeIcon,
@@ -18,20 +11,21 @@ import AnalyticsTrends from './analytics-trends.vue';
import AnalyticsVisitsData from './analytics-visits-data.vue'; import AnalyticsVisitsData from './analytics-visits-data.vue';
import AnalyticsVisitsSales from './analytics-visits-sales.vue'; import AnalyticsVisitsSales from './analytics-visits-sales.vue';
import AnalyticsVisitsSource from './analytics-visits-source.vue'; import AnalyticsVisitsSource from './analytics-visits-source.vue';
import AnalyticsVisits from './analytics-visits.vue'; import { ref, onMounted } from 'vue';
import { ref,onMounted } from 'vue';
import { DatePicker } from 'ant-design-vue'; import { DatePicker } from 'ant-design-vue';
import { Button, Radio } from 'ant-design-vue'; import { Radio } from 'ant-design-vue';
import type { RadioChangeEvent } from 'ant-design-vue'; import {
import {getIndexCount,getStatisticsCurrDay,getStatistics} from '#/api/analytics/index.ts'; getIndexCount,
const overviewItems =ref<AnalysisOverviewItem[]>( getStatisticsCurrDay,
[ getStatistics,
} from '#/api/analytics/index';
const overviewItems = ref<any[]>([
{ {
icon: SvgCardIcon, icon: SvgCardIcon,
title: '今日访客量', title: '今日访客量',
totalTitle: '总访客量', totalTitle: '总访客量',
totalValue: 78, totalValue: 0,
value: 15, value: 0,
}, },
{ {
icon: SvgCakeIcon, icon: SvgCakeIcon,
@@ -44,8 +38,8 @@ const overviewItems =ref<AnalysisOverviewItem[]>(
icon: SvgDownloadIcon, icon: SvgDownloadIcon,
title: '今日预警数量', title: '今日预警数量',
totalTitle: '总预警量', totalTitle: '总预警量',
totalValue: 17, totalValue: 0,
value: 2, value: 0,
}, },
{ {
icon: SvgBellIcon, icon: SvgBellIcon,
@@ -54,44 +48,44 @@ const overviewItems =ref<AnalysisOverviewItem[]>(
totalValue: 0, totalValue: 0,
value: 0, value: 0,
}, },
] ]);
);
const chartTabs: TabOption[] = [
{
label: '电量',
value: 'trends',
},
// {
// label: '水量',
// value: 'visits',
// },
];
//tab选择 //tab选择
const timeUnit = ref(1); const timeUnit = ref(1);
// 月份选择 // 月份选择
const selectedDate = ref(''); const selectedDate = ref<any>(null);
const handleDateChange = (date: string) => { const paramDate = ref(null);
selectedDate.value = date;
// 在这里可以添加根据选择日期筛选数据的逻辑 const statisticsList = ref<any>();
console.log('选择的日期:', date); const workList = ref<any>();
const statusDataList = ref<any>();
const analyticsTrendsRef = ref<InstanceType<typeof AnalyticsTrends> | null>(
null,
);
const handleDateChange = (date: any) => {
paramDate.value = date.format('YYYY-MM');
// 调用子组件的方法
if (
analyticsTrendsRef.value &&
analyticsTrendsRef.value.getMeterRecordTrend
) {
analyticsTrendsRef.value.getMeterRecordTrend(paramDate);
}
}; };
// 工单数量 // 工单数量
const indexCount = ref(0);
async function getIndex() { async function getIndex() {
console.log(123);
const res = await getIndexCount(); const res = await getIndexCount();
console.log(res); overviewItems.value[3].value = res.workOrdersToday;
// overviewItems[3].value = res.workOrdersToday overviewItems.value[3].totalValue = res.workOrdersTotal;
// overviewItems[3].totalValue = res.workOrdersTotald overviewItems.value[0].value = res.visitorsToday;
console.log(overviewItems); overviewItems.value[0].totalValue = res.visitorsTotal;
workList.value = res.satisfactionChartList;
statusDataList.value = res.statusChartVoChartList;
} }
// 车流量 // 车流量
async function getCarCount() { async function getCarCount() {
const startDate = new Date(); const startDate = new Date();
startDate.setHours(0, 0, 0, 0); startDate.setHours(0, 0, 0, 0);
const endDate = new Date(); const endDate = new Date();
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
@@ -101,102 +95,87 @@ async function getCarCount() {
const localTime = new Date(date.getTime() - timezoneOffset); const localTime = new Date(date.getTime() - timezoneOffset);
return localTime.toISOString().slice(0, -1) + 'Z'; return localTime.toISOString().slice(0, -1) + 'Z';
}; };
const response = await fetch( const response = await fetch(
'https://server.cqnctc.com:6081/web/lot/net/queryOrderParkForPage', 'https://server.cqnctc.com:6081/web/lot/net/queryOrderParkForPage',
{ {
method: 'POST', method: 'POST',
headers: { headers: {
'X-Auth-Token': `${sessionStorage.getItem('token')}`, 'X-Auth-Token': `${sessionStorage.getItem('token')}`,
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Bearer ${sessionStorage.getItem('token')}`, Authorization: `Bearer ${sessionStorage.getItem('token')}`,
Accept: 'application/json, text/plain, */*', Accept: 'application/json, text/plain, */*',
}, },
body: JSON.stringify({ body: JSON.stringify({
pageReq: { pageReq: {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10,
},
plNos: ['PFN000000012', 'PFN000000022', 'PFN000000025'],
parkInBeginTime: toLocalISOString(startDate),
parkInEndTime: toLocalISOString(endDate),
orgId: 10012,
parkOrderTypes: [100, 200, 201, 300, 500],
terminalSource: 50,
remark: '',
}),
}, },
plNos: [ );
"PFN000000012", const result = await response.json();
"PFN000000022", overviewItems.value[1].value = result.data.pageTotals;
"PFN000000025" const response2 = await fetch(
], 'https://server.cqnctc.com:6081/web/lot/net/queryOrderParkForPage',
parkInBeginTime: toLocalISOString(startDate), {
parkInEndTime: toLocalISOString(endDate), method: 'POST',
orgId: 10012, headers: {
parkOrderTypes: [ 'X-Auth-Token': `${sessionStorage.getItem('token')}`,
100, 'Content-Type': 'application/json',
200, Authorization: `Bearer ${sessionStorage.getItem('token')}`,
201, Accept: 'application/json, text/plain, */*',
300, },
500 body: JSON.stringify({
], pageReq: {
terminalSource: 50, pageNum: 1,
remark: "" pageSize: 10,
}), },
}, plNos: ['PFN000000012', 'PFN000000022', 'PFN000000025'],
); parkInBeginTime: '',
const result = await response.json(); parkInEndTime: '',
overviewItems.value[1].value = result.data.pageTotals; orgId: 10012,
const response2 = await fetch( parkOrderTypes: [100, 200, 201, 300, 500],
'https://server.cqnctc.com:6081/web/lot/net/queryOrderParkForPage', terminalSource: 50,
{ remark: '',
method: 'POST', }),
headers: {
'X-Auth-Token': `${sessionStorage.getItem('token')}`,
'Content-Type': 'application/json',
Authorization: `Bearer ${sessionStorage.getItem('token')}`,
Accept: 'application/json, text/plain, */*',
},
body: JSON.stringify({
pageReq: {
pageNum: 1,
pageSize: 10
}, },
plNos: [ );
"PFN000000012", const result2 = await response2.json();
"PFN000000022", overviewItems.value[1].totalValue = result2.data.pageTotals;
"PFN000000025"
],
parkInBeginTime: "",
parkInEndTime: "",
orgId: 10012,
parkOrderTypes: [
100,
200,
201,
300,
500
],
terminalSource: 50,
remark: ""
}),
},
);
const result2 = await response2.json();
overviewItems.value[1].totalValue = result2.data.pageTotals;
} }
// 预警 // 预警
async function getStatisticsCurrDayCount() { async function getStatisticsCurrDayCount() {
const res = await getStatisticsCurrDay(); const res = await getStatisticsCurrDay();
console.log(res); let total = 0;
for (const item of res) {
total += item.total;
}
overviewItems.value[2].value = total;
} }
async function getStatisticsCount() { async function getStatisticsCount() {
const res = await getStatistics(); const res = await getStatistics();
console.log(res); let total = 0;
for (const item of res) {
total += item.total;
}
overviewItems.value[2].totalValue = total;
statisticsList.value = res;
} }
// 电量 // 电量
onMounted(() => { onMounted(() => {
getIndex(); getIndex();
getCarCount(); getCarCount();
getStatisticsCurrDayCount(); getStatisticsCurrDayCount();
getStatisticsCount(); getStatisticsCount();
}) });
</script> </script>
<template> <template>
@@ -210,19 +189,12 @@ onMounted(() => {
<AnalyticsVisits /> <AnalyticsVisits />
</template> </template>
</AnalysisChartsTabs> --> </AnalysisChartsTabs> -->
<div class="mt-5 bg-white rounded-lg"> <div class="mt-5 rounded-lg bg-white">
<div <div
class="p-5 flex items-center justify-between " class="flex items-center justify-between p-5"
style=" style="width: 100%; height: 100px"
width: 100%;
height: 100px;
"
> >
<Radio.Group <Radio.Group v-model:value="timeUnit" size="large">
v-model:value="timeUnit"
@change="handleViewModeChange"
size="large"
>
<Radio.Button value="1">电量</Radio.Button> <Radio.Button value="1">电量</Radio.Button>
</Radio.Group> </Radio.Group>
<DatePicker <DatePicker
@@ -234,21 +206,24 @@ onMounted(() => {
/> />
</div> </div>
<div v-if="timeUnit == 1"> <div v-if="timeUnit == 1">
<AnalyticsTrends /> <AnalyticsTrends
ref="analyticsTrendsRef"
:selected-date="selectedDate"
/>
</div> </div>
</div> </div>
<div class="mt-5 w-full md:flex"> <div class="mt-5 w-full md:flex">
<AnalysisChartCard class="mt-5 md:mr-4 md:mt-0 md:w-1/3" title="预警类型"> <AnalysisChartCard class="mt-5 md:mr-4 md:mt-0 md:w-1/3" title="预警类型">
<AnalyticsVisitsData /> <AnalyticsVisitsData :statisticsData="statisticsList" />
</AnalysisChartCard> </AnalysisChartCard>
<AnalysisChartCard <AnalysisChartCard
class="mt-5 md:mr-4 md:mt-0 md:w-1/3" class="mt-5 md:mr-4 md:mt-0 md:w-1/3"
title="设备使用状态" title="设备使用状态"
> >
<AnalyticsVisitsSource /> <AnalyticsVisitsSource :statusData="statusDataList" />
</AnalysisChartCard> </AnalysisChartCard>
<AnalysisChartCard class="mt-5 md:mt-0 md:w-1/3" title="工单类型"> <AnalysisChartCard class="mt-5 md:mt-0 md:w-1/3" title="工单类型">
<AnalyticsVisitsSales /> <AnalyticsVisitsSales :workData="workList" />
</AnalysisChartCard> </AnalysisChartCard>
</div> </div>
</div> </div>

View File

@@ -13,7 +13,7 @@ let arr: CommunityVO[] = [];
const communitySelect: VbenFormSchema = { const communitySelect: VbenFormSchema = {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'communityId', fieldName: 'communityId',
label: '社区', label: '园区名称',
componentProps: { componentProps: {
resultField: 'list', // 根据API返回结构调整 resultField: 'list', // 根据API返回结构调整
labelField: 'communityName', labelField: 'communityName',
@@ -46,11 +46,11 @@ export const querySchema: FormSchemaGetter = () => [
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 }, { type: 'checkbox', width: 60 },
{ {
title: '社区', title: '园区名称',
field: 'communityText', field: 'communityText',
}, },
{ {
title: '建筑', title: '建筑名称',
field: 'buildingName', field: 'buildingName',
}, },
{ {
@@ -73,10 +73,10 @@ export const columns: VxeGridProps['columns'] = [
title: '竣工日期', title: '竣工日期',
field: 'completionDate', field: 'completionDate',
}, },
{ // {
title: '地址', // title: '地址',
field: 'addr', // field: 'addr',
}, // },
{ {
title: '建筑面积(㎡)', title: '建筑面积(㎡)',
field: 'area', field: 'area',
@@ -123,8 +123,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'floorCount', fieldName: 'floorCount',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:1, min: 1,
precision:0, precision: 0,
}, },
}, },
{ {
@@ -132,8 +132,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'unitCount', fieldName: 'unitCount',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:1, min: 1,
precision:0, precision: 0,
}, },
}, },
{ {
@@ -150,8 +150,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'elevatorCount', fieldName: 'elevatorCount',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:0, precision: 0,
}, },
}, },
{ {
@@ -163,19 +163,19 @@ export const modalSchema: FormSchemaGetter = () => [
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
}, },
}, },
{ // {
label: '地址', // label: '地址',
fieldName: 'addr', // fieldName: 'addr',
component: 'Input', // component: 'Input',
rules: 'required', // rules: 'required',
}, // },
{ {
label: '建筑面积(㎡)', label: '建筑面积(㎡)',
fieldName: 'area', fieldName: 'area',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:2, precision: 2,
}, },
}, },
{ {
@@ -183,8 +183,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'insideInArea', fieldName: 'insideInArea',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:2, precision: 2,
}, },
}, },
{ {
@@ -192,8 +192,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'sharedArea', fieldName: 'sharedArea',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:2, precision: 2,
}, },
}, },
]; ];

View File

@@ -1,19 +1,24 @@
import type {FormSchemaGetter} from '#/adapter/form'; import type { FormSchemaGetter } from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import {getPopupContainer} from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import {getDictOptions} from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import {DictEnum} from '@vben/constants'; import { DictEnum } from '@vben/constants';
import {renderDict} from "#/utils/render"; import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
// {
// component: 'Select',
// componentProps: {
// getPopupContainer,
// options: getDictOptions(DictEnum.wy_sqlx),
// },
// fieldName: 'communityType',
// label: '园区类型',
// },
{ {
component: 'Select', component: 'Input',
componentProps: { fieldName: 'communityName',
getPopupContainer, label: '园区名称',
options: getDictOptions(DictEnum.wy_sqlx),
},
fieldName: 'communityType',
label: '园区类型',
}, },
{ {
component: 'Input', component: 'Input',
@@ -25,20 +30,20 @@ export const querySchema: FormSchemaGetter = () => [
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [ // export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
{type: 'checkbox', width: 60}, { type: 'checkbox', width: 60 },
{ {
title: '园区名称', title: '园区名称',
field: 'communityName', field: 'communityName',
}, },
{ // {
title: '园区类型', // title: '园区类型',
field: 'communityType', // field: 'communityType',
slots: { // slots: {
default: ({row}) => { // default: ({row}) => {
return renderDict(row.communityType, DictEnum.wy_sqlx) // return renderDict(row.communityType, DictEnum.wy_sqlx)
} // }
}, // },
}, // },
{ {
title: '城市', title: '城市',
field: 'cityFullName', field: 'cityFullName',
@@ -78,7 +83,7 @@ export const columns: VxeGridProps['columns'] = [
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: {default: 'action'}, slots: { default: 'action' },
title: '操作', title: '操作',
width: 180, width: 180,
}, },
@@ -182,7 +187,7 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Textarea', component: 'Textarea',
}, },
{ {
label: '社区/园区图片', label: '园区图片',
fieldName: 'img', fieldName: 'img',
component: 'ImageUpload', component: 'ImageUpload',
componentProps: { componentProps: {

View File

@@ -5,7 +5,7 @@ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Input', component: 'Input',
fieldName: 'floorName', fieldName: 'floorName',
label: '楼栋号', label: '楼层名称',
}, },
]; ];
@@ -14,22 +14,22 @@ export const querySchema: FormSchemaGetter = () => [
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 }, { type: 'checkbox', width: 60 },
{ {
title: '社区', title: '园区名称',
field: 'communityText', field: 'communityText',
}, },
{ {
title: '建筑', title: '建筑名称',
field: 'buildingText', field: 'buildingText',
}, },
{ {
title: '楼栋号', title: '楼层名称',
field: 'floorName', field: 'floorName',
}, },
{ // {
title: '楼层号', // title: '楼层号',
field: 'floorNumber', // field: 'floorNumber',
}, // },
/* { /* {
title: '楼层类型', title: '楼层类型',
field: 'floorType', field: 'floorType',
},*/ },*/
@@ -78,33 +78,21 @@ export const modalSchema: FormSchemaGetter = () => [
defaultValue: undefined, defaultValue: undefined,
label: '建筑名称', label: '建筑名称',
rules: 'selectRequired', rules: 'selectRequired',
formItemClass:'col-span-2', formItemClass: 'col-span-2',
}, },
{ {
label: '楼栋号', label: '楼层名称',
fieldName: 'floorName', fieldName: 'floorName',
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
}, },
// {
// label: '楼层号',
// fieldName: 'floorNumber',
// component: 'Input',
// rules: 'required',
// },
/*{
label: '楼层类型',
fieldName: 'floorType',
component: 'Select',
componentProps: {},
},*/
{ {
label: '房间数量', label: '房间数量',
fieldName: 'roomCount', fieldName: 'roomCount',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:0, precision: 0,
}, },
}, },
{ {
@@ -112,8 +100,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'floorHeight', fieldName: 'floorHeight',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:0, precision: 0,
}, },
}, },
{ {
@@ -121,8 +109,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'area', fieldName: 'area',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:2, precision: 2,
}, },
}, },
{ {
@@ -130,8 +118,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'insideInArea', fieldName: 'insideInArea',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:2, precision: 2,
}, },
}, },
{ {
@@ -139,8 +127,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'sharedArea', fieldName: 'sharedArea',
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min:0, min: 0,
precision:2, precision: 2,
}, },
}, },
]; ];

View File

@@ -5,11 +5,6 @@ import { getDictOptions } from '#/utils/dict';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { renderDict } from '#/utils/render'; import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'communityName',
label: '社区',
},
{ {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
@@ -44,11 +39,11 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '是否重要', title: '是否重要',
field: 'isMatter', field: 'isMatter',
slots:{ slots: {
default:({row})=>{ default: ({ row }) => {
return renderDict(row.isMatter,'wy_fjzydj') return renderDict(row.isMatter, 'wy_fjzydj');
} },
} },
}, },
{ {
@@ -96,25 +91,25 @@ export const modalSchema: FormSchemaGetter = () => [
getPopupContainer, getPopupContainer,
options: getDictOptions(DictEnum.wy_room_type), options: getDictOptions(DictEnum.wy_room_type),
}, },
rules:'selectRequired' rules: 'selectRequired',
}, },
{ {
label: '建筑面积', label: '建筑面积',
fieldName: 'area', fieldName: 'area',
component: 'InputNumber', component: 'InputNumber',
componentProps:{ componentProps: {
min:0, min: 0,
}, },
rules:'required' rules: 'required',
}, },
{ {
label: '使用面积', label: '使用面积',
fieldName: 'insideInArea', fieldName: 'insideInArea',
component: 'InputNumber', component: 'InputNumber',
componentProps:{ componentProps: {
min:0, min: 0,
}, },
rules:'required' rules: 'required',
}, },
{ {
label: '是否重要', label: '是否重要',
@@ -123,7 +118,7 @@ export const modalSchema: FormSchemaGetter = () => [
componentProps: { componentProps: {
options: getDictOptions('wy_fjzydj'), options: getDictOptions('wy_fjzydj'),
}, },
rules:'selectRequired' rules: 'selectRequired',
}, },
{ {
label: '状态', label: '状态',
@@ -133,7 +128,7 @@ export const modalSchema: FormSchemaGetter = () => [
getPopupContainer, getPopupContainer,
options: getDictOptions(DictEnum.wy_fjzt), options: getDictOptions(DictEnum.wy_fjzt),
}, },
rules:'selectRequired' rules: 'selectRequired',
}, },
{ {
label: '房间图片', label: '房间图片',