From 71194de2eb1ac98368464131be8378fe8d4ce247 Mon Sep 17 00:00:00 2001 From: king Date: Tue, 1 Sep 2026 17:41:36 +0900 Subject: [PATCH] =?UTF-8?q?fix(cupang):=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20?= =?UTF-8?q?=EC=98=81=EC=97=AD=20=EB=86=92=EC=9D=B4=EB=A5=BC=20rAF=20?= =?UTF-8?q?=ED=9B=84=20JS=20=EB=A1=9C=20=EC=A7=80=EC=A0=95=20+=20=EC=A7=84?= =?UTF-8?q?=EB=8B=A8=20=EB=A1=9C=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CSS flex 체인만으로 잡히지 않는 환경 대비. render() 이후 다음 프레임에 각 영역의 화면 위치를 재서 max-height 를 !important 로 지정한다. window.CPG_DEBUG = true 후 window.cpgFit() 으로 계산값 확인 가능. Co-Authored-By: Claude Opus 5 --- .../cupang/templates/cupang/box_calc.html | 39 ++++++++++++++++++- .../cupang/templates/cupang/box_rules.html | 2 +- .../cupang/templates/cupang/centers.html | 2 +- .../cupang/templates/cupang/index.html | 2 +- .../cupang/templates/cupang/products.html | 2 +- app/modules/cupang/templates/cupang/view.html | 2 +- 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/app/modules/cupang/templates/cupang/box_calc.html b/app/modules/cupang/templates/cupang/box_calc.html index 2b147e8..771a9ad 100644 --- a/app/modules/cupang/templates/cupang/box_calc.html +++ b/app/modules/cupang/templates/cupang/box_calc.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
@@ -1066,7 +1066,42 @@ syncConfirm(); } - function render() { renderSummary(); renderDist(); } + // ── 스크롤 영역 높이 (CSS 만으로 안 잡히는 경우 대비) ── + // 각 영역의 화면상 위치를 재서 "창 아래까지" 높이를 직접 준다. + // window.CPG_DEBUG = true 로 두면 계산값을 콘솔에 찍는다. + function fitScrollAreas() { + var panes = [ + [".cpg-calc-card .erp-table-wrap", document.querySelector(".cpg-calc-card .erp-table-wrap")], + [".cpg-sum-scroll", document.querySelector(".cpg-calc-sum .cpg-sum-scroll")], + ["#cpg-dist-list", distList] + ]; + panes.forEach(function (pair) { + var el = pair[1]; + if (!el) return; + var top = el.getBoundingClientRect().top; + var avail = Math.floor(window.innerHeight - top - 16); + var h = avail > 200 ? avail : Math.round(window.innerHeight * 0.6); + el.style.setProperty("max-height", h + "px", "important"); + el.style.setProperty("overflow-y", "auto", "important"); + el.style.setProperty("min-height", "0", "important"); + el.setAttribute("data-fit", h); + if (window.CPG_DEBUG) { + console.log("[cpg fit]", pair[0], "top=", Math.round(top), "avail=", avail, + "set=", h, "client=", el.clientHeight, "scroll=", el.scrollHeight); + } + }); + } + + window.addEventListener("resize", fitScrollAreas); + window.cpgFit = fitScrollAreas; // 콘솔에서 수동 확인용 + + function render() { + renderSummary(); + renderDist(); + // 레이아웃이 확정된 다음 프레임에 높이를 잡는다 + if (window.requestAnimationFrame) { window.requestAnimationFrame(fitScrollAreas); } + else { fitScrollAreas(); } + } // ── 수량 대화상자 ───────────────────────────────── function openDialog(key, centerId) { diff --git a/app/modules/cupang/templates/cupang/box_rules.html b/app/modules/cupang/templates/cupang/box_rules.html index 4da7079..8deada8 100644 --- a/app/modules/cupang/templates/cupang/box_rules.html +++ b/app/modules/cupang/templates/cupang/box_rules.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/centers.html b/app/modules/cupang/templates/cupang/centers.html index e5c829d..232052f 100644 --- a/app/modules/cupang/templates/cupang/centers.html +++ b/app/modules/cupang/templates/cupang/centers.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/index.html b/app/modules/cupang/templates/cupang/index.html index 93808e2..3051a45 100644 --- a/app/modules/cupang/templates/cupang/index.html +++ b/app/modules/cupang/templates/cupang/index.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/products.html b/app/modules/cupang/templates/cupang/products.html index c7cae53..f605ff4 100644 --- a/app/modules/cupang/templates/cupang/products.html +++ b/app/modules/cupang/templates/cupang/products.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/view.html b/app/modules/cupang/templates/cupang/view.html index cd4ca69..7595fac 100644 --- a/app/modules/cupang/templates/cupang/view.html +++ b/app/modules/cupang/templates/cupang/view.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %} {# 출고 묶음 보기 — 상자 계산 화면과 같은 3열 구성. 읽기 전용(수정 없음). #}