diff --git a/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx b/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx index c8ffb904e..957130910 100644 --- a/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx @@ -46,6 +46,7 @@ export default function CoSttn() { coSttnTxtSearch, demandCompList, coSttnPwInit, + getMyUUID } = useWrStore((state) => state); const { regAuthrtYn, mdfcnAuthrtYn } = auth; @@ -278,7 +279,12 @@ export default function CoSttn() { headlist={coSttn.coSttHeadList} pageSize={20} total={coSttnResCount + 10 || 0} - cellClick={(index: number | undefined) => { + 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) => { @@ -322,6 +328,7 @@ export default function CoSttn() { isMoal: false, data: data as DemandCompType, }); + setIsResetSelection(true); } else { const dmd = await getFetch( fetchType.WR, diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx index 837b669ec..efcfb03e6 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx @@ -1,5 +1,5 @@ import { getFetch } from "@/components/lib/api"; -import { TEST_UUID, type customRainBdst } from "../rainReg"; +import type { customRainBdst } from "../rainReg"; import type { customHtdflBdst } from "../htdflReg"; import type { customRswtBdst } from "../rswtReg"; import type { TableUpperProps } from "@/app/store/common/type/header"; @@ -35,18 +35,19 @@ const isRswtBdst = (data: any): data is customRswtBdst => { }; export const makeRstr = ( - data: customRainBdst | customHtdflBdst | customRswtBdst + data: customRainBdst | customHtdflBdst | customRswtBdst, + myUUID: string ) => { - data.rgtr = TEST_UUID; + data.rgtr = myUUID; let chData; if (isRainBdst(data)) { chData = data.reuseBuilding.map((item) => ({ ...item, - rgtr: TEST_UUID, + rgtr: myUUID, rainyObj: { ...item.rainyObj, - rgtr: TEST_UUID, + rgtr: myUUID, }, })); @@ -54,10 +55,10 @@ export const makeRstr = ( } else if (isHtdflBdst(data)) { chData = data.reuseBuilding.map((item) => ({ ...item, - rgtr: TEST_UUID, + rgtr: myUUID, htdflObj: { ...item.htdflObj, - rgtr: TEST_UUID, + rgtr: myUUID, }, })); @@ -65,10 +66,10 @@ export const makeRstr = ( } else if (isRswtBdst(data)) { chData = data.reuseBuilding.map((item) => ({ ...item, - rgtr: TEST_UUID, + rgtr: myUUID, rswtrObj: { ...item.rswtrObj, - rgtr: TEST_UUID, + rgtr: myUUID, }, })); data.reuseBuilding = chData; @@ -81,7 +82,7 @@ export const makeRstr = ( ) { const chRgtr = data.chgBuilding.map((item) => ({ ...item, - rgtr: TEST_UUID, + rgtr: myUUID, mdfr: item.mdfr ?? null, })); data.chgBuilding = chRgtr; @@ -90,23 +91,24 @@ export const makeRstr = ( }; export const makeMdfr = ( - data: customRainBdst | customHtdflBdst | customRswtBdst + data: customRainBdst | customHtdflBdst | customRswtBdst, + myUUID: string ) => { - data.mdfr = TEST_UUID; + data.mdfr = myUUID; let chData; if (isRainBdst(data)) { chData = data.reuseBuilding.map((item) => ({ ...item, - mdfr: TEST_UUID, + mdfr: myUUID, rainyObj: { ...item.rainyObj, - mdfr: TEST_UUID, + mdfr: myUUID, }, })); if (data?.chgBuilding.length > 0) { const chRgtr = data.chgBuilding.map((item) => ({ ...item, - rgtr: TEST_UUID, + rgtr: myUUID, mdfr: item.mdfr ?? null, })); data.chgBuilding = chRgtr; @@ -116,20 +118,20 @@ export const makeMdfr = ( } else if (isHtdflBdst(data)) { chData = data.reuseBuilding.map((item) => ({ ...item, - mdfr: TEST_UUID, + mdfr: myUUID, htdflObj: { ...item.htdflObj, - mdfr: TEST_UUID, + mdfr: myUUID, }, })); data.reuseBuilding = chData; } else if (isRswtBdst(data)) { chData = data.reuseBuilding.map((item) => ({ ...item, - mdfr: TEST_UUID, + mdfr: myUUID, rswtrObj: { ...item.rswtrObj, - mdfr: TEST_UUID, + mdfr: myUUID, }, })); data.reuseBuilding = chData; @@ -142,7 +144,7 @@ export const makeMdfr = ( ) { const chMdfr = data.chgBuilding.map((item) => ({ ...item, - mdfr: TEST_UUID, + mdfr: myUUID, archChgArea: item.archChgArea ?? "", })); data.chgBuilding = chMdfr; @@ -168,8 +170,9 @@ type bdstActions = { setUserCitySggCd: ( laeSeCd: string, cityCd: SelectDataType[], - sggCd: SelectDataType[]) => void; - setUserSggCd: ( userCityCd: string,sggCd: SelectDataType[]) => void; + sggCd: SelectDataType[] + ) => void; + setUserSggCd: (userCityCd: string, sggCd: SelectDataType[]) => void; }; const findBdstInfo = async (sggCd: string, searchTxt: string, flg: string) => { @@ -218,16 +221,15 @@ export const bdstActionsExport: (set: any) => bdstActions = (set: any) => { sggCd: SelectDataType[] ) => { let city = [...cityCd]; - let sgg = [...sggCd] - console.log('sgg ', sgg) + let sgg = [...sggCd]; + console.log("sgg ", sgg); if (laeSeCd === "0" && cityCd.length > 0) { city = city; - sgg = [{ val: "0", text: "전체" }] + sgg = [{ val: "0", text: "전체" }]; } else if (laeSeCd.length === 2 && cityCd.length > 0) { city = cityCd.filter((item) => item.val === laeSeCd); sgg = sggCd.filter((item) => item.val.slice(0, 2) === laeSeCd); sggCd.unshift({ val: "0", text: "전체" }); - } else if ( laeSeCd.length === 5 && cityCd.length > 0 && @@ -235,13 +237,9 @@ export const bdstActionsExport: (set: any) => bdstActions = (set: any) => { ) { city = cityCd.filter((item) => item.val === laeSeCd.slice(0, 2)); sgg = sggCd.filter((item) => item.val === laeSeCd); - - } return set((state: bdstState) => ({ - - ...state, bdst: { ...state.bdst, @@ -249,9 +247,8 @@ export const bdstActionsExport: (set: any) => bdstActions = (set: any) => { userSggCd: sgg, }, })); - },setUserSggCd( userCityCd: string,sggCd: SelectDataType[]){ - - + }, + setUserSggCd(userCityCd: string, sggCd: SelectDataType[]) { const sgg = sggCd.filter((item) => item.val.slice(0, 2) === userCityCd); return set((state: bdstState) => ({