Merge branch 'dev' into dev-yj
This commit is contained in:
commit
df21e6c198
@ -79,7 +79,7 @@ export default function Table({ clsCode }) {
|
||||
>
|
||||
<td className="al-c">
|
||||
{/* 번호 */}
|
||||
{board.rowNumber}
|
||||
{board.totCnt - board.rowNumber + 1}
|
||||
</td>
|
||||
<td>
|
||||
{/* 제목 */}
|
||||
|
||||
@ -34,9 +34,10 @@ import { addedRoofsState, basicSettingState, selectedRoofMaterialSelector, setti
|
||||
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
||||
import { commonUtilsState } from '@/store/commonUtilsAtom'
|
||||
import { menusState, menuTypeState } from '@/store/menuAtom'
|
||||
import { estimateState, floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||
import { estimateState } from '@/store/floorPlanObjectAtom'
|
||||
import { pwrGnrSimTypeState } from '@/store/simulatorAtom'
|
||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
|
||||
import KO from '@/locales/ko.json'
|
||||
import JA from '@/locales/ja.json'
|
||||
@ -86,14 +87,61 @@ export default function CanvasMenu(props) {
|
||||
//견적서버튼 노출용
|
||||
const [buttonStyle, setButtonStyle] = useState('')
|
||||
|
||||
const onClickNav = (menu) => {
|
||||
setMenuNumber(menu.index)
|
||||
setCurrentMenu(menu.title)
|
||||
// 발전시뮬레이션 메뉴 이동
|
||||
const searchParams = useSearchParams()
|
||||
const objectNo = searchParams.get('objectNo')
|
||||
const pid = searchParams.get('pid')
|
||||
|
||||
// 발전시물레이션 Excel/PDF 다운
|
||||
const { promiseGet, promisePost } = useAxios(globalLocale)
|
||||
const pwrGnrSimTypeRecoil = useRecoilValue(pwrGnrSimTypeState)
|
||||
|
||||
const handleExcelPdfFileDown = async (donwloadType, drawingFlg) => {
|
||||
const url = '/api/estimate/excel-download'
|
||||
|
||||
const params = {
|
||||
objectNo: objectNo,
|
||||
planNo: pid,
|
||||
schDownload: donwloadType,
|
||||
schDrawingFlg: drawingFlg,
|
||||
pwrGnrSimType: pwrGnrSimTypeRecoil.type,
|
||||
}
|
||||
|
||||
const options = { responseType: 'blob' }
|
||||
await promisePost({ url: url, data: params, option: options })
|
||||
.then((resultData) => {
|
||||
if (resultData) {
|
||||
let fileName = 'unknow'
|
||||
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
|
||||
const fileUrl = window.URL.createObjectURL(blob)
|
||||
|
||||
const link = document.createElement('a')
|
||||
link.href = fileUrl
|
||||
|
||||
//서버에서 내려오는 파일명
|
||||
const contentDisposition = resultData.headers['content-disposition']
|
||||
if (contentDisposition) {
|
||||
fileName = contentDisposition.split('filename=')[1].replace(/['"]/g, '')
|
||||
}
|
||||
|
||||
link.download = fileName
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
window.URL.revokeObjectURL(fileUrl)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert('File does not exist.')
|
||||
})
|
||||
}
|
||||
|
||||
const onClickNav = (menu) => {
|
||||
switch (menu.index) {
|
||||
case 1:
|
||||
setType('placementShape')
|
||||
onClickPlacementInitialMenu()
|
||||
|
||||
break
|
||||
case 2:
|
||||
setType('outline')
|
||||
@ -109,11 +157,31 @@ export default function CanvasMenu(props) {
|
||||
setType('module')
|
||||
break
|
||||
case 6:
|
||||
router.push(`/floor-plan/simulator/${menu.index}`)
|
||||
promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => {
|
||||
if (res.status === 200) {
|
||||
const planList = res.data.planList
|
||||
const objectPlanDetail = planList.filter((row) => row.objectNo === objectNo && row.planNo === pid)
|
||||
|
||||
if (objectPlanDetail) {
|
||||
if (objectPlanDetail[0].estimateDate) {
|
||||
router.push(`/floor-plan/simulator/${menu.index}?pid=${pid}&objectNo=${objectNo}`)
|
||||
setMenuNumber(menu.index)
|
||||
setCurrentMenu(menu.title)
|
||||
} else {
|
||||
alert(getMessage('simulator.menu.move.valid1'))
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
if (pathname !== '/floor-plan') router.push('/floor-plan')
|
||||
if (menu.index !== 6) {
|
||||
setMenuNumber(menu.index)
|
||||
setCurrentMenu(menu.title)
|
||||
}
|
||||
|
||||
if (pathname !== '/floor-plan') router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
||||
}
|
||||
|
||||
const changeSelectedRoofMaterial = (e) => {
|
||||
@ -215,54 +283,6 @@ export default function CanvasMenu(props) {
|
||||
return (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) || (menuNumber === 4 && menu.index === 2)
|
||||
}
|
||||
|
||||
// 발전시물레이션 Excel/PDF 다운
|
||||
const { promisePost } = useAxios(globalLocale)
|
||||
const objectRecoil = useRecoilValue(floorPlanObjectState)
|
||||
const pwrGnrSimTypeRecoil = useRecoilValue(pwrGnrSimTypeState)
|
||||
|
||||
const { plans } = usePlan()
|
||||
const plan = plans.find((plan) => plan.isCurrent === true)
|
||||
|
||||
const handleExcelPdfFileDown = async (donwloadType, drawingFlg) => {
|
||||
const url = '/api/estimate/excel-download'
|
||||
|
||||
const params = {
|
||||
objectNo: objectRecoil.floorPlanObjectNo,
|
||||
planNo: plan?.id,
|
||||
schDownload: donwloadType,
|
||||
schDrawingFlg: drawingFlg,
|
||||
pwrGnrSimType: pwrGnrSimTypeRecoil.type,
|
||||
}
|
||||
|
||||
const options = { responseType: 'blob' }
|
||||
await promisePost({ url: url, data: params, option: options })
|
||||
.then((resultData) => {
|
||||
if (resultData) {
|
||||
let fileName = 'unknow'
|
||||
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
|
||||
const fileUrl = window.URL.createObjectURL(blob)
|
||||
|
||||
const link = document.createElement('a')
|
||||
link.href = fileUrl
|
||||
|
||||
//서버에서 내려오는 파일명
|
||||
const contentDisposition = resultData.headers['content-disposition']
|
||||
if (contentDisposition) {
|
||||
fileName = contentDisposition.split('filename=')[1].replace(/['"]/g, '')
|
||||
}
|
||||
|
||||
link.download = fileName
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
window.URL.revokeObjectURL(fileUrl)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert('File does not exist.')
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isObjectNotEmpty(estimateRecoilState)) {
|
||||
if (estimateRecoilState?.createUser === 'T01') {
|
||||
|
||||
@ -332,7 +332,7 @@ export default function StuffDetail() {
|
||||
//createUser가 T01인데 로그인사용자가 T01이 아니면 버튼숨기기
|
||||
setShowButton('none')
|
||||
}
|
||||
|
||||
// console.log('상세::', res.data)
|
||||
if (isObjectNotEmpty(res.data)) {
|
||||
let surfaceTypeValue
|
||||
if (res.data.surfaceType === 'Ⅲ・Ⅳ') {
|
||||
|
||||
@ -39,6 +39,7 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
||||
|
||||
if (resultData) {
|
||||
setInfo(resultData)
|
||||
setPassword(resultData.password)
|
||||
} else {
|
||||
alert(getMessage('common.message.no.data'))
|
||||
}
|
||||
|
||||
@ -5,31 +5,23 @@ import { Bar } from 'react-chartjs-2'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
import { useEffect, useState, useRef } from 'react'
|
||||
import { useRecoilValue, useRecoilState } from 'recoil'
|
||||
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||
import { useRecoilState } from 'recoil'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import { pwrGnrSimTypeState } from '@/store/simulatorAtom'
|
||||
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { usePlan } from '@/hooks/usePlan'
|
||||
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||
|
||||
import { convertNumberToPriceDecimal } from '@/util/common-utils'
|
||||
|
||||
export default function Simulator() {
|
||||
const { plans } = usePlan()
|
||||
const plan = plans.find((plan) => plan.isCurrent === true)
|
||||
const searchParams = useSearchParams()
|
||||
const objectNo = searchParams.get('objectNo')
|
||||
const pid = searchParams.get('pid')
|
||||
|
||||
const chartRef = useRef(null)
|
||||
|
||||
// recoil 물건번호
|
||||
const objectRecoil = useRecoilValue(floorPlanObjectState)
|
||||
const [objectNo, setObjectNo] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
setObjectNo(objectRecoil.floorPlanObjectNo)
|
||||
}, [objectRecoil])
|
||||
|
||||
// 캔버스 메뉴 넘버 셋팅
|
||||
const { setMenuNumber } = useCanvasMenu()
|
||||
|
||||
@ -111,7 +103,7 @@ export default function Simulator() {
|
||||
setPwrGnrSimType('D')
|
||||
setPwrRecoil({ ...pwrRecoil, type: 'D' })
|
||||
}
|
||||
}, [objectNo, plan])
|
||||
}, [objectNo, pid])
|
||||
|
||||
// 물건 상세 정보 조회
|
||||
const [objectDetail, setObjectDetail] = useState({})
|
||||
@ -129,7 +121,7 @@ export default function Simulator() {
|
||||
const [hatsudenryouPeakcutAllSnow, setHatsudenryouPeakcutAllSnow] = useState([])
|
||||
|
||||
const fetchObjectDetail = async (objectNo) => {
|
||||
const apiUrl = `/api/pwrGnrSimulation/calculations?objectNo=${objectNo}&planNo=${plan?.id}`
|
||||
const apiUrl = `/api/pwrGnrSimulation/calculations?objectNo=${objectNo}&planNo=${pid}`
|
||||
|
||||
const resultData = await get({ url: apiUrl })
|
||||
if (resultData) {
|
||||
@ -201,7 +193,7 @@ export default function Simulator() {
|
||||
<div className="estimate-box">
|
||||
<div className="estimate-tit">{getMessage('simulator.title.sub1')}</div>
|
||||
<div className="estimate-name">
|
||||
{objectDetail.objectNo} (Plan No: {plan?.id})
|
||||
{objectDetail.objectNo} (Plan No: {pid})
|
||||
</div>
|
||||
</div>
|
||||
{/* 작성일 */}
|
||||
|
||||
@ -9,7 +9,7 @@ import { useMessage } from '@/hooks/useMessage'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
// Constants
|
||||
const ESTIMATE_API_ENDPOINT = '/api/estimate' // API 엔드포인트 정의
|
||||
|
||||
@ -19,6 +19,7 @@ const updateItemInList = (itemList, dispOrder, updates) => {
|
||||
}
|
||||
|
||||
export const useEstimateController = (planNo) => {
|
||||
const { swalFire } = useSwal()
|
||||
const [fileList, setFileList] = useState([])
|
||||
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||
|
||||
@ -353,7 +354,6 @@ export const useEstimateController = (planNo) => {
|
||||
estimateData.pkgAsp = estimateData.pkgAsp.replaceAll(',', '')
|
||||
}
|
||||
|
||||
console.log('최종저장::', estimateData)
|
||||
//2. 상세데이터 저장
|
||||
// return
|
||||
try {
|
||||
@ -361,8 +361,9 @@ export const useEstimateController = (planNo) => {
|
||||
setIsGlobalLoading(true)
|
||||
if (res.status === 201) {
|
||||
estimateData.newFileList = []
|
||||
alert(getMessage('estimate.detail.save.alertMsg'))
|
||||
//어디로 보낼지
|
||||
//알럿창 변경
|
||||
swalFire({ text: getMessage('estimate.detail.save.alertMsg'), type: 'alert' })
|
||||
// alert(getMessage('estimate.detail.save.alertMsg'))
|
||||
fetchSetting(objectRecoil.floorPlanObjectNo, estimateData.planNo)
|
||||
}
|
||||
})
|
||||
@ -400,8 +401,14 @@ export const useEstimateController = (planNo) => {
|
||||
if (res.status === 201) {
|
||||
if (isObjectNotEmpty(res.data)) {
|
||||
let newObjectNo = res.data.objectNo
|
||||
alert(getMessage('estimate.detail.estimateCopyPopup.copy.alertMessage'))
|
||||
router.push(`/management/stuff/detail?objectNo=${newObjectNo.toString()}`, { scroll: false })
|
||||
console.log('newObjectNo::', newObjectNo)
|
||||
swalFire({
|
||||
text: getMessage('estimate.detail.estimateCopyPopup.copy.alertMessage'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
router.push(`/management/stuff/detail?objectNo=${newObjectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -945,6 +945,7 @@
|
||||
"simulator.table.sub9": "予測発電量 (kWh)",
|
||||
"simulator.notice.sub1": "Hanwha Japan 年間発電量",
|
||||
"simulator.notice.sub2": "シミュレーション案内事項",
|
||||
"simulator.menu.move.valid1": "見積書を作成した後に、発電シミュレーションの結果を照会することができます。",
|
||||
"master.moduletypeitem.message.error": "지붕재 코드를 입력하세요.",
|
||||
"can.not.move.module": "모듈을 이동할 수 없습니다.(JA)",
|
||||
"can.not.copy.module": "모듈을 복사할 수 없습니다.(JA)",
|
||||
|
||||
@ -955,6 +955,7 @@
|
||||
"simulator.table.sub9": "예측발전량 (kWh)",
|
||||
"simulator.notice.sub1": "Hanwha Japan 연간 발전량",
|
||||
"simulator.notice.sub2": "시뮬레이션 안내사항",
|
||||
"simulator.menu.move.valid1": "견적서를 생성한 후에, 발전시뮬레이션 결과를 조회할 수 있습니다.",
|
||||
"master.moduletypeitem.message.error": "지붕재 코드를 입력하세요.",
|
||||
"can.not.move.module": "모듈을 이동할 수 없습니다.",
|
||||
"can.not.copy.module": "모듈을 복사할 수 없습니다.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user