wr: 수요처 수정
This commit is contained in:
@@ -21,6 +21,7 @@ Main technologies:
|
||||
|
||||
## 주석 comment
|
||||
- 한글 주석을 삭제하지 말 것
|
||||
- 신규 component나 함수 자동 생성시 주석을 추가할 것(기본 함수의 역할과 인수 설명)
|
||||
|
||||
## Monorepo structure
|
||||
apps/
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
"use client";
|
||||
|
||||
/**
|
||||
* 수요처관리
|
||||
*/
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import { excelCoSttnParsing } from "@/app/store/matDmd/coSttn/excel";
|
||||
@@ -188,6 +191,47 @@ export default function CoSttn() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 등록/수정 : SdmInsertForm에서 저장 버튼을 눌렀을 때, 폼 데이터가 부모로 넘어오는 콜백
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
const handleRtnInputData = async (data: DemandCompType) => {
|
||||
const con =
|
||||
objSearch.sgg && objSearch.sgg !== "0"
|
||||
? objSearch.sgg
|
||||
: objSearch.city;
|
||||
|
||||
if (updateData?.dmdInfoId) { // 수정
|
||||
const message = await updateDemandCompany(data);
|
||||
alert(message);
|
||||
coSttnInit("1", "13", String(con));
|
||||
setIsDmdModal({
|
||||
isMoal: false,
|
||||
data,
|
||||
});
|
||||
setIsResetSelection(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const dmd = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/request/${data.dmdInfoId}`
|
||||
);
|
||||
if (dmd) {
|
||||
alert(`사업자번호 ${dmd.dmdInfoId}는 이미 등록되었습니다. 다시등록해주세요`);
|
||||
return;
|
||||
}
|
||||
|
||||
const message = await regDemandCompany(data); // 등록
|
||||
alert(message);
|
||||
coSttnInit("1", "13", String(con));
|
||||
setIsDmdModal({
|
||||
isMoal: false,
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -284,12 +328,12 @@ export default function CoSttn() {
|
||||
headlist={coSttn.coSttHeadList}
|
||||
pageSize={13}
|
||||
total={coSttnResCount || 0}
|
||||
cellClick={ async(index: number | undefined) => {
|
||||
const uuid = await getMyUUID();
|
||||
const updateData = coSttnRes[index as number];
|
||||
if (updateData && typeof uuid === "string") {
|
||||
updateData.mdfr = uuid;
|
||||
}
|
||||
cellClick={async(index: number | undefined) => {
|
||||
const uuid = await getMyUUID();
|
||||
const updateData = coSttnRes[index as number];
|
||||
if (updateData && typeof uuid === "string") {
|
||||
updateData.mdfr = uuid;
|
||||
}
|
||||
setUpdateData(coSttnRes[index as number]);
|
||||
}}
|
||||
onPageChange={(page) => {
|
||||
@@ -321,38 +365,7 @@ export default function CoSttn() {
|
||||
rtnValue={(searchText: string, pageCnt: number) => {
|
||||
getDemandCompList(searchText, pageCnt);
|
||||
}}
|
||||
rtnInputData={async (data) => {
|
||||
const con =
|
||||
objSearch.sgg && objSearch.sgg !== "0"
|
||||
? objSearch.sgg
|
||||
: objSearch.city;
|
||||
if (updateData?.dmdInfoId) {
|
||||
const message = await updateDemandCompany(data as DemandCompType);
|
||||
alert(message);
|
||||
coSttnInit("1", "13", String(con));
|
||||
setIsDmdModal({
|
||||
isMoal: false,
|
||||
data: data as DemandCompType,
|
||||
});
|
||||
setIsResetSelection(true);
|
||||
} else {
|
||||
const dmd = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/request/${data.dmdInfoId}`
|
||||
);
|
||||
if (dmd) {
|
||||
alert(`사업자번호 ${dmd.dmdInfoId}는 이미 등록되었습니다. 다시등록해주세요`);
|
||||
return;
|
||||
}
|
||||
const message = await regDemandCompany(data as DemandCompType);
|
||||
alert(message);
|
||||
coSttnInit("1", "13", String(con));
|
||||
setIsDmdModal({
|
||||
isMoal: false,
|
||||
data: data as DemandCompType,
|
||||
});
|
||||
}
|
||||
}}
|
||||
rtnInputData={handleRtnInputData}
|
||||
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
|
||||
updateList={updateData}
|
||||
openNetwork={true}
|
||||
|
||||
Reference in New Issue
Block a user