From e846a03f00980673c1c66871d34b3f4bb7c81fd5 Mon Sep 17 00:00:00 2001 From: hwj Date: Mon, 9 Mar 2026 18:22:03 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E9=A6=96=E9=A1=B5-=E6=95=B4?= =?UTF-8?q?=E4=BD=93=E7=94=9F=E4=BA=A7=E6=A6=82=E6=8B=AC-=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=AD=9B=E9=80=89=E5=85=A5=E5=8F=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home/Index.vue | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/views/Home/Index.vue b/src/views/Home/Index.vue index da078ea5..e2a9be1c 100644 --- a/src/views/Home/Index.vue +++ b/src/views/Home/Index.vue @@ -19,7 +19,7 @@ alt="banner" :src="bannerImg" fit="contain" class="home-welcome-image"
+ start-placeholder="开始日期" end-placeholder="结束日期" size="small" @change="handleProductionOverviewRangeChange" />
@@ -534,6 +534,38 @@ const moldTypeBarOptionsData = ref({ } ) const pieOptionsData = reactive(pieOptions) as EChartsOption + +let productionOverviewRequestId = 0 +const buildProductionOverviewParams = () => { + const startTime = productionOverviewRange.value + if (Array.isArray(startTime) && startTime.length === 2 && startTime[0] && startTime[1]) { + const normalizeStart = (value: string) => { + const v = String(value || '').trim() + if (!v) return '' + if (v.includes(' ') || v.includes('T')) return v + return `${v} 00:00:00` + } + const normalizeEnd = (value: string) => { + const v = String(value || '').trim() + if (!v) return '' + if (v.includes(' ') || v.includes('T')) return v + return `${v} 23:59:59` + } + return { startTime: [normalizeStart(startTime[0]), normalizeEnd(startTime[1])] } + } + return {} +} +const loadProductionOverview = async () => { + const currentId = ++productionOverviewRequestId + const data = await DashboardApi.getProduction(buildProductionOverviewParams()) + if (currentId !== productionOverviewRequestId) return + production.value = data + productionOverviewLeft.value = production.value.taskItems + productionOverviewCenter.value = production.value.planItems +} +const handleProductionOverviewRangeChange = async () => { + await loadProductionOverview() +} /** 初始化 **/ onMounted(async () => { // 加载 @@ -544,7 +576,7 @@ onMounted(async () => { // todayWeather.value = weatherList.value[0] // weatherCity = data.city // } - production.value = await DashboardApi.getProduction(productionOverviewRange.value) + await loadProductionOverview() plan.value = await DashboardApi.getPlan() deviceStatusCards.value = await DashboardApi.getDevice() moldStatusCards.value = await DashboardApi.getMold() @@ -559,8 +591,6 @@ onMounted(async () => { console.log(moldTypeOptions) moldTypeBarOptionsData.value.xAxis!.data = moldTypeOptions.xaxis moldTypeBarOptionsData.value.series![0].data = moldTypeOptions.series - productionOverviewLeft.value = production.value.taskItems - productionOverviewCenter.value = production.value.planItems })