From b480345b24ef2880c9b168b1ae6610787c139415 Mon Sep 17 00:00:00 2001 From: ysCha Date: Tue, 30 Sep 2025 18:12:25 +0900 Subject: [PATCH] =?UTF-8?q?[1222]=EA=B2=AC=EC=A0=81=EC=9D=98=20=EC=A0=9C?= =?UTF-8?q?=ED=92=88=20=EC=A0=95=EB=B3=B4=20=ED=99=94=EB=A9=B4=EC=97=90=20?= =?UTF-8?q?=EB=8C=80=ED=95=B4=EC=84=9C=20-=20=EA=B7=B8=EB=A3=B9=EB=B3=84?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 36 +++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index f6517960..d8b127fc 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -138,7 +138,27 @@ export default function Estimate({}) { updatedRes = [...res] } - setOriginDisplayItemList(res) + const groupByItemGroup = (items) => { + const grouped = items.reduce((acc, item) => { + const group = item.itemGroup || '기타'; + if (!acc[group]) { + acc[group] = { + label: group, + options: [] + }; + } + acc[group].options.push({ + value: item.itemId, + label: `${item.itemNo} - ${item.itemName}`, + ...item + }); + return acc; + }, {}); + + return Object.values(grouped); + }; + const groupedItems = groupByItemGroup(res); + setOriginDisplayItemList(groupedItems) setDisplayItemList(updatedRes) } }) @@ -153,6 +173,19 @@ export default function Estimate({}) { }) } + const groupStyles = { + groupHeading: (provided) => ({ + ...provided, + fontSize: '14px', + fontWeight: 'bold', + color: '#333', + backgroundColor: '#f5f5f5', + padding: '8px 12px', + marginBottom: '4px', + borderBottom: '2px solid #ddd' + }) + }; + useEffect(() => { // console.log('πŸš€ ~ Estimate ~ selectedPlan:', selectedPlan) if (selectedPlan) initEstimate(selectedPlan?.planNo?? currentPid) @@ -1998,6 +2031,7 @@ export default function Estimate({}) { classNamePrefix="custom" placeholder="Select" options={originDisplayItemList} + styles={groupStyles} onChange={(e) => { if (isObjectNotEmpty(e)) { onChangeDisplayItem(e.itemId, item.dispOrder, index, false)