Merge branch 'dev' into dev-yj

This commit is contained in:
lelalela 2025-01-17 13:01:41 +09:00
commit 1e372f925b
7 changed files with 159 additions and 152 deletions

View File

@ -44,6 +44,7 @@ import JA from '@/locales/ja.json'
import { MENU } from '@/common/common' import { MENU } from '@/common/common'
import { QcastContext } from '@/app/QcastProvider' import { QcastContext } from '@/app/QcastProvider'
export default function CanvasMenu(props) { export default function CanvasMenu(props) {
const { menuNumber, setMenuNumber } = props const { menuNumber, setMenuNumber } = props
const pathname = usePathname() const pathname = usePathname()
@ -101,6 +102,8 @@ export default function CanvasMenu(props) {
const { setIsGlobalLoading } = useContext(QcastContext) const { setIsGlobalLoading } = useContext(QcastContext)
//
const { selectedPlan } = usePlan()
const handleExcelPdfFileDown = async (donwloadType, drawingFlg) => { const handleExcelPdfFileDown = async (donwloadType, drawingFlg) => {
const url = '/api/estimate/excel-download' const url = '/api/estimate/excel-download'
@ -168,14 +171,14 @@ export default function CanvasMenu(props) {
break break
case 5: case 5:
// let pid = urlParams.get('pid') // let pid = urlParams.get('pid')
promiseGet({ url: `/api/estimate/${objectNo}/${pid}/detail` }).then((res) => { promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.ordering}/detail` }).then((res) => {
if (res.status === 200) { if (res.status === 200) {
const estimateDetail = res.data const estimateDetail = res.data
if (estimateDetail.docNo) { if (estimateDetail.tempFlg === '0' && estimateDetail.estimateDate !== null) {
setMenuNumber(menu.index) setMenuNumber(menu.index)
setCurrentMenu(menu.title) setCurrentMenu(menu.title)
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo }) setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
router.push(`/floor-plan/estimate/5?pid=${pid}&objectNo=${objectNo}`) router.push(`/floor-plan/estimate/${menu.index}?pid=${selectedPlan.ordering}&objectNo=${objectNo}`)
} else { } else {
swalFire({ text: getMessage('estimate.menu.move.valid1') }) swalFire({ text: getMessage('estimate.menu.move.valid1') })
} }
@ -183,13 +186,13 @@ export default function CanvasMenu(props) {
}) })
break break
case 6: case 6:
promiseGet({ url: `/api/estimate/${objectNo}/${pid}/detail` }).then((res) => { promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.ordering}/detail` }).then((res) => {
if (res.status === 200) { if (res.status === 200) {
const estimateDetail = res.data const estimateDetail = res.data
if (estimateDetail.docNo) { if (estimateDetail.tempFlg === '0') {
setMenuNumber(menu.index) setMenuNumber(menu.index)
setCurrentMenu(menu.title) setCurrentMenu(menu.title)
router.push(`/floor-plan/simulator/${menu.index}?pid=${pid}&objectNo=${objectNo}`) router.push(`/floor-plan/simulator/${menu.index}?pid=${selectedPlan.ordering}&objectNo=${objectNo}`)
} else { } else {
swalFire({ text: getMessage('simulator.menu.move.valid1') }) swalFire({ text: getMessage('simulator.menu.move.valid1') })
} }

View File

@ -79,133 +79,134 @@ export default function ContextRoofAllocationSetting(props) {
</button> </button>
</div> </div>
<div className="grid-option-wrap"> <div className="grid-option-wrap">
{currentRoofList.map((roof, index) => { {currentRoofList.length > 0 &&
return ( currentRoofList.map((roof, index) => {
<div className="grid-option-box" key={index}> return (
<div className="d-check-radio pop no-text"> <div className="grid-option-box" key={index}>
<input type="radio" name="radio01" checked={roof.selected && 'checked'} readOnly={true} /> <div className="d-check-radio pop no-text">
<label <input type="radio" name="radio01" checked={roof.selected && 'checked'} readOnly={true} />
htmlFor="ra01" <label
onClick={(e) => { htmlFor="ra01"
handleDefaultRoofMaterial(index) onClick={(e) => {
}} handleDefaultRoofMaterial(index)
></label> }}
</div> ></label>
<div className="grid-option-block-form">
<div className="block-box">
<div className="flex-ment">
<div className="grid-select" style={{ width: '248px' }}>
<QSelectBox
options={roofMaterials}
value={roof}
showKey={'roofMatlNm'}
sourceKey={'roofMatlCd'}
targetKey={'roofMatlCd'}
onChange={(e) => handleChangeRoofMaterial(e, index)}
/>
</div>
{index === 0 && <span className="dec">{getMessage('modal.roof.alloc.default.roof.material')}</span>}
{index !== 0 && <button className="delete" onClick={() => onDeleteRoofMaterial(index)}></button>}
</div>
</div> </div>
<div className="block-box"> <div className="grid-option-block-form">
<div className="flex-ment"> <div className="block-box">
<span>{getMessage('slope')}</span> <div className="flex-ment">
<div className="input-grid" style={{ width: '214px' }}> <div className="grid-select" style={{ width: '248px' }}>
<input <QSelectBox
type="text" options={roofMaterials}
className="input-origin block" value={roof}
onChange={(e) => { showKey={'roofMatlNm'}
handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index) sourceKey={'roofMatlCd'}
}} targetKey={'roofMatlCd'}
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle} onChange={(e) => handleChangeRoofMaterial(e, index)}
/> />
</div>
{index === 0 && <span className="dec">{getMessage('modal.roof.alloc.default.roof.material')}</span>}
{index !== 0 && <button className="delete" onClick={() => onDeleteRoofMaterial(index)}></button>}
</div> </div>
<span>{pitchText}</span>
</div> </div>
</div>
{(roof.widAuth || roof.lenAuth) && (
<div className="block-box"> <div className="block-box">
{roof.widAuth && ( <div className="flex-ment">
<div className="flex-ment"> <span>{getMessage('slope')}</span>
<span>W</span> <div className="input-grid" style={{ width: '214px' }}>
<div className="input-grid" style={{ width: '100px' }}> <input
<input type="text" className="input-origin block" defaultValue={roof.width} readOnly={roof.widAuth === 'R'} /> type="text"
</div> className="input-origin block"
onChange={(e) => {
handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index)
}}
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
/>
</div> </div>
)} <span>{pitchText}</span>
{roof.lenAuth && ( </div>
<div className="flex-ment">
<span>L</span>
<div className="input-grid" style={{ width: '100px' }}>
<input type="text" className="input-origin block" defaultValue={roof.length} readOnly={roof.lenAuth === 'R'} />
</div>
</div>
)}
</div> </div>
)} {(roof.widAuth || roof.lenAuth) && (
{(roof.raftAuth || roof.roofPchAuth) && ( <div className="block-box">
<div className="block-box"> {roof.widAuth && (
{roof.raftAuth && (
<div className="block-box">
<div className="flex-ment"> <div className="flex-ment">
<span>{getMessage('modal.placement.initial.setting.rafter')}</span> <span>W</span>
{raftCodes.length > 0 && ( <div className="input-grid" style={{ width: '100px' }}>
<div className="grid-select" style={{ width: '160px' }}> <input type="text" className="input-origin block" defaultValue={roof.width} readOnly={roof.widAuth === 'R'} />
<QSelectBox
options={raftCodes}
value={roof}
showKey={'clCodeNm'}
sourceKey={'clCode'}
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
/>
</div>
)}
</div>
</div>
)}
{roof.roofPchAuth && (
<div className="block-box">
<div className="flex-ment">
<span>{getMessage('hajebichi')}</span>
<div className="input-grid" style={{ width: '84px' }}>
<input
type="text"
className="input-origin block"
value={parseInt(roof.hajebichi)}
readOnly={roof.roofPchAuth === 'R'}
/>
</div> </div>
</div> </div>
</div> )}
)} {roof.lenAuth && (
</div> <div className="flex-ment">
)} <span>L</span>
<div className="block-box"> <div className="input-grid" style={{ width: '100px' }}>
<div className="icon-btn-wrap"> <input type="text" className="input-origin block" defaultValue={roof.length} readOnly={roof.lenAuth === 'R'} />
<button </div>
className={roof.layout === ROOF_MATERIAL_LAYOUT.PARALLEL ? 'act' : ''} </div>
onClick={() => { )}
handleChangeLayout(ROOF_MATERIAL_LAYOUT.PARALLEL, index) </div>
}} )}
> {(roof.raftAuth || roof.roofPchAuth) && (
{getMessage('modal.roof.alloc.select.parallel')} <div className="block-box">
<i className="allocation01"></i> {roof.raftAuth && (
</button> <div className="block-box">
<button <div className="flex-ment">
className={roof.layout === ROOF_MATERIAL_LAYOUT.STAIRS ? 'act' : ''} <span>{getMessage('modal.placement.initial.setting.rafter')}</span>
onClick={() => { {raftCodes.length > 0 && (
handleChangeLayout(ROOF_MATERIAL_LAYOUT.STAIRS, index) <div className="grid-select" style={{ width: '160px' }}>
}} <QSelectBox
> options={raftCodes}
{getMessage('modal.roof.alloc.select.stairs')} <i className="allocation02"></i> value={roof}
</button> showKey={'clCodeNm'}
sourceKey={'clCode'}
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
/>
</div>
)}
</div>
</div>
)}
{roof.roofPchAuth && (
<div className="block-box">
<div className="flex-ment">
<span>{getMessage('hajebichi')}</span>
<div className="input-grid" style={{ width: '84px' }}>
<input
type="text"
className="input-origin block"
value={parseInt(roof.hajebichi)}
readOnly={roof.roofPchAuth === 'R'}
/>
</div>
</div>
</div>
)}
</div>
)}
<div className="block-box">
<div className="icon-btn-wrap">
<button
className={roof.layout === ROOF_MATERIAL_LAYOUT.PARALLEL ? 'act' : ''}
onClick={() => {
handleChangeLayout(ROOF_MATERIAL_LAYOUT.PARALLEL, index)
}}
>
{getMessage('modal.roof.alloc.select.parallel')}
<i className="allocation01"></i>
</button>
<button
className={roof.layout === ROOF_MATERIAL_LAYOUT.STAIRS ? 'act' : ''}
onClick={() => {
handleChangeLayout(ROOF_MATERIAL_LAYOUT.STAIRS, index)
}}
>
{getMessage('modal.roof.alloc.select.stairs')} <i className="allocation02"></i>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> )
) })}
})}
</div> </div>
<div className="grid-btn-wrap"> <div className="grid-btn-wrap">
<button className="btn-frame modal act" onClick={handleSaveContext}> <button className="btn-frame modal act" onClick={handleSaveContext}>

View File

@ -219,6 +219,10 @@ export default function Stuff() {
pageSize: stuffSearchParams?.pageSize ? stuffSearchParams.pageSize : 100, pageSize: stuffSearchParams?.pageSize ? stuffSearchParams.pageSize : 100,
} }
if (!params.saleStoreId) {
params.saleStoreId = session.storeId
}
async function fetchData() { async function fetchData() {
const apiUrl = `/api/object/list?${queryStringFormatter(params)}` const apiUrl = `/api/object/list?${queryStringFormatter(params)}`
await get({ await get({
@ -271,6 +275,10 @@ export default function Stuff() {
stuffSearchParams.schSortType = defaultSortType stuffSearchParams.schSortType = defaultSortType
stuffSearchParams.pageNo = stuffSearchParams.pageNo stuffSearchParams.pageNo = stuffSearchParams.pageNo
if (!stuffSearchParams.saleStoreId) {
stuffSearchParams.saleStoreId = session.storeId
}
async function fetchData() { async function fetchData() {
const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}` const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}`
await get({ url: apiUrl }).then((res) => { await get({ url: apiUrl }).then((res) => {
@ -301,6 +309,9 @@ export default function Stuff() {
stuffSearchParams.schSortType = defaultSortType stuffSearchParams.schSortType = defaultSortType
setPageNo(1) setPageNo(1)
if (!params.saleStoreId) {
stuffSearchParams.saleStoreId = session.storeId
}
async function fetchData() { async function fetchData() {
const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}` const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}`
await get({ url: apiUrl }).then((res) => { await get({ url: apiUrl }).then((res) => {

View File

@ -16,26 +16,18 @@ import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
import { convertNumberToPriceDecimal } from '@/util/common-utils' import { convertNumberToPriceDecimal } from '@/util/common-utils'
import { usePlan } from '@/hooks/usePlan' import { usePlan } from '@/hooks/usePlan'
import { usePopup } from '@/hooks/usePopup' import { usePopup, closeAll } from '@/hooks/usePopup'
// import { useSearchParams } from 'next/navigation'
export default function Simulator() { export default function Simulator() {
const { floorPlanState } = useContext(FloorPlanContext) const { floorPlanState } = useContext(FloorPlanContext)
const { objectNo, pid } = floorPlanState const { objectNo, pid } = floorPlanState
// const searchParams = useSearchParams()
// const objectNo = searchParams.get('objectNo')
// const pid = searchParams.get('pid')
const { selectedPlan } = usePlan() const { selectedPlan } = usePlan()
const chartRef = useRef(null) const chartRef = useRef(null)
// //
const { setMenuNumber } = useCanvasMenu() const { setMenuNumber } = useCanvasMenu()
const { closeAll } = usePopup()
useEffect(() => {
setMenuNumber(6)
}, [])
const { get } = useAxios() const { get } = useAxios()
const { getMessage } = useMessage() const { getMessage } = useMessage()
@ -43,12 +35,6 @@ export default function Simulator() {
// //
const [chartData, setChartData] = useState([]) const [chartData, setChartData] = useState([])
const { closeAll } = usePopup()
useEffect(() => {
closeAll()
}, [])
const data = { const data = {
labels: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], labels: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
datasets: [ datasets: [
@ -114,7 +100,6 @@ export default function Simulator() {
} }
useEffect(() => { useEffect(() => {
console.log('🚀 ~ useEffect ~ selectedPlan:', selectedPlan)
/* 초기화 작업 */ /* 초기화 작업 */
setChartData([]) setChartData([])
setObjectDetail({}) setObjectDetail({})
@ -125,11 +110,13 @@ export default function Simulator() {
setHatsudenryouPeakcutAll([]) setHatsudenryouPeakcutAll([])
setHatsudenryouPeakcutAllSnow([]) setHatsudenryouPeakcutAllSnow([])
if (objectNo) { if (objectNo && pid && selectedPlan) {
fetchObjectDetail(objectNo) fetchObjectDetail(objectNo, selectedPlan.ordering)
fetchSimulatorNotice() fetchSimulatorNotice()
setPwrGnrSimType('D') setPwrGnrSimType('D')
setPwrRecoil({ ...pwrRecoil, type: 'D' }) setPwrRecoil({ ...pwrRecoil, type: 'D' })
setMenuNumber(6)
closeAll()
} }
}, [objectNo, pid, selectedPlan]) }, [objectNo, pid, selectedPlan])
@ -148,8 +135,8 @@ export default function Simulator() {
const [hatsudenryouPeakcutAll, setHatsudenryouPeakcutAll] = useState([]) const [hatsudenryouPeakcutAll, setHatsudenryouPeakcutAll] = useState([])
const [hatsudenryouPeakcutAllSnow, setHatsudenryouPeakcutAllSnow] = useState([]) const [hatsudenryouPeakcutAllSnow, setHatsudenryouPeakcutAllSnow] = useState([])
const fetchObjectDetail = async (objectNo) => { const fetchObjectDetail = async (objectNo, currentPid) => {
const apiUrl = `/api/pwrGnrSimulation/calculations?objectNo=${objectNo}&planNo=${pid}` const apiUrl = `/api/pwrGnrSimulation/calculations?objectNo=${objectNo}&planNo=${currentPid}`
const resultData = await get({ url: apiUrl }) const resultData = await get({ url: apiUrl })
if (resultData) { if (resultData) {
@ -257,7 +244,7 @@ export default function Simulator() {
{/* 적설조건 */} {/* 적설조건 */}
<div className="estimate-box"> <div className="estimate-box">
<div className="estimate-tit">{getMessage('simulator.title.sub7')}</div> <div className="estimate-tit">{getMessage('simulator.title.sub7')}</div>
<div className="estimate-name">{objectDetail.snowfall} cm</div> <div className="estimate-name">{objectDetail.snowfall ? `${objectDetail.snowfall}cm` : ''} </div>
</div> </div>
{/* 풍속조건 */} {/* 풍속조건 */}
<div className="estimate-box"> <div className="estimate-box">
@ -356,7 +343,10 @@ export default function Simulator() {
{/* 지붕면 */} {/* 지붕면 */}
<td>{moduleInfo.roofSurface}</td> <td>{moduleInfo.roofSurface}</td>
{/* 경사각 */} {/* 경사각 */}
<td>{convertNumberToPriceDecimal(moduleInfo.slopeAngle)}{moduleInfo.classType == 0 ? "寸":"º"}</td> <td>
{convertNumberToPriceDecimal(moduleInfo.slopeAngle)}
{moduleInfo.classType == 0 ? '寸' : 'º'}
</td>
{/* 방위각(도) */} {/* 방위각(도) */}
<td>{convertNumberToPriceDecimal(moduleInfo.azimuth)}</td> <td>{convertNumberToPriceDecimal(moduleInfo.azimuth)}</td>
{/* 태양전지모듈 */} {/* 태양전지모듈 */}

View File

@ -22,8 +22,8 @@ export function useRoofFn() {
const ratio = window.devicePixelRatio || 1 const ratio = window.devicePixelRatio || 1
const layout = roofMaterial.layout const layout = roofMaterial.layout
let width = (roofMaterial.width ?? 226) / 10 let width = (roofMaterial.width || 226) / 10
let height = (roofMaterial.length ?? 158) / 10 let height = (roofMaterial.length || 158) / 10
const index = roofMaterial.index ?? 0 const index = roofMaterial.index ?? 0
let roofStyle = 2 let roofStyle = 2
const inputPatternSize = { width: width, height: height } //임시 사이즈 const inputPatternSize = { width: width, height: height } //임시 사이즈

View File

@ -42,7 +42,7 @@ export function useRoofAllocationSetting(id) {
const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) // 팝업 내 기준 지붕재 const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) // 팝업 내 기준 지붕재
const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열 const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열
const [editingLines, setEditingLines] = useState([]) const [editingLines, setEditingLines] = useState([])
const [currentRoofList, setCurrentRoofList] = useState(null) const [currentRoofList, setCurrentRoofList] = useState([])
const currentAngleType = useRecoilValue(currentAngleTypeSelector) const currentAngleType = useRecoilValue(currentAngleTypeSelector)
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
const [basicInfo, setBasicInfo] = useState(null) const [basicInfo, setBasicInfo] = useState(null)

View File

@ -215,7 +215,6 @@ export function usePlan(params = {}) {
const estimateDetail = res.data const estimateDetail = res.data
if (pathname === '/floor-plan/estimate/5') { if (pathname === '/floor-plan/estimate/5') {
if (estimateDetail.tempFlg === '0' && estimateDetail.estimateDate !== null) { if (estimateDetail.tempFlg === '0' && estimateDetail.estimateDate !== null) {
console.log('이동')
res.data.resetFlag = 'N' res.data.resetFlag = 'N'
if (res.data.itemList.length > 0) { if (res.data.itemList.length > 0) {
@ -238,9 +237,12 @@ export function usePlan(params = {}) {
swalFire({ text: getMessage('estimate.menu.move.valid1') }) swalFire({ text: getMessage('estimate.menu.move.valid1') })
} }
} else { } else {
//발전시뮬레이션 // 발전시뮬레이션
// 클릭한 플랜 탭으로 이동 if (estimateDetail.tempFlg === '0') {
// updateCurrentPlan(newCurrentId) updateCurrentPlan(newCurrentId)
} else {
swalFire({ text: getMessage('simulator.menu.move.valid1') })
}
} }
} }
}) })