[as] feat: 체크리스트 항목 관리에 '정렬 순서' 컬럼 추가
This commit is contained in:
@@ -49,21 +49,15 @@ export function formatTreeBranchPrefix(depth: number): string {
|
||||
return "";
|
||||
}
|
||||
|
||||
function compareSortSeq(a: CklstRvwRow, b: CklstRvwRow): number {
|
||||
return (a.sortSeq ?? 0) - (b.sortSeq ?? 0);
|
||||
}
|
||||
|
||||
export function buildRvwDisplayRows(rows: CklstRvwRow[]): CklstRvwDisplayRow[] {
|
||||
const result: CklstRvwDisplayRow[] = [];
|
||||
|
||||
const roots = rows
|
||||
.filter((row) => (row.rvwCnLvNo ?? 1) === 1 && row.upCklstRvwSn == null)
|
||||
.sort(compareSortSeq);
|
||||
const roots = rows.filter((row) => (row.rvwCnLvNo ?? 1) === 1 && row.upCklstRvwSn == null);
|
||||
|
||||
function appendSubtree(parent: CklstRvwRow, depth: number) {
|
||||
const children = rows
|
||||
.filter((row) => row.upCklstRvwSn != null && row.upCklstRvwSn === parent.cklstRvwSn)
|
||||
.sort(compareSortSeq);
|
||||
const children = rows.filter(
|
||||
(row) => row.upCklstRvwSn != null && row.upCklstRvwSn === parent.cklstRvwSn,
|
||||
);
|
||||
|
||||
for (const child of children) {
|
||||
result.push({ row: child, depth });
|
||||
@@ -82,7 +76,7 @@ export function buildRvwDisplayRows(rows: CklstRvwRow[]): CklstRvwDisplayRow[] {
|
||||
(row) => !result.some((display) => display.row.rowKey === row.rowKey),
|
||||
);
|
||||
|
||||
for (const orphan of orphans.sort(compareSortSeq)) {
|
||||
for (const orphan of orphans) {
|
||||
result.push({ row: orphan, depth: Math.max(0, (orphan.rvwCnLvNo ?? 1) - 1) });
|
||||
}
|
||||
|
||||
|
||||
@@ -279,12 +279,13 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
) : (
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
<col width="42%" />
|
||||
<col width="12%" />
|
||||
<col width="12%" />
|
||||
<col width="16%" />
|
||||
<col width="36%" />
|
||||
<col width="10%" />
|
||||
<col width="10%" />
|
||||
<col width="8%" />
|
||||
<col width="5%" />
|
||||
<col width="11%" />
|
||||
<col width="15%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
@@ -292,6 +293,7 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
<TableHead>주요 검토내용</TableHead>
|
||||
<TableHead>사용 여부</TableHead>
|
||||
<TableHead>체크 사용</TableHead>
|
||||
<TableHead>정렬 순서</TableHead>
|
||||
<TableHead>구분</TableHead>
|
||||
<TableHead>관리</TableHead>
|
||||
</TableRow>
|
||||
|
||||
@@ -107,6 +107,20 @@ function CklstRvwRowComponent({
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
value={row.sortSeq ?? ""}
|
||||
onChange={(e) =>
|
||||
onChange({
|
||||
sortSeq: e.target.value ? Number(e.target.value) : undefined,
|
||||
isDirty: true,
|
||||
})
|
||||
}
|
||||
className="w-20"
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell align="center">{levelLabel}</TableCell>
|
||||
<TableCell align="center">
|
||||
<div className="flex justify-center gap-2">
|
||||
|
||||
Reference in New Issue
Block a user