영업관리 구매요청서관리·품의서관리 신규 2메뉴 (wace_plm 1:1)
backend
- services/salesPurchaseRequestService.ts: listPurchaseRequestReg(DOC_TYPE='PURCHASE_REG') + listPurchaseRegProposal(DOC_TYPE='PURCHASE_REG_PROPOSAL')
· 구매요청서 상태 CASE: PURCHASE_REG_PROPOSAL 자식 존재 시 '품의서생성' → '확정'/'작성중' (wace 매퍼 1:1)
· 품의서 결재상태: amaranth_approval(target_type='PROPOSAL') LEFT JOIN 우선순위
· sales_request_part 누락 → MBOM_DETAIL+PART_MNG fallback (구매관리 패턴 동일)
- routes/salesPurchaseRequestRoutes.ts + app.ts: /api/sales/purchase-request, /api/sales/purchase-proposal
frontend
- lib/api/salesPurchaseRequest.ts
- sales/purchase-request/page.tsx — 14컬럼, 구매요청서작성/품의서생성 액션 (placeholder 토스트)
- sales/purchase-proposal/page.tsx — 10컬럼, 결재상신 액션 (placeholder 토스트)
- PageHeader+CompactFilterBar+SmartSelect+DataGrid logicstudio 6종 패턴 일관 적용
구매관리>품의서관리 vs 영업관리>품의서관리 차이
- 구매관리: DOC_TYPE in ('PROPOSAL', 'PURCHASE_REG_PROPOSAL'(결재완료만)) → 발주서 생성 풀
- 영업관리: DOC_TYPE='PURCHASE_REG_PROPOSAL' 전용 → 결재상신 화면 (결재완료 시 구매관리로 자동 노출)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
"use client";
|
||||
|
||||
// 영업관리 > 품의서관리 — wace salesMng/purchaseRegProposalMngList.jsp 1:1
|
||||
// 그리드: sales_request_master (doc_type='PURCHASE_REG_PROPOSAL') + mbom 품번/품명
|
||||
// 검색: 품의서No / 프로젝트번호 / 결재상태 / 작성일 / 구매유형 / 작성자 / 제품구분
|
||||
// 액션: 조회 / 결재상신 (Amaranth10 SSO 연동 — 기존 견적 패턴 재사용 예정)
|
||||
//
|
||||
// 구매관리>품의서관리 vs 영업관리>품의서관리:
|
||||
// - 구매관리: DOC_TYPE in ('PROPOSAL', 'PURCHASE_REG_PROPOSAL'(결재완료만)) → 발주서 생성 풀
|
||||
// - 영업관리: DOC_TYPE = 'PURCHASE_REG_PROPOSAL' 만 → 구매요청서 → 품의서 결재상신 화면
|
||||
// 결재완료 시 구매관리>품의서관리에 자동 노출됨.
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Send } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { DataGrid, DataGridColumn } from "@/components/common/DataGrid";
|
||||
import { SmartSelect, SmartSelectOption } from "@/components/common/SmartSelect";
|
||||
import { CompactFilterBar, CompactFilterField, CompactDateRange } from "@/components/common/CompactFilterBar";
|
||||
import { PageHeader } from "@/components/common/PageHeader";
|
||||
import { apiClient } from "@/lib/api/client";
|
||||
import { purchaseApi, OptionItem } from "@/lib/api/purchase";
|
||||
import {
|
||||
salesPurchaseRequestApi,
|
||||
SalesPurchaseRequestFilter,
|
||||
} from "@/lib/api/salesPurchaseRequest";
|
||||
import { exportToExcel } from "@/lib/utils/excelExport";
|
||||
|
||||
const PARENT_PURCHASE_TYPE = "0001814";
|
||||
const PARENT_PART_TYPE = "0000001";
|
||||
|
||||
const STATUS_OPTS: SmartSelectOption[] = [
|
||||
{ code: "create", label: "작성중" },
|
||||
{ code: "inProcess", label: "결재중" },
|
||||
{ code: "approvalComplete", label: "결재완료" },
|
||||
{ code: "reject", label: "반려" },
|
||||
];
|
||||
|
||||
const EMPTY_FILTER: SalesPurchaseRequestFilter = {
|
||||
proposal_no: "", project_no: "", search_status: "",
|
||||
purchase_type: "", writer: "", part_type: "",
|
||||
regdate_start: "", regdate_end: "",
|
||||
page: 1, page_size: 50,
|
||||
};
|
||||
|
||||
export default function PurchaseRegProposalPage() {
|
||||
const [rows, setRows] = useState<any[]>([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [filter, setFilter] = useState<SalesPurchaseRequestFilter>(EMPTY_FILTER);
|
||||
const [checkedIds, setCheckedIds] = useState<string[]>([]);
|
||||
|
||||
const [purchaseTypeOpts, setPurchaseTypeOpts] = useState<SmartSelectOption[]>([]);
|
||||
const [partTypeOpts, setPartTypeOpts] = useState<SmartSelectOption[]>([]);
|
||||
const [userOpts, setUserOpts] = useState<OptionItem[]>([]);
|
||||
|
||||
const fetchList = useCallback(async (override?: Partial<SalesPurchaseRequestFilter>) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const f = { ...filter, ...override };
|
||||
const res = await salesPurchaseRequestApi.listPurchaseRegProposal(f);
|
||||
setRows(res.rows ?? []);
|
||||
setTotal(res.totalCount ?? 0);
|
||||
} catch (e: any) {
|
||||
toast.error(e?.response?.data?.message ?? e?.message ?? "조회 실패");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [filter]);
|
||||
|
||||
useEffect(() => {
|
||||
let dead = false;
|
||||
(async () => {
|
||||
try {
|
||||
const [pt, ptt, u] = await Promise.all([
|
||||
apiClient.get(`/sales/codes/${PARENT_PURCHASE_TYPE}`),
|
||||
apiClient.get(`/sales/codes/${PARENT_PART_TYPE}`),
|
||||
purchaseApi.listUsers(),
|
||||
]);
|
||||
if (dead) return;
|
||||
setPurchaseTypeOpts(pt.data?.data ?? []);
|
||||
setPartTypeOpts(ptt.data?.data ?? []);
|
||||
setUserOpts(u);
|
||||
} catch { /* skip */ }
|
||||
})();
|
||||
fetchList(EMPTY_FILTER);
|
||||
return () => { dead = true; };
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const gridRows = useMemo(() => rows.map((r, i) => ({
|
||||
...r,
|
||||
id: r.objid ?? `prp_${i}`,
|
||||
part_display: r.part_extra_count > 0 ? `${r.part_no} 외 ${r.part_extra_count}건` : r.part_no,
|
||||
part_name_display: r.part_extra_count > 0 ? `${r.part_name} 외 ${r.part_extra_count}건` : r.part_name,
|
||||
})), [rows]);
|
||||
|
||||
const GRID_COLUMNS: DataGridColumn[] = useMemo(() => ([
|
||||
{ key: "proposal_no", label: "품의서 No", width: "w-[140px]", align: "center" },
|
||||
{ key: "project_number", label: "프로젝트번호", width: "w-[150px]", align: "center" },
|
||||
{ key: "purchase_type_name", label: "구매유형", width: "w-[115px]", align: "center" },
|
||||
{ key: "order_type_name", label: "주문유형", width: "w-[115px]", align: "center" },
|
||||
{ key: "product_name_title", label: "제품구분", width: "w-[115px]", align: "center" },
|
||||
{ key: "part_display", label: "품번", width: "w-[160px]" },
|
||||
{ key: "part_name_display", label: "품명", minWidth: "min-w-[200px]" },
|
||||
{ key: "status_title", label: "결재상태", width: "w-[120px]", align: "center" },
|
||||
{ key: "regdate_title", label: "작성일", width: "w-[115px]", align: "center" },
|
||||
{ key: "writer_name", label: "작성자", width: "w-[120px]", align: "center" },
|
||||
]), []);
|
||||
|
||||
const summary = useMemo(() => {
|
||||
const approved = gridRows.filter((r: any) => r.status === "approvalComplete").length;
|
||||
const inProc = gridRows.filter((r: any) => r.status === "inProcess").length;
|
||||
return [
|
||||
{ label: "전체 건수", value: total.toLocaleString(), suffix: "건" },
|
||||
{ label: "결재완료(페이지)", value: approved.toLocaleString(), suffix: "건" },
|
||||
{ label: "결재중(페이지)", value: inProc.toLocaleString(), suffix: "건" },
|
||||
{ label: "선택", value: checkedIds.length.toLocaleString(), suffix: "건" },
|
||||
];
|
||||
}, [gridRows, total, checkedIds]);
|
||||
|
||||
const handleSearch = () => { setFilter(f => ({ ...f, page: 1 })); fetchList({ page: 1 }); };
|
||||
const handleReset = () => { setFilter(EMPTY_FILTER); fetchList(EMPTY_FILTER); };
|
||||
|
||||
const onApproval = () => {
|
||||
if (checkedIds.length !== 1) {
|
||||
toast.info("결재상신할 1건을 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
const sel = gridRows.find((r: any) => r.id === checkedIds[0]);
|
||||
if (!sel) return;
|
||||
if (sel.status === "inProcess") return toast.info("결재 진행중인 건은 상신할 수 없습니다.");
|
||||
if (sel.status === "approvalComplete") return toast.info("결재 완료된 건은 상신할 수 없습니다.");
|
||||
toast.info("결재상신 — Amaranth10 SSO 연동 후 활성 (sales/purchase-proposal/:id/amaranth-approval)");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col overflow-hidden p-2 gap-2">
|
||||
<PageHeader
|
||||
title="품의서관리"
|
||||
description="구매요청서 → 품의서 결재상신 — wace purchaseRegProposalMngList 1:1"
|
||||
loading={loading} onSearch={handleSearch} onReset={handleReset}
|
||||
actions={<>
|
||||
<Button size="sm" variant="default" className="h-8 gap-1 px-2 text-xs bg-cyan-600 hover:bg-cyan-700"
|
||||
disabled={checkedIds.length !== 1}
|
||||
onClick={onApproval}>
|
||||
<Send className="h-3.5 w-3.5" /> 결재상신
|
||||
</Button>
|
||||
</>}
|
||||
/>
|
||||
<CompactFilterBar totalText={<>총 {total.toLocaleString()}건</>}>
|
||||
<CompactFilterField label="품의서 No" width={150}>
|
||||
<Input value={filter.proposal_no ?? ""}
|
||||
onChange={(e) => setFilter({ ...filter, proposal_no: e.target.value })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="프로젝트번호" width={170}>
|
||||
<Input value={filter.project_no ?? ""}
|
||||
onChange={(e) => setFilter({ ...filter, project_no: e.target.value })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="결재상태" width={130}>
|
||||
<SmartSelect options={STATUS_OPTS} value={filter.search_status ?? ""}
|
||||
onValueChange={(v) => setFilter({ ...filter, search_status: v })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="작성일" width={280}>
|
||||
<CompactDateRange
|
||||
from={filter.regdate_start ?? ""} setFrom={(v) => setFilter({ ...filter, regdate_start: v })}
|
||||
to={filter.regdate_end ?? ""} setTo={(v) => setFilter({ ...filter, regdate_end: v })}
|
||||
/>
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="구매유형" width={150}>
|
||||
<SmartSelect options={purchaseTypeOpts} value={filter.purchase_type ?? ""}
|
||||
onValueChange={(v) => setFilter({ ...filter, purchase_type: v })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="작성자" width={170}>
|
||||
<SmartSelect options={userOpts} value={filter.writer ?? ""}
|
||||
onValueChange={(v) => setFilter({ ...filter, writer: v })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="제품구분" width={150}>
|
||||
<SmartSelect options={partTypeOpts} value={filter.part_type ?? ""}
|
||||
onValueChange={(v) => setFilter({ ...filter, part_type: v })} />
|
||||
</CompactFilterField>
|
||||
</CompactFilterBar>
|
||||
|
||||
<DataGrid
|
||||
columns={GRID_COLUMNS}
|
||||
data={gridRows}
|
||||
loading={loading}
|
||||
showCheckbox
|
||||
checkedIds={checkedIds}
|
||||
onCheckedChange={setCheckedIds}
|
||||
emptyMessage={loading ? "조회 중..." : "데이터가 없습니다"}
|
||||
gridId="sales-purchase-proposal"
|
||||
pageSizeOptions={[10, 15, 20, 50, 100]}
|
||||
paginationStyle="range"
|
||||
serverPaging
|
||||
serverPage={filter.page ?? 1}
|
||||
serverPageSize={filter.page_size ?? 50}
|
||||
serverTotalItems={total}
|
||||
onPageChange={(p) => { setFilter(f => ({ ...f, page: p })); fetchList({ page: p }); }}
|
||||
onPageSizeChange={(n) => { setFilter(f => ({ ...f, page: 1, page_size: n })); fetchList({ page: 1, page_size: n }); }}
|
||||
showColumnSettings
|
||||
summaryStats={summary}
|
||||
systemColumnKeys={["writer_name", "regdate_title"]}
|
||||
onRefresh={() => fetchList()}
|
||||
onDownload={() => {
|
||||
if (gridRows.length === 0) { toast.info("내보낼 데이터가 없습니다."); return; }
|
||||
const exportRows = gridRows.map((r: any) => {
|
||||
const out: Record<string, any> = {};
|
||||
GRID_COLUMNS.forEach((c) => { out[c.label] = r[c.key] ?? ""; });
|
||||
return out;
|
||||
});
|
||||
exportToExcel(exportRows, "영업_품의서관리.xlsx", "품의서");
|
||||
}}
|
||||
showChart
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
"use client";
|
||||
|
||||
// 영업관리 > 구매요청서관리 — wace salesMng/purchaseRequestRegList.jsp 1:1
|
||||
// 그리드: sales_request_master (doc_type='PURCHASE_REG') + mbom 품번/품명
|
||||
// 검색: 품번 / 품명 / 작성일 / 구매유형(single) / 작성자 / 제품구분
|
||||
// 액션: 조회 / 구매요청서작성(예정) / 품의서생성(예정)
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { FilePlus, ClipboardCheck } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { DataGrid, DataGridColumn } from "@/components/common/DataGrid";
|
||||
import { SmartSelect, SmartSelectOption } from "@/components/common/SmartSelect";
|
||||
import { CompactFilterBar, CompactFilterField, CompactDateRange } from "@/components/common/CompactFilterBar";
|
||||
import { PageHeader } from "@/components/common/PageHeader";
|
||||
import { apiClient } from "@/lib/api/client";
|
||||
import { purchaseApi, OptionItem } from "@/lib/api/purchase";
|
||||
import {
|
||||
salesPurchaseRequestApi,
|
||||
SalesPurchaseRequestFilter,
|
||||
} from "@/lib/api/salesPurchaseRequest";
|
||||
import { exportToExcel } from "@/lib/utils/excelExport";
|
||||
|
||||
const PARENT_PURCHASE_TYPE = "0001814"; // 구매유형
|
||||
const PARENT_PART_TYPE = "0000001"; // 제품구분
|
||||
|
||||
const EMPTY_FILTER: SalesPurchaseRequestFilter = {
|
||||
project_no: "", part_no: "", part_name: "",
|
||||
purchase_type: "", writer: "", part_type: "",
|
||||
regdate_start: "", regdate_end: "",
|
||||
page: 1, page_size: 50,
|
||||
};
|
||||
|
||||
export default function PurchaseRequestRegPage() {
|
||||
const [rows, setRows] = useState<any[]>([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [filter, setFilter] = useState<SalesPurchaseRequestFilter>(EMPTY_FILTER);
|
||||
const [checkedIds, setCheckedIds] = useState<string[]>([]);
|
||||
|
||||
const [purchaseTypeOpts, setPurchaseTypeOpts] = useState<SmartSelectOption[]>([]);
|
||||
const [partTypeOpts, setPartTypeOpts] = useState<SmartSelectOption[]>([]);
|
||||
const [userOpts, setUserOpts] = useState<OptionItem[]>([]);
|
||||
|
||||
const fetchList = useCallback(async (override?: Partial<SalesPurchaseRequestFilter>) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const f = { ...filter, ...override };
|
||||
const res = await salesPurchaseRequestApi.listPurchaseRequestReg(f);
|
||||
setRows(res.rows ?? []);
|
||||
setTotal(res.totalCount ?? 0);
|
||||
} catch (e: any) {
|
||||
toast.error(e?.response?.data?.message ?? e?.message ?? "조회 실패");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [filter]);
|
||||
|
||||
useEffect(() => {
|
||||
let dead = false;
|
||||
(async () => {
|
||||
try {
|
||||
const [pt, ptt, u] = await Promise.all([
|
||||
apiClient.get(`/sales/codes/${PARENT_PURCHASE_TYPE}`),
|
||||
apiClient.get(`/sales/codes/${PARENT_PART_TYPE}`),
|
||||
purchaseApi.listUsers(),
|
||||
]);
|
||||
if (dead) return;
|
||||
setPurchaseTypeOpts(pt.data?.data ?? []);
|
||||
setPartTypeOpts(ptt.data?.data ?? []);
|
||||
setUserOpts(u);
|
||||
} catch { /* skip */ }
|
||||
})();
|
||||
fetchList(EMPTY_FILTER);
|
||||
return () => { dead = true; };
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const gridRows = useMemo(() => rows.map((r, i) => ({
|
||||
...r,
|
||||
id: r.objid ?? `pr_${i}`,
|
||||
part_display: r.part_extra_count > 0 ? `${r.part_no} 외 ${r.part_extra_count}건` : r.part_no,
|
||||
part_name_display: r.part_extra_count > 0 ? `${r.part_name} 외 ${r.part_extra_count}건` : r.part_name,
|
||||
has_purchase_request_label: r.has_purchase_request === "Y" ? "작성" : "미작성",
|
||||
})), [rows]);
|
||||
|
||||
const GRID_COLUMNS: DataGridColumn[] = useMemo(() => ([
|
||||
{ key: "request_mng_no", label: "요청번호", width: "w-[150px]", align: "center" },
|
||||
{ key: "purchase_type_name", label: "구매유형", width: "w-[110px]", align: "center" },
|
||||
{ key: "project_number", label: "프로젝트번호", width: "w-[150px]", align: "center" },
|
||||
{ key: "order_type_name", label: "주문유형", width: "w-[110px]", align: "center" },
|
||||
{ key: "product_name_full", label: "제품구분", width: "w-[110px]", align: "center" },
|
||||
{ key: "customer_name", label: "고객사", width: "w-[160px]" },
|
||||
{ key: "paid_type_name", label: "유/무상", width: "w-[90px]", align: "center" },
|
||||
{ key: "part_display", label: "품번", width: "w-[160px]" },
|
||||
{ key: "part_name_display", label: "품명", minWidth: "min-w-[200px]" },
|
||||
{ key: "has_purchase_request_label",label: "구매요청서", width: "w-[110px]", align: "center" },
|
||||
{ key: "request_user_name", label: "작성자", width: "w-[120px]", align: "center" },
|
||||
{ key: "delivery_request_date", label: "입고요청일", width: "w-[120px]", align: "center" },
|
||||
{ key: "regdate_title", label: "작성일", width: "w-[110px]", align: "center" },
|
||||
{ key: "status_title", label: "상태", width: "w-[110px]", align: "center" },
|
||||
]), []);
|
||||
|
||||
const summary = useMemo(() => {
|
||||
const proposed = gridRows.filter((r: any) => r.status_title === "품의서생성").length;
|
||||
const confirmed = gridRows.filter((r: any) => r.status_title === "확정").length;
|
||||
return [
|
||||
{ label: "전체 건수", value: total.toLocaleString(), suffix: "건" },
|
||||
{ label: "품의서생성(페이지)", value: proposed.toLocaleString(), suffix: "건" },
|
||||
{ label: "확정(페이지)", value: confirmed.toLocaleString(), suffix: "건" },
|
||||
{ label: "선택", value: checkedIds.length.toLocaleString(), suffix: "건" },
|
||||
];
|
||||
}, [gridRows, total, checkedIds]);
|
||||
|
||||
const handleSearch = () => { setFilter(f => ({ ...f, page: 1 })); fetchList({ page: 1 }); };
|
||||
const handleReset = () => { setFilter(EMPTY_FILTER); fetchList(EMPTY_FILTER); };
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col overflow-hidden p-2 gap-2">
|
||||
<PageHeader
|
||||
title="구매요청서관리"
|
||||
description="구매요청서 작성 → 품의서 생성 — wace purchaseRequestRegList 1:1"
|
||||
loading={loading} onSearch={handleSearch} onReset={handleReset}
|
||||
actions={<>
|
||||
<Button size="sm" variant="outline" className="h-8 gap-1 px-2 text-xs"
|
||||
onClick={() => toast.info("구매요청서작성 — 작성 다이얼로그 신설 후 활성")}>
|
||||
<FilePlus className="h-3.5 w-3.5" /> 구매요청서작성
|
||||
</Button>
|
||||
<Button size="sm" variant="default" className="h-8 gap-1 px-2 text-xs"
|
||||
disabled={checkedIds.length !== 1}
|
||||
onClick={() => toast.info("품의서생성 — sales_request_part 신설 후 활성")}>
|
||||
<ClipboardCheck className="h-3.5 w-3.5" /> 품의서생성
|
||||
</Button>
|
||||
</>}
|
||||
/>
|
||||
<CompactFilterBar totalText={<>총 {total.toLocaleString()}건</>}>
|
||||
<CompactFilterField label="품번" width={160}>
|
||||
<Input value={filter.part_no ?? ""}
|
||||
onChange={(e) => setFilter({ ...filter, part_no: e.target.value })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="품명" width={170}>
|
||||
<Input value={filter.part_name ?? ""}
|
||||
onChange={(e) => setFilter({ ...filter, part_name: e.target.value })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="프로젝트번호" width={170}>
|
||||
<Input value={filter.project_no ?? ""}
|
||||
onChange={(e) => setFilter({ ...filter, project_no: e.target.value })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="작성일" width={280}>
|
||||
<CompactDateRange
|
||||
from={filter.regdate_start ?? ""} setFrom={(v) => setFilter({ ...filter, regdate_start: v })}
|
||||
to={filter.regdate_end ?? ""} setTo={(v) => setFilter({ ...filter, regdate_end: v })}
|
||||
/>
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="구매유형" width={150}>
|
||||
<SmartSelect options={purchaseTypeOpts} value={filter.purchase_type ?? ""}
|
||||
onValueChange={(v) => setFilter({ ...filter, purchase_type: v })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="작성자" width={170}>
|
||||
<SmartSelect options={userOpts} value={filter.writer ?? ""}
|
||||
onValueChange={(v) => setFilter({ ...filter, writer: v })} />
|
||||
</CompactFilterField>
|
||||
<CompactFilterField label="제품구분" width={150}>
|
||||
<SmartSelect options={partTypeOpts} value={filter.part_type ?? ""}
|
||||
onValueChange={(v) => setFilter({ ...filter, part_type: v })} />
|
||||
</CompactFilterField>
|
||||
</CompactFilterBar>
|
||||
|
||||
<DataGrid
|
||||
columns={GRID_COLUMNS}
|
||||
data={gridRows}
|
||||
loading={loading}
|
||||
showCheckbox
|
||||
checkedIds={checkedIds}
|
||||
onCheckedChange={setCheckedIds}
|
||||
emptyMessage={loading ? "조회 중..." : "데이터가 없습니다"}
|
||||
gridId="sales-purchase-request"
|
||||
pageSizeOptions={[10, 15, 20, 50, 100]}
|
||||
paginationStyle="range"
|
||||
serverPaging
|
||||
serverPage={filter.page ?? 1}
|
||||
serverPageSize={filter.page_size ?? 50}
|
||||
serverTotalItems={total}
|
||||
onPageChange={(p) => { setFilter(f => ({ ...f, page: p })); fetchList({ page: p }); }}
|
||||
onPageSizeChange={(n) => { setFilter(f => ({ ...f, page: 1, page_size: n })); fetchList({ page: 1, page_size: n }); }}
|
||||
showColumnSettings
|
||||
summaryStats={summary}
|
||||
systemColumnKeys={["request_user_name", "regdate_title"]}
|
||||
onRefresh={() => fetchList()}
|
||||
onDownload={() => {
|
||||
if (gridRows.length === 0) { toast.info("내보낼 데이터가 없습니다."); return; }
|
||||
const exportRows = gridRows.map((r: any) => {
|
||||
const out: Record<string, any> = {};
|
||||
GRID_COLUMNS.forEach((c) => { out[c.label] = r[c.key] ?? ""; });
|
||||
return out;
|
||||
});
|
||||
exportToExcel(exportRows, "구매요청서관리.xlsx", "구매요청서");
|
||||
}}
|
||||
showChart
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user