feat: 接入大屏修复bug

This commit is contained in:
fyy
2025-07-10 17:52:54 +08:00
parent 0d2a4db6a6
commit b1d0c117fc
60 changed files with 6394 additions and 20 deletions

View File

@@ -12,6 +12,7 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
import productDetailModal from './rentalPlan-detial-modal.vue';
import { getDictOptions } from '#/utils/dict';
import { Item } from 'ant-design-vue/es/menu';
const emit = defineEmits<{ reload: [] }>();
@@ -69,7 +70,10 @@ const [BasicModal, modalApi] = useVbenModal({
if ((isUpdate.value || isReadonly.value) && id) {
const record = await rentalPlanInfo(id);
// 后端返回绿植产品包列表结构处理
detailTable.value = record.productList.map((item:any) => item.product);
detailTable.value = record.productList.map((item:any) => {...item.product,Item.productNum});
console.log(detailTable.value);
await formApi.setValues(record);
}
await markInitialized();

View File

@@ -87,10 +87,14 @@ onMounted(async () => {
data: xAxisData.value,
boundaryGap: false,
},
yAxis: { type: 'value' },
yAxis: { type: 'value',
axisLabel: {
formatter: (value) => `${value * 100}%`
},
},
series: [
{
name: '订单',
name: '订单趋势',
type: 'line',
data: seriesData.value ||[],
smooth: true,
@@ -123,17 +127,22 @@ onMounted(async () => {
],
});
renderCustomerTypesBar({
title: { text: '客户类型分' },
title: { text: '客户类型分' },
tooltip: { trigger: 'axis' },
xAxis: {
type: 'category',
data: countByCusTypeData.type || [],
data: ['企业客户','个人客户','政府机构','商业地产','其他'],
boundaryGap: true,
},
yAxis: { type: 'value' },
yAxis: { type: 'value',
axisLabel: {
// formatter: (value: number) => `${parseInt(value.toString())}`
},
// interval: 0,
},
series: [
{
name: '订单数',
name: '客户数',
type: 'bar',
data: countByCusTypeData.counts || [],
},
@@ -141,16 +150,28 @@ onMounted(async () => {
});
renderCustomerRenewalLine({
title: { text: '客户续租率趋势' },
tooltip: { trigger: 'axis' },
tooltip: { trigger: 'axis',
formatter: function(params:any) {
let result = params[0].axisValue + '<br/>';
params.forEach((item:any) => {
result += item.marker + item.seriesName + '' + item.data + '%<br/>';
});
return result;
}
},
xAxis: {
type: 'category',
data: countRenewRateData.month || [],
boundaryGap: false,
},
yAxis: { type: 'value' },
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value}%',
}, },
series: [
{
name: '订单数',
name: '续租率',
type: 'line',
data: countRenewRateData.rate || [],
smooth: true,
@@ -162,6 +183,19 @@ onMounted(async () => {
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
formatter: function(params:any) {
// params 是一个数组,包含每个系列的当前项
let result = params[0].axisValue + '<br/>';
params.forEach((item:any) => {
if (item.seriesName === '完成率') {
// 假设原始数据是 80显示为 80%
result += item.marker + item.seriesName + '' + item.data + '%<br/>';
} else {
result += item.marker + item.seriesName + '' + item.data + '<br/>';
}
});
return result;
}
},
legend: {
data: ['计划任务数', '已完成数', '完成率'],
@@ -169,7 +203,7 @@ onMounted(async () => {
xAxis: [
{
type: 'category',
data: countAchievedData.type || [],
data: ['修剪整形','肥水管理','中耕除草','病虫害防治','越冬防寒'],
},
],
yAxis: [
@@ -195,7 +229,7 @@ onMounted(async () => {
{
name: '计划任务数',
type: 'bar',
data: countAchievedData.toral || [],
data: countAchievedData.total || [],
},
{
name: '已完成数',
@@ -220,7 +254,7 @@ onMounted(async () => {
orient: 'horizontal',
left: 'center',
bottom: 10,
data: ['一星', '星', '三星', '四星', '五星'],
data: ['一星', '星', '三星', '四星', '五星'],
},
series: [
{
@@ -283,7 +317,7 @@ function formatNumber(num: number | string) {
<div class="title">
<div class="title-text">绿植租赁业务统计报表</div>
<div class="title-operate">
<div class="export">
<div class="export" style="display: none;">
<Button size="large" style="color: #fff; background-color: #22c55e">
导出数据
</Button>

View File

@@ -60,7 +60,8 @@ function generateWeekDates(): void {
return startOfWeek.add(i, 'day').format('YYYY-MM-DD');
});
weekDates.value = dates;
selectedDate.value = dates[0] ?? '';
// 默认选中今天
selectedDate.value = today.format('YYYY-MM-DD');
}
// 获取预约数据
@@ -137,7 +138,6 @@ async function fetchBookings(): Promise<void> {
});
bookingTable.value = table;
}
console.log(bookingTable.value,'bookingTable.value');
} catch (error) {
console.error('获取预约数据失败:', error);
@@ -150,7 +150,8 @@ async function fetchBookings(): Promise<void> {
function handleViewModeChange(e: RadioChangeEvent): void {
viewMode.value = e.target.value;
if (viewMode.value === 'date') {
selectedDate.value = weekDates.value[0] ?? '';
// 默认选中今天
selectedDate.value = dayjs().format('YYYY-MM-DD');
} else {
selectedRoom.value = roomList.value[0]?.id ?? '';
}