Merge branch 'dev' into dev-yj

This commit is contained in:
lelalela 2025-01-10 11:18:49 +09:00
commit a35f79bf94
13 changed files with 234 additions and 79 deletions

View File

@ -23,6 +23,17 @@ const defaultEstimateData = {
priceCd: '',
}
/**
* 모듈,회로 구성 상태 데이터
* 설정 팝업 상태를 저장하는 데이터
*/
const defaultProcessStep = {
gnbStep: 0,
processStep: 0,
moduleCofigureData: {},
pcsConfigureData: {},
}
export const FloorPlanContext = createContext({
floorPlanState: {},
setFloorPlanState: () => {},
@ -57,8 +68,12 @@ const FloorPlanProvider = ({ children }) => {
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
const [processStepState, setProcessStepState] = useReducer(reducer, defaultProcessStep)
return (
<FloorPlanContext.Provider value={{ floorPlanState, setFloorPlanState, estimateContextState, setEstimateContextState }}>
<FloorPlanContext.Provider
value={{ floorPlanState, setFloorPlanState, estimateContextState, setEstimateContextState, processStepState, setProcessStepState }}
>
{children}
</FloorPlanContext.Provider>
)

View File

@ -1,9 +1,9 @@
'use client'
import { usePathname } from 'next/navigation'
import FloorPlanProvider from './FloorPlanProvider'
import FloorPlan from '@/components/floor-plan/FloorPlan'
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
import { usePathname } from 'next/navigation'
export default function FloorPlanLayout({ children }) {
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')

View File

@ -993,7 +993,11 @@ export default function Estimate({}) {
<tr>
{/* 2차 판매점명 */}
<th>{getMessage('estimate.detail.otherSaleStoreId')}</th>
<td>{estimateContextState?.agencySaleStoreName}</td>
<td>
{session?.storeLvl === '1' && estimateContextState?.saleStoreLevel === '1'
? getMessage('estimate.detail.noOtherSaleStoreId')
: estimateContextState?.agencySaleStoreName}
</td>
{/* 담당자 */}
<th>
{getMessage('estimate.detail.receiveUser')} <span className="important">*</span>

View File

@ -135,6 +135,15 @@ export default function CanvasMenu(props) {
const onClickNav = (menu) => {
switch (menu.index) {
case 0:
swalFire({
text: getMessage('stuff.detail.move.confirmMsg'),
type: 'confirm',
confirmFn: () => {
router.push(`/management/stuff/detail?objectNo=${objectNo}`)
},
})
break
case 1:
setType('placementShape')
onClickPlacementInitialMenu()
@ -153,6 +162,11 @@ export default function CanvasMenu(props) {
case 4:
setType('module')
break
case 5:
setMenuNumber(menu.index)
setCurrentMenu(menu.title)
router.push(`/floor-plan/estimate/5?pid=${pid}&objectNo=${objectNo}`)
break
case 6:
promiseGet({ url: `/api/estimate/${objectNo}/${pid}/detail` }).then((res) => {
if (res.status === 200) {
@ -169,12 +183,14 @@ export default function CanvasMenu(props) {
break
}
if (menu.index !== 6) {
if (menu.index !== 6 && menu.index !== 0) {
setMenuNumber(menu.index)
setCurrentMenu(menu.title)
}
if (pathname !== '/floor-plan') router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
if (pathname !== '/floor-plan' && pathname !== '/floor-plan/estimate/5') {
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
}
}
const changeSelectedRoofMaterial = (e) => {
@ -236,6 +252,7 @@ export default function CanvasMenu(props) {
//
const handleEstimateReset = () => {
return alert('개발전입니다;;;')
// console.log('estimateRecoilState::', estimateRecoilState)
//objectNo, planNo
swalFire({

View File

@ -11,6 +11,9 @@ import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
import { useCommonCode } from '@/hooks/common/useCommonCode'
import { globalLocaleStore } from '@/store/localeAtom'
import { useRoofShapeSetting } from '@/hooks/roofcover/useRoofShapeSetting'
import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom'
import { getDegreeByChon } from '@/util/canvas-util'
import { onlyNumberWithDotInputChange } from '@/util/input-utils'
export default function RoofAllocationSetting(props) {
const contextPopupPosition = useRecoilValue(contextPopupPositionState)
@ -29,11 +32,13 @@ export default function RoofAllocationSetting(props) {
handleChangeRaft,
handleChangeLayout,
currentRoofList,
handleChangeInput,
} = useRoofAllocationSetting(id)
const { pitchText } = useRoofShapeSetting(id)
const pitchText = useRecoilValue(pitchTextSelector)
const { findCommonCode } = useCommonCode()
const [raftCodes, setRaftCodes] = useState([])
const globalLocale = useRecoilValue(globalLocaleStore)
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
useEffect(() => {
const raftCodeList = findCommonCode('203800')
setRaftCodes(raftCodeList.map((raft) => ({ ...raft, name: raft.clCodeNm })))
@ -110,7 +115,14 @@ export default function RoofAllocationSetting(props) {
<div className="flex-ment">
<span>{getMessage('slope')}</span>
<div className="input-grid" style={{ width: '214px' }}>
<input type="text" className="input-origin block" defaultValue={4} />
<input
type="text"
className="input-origin block"
onChange={(e) => {
handleChangeInput(e, 'pitch', index)
}}
defaultValue={currentAngleType === 'slope' ? roof.pitch : getDegreeByChon(roof.pitch)}
/>
</div>
<span>{pitchText}</span>
</div>
@ -121,7 +133,13 @@ export default function RoofAllocationSetting(props) {
<div className="flex-ment">
<span>W</span>
<div className="input-grid" style={{ width: '100px' }}>
<input type="text" className="input-origin block" defaultValue={roof.width} readOnly={roof.widAuth === 'R'} />
<input
type="text"
className="input-origin block"
defaultValue={roof.width}
onChange={(e) => handleChangeInput(e, 'width', index)}
readOnly={roof.widAuth === 'R'}
/>
</div>
</div>
)}
@ -129,7 +147,13 @@ export default function RoofAllocationSetting(props) {
<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'} />
<input
type="text"
className="input-origin block"
defaultValue={roof.length}
onChange={(e) => handleChangeInput(e, 'length', index)}
readOnly={roof.lenAuth === 'R'}
/>
</div>
</div>
)}
@ -164,6 +188,7 @@ export default function RoofAllocationSetting(props) {
<input
type="text"
className="input-origin block"
onChange={(e) => handleChangeInput(e, 'hajebichi', index)}
value={parseInt(roof.hajebichi)}
readOnly={roof.roofPchAuth === 'R'}
/>

View File

@ -331,7 +331,7 @@ export default function StuffDetail() {
//createUser T01 T01
setShowButton('none')
}
console.log('상세::', res.data)
// console.log('::', res.data)
if (isObjectNotEmpty(res.data)) {
let surfaceTypeValue
if (res.data.surfaceType === 'Ⅲ・Ⅳ') {

View File

@ -19,7 +19,7 @@ export default function PlanRequestPop(props) {
//
const { commonCode, findCommonCode } = useCommonCode()
const [planStatCdList, setPlanStatCdList] = useState([])
// const [planStatCdList, setPlanStatCdList] = useState([])
const globalLocaleState = useRecoilValue(globalLocaleStore)
@ -169,13 +169,13 @@ export default function PlanRequestPop(props) {
gridData: [],
isPageable: false,
gridColumns: [
{
field: 'planStatName',
headerName: getMessage('stuff.planReqPopup.gridHeader.planStatName'),
minWidth: 150,
checkboxSelection: true,
showDisabledCheckboxes: true,
},
// {
// field: 'planStatName',
// headerName: getMessage('stuff.planReqPopup.gridHeader.planStatName'),
// minWidth: 150,
// checkboxSelection: true,
// showDisabledCheckboxes: true,
// },
{
field: 'planReqNo',
headerName: getMessage('stuff.planReqPopup.gridHeader.planReqNo'),
@ -234,12 +234,12 @@ export default function PlanRequestPop(props) {
}
}
useEffect(() => {
const code1 = findCommonCode(115800) //
if (code1 != null) {
setPlanStatCdList(code1)
}
}, [commonCode])
// useEffect(() => {
// const code1 = findCommonCode(115800) //
// if (code1 != null) {
// setPlanStatCdList(code1)
// }
// }, [commonCode])
useEffect(() => {
onSubmit(pageNo, 'S')
@ -380,7 +380,7 @@ export default function PlanRequestPop(props) {
/>
</div>
</td>
<th>{getMessage('stuff.planReqPopup.search.planStatName')}</th>
{/* <th>{getMessage('stuff.planReqPopup.search.planStatName')}</th>
<td>
<div className="select-wrap">
<Select
@ -398,7 +398,7 @@ export default function PlanRequestPop(props) {
isClearable={true}
/>
</div>
</td>
</td> */}
</tr>
<tr>
<th>{getMessage('stuff.planReqPopup.search.period')}</th>

View File

@ -3,6 +3,7 @@
import 'chart.js/auto'
import { Bar } from 'react-chartjs-2'
import dayjs from 'dayjs'
import { v4 as uuidv4 } from 'uuid'
import { useEffect, useState, useRef, useContext } from 'react'
import { useRecoilState } from 'recoil'
@ -14,11 +15,16 @@ import { useMessage } from '@/hooks/useMessage'
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
import { convertNumberToPriceDecimal } from '@/util/common-utils'
// import { useSearchParams } from 'next/navigation'
export default function Simulator() {
const { floorPlanState } = useContext(FloorPlanContext)
const { objectNo, pid } = floorPlanState
// const searchParams = useSearchParams()
// const objectNo = searchParams.get('objectNo')
// const pid = searchParams.get('pid')
const chartRef = useRef(null)
//
@ -96,6 +102,16 @@ export default function Simulator() {
}
useEffect(() => {
/* 초기화 작업 */
setChartData([])
setObjectDetail({})
setModuleInfoList([])
setPcsInfoList([])
setHatsudenryouAll([])
setHatsudenryouAllSnow([])
setHatsudenryouPeakcutAll([])
setHatsudenryouPeakcutAllSnow([])
if (objectNo) {
fetchObjectDetail(objectNo)
fetchSimulatorNotice()
@ -192,7 +208,8 @@ 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: {pid})
{objectDetail.objectNo}
{`${objectDetail.planNo ? `(Plan No: ${objectDetail.planNo})` : ''}`}
</div>
</div>
{/* 작성일 */}
@ -291,7 +308,7 @@ export default function Simulator() {
{chartData.length > 0 ? (
<tr>
{chartData.map((data) => (
<td key={data}>{data}</td>
<td key={uuidv4()}>{data}</td>
))}
</tr>
) : (

View File

@ -1,10 +1,17 @@
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
import { canvasState, currentMenuState, currentObjectState } from '@/store/canvasAtom'
import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
import { useEffect, useRef, useState } from 'react'
import { useAxios } from '@/hooks/useAxios'
import { useSwal } from '@/hooks/useSwal'
import { usePolygon } from '@/hooks/usePolygon'
import { correntObjectNoState, addedRoofsState, basicSettingState, roofDisplaySelector, roofMaterialsSelector, selectedRoofMaterialSelector } from '@/store/settingAtom'
import {
correntObjectNoState,
addedRoofsState,
basicSettingState,
roofDisplaySelector,
roofMaterialsSelector,
selectedRoofMaterialSelector,
} from '@/store/settingAtom'
import { usePopup } from '@/hooks/usePopup'
import { POLYGON_TYPE } from '@/common/common'
import { v4 as uuidv4 } from 'uuid'
@ -16,6 +23,7 @@ import { menuTypeState } from '@/store/menuAtom'
import { useRoofFn } from '@/hooks/common/useRoofFn'
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
import { globalLocaleStore } from '@/store/localeAtom'
import { getChonByDegree } from '@/util/canvas-util'
// 지붕면 할당
export function useRoofAllocationSetting(id) {
@ -37,6 +45,7 @@ export function useRoofAllocationSetting(id) {
const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열
const [editingLines, setEditingLines] = useState([])
const [currentRoofList, setCurrentRoofList] = useState(roofList)
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
const globalLocaleState = useRecoilValue(globalLocaleStore)
const { get, post } = useAxios(globalLocaleState)
@ -110,7 +119,6 @@ export function useRoofAllocationSetting(id) {
}
})
} else {
roofsArray = [
{
roofApply: true,
@ -137,21 +145,22 @@ export function useRoofAllocationSetting(id) {
for (let i = 0; i < roofsArray.length; i++) {
roofMaterials?.map((material) => {
if (material.roofMatlCd === roofsArray[i].roofMatlCd) {
selectRoofs.push({ ...material
, selected: roofsArray[i].roofApply
, index: roofsArray[i].roofSeq
, id: roofsArray[i].roofMatlCd
, width: roofsArray[i].roofWidth
, length: roofsArray[i].roofHeight
, hajebichi: roofsArray[i].roofHajebichi
, raft: roofsArray[i].roofGap
, layout: roofsArray[i].roofLayout
})
selectRoofs.push({
...material,
selected: roofsArray[i].roofApply,
index: roofsArray[i].roofSeq,
id: roofsArray[i].roofMatlCd,
width: roofsArray[i].roofWidth,
length: roofsArray[i].roofHeight,
hajebichi: roofsArray[i].roofHajebichi,
raft: roofsArray[i].roofGap,
layout: roofsArray[i].roofLayout,
})
setCurrentRoofList(selectRoofs)
}
})
}
setBasicSetting({ ...basicSetting, roofsData: roofsArray})
setBasicSetting({ ...basicSetting, roofsData: roofsArray })
})
} catch (error) {
console.error('Data fetching error:', error)
@ -160,7 +169,6 @@ export function useRoofAllocationSetting(id) {
// 저장
const basicSettingSave = async () => {
const patternData = {
objectNo: correntObjectNo,
roofSizeSet: basicSetting.roofSizeSet,
@ -174,24 +182,23 @@ export function useRoofAllocationSetting(id) {
roofHajebichi: item.hajebichi === null || item.hajebichi === undefined ? 0 : item.hajebichi,
roofGap: item.raft === null || item.raft === undefined ? 'HEI_455' : item.raft,
roofLayout: item.layout === null || item.layout === undefined ? 'P' : item.layout,
})),
}
console.log('🚀 ~ basicSettingSave ~ patternData >>>>>>>>>>>>> :', patternData)
// HTTP POST 요청 보내기
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData })
.then((res) => {
swalFire({ text: getMessage(res.returnMessage) })
//Recoil 설정
// setCanvasSetting({ ...basicSetting })
fetchBasicSettings()
})
.catch((error) => {
swalFire({ text: error.message, icon: 'error' })
})
),
}
console.log('🚀 ~ basicSettingSave ~ patternData >>>>>>>>>>>>> :', patternData)
// HTTP POST 요청 보내기
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData })
.then((res) => {
swalFire({ text: getMessage(res.returnMessage) })
//Recoil 설정
// setCanvasSetting({ ...basicSetting })
fetchBasicSettings()
})
.catch((error) => {
swalFire({ text: error.message, icon: 'error' })
})
}
const onAddRoofMaterial = () => {
@ -222,7 +229,6 @@ export function useRoofAllocationSetting(id) {
// 선택한 지붕재로 할당
const handleSave = () => {
basicSettingSave()
// 모두 actualSize 있으면 바로 적용 없으면 actualSize 설정
@ -231,7 +237,6 @@ export function useRoofAllocationSetting(id) {
} else {
apply()
}
}
// 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우
@ -417,6 +422,65 @@ export function useRoofAllocationSetting(id) {
setCurrentRoofList(newRoofList)
}
const handleChangeInput = (e, type, index) => {
const value = e.target.value
if (type === 'pitch') {
// type이 pitch인 경우 소수점 1자리까지만 입력 가능
const reg = /^[0-9]+(\.[0-9]{0,1})?$/
if (!reg.test(value)) {
e.target.value = value.substring(0, value.length - 1)
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return {
...roof,
[type]: currentAngleType === 'slope' ? value.substring(0, value.length - 1) : getChonByDegree(value.substring(0, value.length - 1)),
}
}
return roof
})
setCurrentRoofList(newRoofList)
return
} else {
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return {
...roof,
[type]: currentAngleType === 'slope' ? value : getChonByDegree(value),
}
}
return roof
})
setCurrentRoofList(newRoofList)
}
return
}
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return { ...roof, [type]: value }
}
return roof
})
setCurrentRoofList(newRoofList)
}
const handleChangePitch = (e, index) => {
const value = e.target.value
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return { ...roof, pitch: value }
}
return roof
})
setCurrentRoofList(newRoofList)
}
return {
handleSave,
onAddRoofMaterial,
@ -435,5 +499,7 @@ export function useRoofAllocationSetting(id) {
handleChangeLayout,
handleSaveContext,
currentRoofList,
handleChangeInput,
handleChangePitch,
}
}

View File

@ -1,7 +1,7 @@
'use client'
import { useEffect, useState } from 'react'
import { useRouter } from 'next/navigation'
import { useContext, useEffect, useState } from 'react'
import { usePathname, useRouter } from 'next/navigation'
import { useRecoilState } from 'recoil'
import { v4 as uuidv4 } from 'uuid'
@ -13,8 +13,12 @@ import { useSwal } from '@/hooks/useSwal'
import { useCanvas } from '@/hooks/useCanvas'
import { SAVE_KEY } from '@/common/common'
import { readImage, removeImage } from '@/lib/fileAction'
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
export function usePlan(params = {}) {
const pObjectNo = params.objectNo
const { floorPlanState } = useContext(FloorPlanContext)
const [planNum, setPlanNum] = useState(0)
const [selectedPlan, setSelectedPlan] = useState(null)
@ -24,6 +28,7 @@ export function usePlan(params = {}) {
const [plans, setPlans] = useRecoilState(plansState) // 전체 plan
const router = useRouter()
const pathname = usePathname()
const { swalFire } = useSwal()
const { getMessage } = useMessage()
@ -199,10 +204,12 @@ export function usePlan(params = {}) {
* 현재 plan의 작업상태를 저장 이동
*/
const handleCurrentPlan = async (newCurrentId) => {
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
await saveCanvas()
updateCurrentPlan(newCurrentId)
if (pathname === '/floor-plan') {
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
await saveCanvas()
}
}
updateCurrentPlan(newCurrentId)
}
const updateCurrentPlan = (newCurrentId) => {
@ -219,9 +226,9 @@ export function usePlan(params = {}) {
}, [plans])
// 현재 plan이 변경될 때 마다 현재 plan의 링크로 이동
// useEffect(() => {
// handlePlanMove()
// }, [currentCanvasPlan])
useEffect(() => {
handlePlanMove()
}, [currentCanvasPlan])
const setBgImage = () => {
// readImage(selectedPlan?.id)
@ -312,7 +319,7 @@ export function usePlan(params = {}) {
* 현재 plan 이동 -> 새로운 링크로 이동
*/
const handlePlanMove = () => {
router.push(`/floor-plan?objectNo=${params?.objectNo}&pid=${currentCanvasPlan?.ordering}`)
router.push(`${pathname}?objectNo=${floorPlanState.objectNo}&pid=${currentCanvasPlan?.ordering}`)
}
return {

View File

@ -268,7 +268,7 @@ export const usePolygon = () => {
surfaceCompass: polygon.surfaceCompass,
moduleCompass: polygon.moduleCompass,
visible: isFlowDisplay,
pitch: polygon.pitch,
pitch: polygon.roofMaterial.pitch ?? 4,
parentId: polygon.id,
})

View File

@ -687,6 +687,7 @@
"stuff.detail.save.valierror2": "設置高さ0より大きい値を入力してください",
"stuff.detail.save.valierror3": "{0} 必須入力項目です.",
"stuff.detail.save.valierror4": "二次販売店名は必須オプションです.",
"stuff.detail.move.confirmMsg": "商品情報画面に移動します。 [保存]していない図面情報は削除されます。商品情報画面に移動しますか?",
"stuff.planReqPopup.popTitle": "設計依頼検索",
"stuff.planReqPopup.btn1": "検索",
"stuff.planReqPopup.btn2": "初期化",
@ -844,6 +845,7 @@
"estimate.detail.saleStoreId": "一次販売店名",
"estimate.detail.estimateDate": "見積日",
"estimate.detail.otherSaleStoreId": "二次販売店名",
"estimate.detail.noOtherSaleStoreId": "二次点なし",
"estimate.detail.receiveUser": "担当者 ",
"estimate.detail.objectName": "案件名",
"estimate.detail.objectRemarks": "メモ",

View File

@ -697,7 +697,8 @@
"stuff.detail.save.valierror2": "설치높이는 0보다 큰 값을 입력하세요",
"stuff.detail.save.valierror3": "{0} 필수 입력 항목입니다.",
"stuff.detail.save.valierror4": "2차 판매점명은 필수 선택사항입니다.",
"stuff.planReqPopup.popTitle": "설계 요청 검색",
"stuff.detail.move.confirmMsg": "물건정보 화면으로 이동합니다. [저장]하지 않은 도면정보는 삭제됩니다. 물건정보 화면으로 이동하시겠습니까?",
"stuff.planReqPopup.popTitle": "설계 의뢰 검색",
"stuff.planReqPopup.btn1": "검색",
"stuff.planReqPopup.btn2": "초기화",
"stuff.planReqPopup.btn3": "닫기",
@ -854,6 +855,7 @@
"estimate.detail.saleStoreId": "1차 판매점명",
"estimate.detail.estimateDate": "견적일",
"estimate.detail.otherSaleStoreId": "2차 판매점명",
"estimate.detail.noOtherSaleStoreId": "2차점 없음",
"estimate.detail.receiveUser": "담당자",
"estimate.detail.objectName": "안건명",
"estimate.detail.objectRemarks": "메모",