From e0938c9db814d1b3d15fc8c7e4b5cb853ac3dd92 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 21 Nov 2024 10:12:53 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=EC=A1=B0=EA=B1=B4=20=EB=82=A0=EC=A7=9C=20?= =?UTF-8?q?=EB=B9=88=EA=B0=92=EC=8B=9C=20=EC=95=8C=EB=9F=BF=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/StuffSearchCondition.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/management/StuffSearchCondition.jsx b/src/components/management/StuffSearchCondition.jsx index f803452c..ee038366 100644 --- a/src/components/management/StuffSearchCondition.jsx +++ b/src/components/management/StuffSearchCondition.jsx @@ -69,10 +69,15 @@ export default function StuffSearchCondition() { // 조회 const onSubmit = () => { let diff = dayjs(endDate).diff(startDate, 'day') + if (diff > 366) { return alert(getMessage('stuff.message.periodError')) } + if (isNaN(diff)) { + return alert(getMessage('stuff.message.periodError')) + } + if (stuffSearch.code === 'S') { setStuffSearch({ schObjectNo: objectNo ? objectNo : stuffSearch.schObjectNo, @@ -84,8 +89,8 @@ export default function StuffSearchCondition() { schOtherSelSaleStoreId: stuffSearch?.schOtherSelSaleStoreId ? stuffSearch.schOtherSelSaleStoreId : '', schReceiveUser: receiveUser ? receiveUser : '', schDateType: dateType, - schFromDt: dayjs(startDate).format('YYYY-MM-DD'), - schToDt: dayjs(endDate).format('YYYY-MM-DD'), + schFromDt: startDate ? dayjs(startDate).format('YYYY-MM-DD') : '', + schToDt: endDate ? dayjs(endDate).format('YYYY-MM-DD') : '', code: 'E', startRow: stuffSearch?.startRow ? stuffSearch.startRow : 1, endRow: stuffSearch?.endRow ? stuffSearch.endRow : 100, @@ -102,8 +107,8 @@ export default function StuffSearchCondition() { schOtherSelSaleStoreId: otherSaleStoreId, schReceiveUser: receiveUser, schDateType: dateType, - schFromDt: dayjs(startDate).format('YYYY-MM-DD'), - schToDt: dayjs(endDate).format('YYYY-MM-DD'), + schFromDt: startDate ? dayjs(startDate).format('YYYY-MM-DD') : '', + schToDt: endDate ? dayjs(endDate).format('YYYY-MM-DD') : '', code: 'E', startRow: 1, endRow: 100, @@ -120,8 +125,8 @@ export default function StuffSearchCondition() { schOtherSelSaleStoreId: otherSaleStoreId, schReceiveUser: receiveUser, schDateType: dateType, - schFromDt: dayjs(startDate).format('YYYY-MM-DD'), - schToDt: dayjs(endDate).format('YYYY-MM-DD'), + schFromDt: startDate ? dayjs(startDate).format('YYYY-MM-DD') : '', + schToDt: endDate ? dayjs(endDate).format('YYYY-MM-DD') : '', code: 'E', startRow: 1, endRow: 100, From edc7a245530103e41d09ccc809bd7023a11a947c Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Thu, 21 Nov 2024 10:33:14 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=EC=83=81=EB=A9=B4=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useModuleBasicSetting.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 7d8ea54d..4f9e829d 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -640,7 +640,7 @@ export function useModuleBasicSetting() { module.tempIndex = index const { x, y } = module.getCenterPoint() const { width, height } = module - centerPoints.push({ x, y, width, height }) + centerPoints.push({ x, y, width, height, index }) const circle = new fabric.Circle({ radius: 5, fill: 'red', @@ -665,7 +665,6 @@ export function useModuleBasicSetting() { let touchDimension = 0 //반접면 let halfTouchDimension = 0 - // 노출하면 체크 centerPoints.forEach((centerPoint, index) => { const { x, y, width, height } = centerPoint @@ -676,12 +675,15 @@ export function useModuleBasicSetting() { return } + const bottomLeftPoint = { x: x - width / 2, y: y + height } + const bottomRightPoint = { x: x + width / 2, y: y + height } + // 바로 아래에 셀이 없는 경우 물떼세 배치가 왼쪽 되어있는 셀을 찾는다. const leftBottomCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - (x - width / 2)) < 2 && Math.abs(centerPoint.y - (y + height)) < 2, + (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < 2 && Math.abs(centerPoint.y - bottomLeftPoint.y) < 2, ).length const rightBottomCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - (x + width / 2)) < 2 && Math.abs(centerPoint.y - (y + height)) < 2, + (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < 2 && Math.abs(centerPoint.y - bottomRightPoint.y) < 2, ).length if (leftBottomCnt + rightBottomCnt === 2) { touchDimension++ @@ -706,11 +708,14 @@ export function useModuleBasicSetting() { return } + const topLeftPoint = { x: x - width / 2, y: y - height } + const topRightPoint = { x: x + width / 2, y: y - height } + const leftTopCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - (x - width) < 2) && Math.abs(centerPoint.y - (y - height)) < 2, + (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, ).length const rightTopCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - (x + width / 2) < 2) && Math.abs(centerPoint.y - (y - height)) < 2, + (centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, ).length if (leftTopCnt + rightTopCnt === 1) { From c0553d8b17251ea3da6d49a7438269395a22f538 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 21 Nov 2024 11:06:15 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=EC=83=81=EC=84=B8=20//?= =?UTF-8?q?=20=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=83=81=EC=84=B8=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../estimate/popup/DocDownOptionPop.jsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/components/estimate/popup/DocDownOptionPop.jsx b/src/components/estimate/popup/DocDownOptionPop.jsx index 128b2dd0..e9dd4d4a 100644 --- a/src/components/estimate/popup/DocDownOptionPop.jsx +++ b/src/components/estimate/popup/DocDownOptionPop.jsx @@ -17,7 +17,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) { const [schDisplayFlg, setSchSchDisplayFlg] = useState('0') //가대 중량표 포함(포함:1 미포함 : 0) const [schWeightFlg, setSchWeightFlg] = useState('1') - //도면/시뮬레이션 파일 포함(포함:1 미포함 : 0) + //도면/시뮬레이션 파일 포함 const [schDrawingFlg, setSchDrawingFlg] = useState('1') // recoil 물건번호 @@ -37,6 +37,18 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) { sendUnitPriceFlg = '1' } + //schDrawingFlg 선택값은 의미없어짐 + //가대중량표 포함, 도면/시뮬레이션 파일 포함 선택값에따라 schDrawingFlg에 |구분자로 보냄 + //SchDrawingFlg (1 : 견적서,2 : 발전시뮬레이션, 3 : 도면, 4 : 가대) + // ex) 1|2|3|4 + let defaultSchDrawingFlg = '1' + if (schWeightFlg === '1') { + defaultSchDrawingFlg = defaultSchDrawingFlg.concat('|', '4') + } + if (schDrawingFlg === '1') { + defaultSchDrawingFlg = defaultSchDrawingFlg.concat('|', '3') + } + const params = { objectNo: objectRecoil.floorPlanObjectNo, planNo: planNo, @@ -44,8 +56,10 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) { schUnitPriceFlg: sendUnitPriceFlg, schDisplayFlg: schDisplayFlg, schWeightFlg: schWeightFlg, - schDrawingFlg: schDrawingFlg, + schDrawingFlg: defaultSchDrawingFlg, + pwrGnrSimType: 'D', //default 화면에 안보여줌 } + const options = { responseType: 'blob' } await promisePost({ url: url, data: params, option: options }) .then((resultData) => { From c6fccf54412a47545aa3878b747107ff58770983 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 21 Nov 2024 11:32:14 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/popup/DocDownOptionPop.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/estimate/popup/DocDownOptionPop.jsx b/src/components/estimate/popup/DocDownOptionPop.jsx index e9dd4d4a..d6b22eb2 100644 --- a/src/components/estimate/popup/DocDownOptionPop.jsx +++ b/src/components/estimate/popup/DocDownOptionPop.jsx @@ -46,7 +46,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) { defaultSchDrawingFlg = defaultSchDrawingFlg.concat('|', '4') } if (schDrawingFlg === '1') { - defaultSchDrawingFlg = defaultSchDrawingFlg.concat('|', '3') + defaultSchDrawingFlg = defaultSchDrawingFlg.concat('|', '2', '|', '3') } const params = { From a6ccd78ad12adbba3b7e660715d55121712aa137 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 21 Nov 2024 13:17:28 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/management/Stuff.jsx | 64 +++++++++++-------- .../management/StuffSearchCondition.jsx | 8 ++- src/store/stuffAtom.js | 2 + 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/components/management/Stuff.jsx b/src/components/management/Stuff.jsx index e6b281c4..1fc1bc47 100644 --- a/src/components/management/Stuff.jsx +++ b/src/components/management/Stuff.jsx @@ -172,8 +172,7 @@ export default function Stuff() { schDateType: stuffSearchParams.schDateType, schFromDt: dayjs(new Date()).add(-1, 'year').format('YYYY-MM-DD'), schToDt: dayjs(new Date()).format('YYYY-MM-DD'), - startRow: (pageNo - 1) * pageSize + 1, - // endRow: pageNo * pageSize, + startRow: (stuffSearch.pageNo - 1) * stuffSearchParams.pageSize + 1, endRow: stuffSearchParams?.endRow, schSelSaleStoreId: stuffSearchParams?.schSelSaleStoreId ? stuffSearchParams.schSelSaleStoreId : '', schOtherSelSaleStoreId: stuffSearchParams?.schOtherSelSaleStoreId ? stuffSearchParams.schOtherSelSaleStoreId : '', @@ -219,6 +218,7 @@ export default function Stuff() { stuffSearchParams.endRow = 1 * pageSize stuffSearchParams.schSortType = defaultSortType setPageNo(1) + stuffSearchParams.pageNo = 1 async function fetchData() { const apiUrl = `/api/object/list?saleStoreId=${session?.storeId}&${queryStringFormatter(stuffSearchParams)}` @@ -241,6 +241,7 @@ export default function Stuff() { stuffSearchParams.endRow = 1 * pageSize stuffSearchParams.schSortType = defaultSortType setPageNo(1) + async function fetchData() { const apiUrl = `/api/object/list?saleStoreId=${session?.storeId}&${queryStringFormatter(stuffSearchParams)}` await get({ url: apiUrl }).then((res) => { @@ -262,31 +263,31 @@ export default function Stuff() { const onChangePerPage = (e) => { let startRow = (1 - 1) * e.target.value + 1 stuffSearchParams.startRow = startRow - stuffSearchParams.endRow = 1 * e.target.value + stuffSearchParams.endRow = stuffSearchParams.pageNo * e.target.value stuffSearchParams.schSelSaleStoreId = stuffSearchParams?.schOtherSelSaleStoreId ? stuffSearchParams.schOtherSelSaleStoreId : stuffSearchParams.schSelSaleStoreId setPageSize(e.target.value) setStuffSearch({ - // ...stuffSearchParams, ...stuffSearch, code: 'S', startRow: startRow, - endRow: 1 * e.target.value, + endRow: stuffSearchParams.pageNo * e.target.value, + pageSize: e.target.value, }) setPageNo(1) - const apiUrl = `/api/object/list?saleStoreId=${session?.storeId}&${queryStringFormatter(stuffSearchParams)}` - get({ url: apiUrl }).then((res) => { - if (!isEmptyArray(res)) { - setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt }) - setTotalCount(res[0].totCnt) - } else { - setGridProps({ ...gridProps, gridData: [], count: 0 }) - setTotalCount(0) - } - }) + // const apiUrl = `/api/object/list?saleStoreId=${session?.storeId}&${queryStringFormatter(stuffSearchParams)}` + // get({ url: apiUrl }).then((res) => { + // if (!isEmptyArray(res)) { + // setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt }) + // setTotalCount(res[0].totCnt) + // } else { + // setGridProps({ ...gridProps, gridData: [], count: 0 }) + // setTotalCount(0) + // } + // }) } //최근 등록일 수정일 정렬 이벤트 @@ -309,16 +310,16 @@ export default function Stuff() { }) setPageNo(1) - const apiUrl = `/api/object/list?saleStoreId=${session?.storeId}&${queryStringFormatter(stuffSearchParams)}` - get({ url: apiUrl }).then((res) => { - if (!isEmptyArray(res)) { - setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt }) - setTotalCount(res[0].totCnt) - } else { - setGridProps({ ...gridProps, gridData: [], count: 0 }) - setTotalCount(0) - } - }) + // const apiUrl = `/api/object/list?saleStoreId=${session?.storeId}&${queryStringFormatter(stuffSearchParams)}` + // get({ url: apiUrl }).then((res) => { + // if (!isEmptyArray(res)) { + // setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt }) + // setTotalCount(res[0].totCnt) + // } else { + // setGridProps({ ...gridProps, gridData: [], count: 0 }) + // setTotalCount(0) + // } + // }) } useEffect(() => { @@ -340,6 +341,7 @@ export default function Stuff() { code: 'S', startRow: (page - 1) * pageSize + 1, endRow: page * pageSize, + pageNo: page, }) setPageNo(page) @@ -368,7 +370,8 @@ export default function Stuff() {
- + {/* { handleChartChangeData(e.target.value) + setPwrGnrSimType(e.target.value) }} > diff --git a/src/store/simulatorAtom.js b/src/store/simulatorAtom.js new file mode 100644 index 00000000..7bdfa363 --- /dev/null +++ b/src/store/simulatorAtom.js @@ -0,0 +1,8 @@ +import { atom } from 'recoil' + +export const pwrGnrSimTypeState = atom({ + key: 'pwrGnrSimType', + default: { + type: 'D', + }, +}) From 05ef45bd3802cff2ebc24070a6b98f9109684abc Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 21 Nov 2024 14:03:31 +0900 Subject: [PATCH 7/9] =?UTF-8?q?fix:=20=EB=8F=84=EB=A9=B4=20=EB=B0=B0?= =?UTF-8?q?=EA=B2=BD=20=EC=84=A4=EC=A0=95=20=EA=B0=9C=EB=B0=9C=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - api 스펙 추가 및 수정 --- src/app/api/html2canvas/route.js | 2 +- src/app/api/image-upload/route.js | 25 + src/components/floor-plan/modal/ImgLoad.jsx | 9 +- src/hooks/common/useRefFiles.js | 52 +- src/lib/cadAction.js | 5 + src/lib/canvas.js | 5 + src/lib/fileAction.js | 64 + yarn.lock | 3768 +++++++++---------- 8 files changed, 1858 insertions(+), 2072 deletions(-) create mode 100644 src/app/api/image-upload/route.js create mode 100644 src/lib/fileAction.js diff --git a/src/app/api/html2canvas/route.js b/src/app/api/html2canvas/route.js index 02731f07..ada6c54a 100644 --- a/src/app/api/html2canvas/route.js +++ b/src/app/api/html2canvas/route.js @@ -5,7 +5,7 @@ import fs from 'fs/promises' import { NextResponse } from 'next/server' export async function GET(req) { - const path = 'public/mapImages' + const path = 'public/plan-map-images' const q = req.nextUrl.searchParams.get('q') const fileNm = req.nextUrl.searchParams.get('fileNm') const zoom = req.nextUrl.searchParams.get('zoom') diff --git a/src/app/api/image-upload/route.js b/src/app/api/image-upload/route.js new file mode 100644 index 00000000..e817bd3b --- /dev/null +++ b/src/app/api/image-upload/route.js @@ -0,0 +1,25 @@ +'use server' + +import fs from 'fs/promises' + +import { NextResponse } from 'next/server' + +export async function POST(req) { + const path = 'public/plan-bg-images' + + const formData = await req.formData() + const file = formData.get('file') + const arrayBuffer = await file.arrayBuffer() + const buffer = Buffer.from(arrayBuffer) + // const buffer = new Uint8Array(arrayBuffer) + + try { + await fs.readdir(path) + } catch { + await fs.mkdir(path) + } finally { + await fs.writeFile(`${path}/${file.name}`, buffer) + } + + return NextResponse.json({ fileNm: `${file.name}` }) +} diff --git a/src/components/floor-plan/modal/ImgLoad.jsx b/src/components/floor-plan/modal/ImgLoad.jsx index c67cc3f3..84c2dfdc 100644 --- a/src/components/floor-plan/modal/ImgLoad.jsx +++ b/src/components/floor-plan/modal/ImgLoad.jsx @@ -95,7 +95,14 @@ export default function ImgLoad() {
- + setMapPositionAddress(e.target.value)} + />