wr: 기존 공급처 있는 경우의 처리
This commit is contained in:
@@ -66,7 +66,7 @@ type coRvwActions = {
|
||||
sggCd: string
|
||||
) => void;
|
||||
};
|
||||
|
||||
// 수요매칭검토현황 목록
|
||||
const coMatInit = async (
|
||||
pageNo: number,
|
||||
pageCnt: number,
|
||||
@@ -149,6 +149,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
sggCd: string,
|
||||
dmdCoNm: string
|
||||
) => {
|
||||
// 수요처 년도별 정보 검색
|
||||
let url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd.length > 0) {
|
||||
|
||||
@@ -93,7 +93,7 @@ export const DmdCoReqSchema = z.object({
|
||||
demandCo: DemandCoSchema.nullish(), // 수요처 정보
|
||||
demandMatching: DemandMatchingSchema.nullish(), // 매칭 정보
|
||||
demandCst: DemandCstSchema.nullish(), // 공사비 정보
|
||||
ruseUtztnFcltNm: z.string().nullish(), // 공급처 선정
|
||||
ruseUtztnFcltNm: z.string().nullish(), // 공급처명
|
||||
splyCndtList: z.array(
|
||||
z.object({
|
||||
ruseUtztnFcltNm: z.string(), // 공급처명
|
||||
|
||||
@@ -122,16 +122,34 @@ export default function ConCostForm({
|
||||
link.click();
|
||||
});
|
||||
};
|
||||
const usgPrcsProcsWatch = activeForm.watch("demandCst.usgPrcsProcs");
|
||||
const dmndQtyWatch = activeForm.watch("dmndQty");
|
||||
const totalConstCost = activeForm.watch("totalConstCost");
|
||||
const cstrnCst = activeForm.watch("demandCst.cstrnCst") || 0;
|
||||
const splyList = activeForm.watch("splyCndtList");
|
||||
const useUsgCdWatch = activeForm.watch("useUsgCd");
|
||||
const usgPrcsProcsWatch = activeForm.watch("demandCst.usgPrcsProcs"); // 용도에 따른 처리공정
|
||||
const dmndQtyWatch = activeForm.watch("dmndQty"); // 요구수량(m³/일)
|
||||
const totalConstCost = activeForm.watch("totalConstCost"); // 처리시설 총사업비(백만원)
|
||||
const cstrnCst = activeForm.watch("demandCst.cstrnCst") || 0; // 공급관로 표준공사비(백만원)
|
||||
const prcsFcltCpctCstrnCst = activeForm.watch("demandCst.prcsFcltCpctCstrnCst") || 0; // 처리시설용량에 따른 공사비(백만원)
|
||||
const fcltSbsdCstrnCst = activeForm.watch("demandCst.fcltSbsdCstrnCst") || 0; // 시설부대경비
|
||||
const splyList = activeForm.watch("splyCndtList"); // 공급처 후보지 목록
|
||||
const useUsgCdWatch = activeForm.watch("useUsgCd"); // 사용 용도 코드
|
||||
const ruseUtztnFcltNmWatch = activeForm.watch("ruseUtztnFcltNm"); // 선정된 공급처 명
|
||||
const useUsgCdLabel =
|
||||
code.sewageOutFclttUse?.find((item) => item.val === useUsgCdWatch)?.text ??
|
||||
code.sewageOutFclttUse?.find((item) => item.val === useUsgCdWatch)?.text ?? // 사용 용도 명칭(라벨)
|
||||
String(useUsgCdWatch ?? "");
|
||||
|
||||
useEffect(() => {
|
||||
const calculatedTotalConstCost =
|
||||
Number(prcsFcltCpctCstrnCst) + Number(fcltSbsdCstrnCst);
|
||||
|
||||
if ((totalConstCost ?? 0) !== calculatedTotalConstCost) {
|
||||
activeForm.setValue("totalConstCost", calculatedTotalConstCost);
|
||||
}
|
||||
}, [
|
||||
activeForm,
|
||||
prcsFcltCpctCstrnCst,
|
||||
fcltSbsdCstrnCst,
|
||||
totalConstCost,
|
||||
selectionVersion,
|
||||
]);
|
||||
|
||||
// 용도 변경 시 처리공정 자동 매핑 (시뮬레이션 대응)
|
||||
useEffect(() => {
|
||||
if (useUsgCdWatch) {
|
||||
@@ -239,13 +257,13 @@ export default function ConCostForm({
|
||||
return;
|
||||
}
|
||||
|
||||
// const pk =
|
||||
// splycd && splycd[0]?.ruseUtztnFcltCd
|
||||
// ? splycd[0]?.ruseUtztnFcltCd
|
||||
// : "11000SW001R1";
|
||||
// 1순위: 팝업에서 새로 선택한 코드 (lastSub)
|
||||
// 2순위: 기존 DB에서 불러와 폼에 저장된 코드 (demandMatching.pbnstRuseFcltId)
|
||||
const pk =
|
||||
lastSub?.ruseUtztnFcltCd ??
|
||||
activeForm.getValues("demandMatching.pbnstRuseFcltId") ??
|
||||
null;
|
||||
|
||||
const pk =lastSub?.ruseUtztnFcltCd??null; // 후보지
|
||||
|
||||
if (type === "mat") {
|
||||
if (value.demandCst) {
|
||||
const data: DedMatUpdateType = {
|
||||
@@ -652,13 +670,14 @@ export default function ConCostForm({
|
||||
</div>
|
||||
<FormUi label="">
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="공급처를 선정해주세요"
|
||||
type="text"
|
||||
value={lastSub?.ruseUtztnFcltNm || ""}
|
||||
// 1순위: 팝업에서 새로 선택한 값(lastSub)
|
||||
// 2순위: 기존 DB에서 불러온 값(ruseUtztnFcltNmWatch)
|
||||
value={lastSub?.ruseUtztnFcltNm || ruseUtztnFcltNmWatch || ""}
|
||||
readOnly
|
||||
className={`mt-2 ${readOnlyInputClass}`}
|
||||
/>
|
||||
|
||||
</FormUi>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user