diff --git a/.env.development b/.env.development index f2a2f6f4..f6410ff7 100644 --- a/.env.development +++ b/.env.development @@ -17,6 +17,7 @@ CONVERTER_API_TOKEN="mcHqQkSZP30vxCRpIWJV62ciBYT887RI" NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="https://q-order-dev.q-cells.jp/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="https://q-musubi-dev.q-cells.jp/qm/login/autoLogin" NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="https://q-order-dev.q-cells.jp/eos/simulation/list" +NEXT_PUBLIC_ECONOMIC_SIMULATION_DETAIL_URL="https://q-order-dev.q-cells.jp/eos/simulation/detail" # 테스트용 # AWS_REGION="ap-northeast-2" diff --git a/.env.local.dev b/.env.local.dev index e323559b..399816b4 100644 --- a/.env.local.dev +++ b/.env.local.dev @@ -15,6 +15,7 @@ NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secr NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/list" +NEXT_PUBLIC_ECONOMIC_SIMULATION_DETAIL_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/detail" # 테스트용 # AWS_REGION="ap-northeast-2" diff --git a/.env.localhost b/.env.localhost index 7b67eab2..ab7efa7f 100644 --- a/.env.localhost +++ b/.env.localhost @@ -17,6 +17,7 @@ CONVERTER_API_TOKEN="mcHqQkSZP30vxCRpIWJV62ciBYT887RI" NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/list" +NEXT_PUBLIC_ECONOMIC_SIMULATION_DETAIL_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/detail" # 테스트용 # AWS_REGION="ap-northeast-2" diff --git a/.env.production b/.env.production index 03cbbfcf..9c4645bf 100644 --- a/.env.production +++ b/.env.production @@ -17,6 +17,7 @@ CONVERTER_API_TOKEN="mcHqQkSZP30vxCRpIWJV62ciBYT887RI" NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="https://q-order.q-cells.jp/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="https://q-musubi.q-cells.jp/qm/login/autoLogin" NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="https://q-order.q-cells.jp/eos/simulation/list" +NEXT_PUBLIC_ECONOMIC_SIMULATION_DETAIL_URL="https://q-order.q-cells.jp/eos/simulation/detail" # AWS_REGION="ap-northeast-2" # AMPLIFY_BUCKET="interplug" diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx index dae437e1..17b2e890 100644 --- a/src/components/floor-plan/CanvasMenu.jsx +++ b/src/components/floor-plan/CanvasMenu.jsx @@ -112,6 +112,20 @@ export default function CanvasMenu(props) { // 발전시뮬레이션 메뉴 이동 const { objectNo, pid } = floorPlanState + const openEconomicSimulation = async (objectNo, planNo) => { + const encRes = await promiseGet({ + url: '/api/pwrGnrSimulation/encData', + option: { params: { saleStoreId: sessionState.storeId, userId: sessionState.userId } }, + }) + const { encSaleStoreId, encUserId } = encRes.data + if (!encSaleStoreId || !encUserId) return + window.open( + `${process.env.NEXT_PUBLIC_ECONOMIC_SIMULATION_DETAIL_URL}?authYn=Y&encStoreId=${encodeURIComponent(encSaleStoreId)}&encRegId=${encodeURIComponent(encUserId)}&stuffNo=${objectNo}&planNo=${planNo}`, + 'economicSimulation', + `height=${screen.height},width=${screen.width},fullscreen=yes` + ) + } + // 발전시물레이션 Excel/PDF 다운 const { promiseGet, promisePost } = useAxios(globalLocale) const pwrGnrSimTypeRecoil = useRecoilValue(pwrGnrSimTypeState) @@ -301,15 +315,30 @@ export default function CanvasMenu(props) { } }) break + case 'economicSimulation': + setIsGlobalLoading(true) + promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan?.planNo ?? pid}/detail` }).then(async (res) => { + if (res.status === 200) { + const estimateDetail = res.data + if (estimateDetail.estimateDate !== null && estimateDetail.docNo) { + setIsGlobalLoading(false) + await openEconomicSimulation(objectNo, selectedPlan?.planNo ?? pid) + } else { + setIsGlobalLoading(false) + swalFire({ text: getMessage('simulator.menu.move.valid1') }) + } + } + }) + break } - if (menu.type !== 'simulation' && menu.type !== 'estimate' && menu.type !== 'drawing') { + if (menu.type !== 'simulation' && menu.type !== 'estimate' && menu.type !== 'drawing' && menu.type !== 'economicSimulation') { setSelectedMenu(menu.type) setCurrentMenu(menu.title) } if (pathname !== '/floor-plan') { //견적서 or 발전시뮬레이션 탭에서 같은 탭 클릭시 화면 이동했다 돌아오지않도록.. - if (menu.type !== 'drawing' && menu.type !== 'estimate' && menu.type !== 'simulation') { + if (menu.type !== 'drawing' && menu.type !== 'estimate' && menu.type !== 'simulation' && menu.type !== 'economicSimulation') { router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`) } } diff --git a/src/locales/ja.json b/src/locales/ja.json index 59f6af6c..fecc3c3f 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -249,6 +249,7 @@ "plan.menu.estimate.unLock": "ロック解除", "plan.menu.estimate.lock": "ロック", "plan.menu.simulation": "発電シミュレーション", + "plan.menu.economic.simulation": "経済シミュレーション", "plan.menu.simulation.excel": "Excel", "plan.menu.simulation.pdf": "PDF", "plan.mode.vertical.horizontal": "垂直水平モード", diff --git a/src/locales/ko.json b/src/locales/ko.json index ec258d02..af972e11 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -249,6 +249,7 @@ "plan.menu.estimate.unLock": "잠금 해제", "plan.menu.estimate.lock": "잠금", "plan.menu.simulation": "발전 시뮬레이션", + "plan.menu.economic.simulation": "경제 시뮬레이션", "plan.menu.simulation.excel": "Excel", "plan.menu.simulation.pdf": "PDF", "plan.mode.vertical.horizontal": "수직 수평 모드", diff --git a/src/store/menuAtom.js b/src/store/menuAtom.js index 007e7950..51103e05 100644 --- a/src/store/menuAtom.js +++ b/src/store/menuAtom.js @@ -36,7 +36,10 @@ export const menusState = atom({ icon: 'con05', title: MENU.POWER_GENERATION_SIMULATION.DEFAULT, }, - ], + process.env.NEXT_PUBLIC_RUN_MODE !== 'production' + ? { type: 'economicSimulation', name: 'plan.menu.economic.simulation', icon: 'con05', title: '' } + : null, + ].filter(Boolean), }) export const subMenusState = atom({