Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into qcast-pub

This commit is contained in:
김민식 2025-01-22 15:12:05 +09:00
commit 365a6199d6
38 changed files with 1047 additions and 467 deletions

View File

@ -0,0 +1,11 @@
'use client'
import { useContext } from 'react'
import { QcastContext } from './QcastProvider'
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
export default function GlobalLoadingProvider() {
const { isGlobalLoading } = useContext(QcastContext)
return <>{isGlobalLoading && <GlobalSpinner />}</>
}

View File

@ -6,7 +6,6 @@ import { useCommonCode } from '@/hooks/common/useCommonCode'
import ServerError from './error' import ServerError from './error'
import '@/styles/common.scss' import '@/styles/common.scss'
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
export const QcastContext = createContext({ export const QcastContext = createContext({
qcastState: {}, qcastState: {},
@ -17,7 +16,7 @@ export const QcastContext = createContext({
export const QcastProvider = ({ children }) => { export const QcastProvider = ({ children }) => {
const [planSave, setPlanSave] = useState(false) const [planSave, setPlanSave] = useState(false)
const [isGlobalLoading, setIsGlobalLoading] = useState(false) const [isGlobalLoading, setIsGlobalLoading] = useState(true)
const { commonCode, findCommonCode } = useCommonCode() const { commonCode, findCommonCode } = useCommonCode()
const [qcastState, setQcastState] = useState({ const [qcastState, setQcastState] = useState({
@ -35,11 +34,6 @@ export const QcastProvider = ({ children }) => {
return ( return (
<> <>
{isGlobalLoading && (
<div className="fixed inset-0 bg-white z-50 flex items-center justify-center">
<GlobalSpinner />
</div>
)}
<QcastContext.Provider value={{ qcastState, setQcastState, isGlobalLoading, setIsGlobalLoading }}> <QcastContext.Provider value={{ qcastState, setQcastState, isGlobalLoading, setIsGlobalLoading }}>
<ErrorBoundary fallback={<ServerError />}>{children}</ErrorBoundary> <ErrorBoundary fallback={<ServerError />}>{children}</ErrorBoundary>
</QcastContext.Provider> </QcastContext.Provider>

View File

@ -43,18 +43,27 @@ export const FloorPlanContext = createContext({
const FloorPlanProvider = ({ children }) => { const FloorPlanProvider = ({ children }) => {
const pathname = usePathname() const pathname = usePathname()
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState) const setCorrentObjectNo = useSetRecoilState(correntObjectNoState)
const searchParams = useSearchParams() const searchParams = useSearchParams()
const objectNo = searchParams.get('objectNo') const objectNo = searchParams.get('objectNo')
const pid = searchParams.get('pid') const pid = searchParams.get('pid')
useEffect(() => {
console.log('🚀 ~ useEffect ~ objectNo:')
if (pathname === '/floor-plan') {
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
notFound()
}
setCorrentObjectNo(objectNo)
}
}, [])
//useEffect(() => { // 오류 발생으로 useEffect 사용 //useEffect(() => { // 오류 발생으로 useEffect 사용
if (pathname === '/floor-plan') { // if (pathname === '/floor-plan') {
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) { // if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
notFound() // notFound()
} // }
setCurrentObjectNo(objectNo) // setCurrentObjectNo(objectNo)
} // }
//}, [pid, objectNo]) //}, [pid, objectNo])
const [floorPlanState, setFloorPlanState] = useState({ const [floorPlanState, setFloorPlanState] = useState({

View File

@ -1,31 +1,22 @@
'use client' 'use client'
import { usePathname } from 'next/navigation'
import FloorPlanProvider from './FloorPlanProvider' import FloorPlanProvider from './FloorPlanProvider'
import FloorPlan from '@/components/floor-plan/FloorPlan' import FloorPlan from '@/components/floor-plan/FloorPlan'
import CanvasLayout from '@/components/floor-plan/CanvasLayout' import CanvasLayout from '@/components/floor-plan/CanvasLayout'
import { Suspense } from 'react'
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
export default function FloorPlanLayout({ children }) { export default function FloorPlanLayout({ children }) {
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
const pathname = usePathname()
console.log('🚀 ~ FloorPlanLayout ~ pathname:', pathname)
return ( return (
<> <>
<Suspense fallback={<GlobalSpinner />}> <FloorPlanProvider>
<FloorPlanProvider> <FloorPlan>
<FloorPlan> {/* {pathname.includes('estimate') || pathname.includes('simulator') ? (
{/* {pathname.includes('estimate') || pathname.includes('simulator') ? (
<div className="canvas-layout">{children}</div> <div className="canvas-layout">{children}</div>
) : ( ) : (
<CanvasLayout>{children}</CanvasLayout> <CanvasLayout>{children}</CanvasLayout>
)} */} )} */}
<CanvasLayout>{children}</CanvasLayout> <CanvasLayout>{children}</CanvasLayout>
</FloorPlan> </FloorPlan>
</FloorPlanProvider> </FloorPlanProvider>
</Suspense>
</> </>
) )
} }

View File

@ -8,15 +8,13 @@ import SessionProvider from './SessionProvider'
import GlobalDataProvider from './GlobalDataProvider' import GlobalDataProvider from './GlobalDataProvider'
import Header from '@/components/header/Header' import Header from '@/components/header/Header'
import QModal from '@/components/common/modal/QModal' import QModal from '@/components/common/modal/QModal'
import Dimmed from '@/components/ui/Dimmed'
import PopupManager from '@/components/common/popupManager/PopupManager' import PopupManager from '@/components/common/popupManager/PopupManager'
import './globals.css' import './globals.css'
import '../styles/style.scss' import '../styles/style.scss'
import '../styles/contents.scss' import '../styles/contents.scss'
import Footer from '@/components/footer/Footer' import Footer from '@/components/footer/Footer'
import { Suspense } from 'react' import GlobalLoadingProvider from './GlobalLoadingProvider'
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
export const metadata = { export const metadata = {
title: 'Create Next App', title: 'Create Next App',
@ -70,10 +68,10 @@ export default async function RootLayout({ children }) {
<QcastProvider>{children}</QcastProvider> <QcastProvider>{children}</QcastProvider>
) : ( ) : (
<QcastProvider> <QcastProvider>
<GlobalLoadingProvider />
<div className="wrap"> <div className="wrap">
<Header userSession={sessionProps} /> <Header userSession={sessionProps} />
<div className="content"> <div className="content">
<Dimmed />
<SessionProvider useSession={sessionProps}>{children}</SessionProvider> <SessionProvider useSession={sessionProps}>{children}</SessionProvider>
</div> </div>
<Footer /> <Footer />

View File

@ -113,6 +113,7 @@ export const POLYGON_TYPE = {
TRESTLE: 'trestle', TRESTLE: 'trestle',
MODULE_SETUP_SURFACE: 'moduleSetupSurface', MODULE_SETUP_SURFACE: 'moduleSetupSurface',
MODULE: 'module', MODULE: 'module',
OBJECT_SURFACE: 'objectOffset',
} }
export const SAVE_KEY = [ export const SAVE_KEY = [

View File

@ -1,6 +1,6 @@
'use client' 'use client'
import { useEffect, useRef } from 'react' import { useContext, useEffect, useRef } from 'react'
import { useRecoilValue } from 'recoil' import { useRecoilValue } from 'recoil'
@ -14,20 +14,24 @@ import { useCanvasConfigInitialize } from '@/hooks/common/useCanvasConfigInitial
import { currentMenuState } from '@/store/canvasAtom' import { currentMenuState } from '@/store/canvasAtom'
import { totalDisplaySelector } from '@/store/settingAtom' import { totalDisplaySelector } from '@/store/settingAtom'
import { MENU } from '@/common/common' import { MENU } from '@/common/common'
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
import { QcastContext } from '@/app/QcastProvider'
export default function CanvasFrame() { export default function CanvasFrame() {
const canvasRef = useRef(null) const canvasRef = useRef(null)
const { canvas } = useCanvas('canvas') const { canvas } = useCanvas('canvas')
const { canvasLoadInit, gridInit } = useCanvasConfigInitialize() const { canvasLoadInit, gridInit } = useCanvasConfigInitialize()
const currentMenu = useRecoilValue(currentMenuState) const currentMenu = useRecoilValue(currentMenuState)
const { floorPlanState } = useContext(FloorPlanContext)
const { contextMenu, handleClick } = useContextMenu() const { contextMenu, handleClick } = useContextMenu()
const { selectedPlan } = usePlan() const { selectedPlan } = usePlan()
const totalDisplay = useRecoilValue(totalDisplaySelector) // const totalDisplay = useRecoilValue(totalDisplaySelector) //
const { setIsGlobalLoading } = useContext(QcastContext)
const loadCanvas = () => { const loadCanvas = () => {
if (canvas) { if (canvas) {
canvas?.clear() // . canvas?.clear() // .
if (selectedPlan?.canvasStatus) { if (selectedPlan?.canvasStatus && floorPlanState.objectNo === selectedPlan.objectNo) {
canvas?.loadFromJSON(JSON.parse(selectedPlan.canvasStatus), function () { canvas?.loadFromJSON(JSON.parse(selectedPlan.canvasStatus), function () {
canvasLoadInit() //config canvasLoadInit() //config
canvas?.renderAll() // . canvas?.renderAll() // .
@ -41,6 +45,10 @@ export default function CanvasFrame() {
loadCanvas() loadCanvas()
}, [selectedPlan, canvas]) }, [selectedPlan, canvas])
useEffect(() => {
setIsGlobalLoading(false)
}, [])
return ( return (
<div className="canvas-frame"> <div className="canvas-frame">
<canvas ref={canvasRef} id="canvas" style={{ position: 'relative' }}></canvas> <canvas ref={canvasRef} id="canvas" style={{ position: 'relative' }}></canvas>

View File

@ -41,7 +41,7 @@ import { isObjectNotEmpty } from '@/util/common-utils'
import KO from '@/locales/ko.json' import KO from '@/locales/ko.json'
import JA from '@/locales/ja.json' import JA from '@/locales/ja.json'
import { MENU } from '@/common/common' import { MENU, POLYGON_TYPE } from '@/common/common'
import { QcastContext } from '@/app/QcastProvider' import { QcastContext } from '@/app/QcastProvider'
@ -167,7 +167,12 @@ export default function CanvasMenu(props) {
setType('surface') setType('surface')
break break
case 4: case 4:
setType('module') if (!checkMenuAndCanvasState()) {
swalFire({ text: getMessage('menu.validation.canvas.roof') })
return
} else {
setType('module')
}
break break
case 5: case 5:
// let pid = urlParams.get('pid') // let pid = urlParams.get('pid')
@ -240,6 +245,20 @@ export default function CanvasMenu(props) {
await saveCanvas() await saveCanvas()
} }
//
const handleLeaveCanvas = () => {
swalFire({
text: getMessage('plan.message.leave'),
type: 'confirm',
confirmButtonText: getMessage('plan.message.corfirm.yes'),
cancelButtonText: getMessage('plan.message.confirm.no'),
confirmFn: async () => {
await handleSaveCanvas()
router.push(`/management/stuff`)
},
})
}
const [placementInitialId, setPlacementInitialId] = useState(uuidv4()) const [placementInitialId, setPlacementInitialId] = useState(uuidv4())
const placementInitialProps = { const placementInitialProps = {
id: placementInitialId, id: placementInitialId,
@ -328,6 +347,14 @@ export default function CanvasMenu(props) {
return (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) || (menuNumber === 4 && menu.index === 2) return (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) || (menuNumber === 4 && menu.index === 2)
} }
const checkMenuAndCanvasState = () => {
const roofs = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
//
const isExist = roofs?.some((roof) => roof.roofMaterial)
console.log('🚀 ~ checkMenuAndCanvasState ~ isExist:', isExist)
return isExist
}
useEffect(() => { useEffect(() => {
if (isObjectNotEmpty(estimateRecoilState)) { if (isObjectNotEmpty(estimateRecoilState)) {
if (estimateRecoilState?.createUser === 'T01') { if (estimateRecoilState?.createUser === 'T01') {
@ -518,7 +545,7 @@ export default function CanvasMenu(props) {
</div> </div>
<div className="btn-from"> <div className="btn-from">
<button className="btn08" onClick={handleSaveCanvas}></button> <button className="btn08" onClick={handleSaveCanvas}></button>
<button className="btn09"></button> <button className="btn09" onClick={handleLeaveCanvas}></button>
</div> </div>
</> </>
)} )}

View File

@ -1,18 +1,30 @@
'use client' 'use client'
import { useEffect } from 'react' import { useEffect } from 'react'
//import { useRecoilState } from 'recoil'
import CanvasMenu from '@/components/floor-plan/CanvasMenu' import CanvasMenu from '@/components/floor-plan/CanvasMenu'
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu' import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting' import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
import { usePopup } from '@/hooks/usePopup' import { usePopup } from '@/hooks/usePopup'
//import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
//import { correntObjectNoState } from '@/store/settingAtom'
import '@/styles/contents.scss' import '@/styles/contents.scss'
import { notFound, usePathname, useSearchParams } from 'next/navigation'
import { useSetRecoilState } from 'recoil'
import { correntObjectNoState } from '@/store/settingAtom'
export default function FloorPlan({ children }) { export default function FloorPlan({ children }) {
//const { floorPlanState, setFloorPlanState } = useContext(FloorPlanContext) // const pathname = usePathname()
//const [correntObjectNo, setCorrentObjectNo] = useRecoilState(correntObjectNoState) // const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
// const searchParams = useSearchParams()
// const objectNo = searchParams.get('objectNo')
// const pid = searchParams.get('pid')
// useEffect(() => {
// if (pathname === '/floor-plan') {
// if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
// notFound()
// }
// setCurrentObjectNo(objectNo)
// }
// }, [pathname])
const { closeAll } = usePopup() const { closeAll } = usePopup()
const { menuNumber, setMenuNumber } = useCanvasMenu() const { menuNumber, setMenuNumber } = useCanvasMenu()
const { fetchSettings, fetchBasicSettings } = useCanvasSetting() const { fetchSettings, fetchBasicSettings } = useCanvasSetting()

View File

@ -11,6 +11,10 @@ import { usePopup } from '@/hooks/usePopup'
import { Orientation } from '@/components/floor-plan/modal/basic/step/Orientation' import { Orientation } from '@/components/floor-plan/modal/basic/step/Orientation'
import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting' import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
import { useEvent } from '@/hooks/useEvent' import { useEvent } from '@/hooks/useEvent'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { addedRoofsState } from '@/store/settingAtom'
import { isObjectNotEmpty } from '@/util/common-utils'
import Swal from 'sweetalert2'
export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
const { getMessage } = useMessage() const { getMessage } = useMessage()
@ -20,13 +24,32 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
const orientationRef = useRef(null) const orientationRef = useRef(null)
const { initEvent } = useEvent() const { initEvent } = useEvent()
const [isManualModuleSetup, setIsManualModuleSetup] = useRecoilState(isManualModuleSetupState) const [isManualModuleSetup, setIsManualModuleSetup] = useRecoilState(isManualModuleSetupState)
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
const addedRoofs = useRecoilValue(addedRoofsState)
// const { initEvent } = useContext(EventContext) // const { initEvent } = useContext(EventContext)
const { manualModuleSetup, autoModuleSetup, manualFlatroofModuleSetup, autoFlatroofModuleSetup } = useModuleBasicSetting() const { manualModuleSetup, autoModuleSetup, manualFlatroofModuleSetup, autoFlatroofModuleSetup } = useModuleBasicSetting()
const handleBtnNextStep = () => { const handleBtnNextStep = () => {
if (tabNum === 1) { if (tabNum === 1) {
orientationRef.current.handleNextStep() orientationRef.current.handleNextStep()
} else if (tabNum === 2) {
if (!isObjectNotEmpty(moduleSelectionData.module)) {
Swal.fire({
title: getMessage('module.not.found'),
icon: 'warning',
})
return
}
if (addedRoofs.length !== moduleSelectionData.roofConstructions.length) {
Swal.fire({
title: getMessage('construction.length.difference'),
icon: 'warning',
})
return
}
} }
setTabNum(tabNum + 1) setTabNum(tabNum + 1)
} }

View File

@ -8,12 +8,12 @@ import { useModuleSelection } from '@/hooks/module/useModuleSelection'
import ModuleTabContents from './ModuleTabContents' import ModuleTabContents from './ModuleTabContents'
import { useDebounceValue } from 'usehooks-ts' import { useDebounceValue } from 'usehooks-ts'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions' import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
export default function Module({ setTabNum }) { export default function Module({ setTabNum }) {
const { getMessage } = useMessage() const { getMessage } = useMessage()
const addedRoofs = useRecoilValue(addedRoofsState) // const [addedRoofs, setAddedRoofs] = useRecoilState(addedRoofsState) //
const [roofTab, setRoofTab] = useState(0) // const [roofTab, setRoofTab] = useState(0) //
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
const { const {
moduleSelectionInitParams, moduleSelectionInitParams,
@ -22,7 +22,9 @@ export default function Module({ setTabNum }) {
windSpeedCodes, windSpeedCodes,
managementState, managementState,
moduleList, moduleList,
selectedSurfaceType,
installHeight, installHeight,
standardWindSpeed,
verticalSnowCover, verticalSnowCover,
handleChangeModule, handleChangeModule,
handleChangeSurfaceType, handleChangeSurfaceType,
@ -31,8 +33,8 @@ export default function Module({ setTabNum }) {
handleChangeVerticalSnowCover, handleChangeVerticalSnowCover,
} = useModuleSelection({ addedRoofs }) } = useModuleSelection({ addedRoofs })
const [inputInstallHeight, setInputInstallHeight] = useState(installHeight) const [inputInstallHeight, setInputInstallHeight] = useState()
const [inputVerticalSnowCover, setInputVerticalSnowCover] = useState(verticalSnowCover) const [inputVerticalSnowCover, setInputVerticalSnowCover] = useState()
const [debouncedInstallHeight] = useDebounceValue(inputInstallHeight, 500) const [debouncedInstallHeight] = useDebounceValue(inputInstallHeight, 500)
const [debouncedVerticalSnowCover] = useDebounceValue(inputVerticalSnowCover, 500) const [debouncedVerticalSnowCover] = useDebounceValue(inputVerticalSnowCover, 500)
@ -43,15 +45,31 @@ export default function Module({ setTabNum }) {
}, moduleSelectionData) }, moduleSelectionData)
useEffect(() => { useEffect(() => {
setModuleSelectionData(tempModuleSelectionData) if (installHeight) {
setInputInstallHeight(installHeight)
}
if (verticalSnowCover) {
setInputVerticalSnowCover(verticalSnowCover)
}
}, [installHeight, verticalSnowCover])
useEffect(() => {
if (tempModuleSelectionData) {
setModuleSelectionData(tempModuleSelectionData)
// moduleSelectedDataTrigger(tempModuleSelectionData)
}
}, [tempModuleSelectionData]) }, [tempModuleSelectionData])
useEffect(() => { useEffect(() => {
handleChangeInstallHeight(debouncedInstallHeight) if (debouncedInstallHeight) {
handleChangeInstallHeight(debouncedInstallHeight)
}
}, [debouncedInstallHeight]) }, [debouncedInstallHeight])
useEffect(() => { useEffect(() => {
handleChangeVerticalSnowCover(debouncedVerticalSnowCover) if (debouncedVerticalSnowCover) {
handleChangeVerticalSnowCover(debouncedVerticalSnowCover)
}
}, [debouncedVerticalSnowCover]) }, [debouncedVerticalSnowCover])
const moduleData = { const moduleData = {
@ -71,6 +89,8 @@ export default function Module({ setTabNum }) {
setRoofTab(tab) setRoofTab(tab)
} }
// const { trigger: moduleSelectedDataTrigger } = useCanvasPopupStatusController(2)
return ( return (
<> <>
<div className="roof-module-tab2-overflow"> <div className="roof-module-tab2-overflow">
@ -224,6 +244,7 @@ export default function Module({ setTabNum }) {
key={index} key={index}
index={index} index={index}
addRoof={roof} addRoof={roof}
setAddedRoofs={setAddedRoofs}
roofTab={index} roofTab={index}
tempModuleSelectionData={tempModuleSelectionData} tempModuleSelectionData={tempModuleSelectionData}
setTempModuleSelectionData={setTempModuleSelectionData} setTempModuleSelectionData={setTempModuleSelectionData}

View File

@ -7,10 +7,14 @@ import { useCommonCode } from '@/hooks/common/useCommonCode'
import { moduleSelectionDataState, moduleSelectionInitParamsState, selectedModuleState } from '@/store/selectedModuleOptions' import { moduleSelectionDataState, moduleSelectionInitParamsState, selectedModuleState } from '@/store/selectedModuleOptions'
import { isObjectNotEmpty } from '@/util/common-utils' import { isObjectNotEmpty } from '@/util/common-utils'
import QSelectBox from '@/components/common/select/QSelectBox' import QSelectBox from '@/components/common/select/QSelectBox'
import { addedRoofsState } from '@/store/settingAtom'
export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) { export default function ModuleTabContents({ addRoof, setAddedRoofs, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) {
const { getMessage } = useMessage() const { getMessage } = useMessage()
const [roofMaterial, setRoofMaterial] = useState(addRoof) //` const [roofMaterial, setRoofMaterial] = useState(addRoof) //`
const addRoofsArray = useRecoilValue(addedRoofsState)
const globalPitchText = useRecoilValue(pitchTextSelector) // const globalPitchText = useRecoilValue(pitchTextSelector) //
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState) const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
@ -51,6 +55,40 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) // const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) //
const [hajebichi, setHajebichi] = useState(0)
const [lengthBase, setLengthBase] = useState(0)
const hajebichiRef = useRef()
const lengthRef = useRef()
useEffect(() => {
setHajebichi(addRoof.hajebichi)
setLengthBase(addRoof.lenBase)
}, [])
// addRoofs
useEffect(() => {
// api
setTrestleParams({ ...trestleParams, workingWidth: lengthBase })
const copyAddRoof = { ...addRoof }
copyAddRoof.length = Number(lengthBase)
copyAddRoof.lenBase = lengthBase
const index = addRoof.index
const newArray = [...addRoofsArray.slice(0, index), copyAddRoof, ...addRoofsArray.slice(index + 1)]
setAddedRoofs(newArray)
}, [lengthBase])
// addRoof
useEffect(() => {
const copyAddRoof = { ...addRoof }
copyAddRoof.hajebichi = Number(hajebichi)
copyAddRoof.roofPchBase = hajebichi
const index = addRoof.index
const newArray = [...addRoofsArray.slice(0, index), copyAddRoof, ...addRoofsArray.slice(index + 1)]
setAddedRoofs(newArray)
}, [hajebichi])
useEffect(() => { useEffect(() => {
setModuleConstructionSelectionData(moduleSelectionData.roofConstructions[roofTab]) setModuleConstructionSelectionData(moduleSelectionData.roofConstructions[roofTab])
}, [moduleSelectionData]) }, [moduleSelectionData])
@ -76,7 +114,13 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
// //
const handleChangeConstMthd = (option) => { const handleChangeConstMthd = (option) => {
setSelectedConstMthd(option) // setSelectedConstMthd(option) //
setRoofBaseParams({ ...trestleParams, trestleMkrCd: selectedTrestle.trestleMkrCd, constMthdCd: option.constMthdCd, roofBaseCd: '' }) setRoofBaseParams({
...trestleParams,
trestleMkrCd: selectedTrestle.trestleMkrCd,
constMthdCd: option.constMthdCd,
roofBaseCd: '',
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : '',
})
setRoofBaseList([]) // setRoofBaseList([]) //
setConstructionList([]) // setConstructionList([]) //
} }
@ -114,6 +158,14 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
selectedConstruction.setupSnowCover = false // selectedConstruction.setupSnowCover = false //
selectedConstruction.selectedIndex = index selectedConstruction.selectedIndex = index
//
if (moduleConstructionSelectionData && moduleConstructionSelectionData.construction) {
selectedConstruction.setupCover = moduleConstructionSelectionData.construction.setupCover
selectedConstruction.setupSnowCover = moduleConstructionSelectionData.construction.setupSnowCover
setCvrChecked(selectedConstruction.setupCover)
setSnowGdChecked(selectedConstruction.setupSnowCover)
}
setCvrYn(selectedConstruction.cvrYn) setCvrYn(selectedConstruction.cvrYn)
setSnowGdPossYn(selectedConstruction.snowGdPossYn) setSnowGdPossYn(selectedConstruction.snowGdPossYn)
setSelectedConstruction(selectedConstruction) setSelectedConstruction(selectedConstruction)
@ -126,10 +178,12 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
const handleCvrChecked = () => { const handleCvrChecked = () => {
setCvrChecked(!cvrChecked) setCvrChecked(!cvrChecked)
setSelectedConstruction({ ...selectedConstruction, setupCover: !cvrChecked })
} }
const handleSnowGdChecked = () => { const handleSnowGdChecked = () => {
setSnowGdChecked(!snowGdChecked) setSnowGdChecked(!snowGdChecked)
setSelectedConstruction({ ...selectedConstruction, setupSnowCover: !snowGdChecked })
} }
const getModuleOptionsListData = async (params) => { const getModuleOptionsListData = async (params) => {
@ -195,14 +249,6 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
} }
}, [selectedConstruction]) }, [selectedConstruction])
useEffect(() => {
setSelectedConstruction({ ...selectedConstruction, setupCover: cvrChecked })
}, [cvrChecked])
useEffect(() => {
setSelectedConstruction({ ...selectedConstruction, setupSnowCover: snowGdChecked })
}, [snowGdChecked])
useEffect(() => { useEffect(() => {
if (isExistData) { if (isExistData) {
setConstructionListParams({ setConstructionListParams({
@ -215,7 +261,12 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
}, [selectedRoofBase]) }, [selectedRoofBase])
useEffect(() => { useEffect(() => {
if (isExistData && constructionList.length > 0) { if (
isExistData &&
constructionList.length > 0 &&
isObjectNotEmpty(moduleConstructionSelectionData.construction) &&
moduleConstructionSelectionData.construction.hasOwnProperty('constPossYn') ///
) {
const selectedIndex = moduleConstructionSelectionData.construction.selectedIndex const selectedIndex = moduleConstructionSelectionData.construction.selectedIndex
const construction = constructionList[selectedIndex] const construction = constructionList[selectedIndex]
if (construction.constPossYn === 'Y') { if (construction.constPossYn === 'Y') {
@ -245,15 +296,19 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
) { ) {
const isModuleLoaded = moduleSelectionInitParams.hasOwnProperty('moduleTpCd') // const isModuleLoaded = moduleSelectionInitParams.hasOwnProperty('moduleTpCd') //
if (isModuleLoaded) { if (isModuleLoaded) {
setTrestleParams({ moduleTpCd: moduleSelectionInitParams.moduleTpCd, roofMatlCd: addRoof.roofMatlCd, raftBaseCd: addRoof.raftBaseCd }) setTrestleParams({
moduleTpCd: moduleSelectionInitParams.moduleTpCd,
roofMatlCd: addRoof.roofMatlCd,
raftBaseCd: addRoof.raftBaseCd,
workingWidth: lengthBase,
})
setConstructionList([]) setConstructionList([])
if (isObjectNotEmpty(moduleConstructionSelectionData)) { if (isObjectNotEmpty(moduleConstructionSelectionData)) {
// //
setConstructionParams({ ...moduleConstructionSelectionData.trestle, constMthdCd: '', roofBaseCd: '' }) setConstructionParams({ ...moduleConstructionSelectionData.trestle, constMthdCd: '', roofBaseCd: '' })
setRoofBaseParams({ ...moduleConstructionSelectionData.trestle, roofBaseCd: '' }) setRoofBaseParams({ ...moduleConstructionSelectionData.trestle, roofBaseCd: '' })
setCvrChecked(moduleConstructionSelectionData.construction.setupCover)
setSnowGdChecked(moduleConstructionSelectionData.construction.setupSnowCover)
setIsExistData(true) setIsExistData(true)
} }
} }
@ -286,11 +341,11 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
} }
}, [constructionListParams]) }, [constructionListParams])
useEffect(() => { // useEffect(() => {
if (isObjectNotEmpty(tempModuleSelectionData)) { // if (isObjectNotEmpty(tempModuleSelectionData)) {
setModuleSelectionData(tempModuleSelectionData) // setModuleSelectionData(tempModuleSelectionData)
} // }
}, [tempModuleSelectionData]) // }, [tempModuleSelectionData])
return ( return (
<> <>
@ -308,21 +363,21 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
<> <>
<div className="eaves-keraba-th">L</div> <div className="eaves-keraba-th">L</div>
<div className="eaves-keraba-td"> <div className="eaves-keraba-td">
<div className="keraba-flex"> <div className="grid-select">
<div className="outline-form"> <input
<div className="grid-select"> type="text"
<input className="input-origin block"
type="text" value={lengthBase}
className="input-origin block" onChange={(e) => setLengthBase(e.target.value)}
value={roofMaterial.lenBase} disabled={roofMaterial.lenAuth === 'R' ? true : false}
disabled={roofMaterial.lenAuth === 'R' ? true : false} ref={lengthRef}
/> />
</div>
</div>
</div> </div>
</div> </div>
</> </>
)} )}
</div>
<div className="eaves-keraba-item">
{roofMaterial && ['C', 'R'].includes(roofMaterial.raftAuth) && ( {roofMaterial && ['C', 'R'].includes(roofMaterial.raftAuth) && (
<> <>
<div className="eaves-keraba-th">{getMessage('modal.module.basic.setting.module.rafter.margin')}</div> <div className="eaves-keraba-th">{getMessage('modal.module.basic.setting.module.rafter.margin')}</div>
@ -343,22 +398,21 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
</div> </div>
</> </>
)} )}
</div>
<div className="eaves-keraba-item">
{roofMaterial && ['C', 'R'].includes(roofMaterial.roofPchAuth) && ( {roofMaterial && ['C', 'R'].includes(roofMaterial.roofPchAuth) && (
<> <>
<div className="eaves-keraba-th">{getMessage('modal.module.basic.setting.module.rafter.margin')}</div> <div className="eaves-keraba-th">{getMessage('modal.module.basic.setting.module.hajebichi')}</div>
<div className="eaves-keraba-td"> <div className="eaves-keraba-td">
<div className="keraba-flex"> <div className="grid-select">
<div className="outline-form"> <input
<span>垂木の間隔</span> type="text"
<div className="grid-select"> className="input-origin block"
<input disabled={roofMaterial.roofPchAuth === 'R' ? true : false}
type="text" onChange={(e) => setHajebichi(e.target.value)}
className="input-origin block" value={hajebichi}
value={roofMaterial.hajebichi} ref={hajebichiRef}
disabled={roofMaterial.roofPchAuth === 'R' ? true : false} />
/>
</div>
</div>
</div> </div>
</div> </div>
</> </>
@ -464,7 +518,7 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
type="checkbox" type="checkbox"
id={`ch01_${roofTab}`} id={`ch01_${roofTab}`}
disabled={cvrYn === 'N' ? true : false} disabled={cvrYn === 'N' ? true : false}
defaultChecked={cvrChecked} checked={cvrChecked}
onChange={handleCvrChecked} onChange={handleCvrChecked}
/> />
<label htmlFor={`ch01_${roofTab}`}>{getMessage('modal.module.basic.setting.module.eaves.bar.fitting')}</label> <label htmlFor={`ch01_${roofTab}`}>{getMessage('modal.module.basic.setting.module.eaves.bar.fitting')}</label>
@ -474,7 +528,7 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
type="checkbox" type="checkbox"
id={`ch02_${roofTab}`} id={`ch02_${roofTab}`}
disabled={snowGdPossYn === 'N' ? true : false} disabled={snowGdPossYn === 'N' ? true : false}
defaultChecked={snowGdChecked} checked={snowGdChecked}
onChange={handleSnowGdChecked} onChange={handleSnowGdChecked}
/> />
<label htmlFor={`ch02_${roofTab}`}>{getMessage('modal.module.basic.setting.module.blind.metal.fitting')}</label> <label htmlFor={`ch02_${roofTab}`}>{getMessage('modal.module.basic.setting.module.blind.metal.fitting')}</label>

View File

@ -1,4 +1,4 @@
import { forwardRef, useContext, useImperativeHandle, useState } from 'react' import { forwardRef, useContext, useEffect, useImperativeHandle, useState } from 'react'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
import { useOrientation } from '@/hooks/module/useOrientation' import { useOrientation } from '@/hooks/module/useOrientation'
import { getDegreeInOrientation } from '@/util/canvas-util' import { getDegreeInOrientation } from '@/util/canvas-util'
@ -8,6 +8,8 @@ import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupSta
export const Orientation = forwardRef(({ tabNum }, ref) => { export const Orientation = forwardRef(({ tabNum }, ref) => {
const { getMessage } = useMessage() const { getMessage } = useMessage()
const { trigger: canvasPopupStatusTrigger } = useCanvasPopupStatusController(1)
const { nextStep, compasDeg, setCompasDeg } = useOrientation() const { nextStep, compasDeg, setCompasDeg } = useOrientation()
const [hasAnglePassivity, setHasAnglePassivity] = useState(false) const [hasAnglePassivity, setHasAnglePassivity] = useState(false)
@ -21,6 +23,10 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
canvasPopupStatusTrigger(compasDeg) canvasPopupStatusTrigger(compasDeg)
} }
useEffect(() => {
checkDegree(compasDeg)
}, [compasDeg])
const checkDegree = (e) => { const checkDegree = (e) => {
if (numberCheck(Number(e)) && Number(e) >= -180 && Number(e) <= 180) { if (numberCheck(Number(e)) && Number(e) >= -180 && Number(e) <= 180) {
setCompasDeg(Number(e)) setCompasDeg(Number(e))
@ -29,8 +35,6 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
} }
} }
const { trigger: canvasPopupStatusTrigger } = useCanvasPopupStatusController(1)
return ( return (
<> <>
<div className="properties-setting-wrap"> <div className="properties-setting-wrap">
@ -67,7 +71,7 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
</div> </div>
<div className="center-wrap"> <div className="center-wrap">
<div className="d-check-box pop"> <div className="d-check-box pop">
<input type="checkbox" id="ch99" checked={!hasAnglePassivity} onChange={() => setHasAnglePassivity(!hasAnglePassivity)} /> <input type="checkbox" id="ch99" checked={hasAnglePassivity} onChange={() => setHasAnglePassivity(!hasAnglePassivity)} />
<label htmlFor="ch99">{getMessage('modal.module.basic.setting.orientation.setting.angle.passivity')}-180 180</label> <label htmlFor="ch99">{getMessage('modal.module.basic.setting.orientation.setting.angle.passivity')}-180 180</label>
</div> </div>
<div className="outline-form"> <div className="outline-form">
@ -76,7 +80,7 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
type="text" type="text"
className="input-origin block" className="input-origin block"
value={compasDeg} value={compasDeg}
readOnly={hasAnglePassivity} readOnly={!hasAnglePassivity}
placeholder={0} placeholder={0}
onChange={ onChange={
(e) => checkDegree(e.target.value) (e) => checkDegree(e.target.value)

View File

@ -16,10 +16,12 @@ export default function StepUp(props) {
const [arrayLength, setArrayLength] = useState(3) //module-table-inner const [arrayLength, setArrayLength] = useState(3) //module-table-inner
const [pcsCheck, setPcsCheck] = useRecoilState(pcsCheckState) const [pcsCheck, setPcsCheck] = useRecoilState(pcsCheckState)
const { models } = props const { models } = props
const { getPcsAutoRecommendList } = useMasterController() const { getPcsVoltageStepUpList, getPcsAutoRecommendList } = useMasterController()
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext) const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
const selectedModules = useRecoilValue(selectedModuleState) const selectedModules = useRecoilValue(selectedModuleState)
const [stepUpListData, setStepUpListData] = useState([])
const [optCodes, setOptCodes] = useState([])
useEffect(() => { useEffect(() => {
if (!managementState) { if (!managementState) {
@ -68,7 +70,44 @@ export default function StepUp(props) {
roofSurfaceList: roofSurfaceList, roofSurfaceList: roofSurfaceList,
pscItemList: pscItemList, pscItemList: pscItemList,
} }
getPcsAutoRecommendList(params) //getPcsVoltageStepUpList(null)
getPcsVoltageStepUpList().then((res) => {
if (res?.result.code === 200 && res?.data) {
const dataArray = Array.isArray(res.data) ? res.data : [res.data]
const stepUpListData = dataArray.map((stepUps) => ({
...stepUps,
optionList: (stepUps.optionList || []).map((option) => ({
pcsOptCd: option.pcsOptCd,
pcsOptNm: option.pcsOptNm,
pcsOptNmJp: option.pcsOptNmJp,
})),
pcsItemList: (stepUps.pcsItemList || []).map((item) => ({
goodsNo: item.goodsNo,
itemId: item.itemId,
itemNm: item.itemNm,
pcsMkrCd: item.pcsMkrCd,
pcsSerCd: item.pcsSerCd,
connList: (item.connList || []).map((conn) => ({
connAllowCur: conn.connAllowCur,
connMaxParalCnt: conn.connMaxParalCnt,
goodsNo: conn.goodsNo,
itemId: conn.itemId,
itemNm: conn.itemNm,
vstuParalCnt: conn.vstuParalCnt,
})),
serQtyList: (item.serQtyList || []).map((qty) => ({
serQty: qty.serQty,
paralQty: qty.paralQty,
})),
})),
}))
console.log('🚀 ~ useEffect ~ getPcsVoltageStepUpList ~ stepUpListData:', stepUpListData)
setStepUpListData(stepUpListData)
}
})
//setOptCodes(stepUpListData.optionList.map((opt) => ({ ...opt, code: opt.pcsOptCd, name: opt.pcsOptNm, nameJp: opt.pcsOptNmJp })))
}, []) }, [])
useCanvasPopupStatusController(6) useCanvasPopupStatusController(6)
@ -81,112 +120,101 @@ export default function StepUp(props) {
<div className="properties-setting-wrap outer"> <div className="properties-setting-wrap outer">
<div className="circuit-overflow"> <div className="circuit-overflow">
{/* 3개일때 className = by-max */} {/* 3개일때 className = by-max */}
<div className={`module-table-box ${arrayLength === 3 ? 'by-max' : ''}`}> {stepUpListData.map((stepUp, index) => (
{Array.from({ length: arrayLength }).map((_, idx) => ( <div key={index} className={`module-table-box ${stepUp.pcsItemList.length === 3 ? 'by-max' : ''}`}>
<div key={idx} className="module-table-inner"> {Array.from({ length: stepUp.pcsItemList.length }).map((_, idx) => (
<div className="mb-box"> <div key={idx} className="module-table-inner">
<div className="circuit-table-tit">HQJP-KA55-5</div> <div className="mb-box">
<div className="roof-module-table overflow-y min"> <div className="circuit-table-tit">{stepUp.pcsItemList[idx].goodsNo}</div>
<table> <div className="roof-module-table overflow-y min">
<thead> <table>
<tr> <thead>
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.serial.amount')}</th> <tr>
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.total.amount')}</th> <th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.serial.amount')}</th>
</tr> <th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.total.amount')}</th>
</thead> </tr>
<tbody> </thead>
<tr className="on"> <tbody>
<td className="al-r">10</td> {stepUp.pcsItemList[idx].serQtyList.map((item) => {
<td className="al-r">0</td> return (
</tr> <tr className="on">
<tr> <td className="al-r">{item.serQty}</td>
<td className="al-r">10</td> <td className="al-r">{item.paralQty}</td>
<td className="al-r">0</td> </tr>
</tr> )
<tr> })}
<td className="al-r">10</td> </tbody>
<td className="al-r">0</td> </table>
</tr> </div>
<tr> </div>
<td className="al-r">10</td> <div className="module-box-tab mb10">
<td className="al-r">0</td> <button className={`module-btn ${moduleTab === 1 ? 'act' : ''}`} onClick={() => setModuleTab(1)}>
</tr> {getMessage('modal.circuit.trestle.setting.step.up.allocation.connected')}
<tr> </button>
<td className="al-r">10</td> <button className={`module-btn ${moduleTab === 2 ? 'act' : ''}`} onClick={() => setModuleTab(2)}>
<td className="al-r">0</td> {getMessage('modal.circuit.trestle.setting.step.up.allocation.option')}
</tr> </button>
<tr> </div>
<td className="al-r">10</td> <div className="circuit-table-flx-wrap">
<td className="al-r">0</td> {moduleTab === 1 && (
</tr> <div className="circuit-table-flx-box">
</tbody> <div className="roof-module-table min mb10">
</table> <table>
<thead>
<tr>
<th>{getMessage('modal.circuit.trestle.setting.power.conditional.select.name')}</th>
<th>{getMessage('modal.circuit.trestle.setting.power.conditional.select.circuit.amount')}</th>
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.circuit.amount')}</th>
</tr>
</thead>
<tbody>
<tr>
<td className="al-c">{stepUp.pcsItemList[idx].connList[0].goodsNo}</td>
<td className="al-r">{stepUp.pcsItemList[idx].connList[0].connMaxParalCnt}</td>
<td className="al-r">{stepUp.pcsItemList[idx].connList[0].vstuParalCnt}</td>
</tr>
</tbody>
</table>
</div>
</div>
)}
{moduleTab === 2 && (
<div className="circuit-table-flx-box">
<div className="roof-module-table min mb10">
<table>
<thead>
<tr>
<th>名称</th>
<th>昇圧回路数</th>
</tr>
</thead>
<tbody>
<tr>
<td className="al-c">-</td>
<td className="al-c">-</td>
</tr>
</tbody>
</table>
</div>
</div>
)}
</div> </div>
</div> </div>
<div className="module-box-tab mb10"> ))}
<button className={`module-btn ${moduleTab === 1 ? 'act' : ''}`} onClick={() => setModuleTab(1)}> </div>
{getMessage('modal.circuit.trestle.setting.step.up.allocation.connected')} ))}
</button>
<button className={`module-btn ${moduleTab === 2 ? 'act' : ''}`} onClick={() => setModuleTab(2)}>
{getMessage('modal.circuit.trestle.setting.step.up.allocation.option')}
</button>
</div>
<div className="circuit-table-flx-wrap">
{moduleTab === 1 && (
<div className="circuit-table-flx-box">
<div className="roof-module-table min mb10">
<table>
<thead>
<tr>
<th>{getMessage('modal.circuit.trestle.setting.power.conditional.select.name')}</th>
<th>{getMessage('modal.circuit.trestle.setting.power.conditional.select.circuit.amount')}</th>
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.circuit.amount')}</th>
</tr>
</thead>
<tbody>
<tr>
<td className="al-c">KTN-CBD4C</td>
<td className="al-r">4</td>
<td className="al-r">0</td>
</tr>
</tbody>
</table>
</div>
</div>
)}
{moduleTab === 2 && (
<div className="circuit-table-flx-box">
<div className="roof-module-table min mb10">
<table>
<thead>
<tr>
<th>名称</th>
<th>昇圧回路数</th>
</tr>
</thead>
<tbody>
<tr>
<td className="al-c">-</td>
<td className="al-c">-</td>
</tr>
</tbody>
</table>
</div>
</div>
)}
</div>
</div>
))}
</div>
</div> </div>
<div className="slope-wrap"> <div className="slope-wrap">
<div className="outline-form"> <div className="outline-form">
<span className="mr10" style={{ width: 'auto' }}> <span className="mr10" style={{ width: 'auto' }}>
{getMessage('modal.circuit.trestle.setting.step.up.allocation.select.monitor')} {getMessage('modal.circuit.trestle.setting.step.up.allocation.select.monitor')}
</span> </span>
<div className="grid-select mr10"> {optCodes.length > 0 && (
<QSelectBox title={'電力検出ユニット (モニター付き)'} /> <div className="grid-select mr10">
</div> <QSelectBox title={'電力検出ユニット (モニター付き)'} />
{/* <QSelectBox options={optCodes} value={optCodes.name} sourceKey="code" targetKey="code" showKey="name" /> */}
</div>
)}
</div> </div>
</div> </div>
</div> </div>

View File

@ -18,7 +18,11 @@ export default function OuterLineWall({ props }) {
className="input-origin block" className="input-origin block"
value={length1} value={length1}
ref={length1Ref} ref={length1Ref}
onFocus={(e) => (length1Ref.current.value = '')} onFocus={(e) => {
if (length1Ref.current.value === '0') {
length1Ref.current.value = ''
}
}}
onChange={(e) => onlyNumberInputChange(e, setLength1)} onChange={(e) => onlyNumberInputChange(e, setLength1)}
placeholder="3000" placeholder="3000"
/> />

View File

@ -221,7 +221,7 @@ export default function Header(props) {
return ( return (
<> <>
{!isGlobalLoading && !(pathName.includes('login') || pathName.includes('join') || sessionState.pwdInitYn === 'N') && ( {!(pathName.includes('login') || pathName.includes('join') || sessionState.pwdInitYn === 'N') && (
<header className={isDimmed}> <header className={isDimmed}>
<div className="header-inner"> <div className="header-inner">
<div className="header-right"> <div className="header-right">

View File

@ -10,12 +10,12 @@ import { useRecoilValue } from 'recoil'
import { useRouter } from 'next/navigation' import { useRouter } from 'next/navigation'
import { globalLocaleStore } from '@/store/localeAtom' import { globalLocaleStore } from '@/store/localeAtom'
import { queryStringFormatter } from '@/util/common-utils' import { queryStringFormatter } from '@/util/common-utils'
import MainSkeleton from '../ui/MainSkeleton'
import { useMainContentsController } from '@/hooks/main/useMainContentsController' import { useMainContentsController } from '@/hooks/main/useMainContentsController'
import { QcastContext } from '@/app/QcastProvider' import { QcastContext } from '@/app/QcastProvider'
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import BoardDetailModal from '../community/modal/BoardDetailModal' import BoardDetailModal from '../community/modal/BoardDetailModal'
import { handleFileDown } from '@/util/board-utils'
export default function MainContents() { export default function MainContents() {
const { swalFire } = useSwal() const { swalFire } = useSwal()
@ -23,26 +23,52 @@ export default function MainContents() {
const { getMessage } = useMessage() const { getMessage } = useMessage()
const router = useRouter() const router = useRouter()
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
const { promiseGet } = useAxios(globalLocaleState) const { promiseGet, get } = useAxios(globalLocaleState)
// //
const [recentNoticeList, setRecentNoticeList] = useState([]) const [recentNoticeList, setRecentNoticeList] = useState([])
//FAQ //FAQ
const [recentFaqList, setRecentFaqList] = useState([]) const [recentFaqList, setRecentFaqList] = useState([])
const { qcastState } = useContext(QcastContext) const { qcastState, setIsGlobalLoading } = useContext(QcastContext)
const { fetchObjectList, initObjectList } = useMainContentsController() const { fetchObjectList, initObjectList } = useMainContentsController()
//
const [boardList, setBoardList] = useState([])
useEffect(() => { useEffect(() => {
fetchObjectList() fetchObjectList()
fetchNoticeList() fetchNoticeList()
fetchFaqList() fetchFaqList()
//
fetchArchiveList()
return () => { return () => {
initObjectList() initObjectList()
} }
}, []) }, [])
//
const fetchArchiveList = async () => {
const url = `/api/board/list`
const params = new URLSearchParams({
schNoticeTpCd: 'QC',
schNoticeClsCd: 'DOWN',
startRow: 1,
endRow: 2,
})
const apiUrl = `${url}?${params.toString()}`
const resultData = await get({ url: apiUrl })
if (resultData) {
if (resultData.result.code === 200) {
setBoardList(resultData.data)
} else {
alert(resultData.result.message)
}
}
}
// //
const fetchNoticeList = async () => { const fetchNoticeList = async () => {
try { try {
@ -105,6 +131,7 @@ export default function MainContents() {
key={row.objectNo} key={row.objectNo}
className="recently-item" className="recently-item"
onClick={() => { onClick={() => {
setIsGlobalLoading(true)
if (row.tempFlg === '0') { if (row.tempFlg === '0') {
router.push(`/management/stuff/detail?objectNo=${row.objectNo.toString()}`, { scroll: false }) router.push(`/management/stuff/detail?objectNo=${row.objectNo.toString()}`, { scroll: false })
} else { } else {
@ -114,7 +141,7 @@ export default function MainContents() {
> >
<div className="item-inner"> <div className="item-inner">
<span className="time">{dayjs(row.lastEditDatetime).format('YYYY.MM.DD HH:mm:ss')}</span> <span className="time">{dayjs(row.lastEditDatetime).format('YYYY.MM.DD HH:mm:ss')}</span>
<span>{row.tempFlg === '0' ? row.objectNo : getMessage('stuff.gridData.tempObjectNo')}</span> <span className="product">{row.tempFlg === '0' ? row.objectNo : getMessage('stuff.gridData.tempObjectNo')}</span>
<span>{row.objectName ? row.objectName : '-'}</span> <span>{row.objectName ? row.objectName : '-'}</span>
<span>{row.saleStoreName}</span> <span>{row.saleStoreName}</span>
</div> </div>
@ -183,14 +210,19 @@ export default function MainContents() {
)} )}
</ProductItem> </ProductItem>
<ProductItem num={4} name={'Data Download'}> <ProductItem num={4} name={'Data Download'}>
<div className="data-download-wrap"> {boardList.length > 0 ? (
<button className="data-down" type="button" onClick={() => swalFire({ text: getMessage('main.content.alert.noFile'), type: 'alert' })}> <div className="data-download-wrap">
<span>{getMessage('main.content.download1')}</span> {boardList?.map((board) => (
</button> <button type="button" className="data-down" onClick={() => handleFileDown(board.noticeNo, 'Y')}>
<button className="data-down" type="button" onClick={() => swalFire({ text: getMessage('main.content.alert.noFile'), type: 'alert' })}> <span>{board.title}</span>
<span>{getMessage('main.content.download2')}</span> </button>
</button> ))}
</div> </div>
) : (
<div className="file-down-nodata">
<h3>{getMessage('common.message.no.data')}</h3>
</div>
)}
</ProductItem> </ProductItem>
<ProductItem num={5} name={'Sales Contact info'}> <ProductItem num={5} name={'Sales Contact info'}>
<ul className="contact-info-list"> <ul className="contact-info-list">

View File

@ -222,7 +222,6 @@ export default function Stuff() {
if (!params.saleStoreId) { if (!params.saleStoreId) {
params.saleStoreId = session.storeId 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({
@ -278,6 +277,13 @@ export default function Stuff() {
if (!stuffSearchParams.saleStoreId) { if (!stuffSearchParams.saleStoreId) {
stuffSearchParams.saleStoreId = session.storeId stuffSearchParams.saleStoreId = session.storeId
} }
if (stuffSearchParams.schMyDataCheck) {
if (session.storeLvl === '1') {
//schOtherSelSaleStoreId schSelSaleStoreId saleStoreId
stuffSearchParams.schOtherSelSaleStoreId = ''
stuffSearchParams.schSelSaleStoreId = session.storeId
}
}
async function fetchData() { async function fetchData() {
const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}` const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}`
@ -312,6 +318,12 @@ export default function Stuff() {
if (!params.saleStoreId) { if (!params.saleStoreId) {
stuffSearchParams.saleStoreId = session.storeId stuffSearchParams.saleStoreId = session.storeId
} }
if (stuffSearchParams.schMyDataCheck) {
//schOtherSelSaleStoreId schSelSaleStoreId saleStoreId
stuffSearchParams.schOtherSelSaleStoreId = ''
stuffSearchParams.schSelSaleStoreId = 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) => {
@ -347,6 +359,7 @@ export default function Stuff() {
code: 'S', code: 'S',
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
schMyDataCheck: false,
} }
setStuffSearch({ setStuffSearch({

View File

@ -4,7 +4,6 @@ import { useState, useEffect, useRef, useContext } from 'react'
import { useRouter, useSearchParams } from 'next/navigation' import { useRouter, useSearchParams } from 'next/navigation'
import { Button } from '@nextui-org/react' import { Button } from '@nextui-org/react'
import Select, { components } from 'react-select' import Select, { components } from 'react-select'
import Link from 'next/link'
import { useAxios } from '@/hooks/useAxios' import { useAxios } from '@/hooks/useAxios'
import { globalLocaleStore } from '@/store/localeAtom' import { globalLocaleStore } from '@/store/localeAtom'
import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils' import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
@ -289,10 +288,12 @@ export default function StuffDetail() {
display: 'none', display: 'none',
} }
} }
// if (managementState?.createUser === 'T01' && session?.userId !== 'T01') { if (managementState?.createUser === 'T01') {
//createUser T01 T01 !!!!!!!! if (session.userId !== 'T01') {
//buttonStyle = { display: 'none' } // #474
// } buttonStyle = { display: 'none' }
}
}
return ( return (
<> <>
<div className="grid-cell-btn"> <div className="grid-cell-btn">
@ -301,7 +302,6 @@ export default function StuffDetail() {
type="button" type="button"
className="grid-btn" className="grid-btn"
onClick={() => { onClick={() => {
//mid:5(), /pid:
setFloorPlanObjectNo({ floorPlanObjectNo: params.data.objectNo }) setFloorPlanObjectNo({ floorPlanObjectNo: params.data.objectNo })
setIsGlobalLoading(true) setIsGlobalLoading(true)
setMenuNumber(5) setMenuNumber(5)
@ -1025,6 +1025,8 @@ export default function StuffDetail() {
const _objectNameOmit = watch('objectNameOmit') const _objectNameOmit = watch('objectNameOmit')
// saleStoreId: '', //1 ID // saleStoreId: '', //1 ID
const _saleStoreId = watch('saleStoreId') const _saleStoreId = watch('saleStoreId')
// 2
const _otherSaleStoreId = watch('otherSaleStoreId')
// zipNo: '', // // zipNo: '', //
const _zipNo = watch('zipNo') const _zipNo = watch('zipNo')
// prefId: '', // // prefId: '', //
@ -1043,6 +1045,7 @@ export default function StuffDetail() {
useEffect(() => { useEffect(() => {
if (editMode === 'NEW') { if (editMode === 'NEW') {
const formData = form.getValues() const formData = form.getValues()
let errors = {} let errors = {}
if (!formData.receiveUser || formData.receiveUser.trim().length === 0) { if (!formData.receiveUser || formData.receiveUser.trim().length === 0) {
errors.receiveUser = true errors.receiveUser = true
@ -1057,6 +1060,12 @@ export default function StuffDetail() {
errors.saleStoreId = true errors.saleStoreId = true
} }
if (session?.storeLvl === '2') {
if (!formData.otherSaleStoreId) {
errors.otherSaleStoreId = true
}
}
if (!formData.zipNo) { if (!formData.zipNo) {
errors.zipNo = true errors.zipNo = true
} }
@ -1099,6 +1108,12 @@ export default function StuffDetail() {
errors.saleStoreId = true errors.saleStoreId = true
} }
if (session?.storeLvl === '2') {
if (!formData.otherSaleStoreId) {
errors.otherSaleStoreId = true
}
}
if (!formData.zipNo) { if (!formData.zipNo) {
errors.zipNo = true errors.zipNo = true
} }
@ -1130,6 +1145,7 @@ export default function StuffDetail() {
_objectName, _objectName,
_objectNameOmit, _objectNameOmit,
_saleStoreId, _saleStoreId,
_otherSaleStoreId,
_zipNo, _zipNo,
_prefId, _prefId,
_address, _address,
@ -1368,13 +1384,12 @@ export default function StuffDetail() {
setIsGlobalLoading(true) setIsGlobalLoading(true)
// //
if (res.status === 201) { if (res.status === 201) {
setIsGlobalLoading(false)
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo }) setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
swalFire({ swalFire({
text: getMessage('stuff.detail.save'), text: getMessage('stuff.detail.save'),
type: 'alert', type: 'alert',
confirmFn: () => { confirmFn: () => {
setIsGlobalLoading(false)
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}, },
}) })
@ -1391,12 +1406,12 @@ export default function StuffDetail() {
setIsGlobalLoading(true) setIsGlobalLoading(true)
if (res.status === 201) { if (res.status === 201) {
setIsGlobalLoading(false)
setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo }) setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo })
swalFire({ swalFire({
text: getMessage('stuff.detail.save'), text: getMessage('stuff.detail.save'),
type: 'alert', type: 'alert',
confirmFn: () => { confirmFn: () => {
setIsGlobalLoading(false)
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}, },
}) })
@ -1468,11 +1483,11 @@ export default function StuffDetail() {
.then((res) => { .then((res) => {
setIsGlobalLoading(true) setIsGlobalLoading(true)
if (res.status === 201) { if (res.status === 201) {
setIsGlobalLoading(false)
swalFire({ swalFire({
text: getMessage('stuff.detail.tempSave.message1'), text: getMessage('stuff.detail.tempSave.message1'),
type: 'alert', type: 'alert',
confirmFn: () => { confirmFn: () => {
setIsGlobalLoading(false)
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}, },
}) })
@ -1487,11 +1502,11 @@ export default function StuffDetail() {
.then((res) => { .then((res) => {
setIsGlobalLoading(true) setIsGlobalLoading(true)
if (res.status === 201) { if (res.status === 201) {
setIsGlobalLoading(false)
swalFire({ swalFire({
text: getMessage('stuff.detail.tempSave.message1'), text: getMessage('stuff.detail.tempSave.message1'),
type: 'alert', type: 'alert',
confirmFn: () => { confirmFn: () => {
setIsGlobalLoading(false)
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}, },
}) })
@ -1519,7 +1534,7 @@ export default function StuffDetail() {
confirmFn: () => { confirmFn: () => {
setFloorPlanObjectNo({ floorPlanObjectNo: '' }) setFloorPlanObjectNo({ floorPlanObjectNo: '' })
del({ url: `/api/object/${objectNo}?${queryStringFormatter(delParams)}` }) del({ url: `/api/object/${objectNo}?${queryStringFormatter(delParams)}` })
.then((res) => { .then(() => {
setIsGlobalLoading(true) setIsGlobalLoading(true)
setFloorPlanObjectNo({ floorPlanObjectNo: '' }) setFloorPlanObjectNo({ floorPlanObjectNo: '' })
if (session.storeId === 'T01') { if (session.storeId === 'T01') {
@ -1595,6 +1610,13 @@ export default function StuffDetail() {
// //
const getCellDoubleClicked = (params) => { const getCellDoubleClicked = (params) => {
//#474
if (managementState.createUser === 'T01') {
if (session.userId !== 'T01') {
return false
}
}
if (params?.column?.colId !== 'estimateDate') { if (params?.column?.colId !== 'estimateDate') {
if (params?.data?.planNo && params?.data?.objectNo) { if (params?.data?.planNo && params?.data?.objectNo) {
let objectNo = params?.data?.objectNo let objectNo = params?.data?.objectNo
@ -1631,11 +1653,21 @@ export default function StuffDetail() {
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
)} )}
<Link href="/management/stuff" scroll={false}> {/* <Link href="/management/stuff" scroll={false}>
<button type="button" className="btn-origin grey"> <button type="button" className="btn-origin grey">
{getMessage('stuff.detail.btn.moveList')} {getMessage('stuff.detail.btn.moveList')}
</button> </button>
</Link> </Link> */}
<button
type="button"
className="btn-origin grey"
onClick={() => {
setIsGlobalLoading(true)
router.push(`/management/stuff`, { scroll: false })
}}
>
{getMessage('stuff.detail.btn.moveList')}
</button>
</div> </div>
</div> </div>
<div className="infomation-table"> <div className="infomation-table">
@ -2131,11 +2163,21 @@ export default function StuffDetail() {
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
)} )}
<Link href="/management/stuff" scroll={false}> {/* <Link href="/management/stuff" scroll={false}>
<button type="button" className="btn-origin grey"> <button type="button" className="btn-origin grey">
{getMessage('stuff.detail.btn.moveList')} {getMessage('stuff.detail.btn.moveList')}
</button> </button>
</Link> </Link> */}
<button
type="button"
className="btn-origin grey"
onClick={() => {
setIsGlobalLoading(true)
router.push(`/management/stuff`, { scroll: false })
}}
>
{getMessage('stuff.detail.btn.moveList')}
</button>
</div> </div>
</div> </div>
</form> </form>
@ -2150,11 +2192,21 @@ export default function StuffDetail() {
{managementState?.tempFlg === '0' ? ( {managementState?.tempFlg === '0' ? (
<> <>
<div className="left-unit-box"> <div className="left-unit-box">
<Link href="/management/stuff" scroll={false}> {/* <Link href="/management/stuff" scroll={false}>
<button type="button" className="btn-origin grey mr5"> <button type="button" className="btn-origin grey mr5">
{getMessage('stuff.detail.btn.moveList')} {getMessage('stuff.detail.btn.moveList')}
</button> </button>
</Link> </Link> */}
<button
type="button"
className="btn-origin grey mr5"
onClick={() => {
setIsGlobalLoading(true)
router.push(`/management/stuff`, { scroll: false })
}}
>
{getMessage('stuff.detail.btn.moveList')}
</button>
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}> <Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
@ -2175,11 +2227,21 @@ export default function StuffDetail() {
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
)} )}
<Link href="/management/stuff" scroll={false}> {/* <Link href="/management/stuff" scroll={false}>
<button type="button" className="btn-origin grey"> <button type="button" className="btn-origin grey">
{getMessage('stuff.detail.btn.moveList')} {getMessage('stuff.detail.btn.moveList')}
</button> </button>
</Link> </Link> */}
<button
type="button"
className="btn-origin grey"
onClick={() => {
setIsGlobalLoading(true)
router.push(`/management/stuff`, { scroll: false })
}}
>
{getMessage('stuff.detail.btn.moveList')}
</button>
</div> </div>
</> </>
)} )}
@ -2422,6 +2484,7 @@ export default function StuffDetail() {
<td> <td>
<div className="flx-box"> <div className="flx-box">
<div className="select-wrap mr5" style={{ width: '567px' }}> <div className="select-wrap mr5" style={{ width: '567px' }}>
상세
<Select <Select
id="long-value-select2" id="long-value-select2"
instanceId="long-value-select2" instanceId="long-value-select2"
@ -2433,16 +2496,18 @@ export default function StuffDetail() {
onChange={onSelectionChange2} onChange={onSelectionChange2}
getOptionLabel={(x) => x.saleStoreName} getOptionLabel={(x) => x.saleStoreName}
getOptionValue={(x) => x.saleStoreId} getOptionValue={(x) => x.saleStoreId}
// isDisabled={ isDisabled={
// managementState?.tempFlg === '0' managementState?.tempFlg === '0'
// ? true ? true
// : session?.storeLvl === '1' && form.watch('saleStoreId') != '' : session?.storeLvl === '1'
// ? false ? otherSaleStoreList.length > 0
// : false ? false
// } : true
isDisabled={managementState?.tempFlg === '0' ? true : false} : otherSaleStoreList.length === 1
? true
: false
}
isClearable={managementState?.tempFlg === '0' ? false : true} isClearable={managementState?.tempFlg === '0' ? false : true}
// isClearable={managementState?.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : true}
value={otherSaleStoreList.filter(function (option) { value={otherSaleStoreList.filter(function (option) {
return option.saleStoreId === otherSelOptions return option.saleStoreId === otherSelOptions
})} })}
@ -2729,11 +2794,21 @@ export default function StuffDetail() {
</div> </div>
{/* 진짜R 플랜끝 */} {/* 진짜R 플랜끝 */}
<div className="sub-right-footer"> <div className="sub-right-footer">
<Link href="/management/stuff" scroll={false}> {/* <Link href="/management/stuff" scroll={false}>
<button type="button" className="btn-origin grey mr5"> <button type="button" className="btn-origin grey mr5">
{getMessage('stuff.detail.btn.moveList')} {getMessage('stuff.detail.btn.moveList')}
</button> </button>
</Link> </Link> */}
<button
type="button"
className="btn-origin grey mr5"
onClick={() => {
setIsGlobalLoading(true)
router.push(`/management/stuff`, { scroll: false })
}}
>
{getMessage('stuff.detail.btn.moveList')}
</button>
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}> <Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
@ -2754,11 +2829,21 @@ export default function StuffDetail() {
{getMessage('stuff.detail.btn.save')} {getMessage('stuff.detail.btn.save')}
</Button> </Button>
)} )}
<Link href="/management/stuff" scroll={false}> {/* <Link href="/management/stuff" scroll={false}>
<button type="button" className="btn-origin grey"> <button type="button" className="btn-origin grey">
{getMessage('stuff.detail.btn.moveList')} {getMessage('stuff.detail.btn.moveList')}
</button> </button>
</Link> </Link> */}
<button
type="button"
className="btn-origin grey"
onClick={() => {
setIsGlobalLoading(true)
router.push(`/management/stuff`, { scroll: false })
}}
>
{getMessage('stuff.detail.btn.moveList')}
</button>
</div> </div>
</> </>
)} )}

View File

@ -10,7 +10,7 @@ import JA from '@/locales/ja.json'
import { stuffSearchState } from '@/store/stuffAtom' import { stuffSearchState } from '@/store/stuffAtom'
import { isEmptyArray } from '@/util/common-utils' import { isEmptyArray } from '@/util/common-utils'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import Link from 'next/link' import { useRouter } from 'next/navigation'
import SingleDatePicker from '../common/datepicker/SingleDatePicker' import SingleDatePicker from '../common/datepicker/SingleDatePicker'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
import { isObjectNotEmpty } from '@/util/common-utils' import { isObjectNotEmpty } from '@/util/common-utils'
@ -20,6 +20,7 @@ import { SessionContext } from '@/app/SessionProvider'
import { QcastContext } from '@/app/QcastProvider' import { QcastContext } from '@/app/QcastProvider'
export default function StuffSearchCondition() { export default function StuffSearchCondition() {
const router = useRouter()
const { session } = useContext(SessionContext) const { session } = useContext(SessionContext)
const setAppMessageState = useSetRecoilState(appMessageStore) const setAppMessageState = useSetRecoilState(appMessageStore)
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
@ -342,7 +343,7 @@ export default function StuffSearchCondition() {
}) })
} else { } else {
if (session?.storeLvl === '2') { if (session?.storeLvl === '2') {
if (otherSaleStoreList.length > 1) { if (otherSaleStoreList.length === 1) {
setOtherSaleStoreId(session.storeId) setOtherSaleStoreId(session.storeId)
stuffSearch.schOtherSelSaleStoreId = session.storeId stuffSearch.schOtherSelSaleStoreId = session.storeId
stuffSearch.schObjectNo = '' stuffSearch.schObjectNo = ''
@ -355,6 +356,24 @@ export default function StuffSearchCondition() {
stuffSearch.schTempFlg = '' stuffSearch.schTempFlg = ''
stuffSearch.schMyDataCheck = false stuffSearch.schMyDataCheck = false
stuffSearch.startRow = 1
stuffSearch.endRow = 100
stuffSearch.schSortType = 'U'
stuffSearch.pageNo = 1
stuffSearch.pageSize = 100
} else if (otherSaleStoreList.length > 1) {
setOtherSaleStoreId('')
stuffSearch.schOtherSelSaleStoreId = session.storeId
stuffSearch.schObjectNo = ''
stuffSearch.schAddress = ''
stuffSearch.schObjectName = ''
stuffSearch.schSaleStoreName = ''
stuffSearch.schReceiveUser = ''
stuffSearch.schDispCompanyName = ''
stuffSearch.schDateType = 'U'
stuffSearch.schTempFlg = ''
stuffSearch.schMyDataCheck = false
stuffSearch.startRow = 1 stuffSearch.startRow = 1
stuffSearch.endRow = 100 stuffSearch.endRow = 100
stuffSearch.schSortType = 'U' stuffSearch.schSortType = 'U'
@ -503,13 +522,23 @@ export default function StuffSearchCondition() {
}) })
} else { } else {
if (stuffSearch.code === 'S') { if (stuffSearch.code === 'S') {
setOtherSaleStoreId(session?.storeId) if (otherList.length === 1) {
setStuffSearch({ setOtherSaleStoreId(session?.storeId)
...stuffSearch, setStuffSearch({
code: 'S', ...stuffSearch,
schSelSaleStoreId: res[0].saleStoreId, code: 'S',
schOtherSelSaleStoreId: otherList[0].saleStoreId, schSelSaleStoreId: res[0].saleStoreId,
}) schOtherSelSaleStoreId: otherList[0].saleStoreId,
})
} else {
setOtherSaleStoreId('')
setStuffSearch({
...stuffSearch,
code: 'S',
schSelSaleStoreId: res[0].saleStoreId,
schOtherSelSaleStoreId: '',
})
}
} else { } else {
setOtherSaleStoreId(stuffSearch?.schOtherSelSaleStoreId) setOtherSaleStoreId(stuffSearch?.schOtherSelSaleStoreId)
setStuffSearch({ setStuffSearch({
@ -560,7 +589,6 @@ export default function StuffSearchCondition() {
setOtherSaleStoreId('') setOtherSaleStoreId('')
setSchSelSaleStoreId(key.saleStoreId) setSchSelSaleStoreId(key.saleStoreId)
stuffSearch.schSelSaleStoreId = key.saleStoreId stuffSearch.schSelSaleStoreId = key.saleStoreId
//T01 1
// 1 saleStoreId 2 API // 1 saleStoreId 2 API
let url = `/api/object/saleStore/${key.saleStoreId}/list?firstFlg=0&userId=${session?.userId}` let url = `/api/object/saleStore/${key.saleStoreId}/list?firstFlg=0&userId=${session?.userId}`
let otherList let otherList
@ -719,19 +747,61 @@ export default function StuffSearchCondition() {
setMyDataCheck(stuffSearch.schMyDataCheck) setMyDataCheck(stuffSearch.schMyDataCheck)
} }
} else { } else {
setStartDate(stuffSearch?.schFromDt ? stuffSearch.schFromDt : dayjs(new Date()).add(-1, 'year').format('YYYY-MM-DD')) if (stuffSearch.code === 'DELETE') {
setEndDate(stuffSearch?.schToDt ? stuffSearch.schToDt : dayjs(new Date()).format('YYYY-MM-DD')) //1
setObjectNo(stuffSearch.schObjectNo ? stuffSearch.schObjectNo : objectNo) if (session.storeLvl === '1') {
setSaleStoreName(stuffSearch.schSaleStoreName ? stuffSearch.schSaleStoreName : saleStoreName) stuffSearch.schOtherSelSaleStoreId = ''
setAddress(stuffSearch.schAddress ? stuffSearch.schAddress : address) setOtherSaleStoreId('')
setobjectName(stuffSearch.schObjectName ? stuffSearch.schObjectName : objectName) } else {
setDispCompanyName(stuffSearch.schDispCompanyName ? stuffSearch.schDispCompanyName : dispCompanyName) //2
setReceiveUser(stuffSearch.schReceiveUser ? stuffSearch.schReceiveUser : receiveUser) //34
setDateType(stuffSearch.schDateType ? stuffSearch.schDateType : dateType) stuffSearch.schOtherSelSaleStoreId = ''
setTempFlg(stuffSearch.schTempFlg ? stuffSearch.schTempFlg : tempFlg) setOtherSaleStoreId('')
setMyDataCheck(stuffSearch.schMyDataCheck) }
if (session.storeLvl !== '1') {
stuffSearch.schSelSaleStoreId = '' setObjectNo('')
setSaleStoreName('')
setAddress('')
setobjectName('')
setDispCompanyName('')
setReceiveUser('')
objectNoRef.current.value = ''
saleStoreNameRef.current.value = ''
addressRef.current.value = ''
objectNameRef.current.value = ''
dispCompanyNameRef.current.value = ''
receiveUserRef.current.value = ''
stuffSearch.schObjectNo = ''
stuffSearch.schAddress = ''
stuffSearch.schObjectName = ''
stuffSearch.schSaleStoreName = ''
stuffSearch.schReceiveUser = ''
stuffSearch.schDispCompanyName = ''
stuffSearch.schDateType = 'U'
stuffSearch.schTempFlg = ''
stuffSearch.schMyDataCheck = false
stuffSearch.schFromDt = dayjs(new Date()).add(-1, 'year').format('YYYY-MM-DD')
stuffSearch.schToDt = dayjs(new Date()).format('YYYY-MM-DD')
stuffSearch.startRow = 1
stuffSearch.endRow = 100
stuffSearch.schSortType = 'U'
stuffSearch.pageNo = 1
stuffSearch.pageSize = 100
} else {
setStartDate(stuffSearch?.schFromDt ? stuffSearch.schFromDt : dayjs(new Date()).add(-1, 'year').format('YYYY-MM-DD'))
setEndDate(stuffSearch?.schToDt ? stuffSearch.schToDt : dayjs(new Date()).format('YYYY-MM-DD'))
setObjectNo(stuffSearch.schObjectNo ? stuffSearch.schObjectNo : objectNo)
setSaleStoreName(stuffSearch.schSaleStoreName ? stuffSearch.schSaleStoreName : saleStoreName)
setAddress(stuffSearch.schAddress ? stuffSearch.schAddress : address)
setobjectName(stuffSearch.schObjectName ? stuffSearch.schObjectName : objectName)
setDispCompanyName(stuffSearch.schDispCompanyName ? stuffSearch.schDispCompanyName : dispCompanyName)
setReceiveUser(stuffSearch.schReceiveUser ? stuffSearch.schReceiveUser : receiveUser)
setDateType(stuffSearch.schDateType ? stuffSearch.schDateType : dateType)
setTempFlg(stuffSearch.schTempFlg ? stuffSearch.schTempFlg : tempFlg)
setMyDataCheck(stuffSearch.schMyDataCheck)
if (session.storeLvl !== '1') {
stuffSearch.schSelSaleStoreId = ''
}
} }
} }
@ -801,10 +871,12 @@ export default function StuffSearchCondition() {
if (e.target.checked) { if (e.target.checked) {
stuffSearch.schMyDataCheck = e.target.value stuffSearch.schMyDataCheck = e.target.value
setMyDataCheck(true) setMyDataCheck(true)
if (otherSaleStoreList.length > 1) { if (otherSaleStoreList.length > 1) {
stuffSearch.schSelSaleStoreId = otherSaleStoreId stuffSearch.schOtherSelSaleStoreId = session.storeId
stuffSearch.schOtherSelSaleStoreId = '' setOtherSaleStoreId(session.storeId)
} else {
stuffSearch.schSelSaleStoreId = ''
stuffSearch.schOtherSelSaleStoreId = session.storeId
} }
} else { } else {
setMyDataCheck(false) setMyDataCheck(false)
@ -822,12 +894,21 @@ export default function StuffSearchCondition() {
<h3>{getMessage('stuff.search.title')}</h3> <h3>{getMessage('stuff.search.title')}</h3>
</div> </div>
<div className="left-unit-box"> <div className="left-unit-box">
<Link href="/management/stuff/tempReg" scroll={false}> {/* <Link href="/management/stuff/tempReg" scroll={false}>
{/* <Link href="/management/stuff/tempdetail" scroll={false}> */}
<button type="button" className="btn-origin navy mr5"> <button type="button" className="btn-origin navy mr5">
{getMessage('stuff.search.btn.register')} {getMessage('stuff.search.btn.register')}
</button> </button>
</Link> </Link> */}
<button
type="button"
className="btn-origin navy mr5"
onClick={() => {
setIsGlobalLoading(true)
router.push(`/management/stuff/tempReg`, { scroll: false })
}}
>
{getMessage('stuff.search.btn.register')}
</button>
<button type="button" className="btn-origin navy mr5" onClick={onSubmit}> <button type="button" className="btn-origin navy mr5" onClick={onSubmit}>
{getMessage('stuff.search.btn.search')} {getMessage('stuff.search.btn.search')}
</button> </button>

View File

@ -66,87 +66,85 @@ export default function StuffSubHeader({ type }) {
} }
return ( return (
!isGlobalLoading && ( <>
<> <div className="sub-header">
<div className="sub-header"> <div className="sub-header-inner">
<div className="sub-header-inner"> {type === 'list' && (
{type === 'list' && ( <>
<> <Link href={'#'}>
<Link href={'#'}> <h1 className="sub-header-title">{getMessage('header.menus.management')}</h1>
<h1 className="sub-header-title">{getMessage('header.menus.management')}</h1> </Link>
</Link> <ul className="sub-header-location">
<ul className="sub-header-location"> <li className="location-item">
<li className="location-item"> <span className="home">
<span className="home"> <Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} /> </span>
</span> </li>
</li> <li className="location-item">
<li className="location-item"> <span>{getMessage('header.menus.management')}</span>
<span>{getMessage('header.menus.management')}</span> </li>
</li> <li className="location-item">
<li className="location-item"> <span>{getMessage('header.menus.management.stuffList')}</span>
<span>{getMessage('header.menus.management.stuffList')}</span> </li>
</li> </ul>
</ul> </>
</> )}
)} {type === 'temp' && (
{type === 'temp' && ( <>
<> <ul className="sub-header-title-wrap">
<ul className="sub-header-title-wrap"> <li className="title-item">
<li className="title-item"> <Link className="sub-header-title" href={'#'}>
<Link className="sub-header-title" href={'#'}> {getMessage('stuff.temp.subTitle')}
{getMessage('stuff.temp.subTitle')} </Link>
</Link> </li>
</li> </ul>
</ul> <ul className="sub-header-location">
<ul className="sub-header-location"> <li className="location-item">
<li className="location-item"> <span className="home">
<span className="home"> <Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} /> </span>
</span> </li>
</li> <li className="location-item">
<li className="location-item"> <span>{getMessage('header.menus.management')}</span>
<span>{getMessage('header.menus.management')}</span> </li>
</li> <li className="location-item">
<li className="location-item"> <span>{getMessage('header.menus.management.newStuff')}</span>
<span>{getMessage('header.menus.management.newStuff')}</span> </li>
</li> </ul>
</ul> </>
</> )}
)} {type === 'detail' && (
{type === 'detail' && ( <>
<> <ul className="sub-header-title-wrap">
<ul className="sub-header-title-wrap"> <li className="title-item">
<li className="title-item"> <Link className="sub-header-title" href={'#'}>
<Link className="sub-header-title" href={'#'}> {getMessage('stuff.temp.subTitle')}
{getMessage('stuff.temp.subTitle')} </Link>
</Link> </li>
</li> <li className="title-item" style={{ display: buttonStyle }}>
<li className="title-item" style={{ display: buttonStyle }}> <a className="sub-header-title" onClick={moveFloorPlan}>
<a className="sub-header-title" onClick={moveFloorPlan}> <span className="icon drawing"></span>
<span className="icon drawing"></span> {getMessage('stuff.temp.subTitle2')}
{getMessage('stuff.temp.subTitle2')} </a>
</a> </li>
</li> </ul>
</ul> <ul className="sub-header-location">
<ul className="sub-header-location"> <li className="location-item">
<li className="location-item"> <span className="home">
<span className="home"> <Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} /> </span>
</span> </li>
</li> <li className="location-item">
<li className="location-item"> <span>{getMessage('header.menus.management')}</span>
<span>{getMessage('header.menus.management')}</span> </li>
</li> <li className="location-item">
<li className="location-item"> <span>{getMessage('header.menus.management.detail')}</span>
<span>{getMessage('header.menus.management.detail')}</span> </li>
</li> </ul>
</ul> </>
</> )}
)}
</div>
</div> </div>
</> </div>
) </>
) )
} }

View File

@ -56,9 +56,6 @@ export default function FindAddressPop(props) {
// //
const searchPostNum = () => { const searchPostNum = () => {
// //7830060
// //9302226
// //0790177 3
const params = { const params = {
zipcode: watch('zipNo'), zipcode: watch('zipNo'),
} }
@ -122,6 +119,28 @@ export default function FindAddressPop(props) {
} }
} }
//
const getCellDoubleClicked = (event) => {
setAddress1(event.data.address1)
setAddress2(event.data.address2)
setAddress3(event.data.address3)
setPrefId(event.data.prefcode)
setZipNo(event.data.zipcode)
if (event.data.prefcode == null) {
return alert(getMessage('stuff.addressPopup.error.message2'))
} else {
props.zipInfo({
zipNo: event.data.zipcode,
address1: event.data.address1,
address2: event.data.address2,
address3: event.data.address3,
prefId: event.data.prefcode,
})
}
props.setShowAddressButtonValid(false)
}
return ( return (
<div className="modal-popup"> <div className="modal-popup">
<div className="modal-dialog middle"> <div className="modal-dialog middle">
@ -146,7 +165,7 @@ export default function FindAddressPop(props) {
<button className="search-btn" onClick={searchPostNum}></button> <button className="search-btn" onClick={searchPostNum}></button>
</div> </div>
<div className="address-grid"> <div className="address-grid">
<FindAddressPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} /> <FindAddressPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} getCellDoubleClicked={getCellDoubleClicked} />
</div> </div>
</div> </div>
<div className="footer-btn-wrap"> <div className="footer-btn-wrap">

View File

@ -48,6 +48,11 @@ export default function FindAddressPopGrid(props) {
props.getSelectedRowdata(selectedData) props.getSelectedRowdata(selectedData)
} }
//
const onCellDoubleClicked = useCallback((event) => {
props.getCellDoubleClicked(event)
}, [])
return ( return (
<div className="ag-theme-quartz" style={{ height: 400 }}> <div className="ag-theme-quartz" style={{ height: 400 }}>
<AgGridReact <AgGridReact
@ -58,6 +63,7 @@ export default function FindAddressPopGrid(props) {
defaultColDef={defaultColDef} defaultColDef={defaultColDef}
pagination={isPageable} pagination={isPageable}
onSelectionChanged={onSelectionChanged} onSelectionChanged={onSelectionChanged}
onCellDoubleClicked={onCellDoubleClicked}
overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`} overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`}
/> />
</div> </div>

View File

@ -243,6 +243,13 @@ export default function PlanRequestPop(props) {
} }
} }
//
const getCellDoubleClicked = (event) => {
setPlanReqObject(event.data)
props.planReqInfo(event.data)
props.setShowDesignRequestButtonValid(false)
}
return ( return (
<div className="modal-popup"> <div className="modal-popup">
<div className="modal-dialog big"> <div className="modal-dialog big">
@ -409,7 +416,7 @@ export default function PlanRequestPop(props) {
</div> </div>
</div> </div>
<div className="q-grid"> <div className="q-grid">
<PlanRequestPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} /> <PlanRequestPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} getCellDoubleClicked={getCellDoubleClicked} />
<div className="pagination-wrap"> <div className="pagination-wrap">
<QPagination pageNo={pageNo} pageSize={pageSize} pagePerBlock={10} totalCount={totalCount} handleChangePage={handleChangePage} /> <QPagination pageNo={pageNo} pageSize={pageSize} pagePerBlock={10} totalCount={totalCount} handleChangePage={handleChangePage} />
</div> </div>

View File

@ -48,6 +48,11 @@ export default function PlanRequestPopQGrid(props) {
props.getSelectedRowdata(selectedData) props.getSelectedRowdata(selectedData)
} }
//
const onCellDoubleClicked = useCallback((event) => {
props.getCellDoubleClicked(event)
}, [])
return ( return (
<div className="ag-theme-quartz" style={{ height: 350 }}> <div className="ag-theme-quartz" style={{ height: 350 }}>
<AgGridReact <AgGridReact
@ -58,6 +63,7 @@ export default function PlanRequestPopQGrid(props) {
defaultColDef={defaultColDef} defaultColDef={defaultColDef}
pagination={isPageable} pagination={isPageable}
onSelectionChanged={onSelectionChanged} onSelectionChanged={onSelectionChanged}
onCellDoubleClicked={onCellDoubleClicked}
autoSizeAllColumns={true} autoSizeAllColumns={true}
overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`} overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`}
/> />

View File

@ -11,14 +11,14 @@ import { compasDegAtom } from '@/store/orientationAtom'
import { currentCanvasPlanState } from '@/store/canvasAtom' import { currentCanvasPlanState } from '@/store/canvasAtom'
export function useCanvasPopupStatusController(param = 1) { export function useCanvasPopupStatusController(param = 1) {
const popupType = param const popupType = parseInt(param)
const [compasDeg, setCompasDeg] = useRecoilState(compasDegAtom) const [compasDeg, setCompasDeg] = useRecoilState(compasDegAtom)
const [moduleSelectionDataStore, setModuleSelectionDataStore] = useRecoilState(moduleSelectionDataState) const [moduleSelectionDataStore, setModuleSelectionDataStore] = useRecoilState(moduleSelectionDataState)
const { getFetcher, postFetcher } = useAxios() const { getFetcher, postFetcher } = useAxios()
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState) const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
console.log('🚀 ~ Orientation ~ currentCanvasPlan:', currentCanvasPlan) // console.log('🚀 ~ Orientation ~ currentCanvasPlan:', currentCanvasPlan)
const { const {
data: popupStatus, data: popupStatus,
@ -30,7 +30,7 @@ export function useCanvasPopupStatusController(param = 1) {
) )
useEffect(() => { useEffect(() => {
console.log('🚀 ~ useEffect ~ popupStatus:', popupStatus) // console.log('🚀 ~ useEffect ~ popupStatus:', popupStatus)
if (popupStatus) { if (popupStatus) {
switch (parseInt(popupStatus?.popupType)) { switch (parseInt(popupStatus?.popupType)) {
case 1: case 1:
@ -43,6 +43,10 @@ export function useCanvasPopupStatusController(param = 1) {
break break
case 4: case 4:
break break
case 5:
break
case 6:
break
default: default:
} }
} else { } else {
@ -56,6 +60,15 @@ export function useCanvasPopupStatusController(param = 1) {
roofConstructions: [], roofConstructions: [],
}) })
break break
case 3:
break
case 4:
break
case 5:
break
case 6:
break
default:
} }
} }
}, [popupStatus]) }, [popupStatus])
@ -67,7 +80,7 @@ export function useCanvasPopupStatusController(param = 1) {
objectNo: currentCanvasPlan.objectNo, objectNo: currentCanvasPlan.objectNo,
planNo: parseInt(currentCanvasPlan.planNo), planNo: parseInt(currentCanvasPlan.planNo),
popupType: popupType.toString(), popupType: popupType.toString(),
popupStatus: JSON.stringify(arg).replace(/"/g, '\"'), popupStatus: popupType === 1 ? arg : JSON.stringify(arg).replace(/"/g, '\"'),
} }
postFetcher(`/api/v1/canvas-popup-status`, params) postFetcher(`/api/v1/canvas-popup-status`, params)
}, },

View File

@ -147,7 +147,7 @@ export function useMasterController() {
], ],
} }
return await post({ url: '/api/v1/master/getPcsSeriesItemList', data: params }).then((res) => { return await post({ url: '/api/v1/master/getPcsSeriesItemList', data: test }).then((res) => {
return res return res
}) })
} }
@ -168,6 +168,82 @@ export function useMasterController() {
}) })
} }
/**
* PCS 승압설정 정보 조회
* @param {Max접속(과적)여부} maxConnYn
* @param {동일회로도여부} smpCirYn
* @param {한랭지여부} coldZoneYn
* @param {사용된 모듈아이템 목록} useModuleItemList
* @param {지붕면 목록} roofSurfaceList
* @param {PCS 아이템 목록} pcsItemList
* @returns
*/
const getPcsVoltageStepUpList = async (params2 = null) => {
const params = {
maxConnYn: 'N',
smpCirYn: 'Y',
coldZoneYn: 'N',
useModuleItemList: [{ itemId: '107077', mixMatlNo: '0' }],
roofSurfaceList: [
{
roofSurfaceId: '1',
roofSurface: '남서',
roofSurfaceIncl: '5',
moduleList: [
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
],
},
{
roofSurfaceId: '2',
roofSurface: '남서',
roofSurfaceIncl: '5',
moduleList: [
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
],
},
{
roofSurfaceId: '3',
roofSurface: '남',
roofSurfaceIncl: '3',
moduleList: [
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
{ itemId: '107077' },
],
},
],
pcsItemList: [
{ itemId: '106857', pcsMkrCd: 'MKR001', pcsSerCd: 'SER001' },
{ itemId: '106856', pcsMkrCd: 'MKR001', pcsSerCd: 'SER001' },
],
}
return await post({ url: '/api/v1/master/getPcsVoltageStepUpList', data: params }).then((res) => {
console.log('🚀🚀 ~ getPcsVoltageStepUpList ~ res:', res)
return res
})
}
return { return {
getRoofMaterialList, getRoofMaterialList,
getModuleTypeItemList, getModuleTypeItemList,
@ -177,5 +253,6 @@ export function useMasterController() {
getPcsMakerList, getPcsMakerList,
getPcsModelList, getPcsModelList,
getPcsAutoRecommendList, getPcsAutoRecommendList,
getPcsVoltageStepUpList,
} }
} }

View File

@ -73,6 +73,7 @@ export function useModuleBasicSetting() {
const makeModuleInstArea = () => { const makeModuleInstArea = () => {
//지붕 객체 반환 //지붕 객체 반환
const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof') const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof')
let offsetLength = canvasSetting.roofSizeSet === 3 ? -90 : -20 let offsetLength = canvasSetting.roofSizeSet === 3 ? -90 : -20
@ -80,6 +81,50 @@ export function useModuleBasicSetting() {
return return
} }
const batchObjects = canvas
?.getObjects()
.filter(
(obj) =>
obj.name === BATCH_TYPE.OPENING ||
obj.name === BATCH_TYPE.SHADOW ||
obj.name === BATCH_TYPE.TRIANGLE_DORMER ||
obj.name === BATCH_TYPE.PENTAGON_DORMER,
) //도머s 객체
//도머도 외곽을 따야한다
const batchObjectOptions = {
stroke: 'red',
fill: 'transparent',
strokeDashArray: [10, 4],
strokeWidth: 1,
lockMovementX: true,
lockMovementY: true,
lockRotation: true,
lockScalingX: true,
lockScalingY: true,
selectable: true,
name: POLYGON_TYPE.OBJECT_SURFACE,
originX: 'center',
originY: 'center',
}
batchObjects.forEach((obj) => {
if (obj.name === BATCH_TYPE.TRIANGLE_DORMER || obj.name === BATCH_TYPE.PENTAGON_DORMER) {
const groupPoints = obj.groupPoints
const offsetObjects = offsetPolygon(groupPoints, 10)
const dormerOffset = new QPolygon(offsetObjects, batchObjectOptions)
dormerOffset.setViewLengthText(false)
canvas.add(dormerOffset) //모듈설치면 만들기
} else {
const points = obj.points
const offsetObjects = offsetPolygon(points, 10)
const offset = new QPolygon(offsetObjects, batchObjectOptions)
offset.setViewLengthText(false)
canvas.add(offset) //모듈설치면 만들기
}
})
roofs.forEach((roof) => { roofs.forEach((roof) => {
const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id) const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id)
if (isExistSurface) { if (isExistSurface) {
@ -190,15 +235,7 @@ export function useModuleBasicSetting() {
} }
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴 const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
const batchObjects = canvas const batchObjects = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.OBJECT_SURFACE) //도머s 객체
?.getObjects()
.filter(
(obj) =>
obj.name === BATCH_TYPE.OPENING ||
obj.name === BATCH_TYPE.TRIANGLE_DORMER ||
obj.name === BATCH_TYPE.PENTAGON_DORMER ||
obj.name === BATCH_TYPE.SHADOW,
) //도머s 객체
const moduleOptions = { const moduleOptions = {
fill: checkedModule[0].color, fill: checkedModule[0].color,
@ -449,17 +486,7 @@ export function useModuleBasicSetting() {
//도머 객체를 가져옴 //도머 객체를 가져옴
if (batchObjects) { if (batchObjects) {
batchObjects.forEach((object) => { batchObjects.forEach((object) => {
let dormerTurfPolygon let dormerTurfPolygon = polygonToTurfPolygon(object, true)
if (object.type === 'group') {
//도머는 그룹형태임
dormerTurfPolygon = batchObjectGroupToTurfPolygon(object)
} else {
//개구, 그림자
object.set({ points: rectToPolygon(object) })
dormerTurfPolygon = polygonToTurfPolygon(object)
}
const intersection = turf.intersect(turf.featureCollection([dormerTurfPolygon, tempTurfModule])) //겹치는지 확인 const intersection = turf.intersect(turf.featureCollection([dormerTurfPolygon, tempTurfModule])) //겹치는지 확인
//겹치면 안됨 //겹치면 안됨
if (intersection) { if (intersection) {
@ -520,15 +547,7 @@ export function useModuleBasicSetting() {
?.getObjects() ?.getObjects()
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && !moduleSetupSurfaces.includes(obj)) //설치면이 아닌것 .filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && !moduleSetupSurfaces.includes(obj)) //설치면이 아닌것
const batchObjects = canvas const batchObjects = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.OBJECT_SURFACE) //도머s 객체
?.getObjects()
.filter(
(obj) =>
obj.name === BATCH_TYPE.OPENING ||
obj.name === BATCH_TYPE.TRIANGLE_DORMER ||
obj.name === BATCH_TYPE.PENTAGON_DORMER ||
obj.name === BATCH_TYPE.SHADOW,
) //도머s 객체
if (moduleSetupSurfaces.length === 0) { if (moduleSetupSurfaces.length === 0) {
swalFire({ text: getMessage('module.place.no.surface') }) swalFire({ text: getMessage('module.place.no.surface') })
@ -582,18 +601,7 @@ export function useModuleBasicSetting() {
const objectsIncludeSurface = (turfModuleSetupSurface) => { const objectsIncludeSurface = (turfModuleSetupSurface) => {
let containsBatchObjects = [] let containsBatchObjects = []
containsBatchObjects = batchObjects.filter((batchObject) => { containsBatchObjects = batchObjects.filter((batchObject) => {
let convertBatchObject let convertBatchObject = polygonToTurfPolygon(batchObject)
if (batchObject.type === 'group') {
//도머는 그룹형태임
convertBatchObject = batchObjectGroupToTurfPolygon(batchObject)
} else {
//개구, 그림자
batchObject.set({ points: rectToPolygon(batchObject) })
canvas?.renderAll() // set된걸 바로 적용하기 위해
convertBatchObject = polygonToTurfPolygon(batchObject) //rect를 폴리곤으로 변환 -> turf 폴리곤으로 변환
}
// 폴리곤 안에 도머 폴리곤이 포함되어있는지 확인해서 반환하는 로직 // 폴리곤 안에 도머 폴리곤이 포함되어있는지 확인해서 반환하는 로직
return turf.booleanContains(turfModuleSetupSurface, convertBatchObject) || turf.booleanWithin(convertBatchObject, turfModuleSetupSurface) return turf.booleanContains(turfModuleSetupSurface, convertBatchObject) || turf.booleanWithin(convertBatchObject, turfModuleSetupSurface)
}) })
@ -1309,13 +1317,13 @@ export function useModuleBasicSetting() {
const pointX2 = coords[2].x + ((coords[2].y - top) / (coords[2].y - coords[1].y)) * (coords[1].x - coords[2].x) const pointX2 = coords[2].x + ((coords[2].y - top) / (coords[2].y - coords[1].y)) * (coords[1].x - coords[2].x)
const pointY2 = top const pointY2 = top
const finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], { // const finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], {
stroke: 'red', // stroke: 'red',
strokeWidth: 1, // strokeWidth: 1,
selectable: true, // selectable: true,
}) // })
canvas?.add(finalLine) // canvas?.add(finalLine)
canvas?.renderAll() // canvas?.renderAll()
let rtnObj let rtnObj
//평평하면 //평평하면
@ -1432,13 +1440,13 @@ export function useModuleBasicSetting() {
const pointX2 = top const pointX2 = top
const pointY2 = coords[2].y + ((coords[2].x - top) / (coords[2].x - coords[1].x)) * (coords[1].y - coords[2].y) const pointY2 = coords[2].y + ((coords[2].x - top) / (coords[2].x - coords[1].x)) * (coords[1].y - coords[2].y)
const finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], { // const finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], {
stroke: 'red', // stroke: 'red',
strokeWidth: 1, // strokeWidth: 1,
selectable: true, // selectable: true,
}) // })
canvas?.add(finalLine) // canvas?.add(finalLine)
canvas?.renderAll() // canvas?.renderAll()
let rtnObj let rtnObj
//평평하면 //평평하면

View File

@ -28,7 +28,7 @@ export function useModulePlace() {
roofBaseCd: item.trestle.roofBaseCd, roofBaseCd: item.trestle.roofBaseCd,
constTp: item.construction.constTp, constTp: item.construction.constTp,
mixMatlNo: selectedModules.mixMatlNo, mixMatlNo: selectedModules.mixMatlNo,
roofPitch: selectedModules.roofPchBase ? selectedModules.roofPchBase : null, roofPitch: item.addRoof.roofPchBase ? item.addRoof.roofPchBase : null,
inclCd: String(item.addRoof.pitch), inclCd: String(item.addRoof.pitch),
roofIndex: item.addRoof.index, roofIndex: item.addRoof.index,
workingWidth: item.addRoof.lenBase, workingWidth: item.addRoof.lenBase,

View File

@ -4,7 +4,7 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
import { useMasterController } from '@/hooks/common/useMasterController' import { useMasterController } from '@/hooks/common/useMasterController'
import { useCommonCode } from '@/hooks/common/useCommonCode' import { useCommonCode } from '@/hooks/common/useCommonCode'
import { selectedModuleState, moduleSelectionInitParamsState } from '@/store/selectedModuleOptions' import { selectedModuleState, moduleSelectionInitParamsState, moduleSelectionDataState } from '@/store/selectedModuleOptions'
export function useModuleSelection(props) { export function useModuleSelection(props) {
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext) const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
@ -13,30 +13,38 @@ export function useModuleSelection(props) {
const [windSpeedCodes, setWindSpeedCodes] = useState([]) //기준풍속 목록 const [windSpeedCodes, setWindSpeedCodes] = useState([]) //기준풍속 목록
const [moduleList, setModuleList] = useState([{}]) //모듈 목록 const [moduleList, setModuleList] = useState([{}]) //모듈 목록
const [selectedModules, setSelectedModules] = useRecoilState(selectedModuleState) //선택된 모듈
const [selectedSurfaceType, setSelectedSurfaceType] = useState({}) //선택된 면조도 const [selectedSurfaceType, setSelectedSurfaceType] = useState({}) //선택된 면조도
const [installHeight, setInstallHeight] = useState(managementState?.installHeight) //설치 높이 const [installHeight, setInstallHeight] = useState() //설치 높이
const [standardWindSpeed, setStandardWindSpeed] = useState({}) //기준풍속 const [standardWindSpeed, setStandardWindSpeed] = useState({}) //기준풍속
const [verticalSnowCover, setVerticalSnowCover] = useState(managementState?.verticalSnowCover) //수직적설량 const [verticalSnowCover, setVerticalSnowCover] = useState() //수직적설량
const [selectedModules, setSelectedModules] = useRecoilState(selectedModuleState) //선택된 모듈
const [moduleSelectionInitParams, setModuleSelectionInitParams] = useRecoilState(moduleSelectionInitParamsState) //모듈 기본 데이터 ex) 면조도, 높이등등 const [moduleSelectionInitParams, setModuleSelectionInitParams] = useRecoilState(moduleSelectionInitParamsState) //모듈 기본 데이터 ex) 면조도, 높이등등
const { getModuleTypeItemList } = useMasterController() const { getModuleTypeItemList } = useMasterController()
const { findCommonCode } = useCommonCode() const { findCommonCode } = useCommonCode()
//탭별 파라메터 초기화 const bindInitData = () => {
useEffect(() => {
setInstallHeight(managementState?.installHeight) setInstallHeight(managementState?.installHeight)
setStandardWindSpeed(managementState?.standardWindSpeedId) setStandardWindSpeed(managementState?.standardWindSpeedId)
setVerticalSnowCover(managementState?.verticalSnowCover) setVerticalSnowCover(managementState?.verticalSnowCover)
setSelectedSurfaceType(managementState?.surfaceType) setSelectedSurfaceType(managementState?.surfaceType)
}
//탭별 파라메터 초기화
useEffect(() => {
bindInitData()
const initParams = { const initParams = {
illuminationTp: managementState?.surfaceTypeValue, //면조도 illuminationTp: managementState?.surfaceTypeValue, //면조도
instHt: managementState?.installHeight, //설치높이 instHt: managementState?.installHeight, //설치높이
stdWindSpeed: managementState?.standardWindSpeedId, //기준풍속 stdWindSpeed: managementState?.standardWindSpeedId, //기준풍속
stdSnowLd: managementState?.verticalSnowCover, //기준적설량 stdSnowLd: managementState?.verticalSnowCover, //기준적설량
} }
if (selectedModules) {
initParams.moduleTpCd = selectedModules.itemTp
initParams.moduleItemId = selectedModules.itemId
}
setModuleSelectionInitParams(initParams) setModuleSelectionInitParams(initParams)
}, [managementState]) }, [managementState])
@ -65,8 +73,10 @@ export function useModuleSelection(props) {
} }
//새로고침시 데이터 날아가는거 방지 //새로고침시 데이터 날아가는거 방지
if (!managementState) { if (managementState === null) {
setManagementState(managementStateLoaded) setManagementState(managementStateLoaded)
} else {
bindInitData()
} }
getModuleData(roofsIds) getModuleData(roofsIds)
@ -101,12 +111,23 @@ export function useModuleSelection(props) {
...moduleSelectionInitParams, ...moduleSelectionInitParams,
illuminationTp: option.clCode, illuminationTp: option.clCode,
}) })
setManagementState({
...managementState,
surfaceType: option.clCodeNm,
surfaceTypeValue: option.clCode,
})
} }
const handleChangeWindSpeed = (option) => { const handleChangeWindSpeed = (option) => {
setModuleSelectionInitParams({ setModuleSelectionInitParams({
...moduleSelectionInitParams, ...moduleSelectionInitParams,
surfaceType: option.clCode, stdWindSpeed: option.clCode,
})
setManagementState({
...managementState,
standardWindSpeedId: option.clCode,
}) })
} }
@ -116,15 +137,24 @@ export function useModuleSelection(props) {
...moduleSelectionInitParams, ...moduleSelectionInitParams,
instHt: option, instHt: option,
}) })
setManagementState({
...managementState,
installHeight: option,
})
} }
const handleChangeVerticalSnowCover = (option) => { const handleChangeVerticalSnowCover = (option) => {
setVerticalSnowCover(option) setVerticalSnowCover(option)
setModuleSelectionInitParams({ setModuleSelectionInitParams({
...moduleSelectionInitParams, ...moduleSelectionInitParams,
stdSnowLd: option, stdSnowLd: option,
}) })
setManagementState({
...managementState,
verticalSnowCover: option,
})
} }
useEffect(() => { useEffect(() => {

View File

@ -93,7 +93,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
}) })
if (!selectedSurface) { if (!selectedSurface) {
swalFire({ text: '지붕안에 그려야해요', icon: 'error' }) swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
initEvent() //이벤트 초기화 initEvent() //이벤트 초기화
if (setIsHidden) setIsHidden(false) if (setIsHidden) setIsHidden(false)
return return
@ -150,7 +150,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
//지붕 밖으로 그렸을때 //지붕 밖으로 그렸을때
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) { if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
swalFire({ text: '개구를 배치할 수 없습니다.', icon: 'error' }) swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
//일단 지워 //일단 지워
deleteTempObjects() deleteTempObjects()
return return
@ -162,14 +162,14 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon)) const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon))
if (isCross) { if (isCross) {
swalFire({ text: '겹치기 불가요...', icon: 'error' }) swalFire({ text: getMessage('batch.object.notinstall.cross'), icon: 'error' })
deleteTempObjects() deleteTempObjects()
return return
} }
} }
isDown = false isDown = false
rect.set({ name: objName, parentId: selectedSurface.id }) rect.set({ name: objName, parentId: selectedSurface.id, points: rectToPolygon(rect) })
rect.setCoords() rect.setCoords()
initEvent() initEvent()
@ -232,7 +232,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
//지붕 밖으로 그렸을때 //지붕 밖으로 그렸을때
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) { if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
swalFire({ text: '개구를 배치할 수 없습니다.', icon: 'error' }) swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
//일단 지워 //일단 지워
deleteTempObjects() deleteTempObjects()
return return
@ -244,14 +244,14 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon)) const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon))
if (isCross) { if (isCross) {
swalFire({ text: '겹치기 불가요...', icon: 'error' }) swalFire({ text: getMessage('batch.object.notinstall.cross'), icon: 'error' })
deleteTempObjects() deleteTempObjects()
return return
} }
} }
isDown = false isDown = false
rect.set({ name: objName, parentId: selectedSurface.id }) rect.set({ name: objName, parentId: selectedSurface.id, points: rectToPolygon(rect) })
rect.setCoords() rect.setCoords()
initEvent() initEvent()
if (setIsHidden) setIsHidden(false) if (setIsHidden) setIsHidden(false)
@ -377,12 +377,9 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
const trianglePolygon = pointsToTurfPolygon(triangleToPolygon(dormer)) const trianglePolygon = pointsToTurfPolygon(triangleToPolygon(dormer))
const selectedSurfacePolygon = polygonToTurfPolygon(selectedSurface) const selectedSurfacePolygon = polygonToTurfPolygon(selectedSurface)
console.log('trianglePolygon', trianglePolygon)
console.log('selectedSurfacePolygon', selectedSurfacePolygon)
//지붕 밖으로 그렸을때 //지붕 밖으로 그렸을때
if (!turf.booleanWithin(trianglePolygon, selectedSurfacePolygon)) { if (!turf.booleanWithin(trianglePolygon, selectedSurfacePolygon)) {
swalFire({ text: '도머를 배치할 수 없습니다.', icon: 'error' }) swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
//일단 지워 //일단 지워
deleteTempObjects() deleteTempObjects()
return return
@ -406,6 +403,8 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
direction = 'north' direction = 'north'
} }
const groupPoints = offsetRef > 0 ? triangleToPolygon(dormerOffset) : triangleToPolygon(dormer)
let splitedTriangle = offsetRef > 0 ? splitDormerTriangle(dormerOffset, directionRef) : splitDormerTriangle(dormer, directionRef) let splitedTriangle = offsetRef > 0 ? splitDormerTriangle(dormerOffset, directionRef) : splitDormerTriangle(dormer, directionRef)
canvas?.remove(offsetRef > 0 ? dormerOffset : dormer) canvas?.remove(offsetRef > 0 ? dormerOffset : dormer)
@ -499,6 +498,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
parentId: selectedSurface.id, parentId: selectedSurface.id,
originX: 'center', originX: 'center',
originY: 'center', originY: 'center',
groupPoints: groupPoints,
}) })
canvas?.add(objectGroup) canvas?.add(objectGroup)
@ -604,7 +604,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
//지붕 밖으로 그렸을때 //지붕 밖으로 그렸을때
if (!turf.booleanWithin(pentagonPolygon, selectedSurfacePolygon)) { if (!turf.booleanWithin(pentagonPolygon, selectedSurfacePolygon)) {
swalFire({ text: '도머를 배치할 수 없습니다.', icon: 'error' }) swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
//일단 지워 //일단 지워
deleteTempObjects() deleteTempObjects()
return return
@ -708,6 +708,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
} }
const groupPolygon = offsetPolygon ? [leftPentagon, rightPentagon, offsetPolygon] : [leftPentagon, rightPentagon] const groupPolygon = offsetPolygon ? [leftPentagon, rightPentagon, offsetPolygon] : [leftPentagon, rightPentagon]
const groupPoints = offsetRef > 0 ? pentagonOffsetPoints : pentagonPoints
const objectGroup = new fabric.Group(groupPolygon, { const objectGroup = new fabric.Group(groupPolygon, {
subTargetCheck: true, subTargetCheck: true,
@ -717,6 +718,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
groupYn: true, groupYn: true,
originX: 'center', originX: 'center',
originY: 'center', originY: 'center',
groupPoints: groupPoints,
}) })
canvas?.add(objectGroup) canvas?.add(objectGroup)

View File

@ -1,4 +1,4 @@
import { useEffect, useState, useRef } from 'react' import { useEffect, useState, useRef, useContext } from 'react'
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil' import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
import { import {
adsorptionPointModeState, adsorptionPointModeState,
@ -35,6 +35,7 @@ import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementSha
import { useCanvasMenu } from '../common/useCanvasMenu' import { useCanvasMenu } from '../common/useCanvasMenu'
import { menuTypeState } from '@/store/menuAtom' import { menuTypeState } from '@/store/menuAtom'
import { usePopup } from '../usePopup' import { usePopup } from '../usePopup'
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
const defaultDotLineGridSetting = { const defaultDotLineGridSetting = {
INTERVAL: { INTERVAL: {
@ -122,6 +123,8 @@ export function useCanvasSetting() {
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector) const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
const { floorPlanState } = useContext(FloorPlanContext)
const { closeAll } = usePopup() const { closeAll } = usePopup()
useEffect(() => { useEffect(() => {
@ -170,7 +173,6 @@ export function useCanvasSetting() {
const previousRoofMaterialsRef = useRef(null) const previousRoofMaterialsRef = useRef(null)
useEffect(() => { useEffect(() => {
//console.log('🚀 ~ useEffect ~ roofMaterials 22 :', previousRoofMaterialsYn, roofMaterials.length , JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials))
// 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음 // 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음
if ( if (
(!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo) || (!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo) ||
@ -194,6 +196,9 @@ export function useCanvasSetting() {
} }
const { column } = corridorDimension const { column } = corridorDimension
const lengthTexts = canvas.getObjects().filter((obj) => obj.name === 'lengthText') const lengthTexts = canvas.getObjects().filter((obj) => obj.name === 'lengthText')
lengthTexts.forEach((obj) => {
obj.set({ text: '' })
})
switch (column) { switch (column) {
case 'corridorDimension': case 'corridorDimension':
lengthTexts.forEach((obj) => { lengthTexts.forEach((obj) => {
@ -219,7 +224,6 @@ export function useCanvasSetting() {
}, [corridorDimension]) }, [corridorDimension])
useEffect(() => { useEffect(() => {
console.log('🚀 ~ useEffect ~ settingsDataSave:', settingsDataSave)
if (settingsDataSave !== undefined) onClickOption2() if (settingsDataSave !== undefined) onClickOption2()
}, [settingsData]) }, [settingsData])
@ -297,9 +301,7 @@ export function useCanvasSetting() {
// 기본설정(PlacementShapeSetting) 조회 및 초기화 // 기본설정(PlacementShapeSetting) 조회 및 초기화
const fetchBasicSettings = async () => { const fetchBasicSettings = async () => {
try { try {
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}` }).then((res) => { await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${floorPlanState.objectNo}` }).then((res) => {
console.log('🚀 ~ fetchBasicSettings ~ res >>>>>>>>>> :', res)
let roofsRow = {} let roofsRow = {}
let roofsArray = {} let roofsArray = {}
@ -313,7 +315,7 @@ export function useCanvasSetting() {
roofsArray = res.map((item) => { roofsArray = res.map((item) => {
return { return {
roofApply: item.roofApply, roofApply: item.roofApply,
roofSeq: 0, roofSeq: item.roofSeq,
roofMatlCd: item.roofMatlCd, roofMatlCd: item.roofMatlCd,
roofWidth: item.roofWidth, roofWidth: item.roofWidth,
roofHeight: item.roofHeight, roofHeight: item.roofHeight,
@ -370,7 +372,6 @@ export function useCanvasSetting() {
} }
}) })
} }
console.log('🚀 ~ fetchBasicSettings ~ addRoofs:', addRoofs)
setAddedRoofs(addRoofs) setAddedRoofs(addRoofs)
setBasicSettings({ setBasicSettings({
...basicSetting, ...basicSetting,
@ -378,16 +379,16 @@ export function useCanvasSetting() {
roofSizeSet: roofsRow[0].roofSizeSet, roofSizeSet: roofsRow[0].roofSizeSet,
roofAngleSet: roofsRow[0].roofAngleSet, roofAngleSet: roofsRow[0].roofAngleSet,
roofsData: roofsArray, roofsData: roofsArray,
selectedRoofMaterial: addRoofs[0], selectedRoofMaterial: addRoofs.find((roof) => roof.selected),
}) })
}) })
} catch (error) { } catch (error) {
console.error('Data fetching error:', error) console.error('Data fetching error:', error)
} }
if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) { // if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) {
setBasicSettings({ ...canvasSetting }) // setBasicSettings({ ...canvasSetting })
} // }
setCanvasSetting({ ...basicSetting }) setCanvasSetting({ ...basicSetting })
} }
@ -451,7 +452,7 @@ export function useCanvasSetting() {
// CanvasSetting 조회 및 초기화 // CanvasSetting 조회 및 초기화
const fetchSettings = async () => { const fetchSettings = async () => {
try { try {
const res = await get({ url: `/api/canvas-management/canvas-settings/by-object/${correntObjectNo}` }) const res = await get({ url: `/api/canvas-management/canvas-settings/by-object/${floorPlanState.objectNo}` })
console.log('res', res) console.log('res', res)
if (Object.keys(res).length > 0) { if (Object.keys(res).length > 0) {

View File

@ -169,6 +169,7 @@ export function useRoofAllocationSetting(id) {
roofSizeSet: res[0].roofSizeSet, roofSizeSet: res[0].roofSizeSet,
roofAngleSet: res[0].roofAngleSet, roofAngleSet: res[0].roofAngleSet,
roofsData: roofsArray, roofsData: roofsArray,
selectedRoofMaterial: selectRoofs.find((roof) => roof.selected),
}) })
setBasicInfo({ setBasicInfo({
roofSizeSet: '' + res[0].roofSizeSet, roofSizeSet: '' + res[0].roofSizeSet,
@ -188,7 +189,7 @@ export function useRoofAllocationSetting(id) {
roofSizeSet: Number(basicSetting.roofSizeSet), roofSizeSet: Number(basicSetting.roofSizeSet),
roofAngleSet: basicSetting.roofAngleSet, roofAngleSet: basicSetting.roofAngleSet,
roofAllocationList: currentRoofList.map((item, index) => ({ roofAllocationList: currentRoofList.map((item, index) => ({
roofApply: item.selected === null || item.selected === undefined ? 'true' : item.selected, roofApply: item.selected,
roofSeq: index, roofSeq: index,
roofMatlCd: item.roofMatlCd === null || item.roofMatlCd === undefined ? 'ROOF_ID_WA_53A' : item.roofMatlCd, roofMatlCd: item.roofMatlCd === null || item.roofMatlCd === undefined ? 'ROOF_ID_WA_53A' : item.roofMatlCd,
roofWidth: item.width === null || item.width === undefined ? 0 : Number(item.width), roofWidth: item.width === null || item.width === undefined ? 0 : Number(item.width),

View File

@ -181,6 +181,7 @@ export function usePlan(params = {}) {
setPlans((plans) => [...plans, { id: res.data, objectNo: objectNo, planNo: planNo, userId: userId, canvasStatus: canvasStatus }]) setPlans((plans) => [...plans, { id: res.data, objectNo: objectNo, planNo: planNo, userId: userId, canvasStatus: canvasStatus }])
} }
updateCurrentPlan(res.data) updateCurrentPlan(res.data)
swalFire({ text: getMessage('plan.message.save') })
}) })
.catch((error) => { .catch((error) => {
swalFire({ text: error.message, icon: 'error' }) swalFire({ text: error.message, icon: 'error' })
@ -200,6 +201,7 @@ export function usePlan(params = {}) {
await promisePut({ url: '/api/canvas-management/canvas-statuses', data: planData }) await promisePut({ url: '/api/canvas-management/canvas-statuses', data: planData })
.then((res) => { .then((res) => {
setPlans((plans) => plans.map((plan) => (plan.id === currentCanvasPlan.id ? { ...plan, canvasStatus: canvasStatus } : plan))) setPlans((plans) => plans.map((plan) => (plan.id === currentCanvasPlan.id ? { ...plan, canvasStatus: canvasStatus } : plan)))
swalFire({ text: getMessage('plan.message.save') })
}) })
.catch((error) => { .catch((error) => {
swalFire({ text: error.message, icon: 'error' }) swalFire({ text: error.message, icon: 'error' })

View File

@ -429,7 +429,7 @@ export const usePolygon = () => {
const sameDirectionCnt = canvas.getObjects().filter((obj) => { const sameDirectionCnt = canvas.getObjects().filter((obj) => {
const onlyStrDirection = obj.directionText?.replace(/[0-9]/g, '') const onlyStrDirection = obj.directionText?.replace(/[0-9]/g, '')
return obj.name === POLYGON_TYPE.ROOF && obj.visible && obj !== polygon && onlyStrDirection === text return obj.name === POLYGON_TYPE.ROOF && obj !== polygon && onlyStrDirection === text
}) })
text = text + (sameDirectionCnt.length + 1) text = text + (sameDirectionCnt.length + 1)
@ -860,9 +860,9 @@ export const usePolygon = () => {
}) })
polygonLines.forEach((line) => { polygonLines.forEach((line) => {
line.set({ strokeWidth: 5, stroke: 'green' }) /*line.set({ strokeWidth: 5, stroke: 'green' })
canvas.add(line) canvas.add(line)
canvas.renderAll() canvas.renderAll()*/
const startPoint = line.startPoint // 시작점 const startPoint = line.startPoint // 시작점
let arrivalPoint = line.endPoint // 도착점 let arrivalPoint = line.endPoint // 도착점

View File

@ -311,6 +311,9 @@
"plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?", "plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?",
"plan.message.save": "저장되었습니다.", "plan.message.save": "저장되었습니다.",
"plan.message.delete": "삭제되었습니다.", "plan.message.delete": "삭제되었습니다.",
"plan.message.leave": "물건현황(목록)으로 이동하시겠습니까? [예]를 선택한 경우, 저장하고 이동합니다.",
"plan.message.confirm.yes": "예",
"plan.message.confirm.no": "아니오",
"setting": "設定", "setting": "設定",
"delete": "삭제(JA)", "delete": "삭제(JA)",
"delete.all": "전체 삭제(JA)", "delete.all": "전체 삭제(JA)",
@ -976,5 +979,6 @@
"can.not.copy.module": "모듈을 복사할 수 없습니다.(JA)", "can.not.copy.module": "모듈을 복사할 수 없습니다.(JA)",
"can.not.remove.module": "모듈을 삭제할 수 없습니다.(JA)", "can.not.remove.module": "모듈을 삭제할 수 없습니다.(JA)",
"can.not.insert.module": "모듈을 삽입할 수 없습니다.(JA)", "can.not.insert.module": "모듈을 삽입할 수 없습니다.(JA)",
"can.not.align.module": "모듈을 정렬할 수 없습니다.(JA)" "can.not.align.module": "모듈을 정렬할 수 없습니다.(JA)",
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다."
} }

View File

@ -95,6 +95,7 @@
"modal.module.basic.setting.module.construction.method": "공법", "modal.module.basic.setting.module.construction.method": "공법",
"modal.module.basic.setting.module.under.roof": "지붕밑바탕", "modal.module.basic.setting.module.under.roof": "지붕밑바탕",
"modal.module.basic.setting.module.setting": "모듈 선택", "modal.module.basic.setting.module.setting": "모듈 선택",
"modal.module.basic.setting.module.hajebichi": "망둥어 피치",
"modal.module.basic.setting.module.setting.info1": "※ 구배의 범위에는 제한이 있습니다. 지붕경사가 2.5치 미만, 10치를 초과하는 경우에는 시공이 가능한지 시공 매뉴얼을 확인해주십시오.", "modal.module.basic.setting.module.setting.info1": "※ 구배의 범위에는 제한이 있습니다. 지붕경사가 2.5치 미만, 10치를 초과하는 경우에는 시공이 가능한지 시공 매뉴얼을 확인해주십시오.",
"modal.module.basic.setting.module.setting.info2": "※ 모듈 배치 시에는 시공 매뉴얼에 기재된 <모듈 배치 조건>을 반드시 확인해주십시오.", "modal.module.basic.setting.module.setting.info2": "※ 모듈 배치 시에는 시공 매뉴얼에 기재된 <모듈 배치 조건>을 반드시 확인해주십시오.",
"modal.module.basic.setting.module.stuff.info": "물건정보", "modal.module.basic.setting.module.stuff.info": "물건정보",
@ -311,6 +312,9 @@
"plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?", "plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?",
"plan.message.save": "저장되었습니다.", "plan.message.save": "저장되었습니다.",
"plan.message.delete": "삭제되었습니다.", "plan.message.delete": "삭제되었습니다.",
"plan.message.leave": "물건현황(목록)으로 이동하시겠습니까? [예]를 선택한 경우, 저장하고 이동합니다.",
"plan.message.corfirm.yes": "예",
"plan.message.confirm.no": "아니오",
"setting": "설정", "setting": "설정",
"delete": "삭제", "delete": "삭제",
"delete.all": "전체 삭제", "delete.all": "전체 삭제",
@ -988,5 +992,10 @@
"module.place.no.surface": "선택된 모듈 설치면이 없습니다.", "module.place.no.surface": "선택된 모듈 설치면이 없습니다.",
"module.place.select.module": "모듈을 선택해주세요.", "module.place.select.module": "모듈을 선택해주세요.",
"module.place.select.one.module": "모듈은 하나만 선택해주세요.", "module.place.select.one.module": "모듈은 하나만 선택해주세요.",
"batch.canvas.delete.all": "배치면 내용을 전부 삭제하시겠습니까?" "batch.canvas.delete.all": "배치면 내용을 전부 삭제하시겠습니까?",
"module.not.found": "설치 모듈을 선택하세요.",
"construction.length.difference": "지붕면 공법을 전부 선택해주세요.",
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다.",
"batch.object.outside.roof": "오브젝트는 지붕내에 설치해야 합니다.",
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다."
} }

View File

@ -81,6 +81,7 @@ export const moduleSelectionDataState = atom({
key: 'moduleSelectionDataState', key: 'moduleSelectionDataState',
default: { default: {
common: {}, common: {},
module: {},
roofConstructions: [], roofConstructions: [],
}, },
dangerouslyAllowMutability: true, dangerouslyAllowMutability: true,