From 58faa1f759ee1d7dc9718e48ff4f7c4a85354a2a Mon Sep 17 00:00:00 2001 From: kjs Date: Fri, 10 Apr 2026 17:32:33 +0900 Subject: [PATCH] refactor: Improve inspection management page functionality and UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enhanced the rendering of the manager column to display user labels instead of IDs for better clarity. - Updated the default state for the defect form to set is_active to "사용" upon creation. - Simplified the badge rendering logic for the is_active status to improve readability. - Adjusted the select component for active status to remove unnecessary options and streamline user interaction. These changes aim to enhance the user experience and data representation in the inspection management process across multiple companies. --- .../COMPANY_10/quality/inspection/page.tsx | 29 ++++++++----------- .../COMPANY_16/quality/inspection/page.tsx | 29 ++++++++----------- .../COMPANY_29/quality/inspection/page.tsx | 29 ++++++++----------- .../COMPANY_30/quality/inspection/page.tsx | 29 ++++++++----------- .../COMPANY_7/quality/inspection/page.tsx | 29 ++++++++----------- .../COMPANY_8/quality/inspection/page.tsx | 29 ++++++++----------- .../COMPANY_9/quality/inspection/page.tsx | 29 ++++++++----------- 7 files changed, 84 insertions(+), 119 deletions(-) diff --git a/frontend/app/(main)/COMPANY_10/quality/inspection/page.tsx b/frontend/app/(main)/COMPANY_10/quality/inspection/page.tsx index cacd9d02..3ec68732 100644 --- a/frontend/app/(main)/COMPANY_10/quality/inspection/page.tsx +++ b/frontend/app/(main)/COMPANY_10/quality/inspection/page.tsx @@ -188,9 +188,12 @@ export default function InspectionManagementPage() { if (["inspection_type", "inspection_method", "judgment_criteria", "unit", "apply_type"].includes(col.key)) { base.render = (v: any, row: any) => getCatLabel(INSPECTION_TABLE, col.key, row[col.key]); } + if (col.key === "manager") { + base.render = (v: any, row: any) => userOptions.find((u) => u.code === row.manager)?.label || row.manager || "-"; + } return base; }); - }, [ts.visibleColumns, catOptions]); // eslint-disable-line react-hooks/exhaustive-deps + }, [ts.visibleColumns, catOptions, userOptions]); // eslint-disable-line react-hooks/exhaustive-deps /* ═══════════════════ 데이터 조회 ═══════════════════ */ // 다중값 컬럼 (쉼표 구분 저장) — 서버 equals 대신 contains 사용 @@ -385,7 +388,7 @@ export default function InspectionManagementPage() { /* ═══════════════════ 불량관리 CRUD ═══════════════════ */ const openDefCreate = async () => { - setDefForm({}); + setDefForm({ is_active: "사용" }); setDefEditMode(false); setNumberingRuleId(null); setPreviewCode(null); @@ -867,20 +870,16 @@ export default function InspectionManagementPage() { - {getCatLabel(DEFECT_TABLE, "is_active", row.is_active) || "-"} + {row.is_active === "사용" || row.is_active === "true" ? "사용" : row.is_active || "미사용"} {row.reg_date || (row.created_date ? row.created_date.slice(0, 10) : "-")} - {row.manager_id || "-"} + {userOptions.find((u) => u.code === row.manager_id)?.label || row.manager_id || "-"} {row.remarks || "-"} ); @@ -1442,19 +1441,15 @@ export default function InspectionManagementPage() {
diff --git a/frontend/app/(main)/COMPANY_16/quality/inspection/page.tsx b/frontend/app/(main)/COMPANY_16/quality/inspection/page.tsx index cacd9d02..3ec68732 100644 --- a/frontend/app/(main)/COMPANY_16/quality/inspection/page.tsx +++ b/frontend/app/(main)/COMPANY_16/quality/inspection/page.tsx @@ -188,9 +188,12 @@ export default function InspectionManagementPage() { if (["inspection_type", "inspection_method", "judgment_criteria", "unit", "apply_type"].includes(col.key)) { base.render = (v: any, row: any) => getCatLabel(INSPECTION_TABLE, col.key, row[col.key]); } + if (col.key === "manager") { + base.render = (v: any, row: any) => userOptions.find((u) => u.code === row.manager)?.label || row.manager || "-"; + } return base; }); - }, [ts.visibleColumns, catOptions]); // eslint-disable-line react-hooks/exhaustive-deps + }, [ts.visibleColumns, catOptions, userOptions]); // eslint-disable-line react-hooks/exhaustive-deps /* ═══════════════════ 데이터 조회 ═══════════════════ */ // 다중값 컬럼 (쉼표 구분 저장) — 서버 equals 대신 contains 사용 @@ -385,7 +388,7 @@ export default function InspectionManagementPage() { /* ═══════════════════ 불량관리 CRUD ═══════════════════ */ const openDefCreate = async () => { - setDefForm({}); + setDefForm({ is_active: "사용" }); setDefEditMode(false); setNumberingRuleId(null); setPreviewCode(null); @@ -867,20 +870,16 @@ export default function InspectionManagementPage() { - {getCatLabel(DEFECT_TABLE, "is_active", row.is_active) || "-"} + {row.is_active === "사용" || row.is_active === "true" ? "사용" : row.is_active || "미사용"} {row.reg_date || (row.created_date ? row.created_date.slice(0, 10) : "-")} - {row.manager_id || "-"} + {userOptions.find((u) => u.code === row.manager_id)?.label || row.manager_id || "-"} {row.remarks || "-"} ); @@ -1442,19 +1441,15 @@ export default function InspectionManagementPage() {
diff --git a/frontend/app/(main)/COMPANY_29/quality/inspection/page.tsx b/frontend/app/(main)/COMPANY_29/quality/inspection/page.tsx index cacd9d02..3ec68732 100644 --- a/frontend/app/(main)/COMPANY_29/quality/inspection/page.tsx +++ b/frontend/app/(main)/COMPANY_29/quality/inspection/page.tsx @@ -188,9 +188,12 @@ export default function InspectionManagementPage() { if (["inspection_type", "inspection_method", "judgment_criteria", "unit", "apply_type"].includes(col.key)) { base.render = (v: any, row: any) => getCatLabel(INSPECTION_TABLE, col.key, row[col.key]); } + if (col.key === "manager") { + base.render = (v: any, row: any) => userOptions.find((u) => u.code === row.manager)?.label || row.manager || "-"; + } return base; }); - }, [ts.visibleColumns, catOptions]); // eslint-disable-line react-hooks/exhaustive-deps + }, [ts.visibleColumns, catOptions, userOptions]); // eslint-disable-line react-hooks/exhaustive-deps /* ═══════════════════ 데이터 조회 ═══════════════════ */ // 다중값 컬럼 (쉼표 구분 저장) — 서버 equals 대신 contains 사용 @@ -385,7 +388,7 @@ export default function InspectionManagementPage() { /* ═══════════════════ 불량관리 CRUD ═══════════════════ */ const openDefCreate = async () => { - setDefForm({}); + setDefForm({ is_active: "사용" }); setDefEditMode(false); setNumberingRuleId(null); setPreviewCode(null); @@ -867,20 +870,16 @@ export default function InspectionManagementPage() { - {getCatLabel(DEFECT_TABLE, "is_active", row.is_active) || "-"} + {row.is_active === "사용" || row.is_active === "true" ? "사용" : row.is_active || "미사용"} {row.reg_date || (row.created_date ? row.created_date.slice(0, 10) : "-")} - {row.manager_id || "-"} + {userOptions.find((u) => u.code === row.manager_id)?.label || row.manager_id || "-"} {row.remarks || "-"} ); @@ -1442,19 +1441,15 @@ export default function InspectionManagementPage() {
diff --git a/frontend/app/(main)/COMPANY_30/quality/inspection/page.tsx b/frontend/app/(main)/COMPANY_30/quality/inspection/page.tsx index cacd9d02..3ec68732 100644 --- a/frontend/app/(main)/COMPANY_30/quality/inspection/page.tsx +++ b/frontend/app/(main)/COMPANY_30/quality/inspection/page.tsx @@ -188,9 +188,12 @@ export default function InspectionManagementPage() { if (["inspection_type", "inspection_method", "judgment_criteria", "unit", "apply_type"].includes(col.key)) { base.render = (v: any, row: any) => getCatLabel(INSPECTION_TABLE, col.key, row[col.key]); } + if (col.key === "manager") { + base.render = (v: any, row: any) => userOptions.find((u) => u.code === row.manager)?.label || row.manager || "-"; + } return base; }); - }, [ts.visibleColumns, catOptions]); // eslint-disable-line react-hooks/exhaustive-deps + }, [ts.visibleColumns, catOptions, userOptions]); // eslint-disable-line react-hooks/exhaustive-deps /* ═══════════════════ 데이터 조회 ═══════════════════ */ // 다중값 컬럼 (쉼표 구분 저장) — 서버 equals 대신 contains 사용 @@ -385,7 +388,7 @@ export default function InspectionManagementPage() { /* ═══════════════════ 불량관리 CRUD ═══════════════════ */ const openDefCreate = async () => { - setDefForm({}); + setDefForm({ is_active: "사용" }); setDefEditMode(false); setNumberingRuleId(null); setPreviewCode(null); @@ -867,20 +870,16 @@ export default function InspectionManagementPage() { - {getCatLabel(DEFECT_TABLE, "is_active", row.is_active) || "-"} + {row.is_active === "사용" || row.is_active === "true" ? "사용" : row.is_active || "미사용"} {row.reg_date || (row.created_date ? row.created_date.slice(0, 10) : "-")} - {row.manager_id || "-"} + {userOptions.find((u) => u.code === row.manager_id)?.label || row.manager_id || "-"} {row.remarks || "-"} ); @@ -1442,19 +1441,15 @@ export default function InspectionManagementPage() {
diff --git a/frontend/app/(main)/COMPANY_7/quality/inspection/page.tsx b/frontend/app/(main)/COMPANY_7/quality/inspection/page.tsx index cacd9d02..3ec68732 100644 --- a/frontend/app/(main)/COMPANY_7/quality/inspection/page.tsx +++ b/frontend/app/(main)/COMPANY_7/quality/inspection/page.tsx @@ -188,9 +188,12 @@ export default function InspectionManagementPage() { if (["inspection_type", "inspection_method", "judgment_criteria", "unit", "apply_type"].includes(col.key)) { base.render = (v: any, row: any) => getCatLabel(INSPECTION_TABLE, col.key, row[col.key]); } + if (col.key === "manager") { + base.render = (v: any, row: any) => userOptions.find((u) => u.code === row.manager)?.label || row.manager || "-"; + } return base; }); - }, [ts.visibleColumns, catOptions]); // eslint-disable-line react-hooks/exhaustive-deps + }, [ts.visibleColumns, catOptions, userOptions]); // eslint-disable-line react-hooks/exhaustive-deps /* ═══════════════════ 데이터 조회 ═══════════════════ */ // 다중값 컬럼 (쉼표 구분 저장) — 서버 equals 대신 contains 사용 @@ -385,7 +388,7 @@ export default function InspectionManagementPage() { /* ═══════════════════ 불량관리 CRUD ═══════════════════ */ const openDefCreate = async () => { - setDefForm({}); + setDefForm({ is_active: "사용" }); setDefEditMode(false); setNumberingRuleId(null); setPreviewCode(null); @@ -867,20 +870,16 @@ export default function InspectionManagementPage() { - {getCatLabel(DEFECT_TABLE, "is_active", row.is_active) || "-"} + {row.is_active === "사용" || row.is_active === "true" ? "사용" : row.is_active || "미사용"} {row.reg_date || (row.created_date ? row.created_date.slice(0, 10) : "-")} - {row.manager_id || "-"} + {userOptions.find((u) => u.code === row.manager_id)?.label || row.manager_id || "-"} {row.remarks || "-"} ); @@ -1442,19 +1441,15 @@ export default function InspectionManagementPage() {
diff --git a/frontend/app/(main)/COMPANY_8/quality/inspection/page.tsx b/frontend/app/(main)/COMPANY_8/quality/inspection/page.tsx index cacd9d02..3ec68732 100644 --- a/frontend/app/(main)/COMPANY_8/quality/inspection/page.tsx +++ b/frontend/app/(main)/COMPANY_8/quality/inspection/page.tsx @@ -188,9 +188,12 @@ export default function InspectionManagementPage() { if (["inspection_type", "inspection_method", "judgment_criteria", "unit", "apply_type"].includes(col.key)) { base.render = (v: any, row: any) => getCatLabel(INSPECTION_TABLE, col.key, row[col.key]); } + if (col.key === "manager") { + base.render = (v: any, row: any) => userOptions.find((u) => u.code === row.manager)?.label || row.manager || "-"; + } return base; }); - }, [ts.visibleColumns, catOptions]); // eslint-disable-line react-hooks/exhaustive-deps + }, [ts.visibleColumns, catOptions, userOptions]); // eslint-disable-line react-hooks/exhaustive-deps /* ═══════════════════ 데이터 조회 ═══════════════════ */ // 다중값 컬럼 (쉼표 구분 저장) — 서버 equals 대신 contains 사용 @@ -385,7 +388,7 @@ export default function InspectionManagementPage() { /* ═══════════════════ 불량관리 CRUD ═══════════════════ */ const openDefCreate = async () => { - setDefForm({}); + setDefForm({ is_active: "사용" }); setDefEditMode(false); setNumberingRuleId(null); setPreviewCode(null); @@ -867,20 +870,16 @@ export default function InspectionManagementPage() { - {getCatLabel(DEFECT_TABLE, "is_active", row.is_active) || "-"} + {row.is_active === "사용" || row.is_active === "true" ? "사용" : row.is_active || "미사용"} {row.reg_date || (row.created_date ? row.created_date.slice(0, 10) : "-")} - {row.manager_id || "-"} + {userOptions.find((u) => u.code === row.manager_id)?.label || row.manager_id || "-"} {row.remarks || "-"} ); @@ -1442,19 +1441,15 @@ export default function InspectionManagementPage() {
diff --git a/frontend/app/(main)/COMPANY_9/quality/inspection/page.tsx b/frontend/app/(main)/COMPANY_9/quality/inspection/page.tsx index cacd9d02..3ec68732 100644 --- a/frontend/app/(main)/COMPANY_9/quality/inspection/page.tsx +++ b/frontend/app/(main)/COMPANY_9/quality/inspection/page.tsx @@ -188,9 +188,12 @@ export default function InspectionManagementPage() { if (["inspection_type", "inspection_method", "judgment_criteria", "unit", "apply_type"].includes(col.key)) { base.render = (v: any, row: any) => getCatLabel(INSPECTION_TABLE, col.key, row[col.key]); } + if (col.key === "manager") { + base.render = (v: any, row: any) => userOptions.find((u) => u.code === row.manager)?.label || row.manager || "-"; + } return base; }); - }, [ts.visibleColumns, catOptions]); // eslint-disable-line react-hooks/exhaustive-deps + }, [ts.visibleColumns, catOptions, userOptions]); // eslint-disable-line react-hooks/exhaustive-deps /* ═══════════════════ 데이터 조회 ═══════════════════ */ // 다중값 컬럼 (쉼표 구분 저장) — 서버 equals 대신 contains 사용 @@ -385,7 +388,7 @@ export default function InspectionManagementPage() { /* ═══════════════════ 불량관리 CRUD ═══════════════════ */ const openDefCreate = async () => { - setDefForm({}); + setDefForm({ is_active: "사용" }); setDefEditMode(false); setNumberingRuleId(null); setPreviewCode(null); @@ -867,20 +870,16 @@ export default function InspectionManagementPage() { - {getCatLabel(DEFECT_TABLE, "is_active", row.is_active) || "-"} + {row.is_active === "사용" || row.is_active === "true" ? "사용" : row.is_active || "미사용"} {row.reg_date || (row.created_date ? row.created_date.slice(0, 10) : "-")} - {row.manager_id || "-"} + {userOptions.find((u) => u.code === row.manager_id)?.label || row.manager_id || "-"} {row.remarks || "-"} ); @@ -1442,19 +1441,15 @@ export default function InspectionManagementPage() {