diff --git a/apps/wr/.env.local b/apps/wr/.env.local index db59d33c4..19f7f5a24 100644 --- a/apps/wr/.env.local +++ b/apps/wr/.env.local @@ -12,8 +12,8 @@ NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver -NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 -#NEXT_PUBLIC_WR_SERVER_API_URL = http://192.168.1.222:8883/reuse-service/api/v1 +# NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 +NEXT_PUBLIC_WR_SERVER_API_URL = http://192.168.1.222:8883/reuse-service/api/v1 NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service # ๊ฐœ๋ฐœ ์„œ๋ฒ„ API # NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr diff --git a/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx index bcc168aac..330847f86 100644 --- a/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx @@ -1,6 +1,6 @@ "use client"; /** - * ๐Ÿ“„ CoMatRvw ์ˆ˜์š”๋งค์นญ ๊ฒ€ํ†  + * ๐Ÿ“„ CoMatRvw ์ˆ˜์š”์ฒ˜ ๋งค์นญ ๊ฒ€ํ†  * Next.js App Router (app/) ๊ธฐ๋ฐ˜ ํŽ˜์ด์ง€ ์ปดํฌ๋„ŒํŠธ ์˜ˆ์‹œ * * - ๋Œ€๋ฏผ์—์„œ ์‹ ์ฒญํ•˜๋Š” ์ˆ˜์š”์ฒ˜์˜ ์ˆ˜์š”๋“ฑ๋ก ์ •๋ณด๋ฅผ ์šด์˜๋‹ด๋‹น์ž๊ฐ€ ์ˆ˜์š” ๋งค์นญ ๊ฒ€ํ† ๋ฅผ ์ง„ํ–‰ํ•œ๋‹ค. @@ -8,7 +8,7 @@ */ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; -import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList"; +import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList"; // ์šฉ๋„์— ๋”ฐ๋ฅธ ์ฒ˜๋ฆฌ๊ณต์ • import { DmdCoReqSchema, type DmdCoReqType, @@ -112,19 +112,29 @@ export default function CoMatRvw() { if (coMatRvwRes && coMatRvwRes[index]) { setSelectData(coMatRvwRes[index]); setSelectionVersion((v) => v + 1); // ํ–‰์„ ํด๋ฆญํ•  ๋•Œ๋งˆ๋‹ค ๋ฒ„์ „์„ 1์”ฉ ์ฆ๊ฐ€ - bottomRef.current?.scrollIntoView({ behavior: "smooth" }); + bottomRef.current?.scrollIntoView({ behavior: "smooth" }); // ํ™”๋ฉด ์Šคํฌ๋กœ ์ฒ˜๋ฆฌ } }; const useUsgCdWatch = useWatch({ control: form.control, name: "useUsgCd" }); useEffect(() => { if (useUsgCdWatch) { + console.log("useUsgCdWatch:" , useUsgCdWatch); + const normalizedUseUsgCd = + code.sewageOutFclttUse?.find((item) => item.val === useUsgCdWatch)?.val ?? + code.sewageOutFclttUse?.find((item) => item.text === useUsgCdWatch)?.val ?? + useUsgCdWatch; + + if (normalizedUseUsgCd !== useUsgCdWatch) { + form.setValue("useUsgCd", normalizedUseUsgCd); + } + form.setValue( "demandCst.usgPrcsProcs", - usageProcData?.find((item) => item.usage === useUsgCdWatch)?.process ?? + usageProcData?.find((item) => item.useUsgCd === normalizedUseUsgCd)?.process ?? "" ); } - }, [useUsgCdWatch, form, selectionVersion]); + }, [useUsgCdWatch, form, selectionVersion, code.sewageOutFclttUse]); useEffect(() => { if (coMatRvwRes && coMatRvwRes.length > 0) { diff --git a/apps/wr/app/layout.tsx b/apps/wr/app/layout.tsx index edd57b02b..e26635d4f 100644 --- a/apps/wr/app/layout.tsx +++ b/apps/wr/app/layout.tsx @@ -1,6 +1,8 @@ import type { Metadata } from "next"; import { App } from "../src/app"; +import { setCookie } from "../src/shared/lib/cookie"; +setCookie("site-id-key", process.env.NEXT_PUBLIC_SITE_ID || "WR"); export const metadata: Metadata = { title: "๋ฌผ์žฌ์ด์šฉ๋งค์นญ์‹œ์Šคํ…œ", description: "๋ฌผ์žฌ์ด์šฉ๋งค์นญ ์‹œ์Šคํ…œ์ž…๋‹ˆ๋‹ค", diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index f6e28339c..fb400de2c 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -77,6 +77,7 @@ export const getCommonUpCd = async (set: any) => { pplQulity: lwCdCode["pplQulity"] ?? [], pplLenght: lwCdCode["pplLenght"] ?? [], dmdUszCd: lwCdCode["dmdUszCd"] ?? [], + sewageOutFclttUse: lwCdCode["sewageOutFclttUse"] ?? [], ruseMngMtd: lwCdCode["ruseMngMtd"] ?? [], rusePrcsMthdCd: lwCdCode["rusePrcsMthdCd"] ?? [], erctUswtrPrcsMeth: lwCdCode["erctUswtrPrcsMeth"] ?? [], @@ -233,6 +234,7 @@ export type comCodeState = { pplQulity: SelectDataType[]; pplLenght: SelectDataType[]; dmdUszCd: SelectDataType[]; + sewageOutFclttUse: SelectDataType[]; buildingType: { RST: string; RNB: string; @@ -274,6 +276,7 @@ export const comCodeStateExport: comCodeState = { pplLenght: lwCds["pplLenght"] ?? [], yn: yn, dmdUszCd: lwCds["dmdUszCd"] ?? [], + sewageOutFclttUse: lwCds["sewageOutFclttUse"] ?? [], buildingType: buildingType, ruseMngMtd: lwCds["ruseMngMtd"] ?? [], ruseSeCd: ruseSeCd, diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts index 1478b10a8..a48225e12 100644 --- a/apps/wr/app/store/common/searchCode/index.ts +++ b/apps/wr/app/store/common/searchCode/index.ts @@ -39,7 +39,8 @@ export const comFcltStateExport: comFcltState = { cdtnv: 0, crmty: 0, rmrk: "", - reqDt: "" + reqDt: "", + zip: "", }, constCostRes:[], rateFeeRes:[], @@ -51,7 +52,7 @@ export type comFcltState = { searchFclts: pubHasuType[]; demandCompList: DemandCompType[]; checkDemand: DemandCompType; - constCostRes:conCostFeeType[], + constCostRes:conCostFeeType[], // ํ‘œ์ค€์‚ฌ์—…๋น„ rateFeeRes:rateFeeType[], }; @@ -164,7 +165,9 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { } catch (e) { console.log(" error ", e); } - },getConstCostFee: async (year: string) => { + }, + // ๊ณต์‚ฌ๊ธˆ์•ก ์กฐํšŒ : ONSEMIRO_NEW.EM_STD_COST_REUSE ์„ค์น˜๊ด€๋ฆฌํ‘œ์ค€์‚ฌ์—…๋น„ ์žฌ์ด์šฉ์‹œ์„ค ๊ณต์‚ฌ๋น„ + getConstCostFee: async (year: string) => { try { const url = `/prcsFclt/CstRuse/${year}`; const constCost = await getFetch(fetchType.COMMON, url); diff --git a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx index 16d2107c6..895ba5f89 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx @@ -187,13 +187,11 @@ export const rateFeeHeadListExport: CommonTableProps[] = [ ]; export const usageProcData = [ - { usage: "์ฒญ์†Œ", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+์—ผ์†Œ์†Œ๋…" }, - { usage: "ํ™”์žฅ์‹ค์šฉ์ˆ˜", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+์—ผ์†Œ์†Œ๋…" }, - { usage: "์„ธ์ฒ™", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, - { usage: "์‚ด์ˆ˜", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, - { usage: "์กฐ๊ฒฝ", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, - { usage: "๋†์—…", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, - { usage: "ํ•˜์ฒœ", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, - { usage: "์ง€ํ•˜์ˆ˜", process: "์ „์ฒ˜๋ฆฌ์‹œ์„ค+RO" }, - { usage: "๊ณต์—…", process: "์ „์ฒ˜๋ฆฌ์‹œ์„ค+RO" }, + { useUsgCd: "01", usage: "์ฒญ์†Œํ™”์žฅ์‹ค์šฉ์ˆ˜", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+์—ผ์†Œ์†Œ๋…" }, + { useUsgCd: "02", usage: "์„ธ์ฒ™์‚ด์ˆ˜์šฉ์ˆ˜", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, + { useUsgCd: "03", usage: "์กฐ๊ฒฝ์šฉ์ˆ˜", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, + { useUsgCd: "05", usage: "์ง€ํ•˜์ˆ˜์ถฉ์ „", process: "์ „์ฒ˜๋ฆฌ์‹œ์„ค+RO" }, + { useUsgCd: "06", usage: "๋†์—…์šฉ์ˆ˜", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, + { useUsgCd: "07", usage: "ํ•˜์ฒœ๋“ฑ์œ ์ง€์šฉ์ˆ˜", process: "์ด์ธ์ฒ˜๋ฆฌ์‹œ์„ค+UV์†Œ๋…" }, + { useUsgCd: "08", usage: "๊ณต์—…์šฉ์ˆ˜", process: "์ „์ฒ˜๋ฆฌ์‹œ์„ค+RO" }, ]; diff --git a/apps/wr/app/store/matDmd/coMatRvw/index.tsx b/apps/wr/app/store/matDmd/coMatRvw/index.tsx index 0c58db9a6..39d1eaa28 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/index.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/index.tsx @@ -139,6 +139,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { return "๋งค์นญ ๊ฒ€ํ†  ์ €์žฅ ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค."; } }, + // ์ˆ˜์š”์ฒ˜ ๋งค์นญ ๊ฒ€ํ†  ํ˜„ํ™ฉ coMatRvwSearch: async ( pageNo: number, pageCnt: number, @@ -160,7 +161,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { url += `/0`; } - console.log(" url ", url); + // console.log(" url ", url); const coMatRvwRes = await getFetchWithCount(fetchType.WR, url); return set((state: coRvwState) => ({ diff --git a/apps/wr/components/lib/func/calculateConstCost .tsx b/apps/wr/components/lib/func/calculateConstCost .tsx index 5e9387385..2c2ec48ae 100644 --- a/apps/wr/components/lib/func/calculateConstCost .tsx +++ b/apps/wr/components/lib/func/calculateConstCost .tsx @@ -1,3 +1,18 @@ +/** + * ์ฃผ์–ด์ง„ ์ฝ”๋“œ์™€ ์ˆ˜๋Ÿ‰ ๊ธฐ์ค€์œผ๋กœ ๋ณด๊ฐ„ ๊ณ„์‚ฐ์— ์‚ฌ์šฉํ•  ํ•˜ํ•œ/์ƒํ•œ ๊ตฌ๊ฐ„ ๋ฐ์ดํ„ฐ๋ฅผ ์ฐพ๋Š”๋‹ค. + * + * ๊ฐ™์€ ์ฝ”๋“œ(`fctCd`)๋ฅผ ๊ฐ€์ง„ ๋ฐ์ดํ„ฐ๋งŒ ์ถ”๋ฆฐ ๋’ค, + * `qtyCode` ๊ฐ’์ด ํ˜„์žฌ ์ˆ˜๋Ÿ‰(`qty`) ์ดํ•˜์ธ ํ•ญ๋ชฉ ์ค‘ ๊ฐ€์žฅ ํฐ ๊ฐ’์„ `lower`, + * ์ดˆ๊ณผ์ธ ํ•ญ๋ชฉ ์ค‘ ๊ฐ€์žฅ ์ž‘์€ ๊ฐ’์„ `upper`๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค. + * ํ•œ์ชฝ ๊ฒฝ๊ณ„๋งŒ ์กด์žฌํ•˜๋ฉด ๊ฐ™์€ ๊ฐ’์„ ์ƒ/ํ•˜ํ•œ์— ๋ณด์ •ํ•ด ๋ฐ˜ํ™˜ํ•œ๋‹ค. + * + * @param data ์ „์ฒด ๊ธฐ์ค€ ๋ฐ์ดํ„ฐ ๋ชฉ๋ก + * @param fctCd ์ฐพ๊ณ  ์‹ถ์€ ์‹œ์„ค/๊ตฌ๋ถ„ ์ฝ”๋“œ ๊ฐ’ + * @param dataCode ์ฝ”๋“œ ๋น„๊ต์— ์‚ฌ์šฉํ•  ๊ฐ์ฒด ์†์„ฑ๋ช… + * @param qtyCode ์ˆ˜๋Ÿ‰ ๋น„๊ต์— ์‚ฌ์šฉํ•  ๊ฐ์ฒด ์†์„ฑ๋ช… + * @param qty ํ˜„์žฌ ๋น„๊ต ๊ธฐ์ค€ ์ˆ˜๋Ÿ‰ + * @returns ๋ณด๊ฐ„ ๊ณ„์‚ฐ์— ์‚ฌ์šฉํ•  ํ•˜ํ•œ(lower), ์ƒํ•œ(upper) ๋ฐ์ดํ„ฐ + */ export const findBounds = ( data: any[], fctCd: string, diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index cfb388264..dc1799e30 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -20,6 +20,7 @@ import { Form, FormField, FormUi, + SelectBox, UiTable, } from "@common/business_components/ui"; import PopoverUi from "@common/business_components/ui/popover_ui"; @@ -47,12 +48,13 @@ export default function ConCostForm({ readonly: boolean; }) { const { - constCostRes, + constCostRes, // ํ‘œ์ค€์‚ฌ์—…๋น„ rateFeeRes, coMatRvwUpdate, ruseRvwCalUpdate, getRateFee, getConstCostFee, + code, } = useWrStore((state) => state); const alert = useAlertStore((state) => state.setMessage); @@ -122,20 +124,19 @@ export default function ConCostForm({ const dmndQtyYear = dmndQtyWatch; if (usgPrcsProcs && usgPrcsProcs?.length > 0) { - const firstProc = - getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || ""; - const secondProc = - getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || ""; + const firstProc = getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || ""; // ์ฒซ๋ฒˆ์งธ ๊ณต์ • + const secondProc = getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || ""; // ๋‘๋ฒˆ์งธ ๊ณต์ • + // ์ฒซ๋ฒˆ์งธ ์ฒ˜๋ฆฌ๊ณต์ • ์ฝ”๋“œ์— ํ•ด๋‹นํ•˜๋Š” ํ‘œ์ค€๊ณต์‚ฌ๋น„ ํ…Œ์ด๋ธ”์ด์„œ ์š”๊ตฌ์ˆ˜๋Ÿ‰์„ ๊ฐ์‹ธ๋Š” ํ•˜ํ•œ/์ƒํ•œ ๊ตฌ๊ฐ„์„ ์ฐพ๋Š” ๋ถ€๋ถ„์ด๋‹ค. const { lower: firstLower, upper: firstUpper } = findBounds( - constCostRes, + constCostRes, // ํ‘œ์ค€๊ณต์‚ฌ๋น„ firstProc || "", "fctCd", "fctCpc", Number(dmndQtyYear) ); const { lower: secondLower, upper: secondUpper } = findBounds( - constCostRes, + constCostRes, // ํ‘œ์ค€๊ณต์‚ฌ๋น„ secondProc || "", "fctCd", "fctCpc", @@ -365,14 +366,17 @@ export default function ConCostForm({ name="useUsgCd" render={({ field }) => ( - { - field.onChange(e.target.value); + { + if (readonly) return; + field.onChange(String(val)); }} value={field.value ?? ""} - readOnly={true} + readOnly={readonly} /> )} diff --git a/packages/common/business_components/src/ui/form/index.tsx b/packages/common/business_components/src/ui/form/index.tsx index d2f955244..fc9bf5b8c 100644 --- a/packages/common/business_components/src/ui/form/index.tsx +++ b/packages/common/business_components/src/ui/form/index.tsx @@ -42,22 +42,24 @@ const FormField = < } const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext) - const itemContext = React.useContext(FormItemContext) - const { getFieldState, formState } = useFormContext() + const fieldContext = React.useContext(FormFieldContext); + const itemContext = React.useContext(FormItemContext); + const { getFieldState, formState } = useFormContext(); - const fieldState = getFieldState(fieldContext.name, formState) + // ํ•„๋“œ๋ช…์œผ๋กœ ํ•„๋“œ์˜ ์ƒํƒœ๋ฅผ ๊ฐ€์ ธ์˜ด. + // errors, isDirty, dirtyFields, touchedFields, isSubmitted, isSubmitSuccessful, isValid, defaultValues, disabled + const fieldState = getFieldState(fieldContext.name, formState); if (!fieldContext) { throw new Error("useFormField should be used within ") } - const { id } = itemContext + const { id } = itemContext; return { id, name: fieldContext.name, - formItemId: `${id}-form-item`, + formItemId: `${id}-form-item`, // ์ ‘๊ทผ์„ฑ ์†์„ฑ ์—ฐ๊ฒฐ์šฉ formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState, @@ -86,6 +88,8 @@ const FormItem = React.forwardRef< }) FormItem.displayName = "FormItem" +// React.forwardRef๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋ถ€๋ชจ๊ฐ€ Label DOM ref๋ฅผ ์ง์ ‘ ๋ฐ›์„ ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๊ณ , +// ํ˜„์žฌ FormField์˜ ์—๋Ÿฌ ์ƒํƒœ์™€ form item id๋ฅผ ์—ฐ๊ฒฐํ•ด ์ ‘๊ทผ์„ฑ(htmlFor)๊ณผ ์—๋Ÿฌ ์Šคํƒ€์ผ์„ ํ•จ๊ป˜ ์ฒ˜๋ฆฌํ•œ๋‹ค. const FormLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef