From 765bc6aaa614c3ae668aeead45f86621a2542fa0 Mon Sep 17 00:00:00 2001 From: jiangxh <1217934998@qq.com> Date: Tue, 30 Jun 2026 17:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=B6=E6=96=99=E5=BF=AB=E6=A3=80=E6=9B=B2?= =?UTF-8?q?=E7=BA=BF=E5=9B=BE=E5=B1=95=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MesXslRubberQuickTestRecordModal.vue | 130 +++++++++++------- 1 file changed, 80 insertions(+), 50 deletions(-) diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue index 1d8ef90f..12d6aa90 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue +++ b/jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue @@ -85,20 +85,16 @@
- - -
-
温度曲线(上模 / 下模)
-
-
-
- -
-
S'(dNm) 曲线
-
-
-
-
+
+
+
温度曲线(上模 / 下模)
+
+
+
+
S'(dNm) 曲线
+
+
+
@@ -172,8 +168,16 @@ const tempChartRef = ref(null); const torqueChartRef = ref(null); - const { setOptions: setTempChartOptions, resize: resizeTempChart } = useECharts(tempChartRef as Ref); - const { setOptions: setTorqueChartOptions, resize: resizeTorqueChart } = useECharts(torqueChartRef as Ref); + const { + setOptions: setTempChartOptions, + resize: resizeTempChart, + getInstance: getTempChartInstance, + } = useECharts(tempChartRef as Ref); + const { + setOptions: setTorqueChartOptions, + resize: resizeTorqueChart, + getInstance: getTorqueChartInstance, + } = useECharts(torqueChartRef as Ref); const ledgerPickTarget = ref<'prod' | 'inspect'>('prod'); @@ -281,53 +285,69 @@ } tableReady.value = true; if (useNewDetail.value) { + await nextTick(); await scheduleRenderCharts(chartPointDataSource.value); } }); + function isChartContainerReady() { + const temp = tempChartRef.value; + const torque = torqueChartRef.value; + return !!( + temp && + torque && + temp.offsetWidth > 0 && + temp.offsetHeight > 0 && + torque.offsetWidth > 0 && + torque.offsetHeight > 0 + ); + } + + async function waitForChartContainers(maxTry = 24) { + for (let i = 0; i < maxTry; i++) { + await nextTick(); + if (isChartContainerReady()) { + return true; + } + await new Promise((resolve) => window.setTimeout(resolve, 80)); + } + return isChartContainerReady(); + } + async function scheduleRenderCharts(points: Recordable[]) { + if (!useNewDetail.value) { + return; + } + await waitForChartContainers(); + renderCharts(points); await nextTick(); - await nextTick(); - await new Promise((resolve) => { - window.setTimeout(() => { - renderCharts(points); - resizeTempChart(); - resizeTorqueChart(); - resolve(); - }, 280); - }); + resizeTempChart(); + resizeTorqueChart(); + getTempChartInstance()?.resize(); + getTorqueChartInstance()?.resize(); + window.setTimeout(() => { + resizeTempChart(); + resizeTorqueChart(); + getTempChartInstance()?.resize(); + getTorqueChartInstance()?.resize(); + }, 200); } function onModalVisibleChange(visible: boolean) { if (visible && useNewDetail.value) { - scheduleRenderCharts(chartPointDataSource.value); + window.setTimeout(() => { + scheduleRenderCharts(chartPointDataSource.value); + }, 320); } } - watch(useNewDetail, async (visible) => { - if (visible) { - await scheduleRenderCharts(chartPointDataSource.value); - } - }); - watch( - () => [useNewDetail.value, tempChartRef.value, torqueChartRef.value] as const, - ([visible, tempEl, torqueEl]) => { - if (visible && tempEl && torqueEl) { - scheduleRenderCharts(chartPointDataSource.value); + () => chartPointDataSource.value.length, + async (len) => { + if (useNewDetail.value && len > 0) { + await scheduleRenderCharts(chartPointDataSource.value); } }, - { flush: 'post' }, - ); - - watch( - chartPointDataSource, - async (points) => { - if (useNewDetail.value && points?.length) { - await scheduleRenderCharts(points); - } - }, - { deep: true }, ); const title = computed(() => (unref(isDetail) ? '快检记录详情' : '编辑胶料快检记录')); @@ -524,7 +544,13 @@ } .detail-section__body--chart { - padding: 12px 12px 4px; + padding: 12px; + } + + .chart-stack { + display: flex; + flex-direction: column; + width: 100%; } .chart-card { @@ -534,6 +560,10 @@ border-radius: 6px; } + .chart-card--spaced { + margin-top: 16px; + } + .chart-card__title { margin-bottom: 8px; padding-left: 8px; @@ -545,7 +575,7 @@ .chart-box { width: 100%; - height: 220px; - min-height: 220px; + height: 260px; + min-height: 260px; }