수요처 관리 등록 팝업 삽입

This commit is contained in:
leedj312
2025-06-05 10:14:05 +09:00
parent 374336f0b9
commit a38a1315f2
2 changed files with 33 additions and 11 deletions
+28 -4
View File
@@ -15,14 +15,16 @@ import {
type ReturnType,
} from "@common/business_components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import SdmInsertForm, { type DemandCompType } from "@common/business_components/ui/sdmInsertForm";
export default function coSttn() {
const [bdstTable, setBdstTable] = useState<customCoBdst[]>();
const [bdstTable, setBdstTabl] = useState<customCoBdst[]>();
const [pageNation, setPageNation] = useState(1);
const { code, coSttn } = useWrStore(
const { code, coSttn ,getDemandCompList,regDemandCompany,demandCompList} = useWrStore(
(state) => state
);
const [isDmdModal, setIsDmdModal] = useState<{isMoal: boolean, data: DemandCompType}>({isMoal: false, data: {} as DemandCompType})
const ref = useRef<ReturnType>({} as ReturnType);
@@ -47,7 +49,7 @@ export default function coSttn() {
<Button
className={btnClass}
onClick={() => {
/* 등록 로직 */
setIsDmdModal({ ...isDmdModal, isMoal:true });
}}
>
등록
@@ -98,7 +100,29 @@ export default function coSttn() {
</ListDiv>
</div>
</div>
<UiModal
bodyClass={"w-[40vw] max-w-none h-[90vh]"}
open={isDmdModal.isMoal}
onOpenChange={() => {
setIsDmdModal({ isMoal: false, data: {} as DemandCompType });
}}
body={
<SdmInsertForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
dataList={demandCompList}
rtnValue={(searchText: string, pageCnt: number) => {
getDemandCompList(searchText, pageCnt);
}}
rtnInputData={(data) => {
console.log(" rtn data ", data);
regDemandCompany(data as DemandCompType);
setIsDmdModal({ isMoal: false, data: data as DemandCompType });
}}
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
></SdmInsertForm>
}
></UiModal>
</ContentsDiv>
</>
@@ -221,6 +221,7 @@ export function PbnstBuseForm({
splyFmYn: "Y",
pbnstRuseFcltBizPk: form.getValues('pbnstRuseFcltBizPk'),
pbnstRuseFcltFk: form.getValues('pbnstRuseFcltFk')??'',
dmdInfoFk: '',
//telno: "",
});
};
@@ -499,10 +500,9 @@ export function PbnstBuseForm({
`fcDemands.${index}.splyFmYn`,
valList['0'].splyFmYn ?? "Y"
);
form.setValue(
`fcDemands.${index}.dmdInfoPk`,
valList['0'].dmdInfoPk ?? "Y"
`fcDemands.${index}.dmdInfoFk`,
valList['0'].dmdInfoPk?.toString() ?? ""
);
}
@@ -541,10 +541,8 @@ export function PbnstBuseForm({
selectClass={""}
className="w-full"
selectArray={code.dmdUszCd}
onSelectValue={(val: string | number) =>
f.onChange(val)
}
value={f.value}
onSelectValue={f.onChange}
value={f.value?? code.dmdUszCd[0]?.val}
/>
</FormUi>
)}