Compare commits

...

4 Commits

Author SHA1 Message Date
hjlee 97256f8db0 Merge pull request 'lhj' (#374) from lhj into main
Reviewed-on: http://39.117.244.52:3000/kjs/ERP-node/pulls/374
2026-01-21 09:26:35 +09:00
leeheejin 6a0aa87d3b Merge branch 'main' of http://39.117.244.52:3000/kjs/ERP-node into lhj 2026-01-21 09:25:51 +09:00
leeheejin 2bf81a6e24 Merge branch 'main' of http://39.117.244.52:3000/kjs/ERP-node into lhj
; Please enter a commit message to explain why this merge is necessary,
; especially if it merges an updated upstream into a topic branch.
;
; Lines starting with ';' will be ignored, and an empty message aborts
; the commit.
2026-01-21 09:25:36 +09:00
leeheejin a55115ac48 엑셀 열짤려서 업로드 되는거랑 다운로드시 카테고리 두개이상이면 코드로 나오던거 수정했습니당 2026-01-21 09:25:21 +09:00
3 changed files with 62 additions and 14 deletions

View File

@ -2688,19 +2688,41 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
const value = row[mappedColumnName]; const value = row[mappedColumnName];
// 카테고리 매핑된 값 처리 // 카테고리 매핑된 값 처리
if (categoryMappings[col.columnName] && value !== null && value !== undefined) { if (value !== null && value !== undefined) {
const mapping = categoryMappings[col.columnName][String(value)]; const valueStr = String(value);
// 디버그 로그 (카테고리 값인 경우만)
if (valueStr.startsWith("CATEGORY_")) {
console.log("🔍 [엑셀다운로드] 카테고리 변환 시도:", {
columnName: col.columnName,
value: valueStr,
hasMappings: !!categoryMappings[col.columnName],
mappingsKeys: categoryMappings[col.columnName] ? Object.keys(categoryMappings[col.columnName]).slice(0, 5) : [],
});
}
if (categoryMappings[col.columnName]) {
// 쉼표로 구분된 중복 값 처리
if (valueStr.includes(",")) {
const values = valueStr.split(",").map((v) => v.trim()).filter((v) => v);
const labels = values.map((v) => {
const mapping = categoryMappings[col.columnName][v];
return mapping ? mapping.label : v;
});
return labels.join(", ");
}
// 단일 값 처리
const mapping = categoryMappings[col.columnName][valueStr];
if (mapping) { if (mapping) {
return mapping.label; return mapping.label;
} }
} }
// null/undefined 처리 return value;
if (value === null || value === undefined) {
return "";
} }
return value; // null/undefined 처리
return "";
}); });
}); });

View File

@ -4801,7 +4801,24 @@ export class ButtonActionExecutor {
const filteredRow: Record<string, any> = {}; const filteredRow: Record<string, any> = {};
visibleColumns!.forEach((columnName: string) => { visibleColumns!.forEach((columnName: string) => {
const label = columnLabels?.[columnName] || columnName; const label = columnLabels?.[columnName] || columnName;
filteredRow[label] = row[columnName]; let value = row[columnName];
// 카테고리 코드를 라벨로 변환 (CATEGORY_로 시작하는 값)
if (value && typeof value === "string" && value.includes("CATEGORY_")) {
// 먼저 _label 필드 확인 (API에서 제공하는 경우)
const labelFieldName = `${columnName}_label`;
if (row[labelFieldName]) {
value = row[labelFieldName];
} else {
// _value_label 필드 확인
const valueLabelFieldName = `${columnName}_value_label`;
if (row[valueLabelFieldName]) {
value = row[valueLabelFieldName];
}
}
}
filteredRow[label] = value;
}); });
return filteredRow; return filteredRow;
}); });
@ -5074,9 +5091,16 @@ export class ButtonActionExecutor {
value = row[`${columnName}_name`]; value = row[`${columnName}_name`];
} }
// 카테고리 타입 필드는 라벨로 변환 (백엔드에서 정의된 컬럼만) // 카테고리 타입 필드는 라벨로 변환 (백엔드에서 정의된 컬럼만)
else if (categoryMap[columnName] && typeof value === "string" && categoryMap[columnName][value]) { else if (categoryMap[columnName] && typeof value === "string") {
// 쉼표로 구분된 다중 값 처리
if (value.includes(",")) {
const values = value.split(",").map((v) => v.trim()).filter((v) => v);
const labels = values.map((v) => categoryMap[columnName][v] || v);
value = labels.join(", ");
} else if (categoryMap[columnName][value]) {
value = categoryMap[columnName][value]; value = categoryMap[columnName][value];
} }
}
filteredRow[label] = value; filteredRow[label] = value;
} }

View File

@ -116,8 +116,10 @@ export async function importFromExcel(
return; return;
} }
// JSON으로 변환 // JSON으로 변환 (빈 셀도 포함하여 모든 컬럼 키 유지)
const jsonData = XLSX.utils.sheet_to_json(worksheet); const jsonData = XLSX.utils.sheet_to_json(worksheet, {
defval: "", // 빈 셀에 빈 문자열 할당
});
console.log("✅ 엑셀 가져오기 완료:", { console.log("✅ 엑셀 가져오기 완료:", {
sheetName: targetSheetName, sheetName: targetSheetName,