summaryrefslogtreecommitdiff
path: root/lib/avl/table/project-avl-table.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/avl/table/project-avl-table.tsx')
-rw-r--r--lib/avl/table/project-avl-table.tsx33
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/avl/table/project-avl-table.tsx b/lib/avl/table/project-avl-table.tsx
index 9584c6f9..ad72b221 100644
--- a/lib/avl/table/project-avl-table.tsx
+++ b/lib/avl/table/project-avl-table.tsx
@@ -177,12 +177,40 @@ export const ProjectAvlTable = forwardRef<ProjectAvlTableRef, ProjectAvlTablePro
const projectData = await getProjectInfoByCode(projectCode.trim(), 'both')
if (projectData) {
+ // constructionSector 동적 결정
+ let constructionSector = "해양" // 기본값
+ if (projectData.source === 'projects') {
+ // projects 테이블의 경우: type='ship'이면 '조선', 그 외는 '해양'
+ constructionSector = projectData.type === 'ship' ? "조선" : "해양"
+ } else if (projectData.source === 'biddingProjects') {
+ // biddingProjects 테이블의 경우: sector가 'S'이면 '조선', 'M'이면 '해양'
+ constructionSector = projectData.sector === 'S' ? "조선" : "해양"
+ }
+
+ // htDivision 동적 결정
+ let htDivision = "" // 기본값
+ if (constructionSector === "조선") {
+ // constructionSector가 '조선'인 경우는 항상 H
+ htDivision = "H"
+ } else if (projectData.source === 'projects') {
+ // projects에서는 TYPE_MDG 컬럼이 Top이면 T, Hull이면 H
+ htDivision = projectData.typeMdg === 'Top' ? "T" : "H"
+ } else if (projectData.source === 'biddingProjects') {
+ if (projectData.sector === 'S') {
+ // biddingProjects에서 sector가 S이면 HtDivision은 항상 H
+ htDivision = "H"
+ } else if (projectData.sector === 'M') {
+ // biddingProjects에서 sector가 M인 경우: pjtType이 TOP이면 'T', HULL이면 'H'
+ htDivision = projectData.pjtType === 'TOP' ? "T" : "H"
+ }
+ }
+
// 프로젝트 정보 설정
setProjectInfo({
projectName: projectData.projectName || "",
- constructionSector: "조선", // 기본값으로 조선 설정 (필요시 로직 변경)
+ constructionSector: constructionSector,
shipType: projectData.shipType || projectData.projectMsrm || "",
- htDivision: projectData.projectHtDivision || ""
+ htDivision: htDivision
})
// 검색 상태 설정
@@ -307,6 +335,7 @@ export const ProjectAvlTable = forwardRef<ProjectAvlTableRef, ProjectAvlTablePro
getFilteredRowModel: getFilteredRowModel(),
manualPagination: true,
pageCount,
+ columnResizeMode: "onChange",
state: {
pagination,
},