Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into qcast-pub
This commit is contained in:
commit
365a6199d6
11
src/app/GlobalLoadingProvider.js
Normal file
11
src/app/GlobalLoadingProvider.js
Normal 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 />}</>
|
||||
}
|
||||
@ -6,7 +6,6 @@ import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||
import ServerError from './error'
|
||||
|
||||
import '@/styles/common.scss'
|
||||
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
|
||||
|
||||
export const QcastContext = createContext({
|
||||
qcastState: {},
|
||||
@ -17,7 +16,7 @@ export const QcastContext = createContext({
|
||||
|
||||
export const QcastProvider = ({ children }) => {
|
||||
const [planSave, setPlanSave] = useState(false)
|
||||
const [isGlobalLoading, setIsGlobalLoading] = useState(false)
|
||||
const [isGlobalLoading, setIsGlobalLoading] = useState(true)
|
||||
const { commonCode, findCommonCode } = useCommonCode()
|
||||
|
||||
const [qcastState, setQcastState] = useState({
|
||||
@ -35,11 +34,6 @@ export const QcastProvider = ({ children }) => {
|
||||
|
||||
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 }}>
|
||||
<ErrorBoundary fallback={<ServerError />}>{children}</ErrorBoundary>
|
||||
</QcastContext.Provider>
|
||||
|
||||
@ -43,18 +43,27 @@ export const FloorPlanContext = createContext({
|
||||
|
||||
const FloorPlanProvider = ({ children }) => {
|
||||
const pathname = usePathname()
|
||||
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
|
||||
const setCorrentObjectNo = useSetRecoilState(correntObjectNoState)
|
||||
const searchParams = useSearchParams()
|
||||
const objectNo = searchParams.get('objectNo')
|
||||
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 사용
|
||||
if (pathname === '/floor-plan') {
|
||||
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||
notFound()
|
||||
}
|
||||
setCurrentObjectNo(objectNo)
|
||||
}
|
||||
// if (pathname === '/floor-plan') {
|
||||
// if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||
// notFound()
|
||||
// }
|
||||
// setCurrentObjectNo(objectNo)
|
||||
// }
|
||||
//}, [pid, objectNo])
|
||||
|
||||
const [floorPlanState, setFloorPlanState] = useState({
|
||||
|
||||
@ -1,31 +1,22 @@
|
||||
'use client'
|
||||
|
||||
import { usePathname } from 'next/navigation'
|
||||
import FloorPlanProvider from './FloorPlanProvider'
|
||||
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||
import { Suspense } from 'react'
|
||||
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
|
||||
|
||||
export default function FloorPlanLayout({ children }) {
|
||||
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
|
||||
const pathname = usePathname()
|
||||
console.log('🚀 ~ FloorPlanLayout ~ pathname:', pathname)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Suspense fallback={<GlobalSpinner />}>
|
||||
<FloorPlanProvider>
|
||||
<FloorPlan>
|
||||
{/* {pathname.includes('estimate') || pathname.includes('simulator') ? (
|
||||
<FloorPlanProvider>
|
||||
<FloorPlan>
|
||||
{/* {pathname.includes('estimate') || pathname.includes('simulator') ? (
|
||||
<div className="canvas-layout">{children}</div>
|
||||
) : (
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
)} */}
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
</FloorPlan>
|
||||
</FloorPlanProvider>
|
||||
</Suspense>
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
</FloorPlan>
|
||||
</FloorPlanProvider>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -8,15 +8,13 @@ import SessionProvider from './SessionProvider'
|
||||
import GlobalDataProvider from './GlobalDataProvider'
|
||||
import Header from '@/components/header/Header'
|
||||
import QModal from '@/components/common/modal/QModal'
|
||||
import Dimmed from '@/components/ui/Dimmed'
|
||||
import PopupManager from '@/components/common/popupManager/PopupManager'
|
||||
|
||||
import './globals.css'
|
||||
import '../styles/style.scss'
|
||||
import '../styles/contents.scss'
|
||||
import Footer from '@/components/footer/Footer'
|
||||
import { Suspense } from 'react'
|
||||
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
|
||||
import GlobalLoadingProvider from './GlobalLoadingProvider'
|
||||
|
||||
export const metadata = {
|
||||
title: 'Create Next App',
|
||||
@ -70,10 +68,10 @@ export default async function RootLayout({ children }) {
|
||||
<QcastProvider>{children}</QcastProvider>
|
||||
) : (
|
||||
<QcastProvider>
|
||||
<GlobalLoadingProvider />
|
||||
<div className="wrap">
|
||||
<Header userSession={sessionProps} />
|
||||
<div className="content">
|
||||
<Dimmed />
|
||||
<SessionProvider useSession={sessionProps}>{children}</SessionProvider>
|
||||
</div>
|
||||
<Footer />
|
||||
|
||||
@ -113,6 +113,7 @@ export const POLYGON_TYPE = {
|
||||
TRESTLE: 'trestle',
|
||||
MODULE_SETUP_SURFACE: 'moduleSetupSurface',
|
||||
MODULE: 'module',
|
||||
OBJECT_SURFACE: 'objectOffset',
|
||||
}
|
||||
|
||||
export const SAVE_KEY = [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { useContext, useEffect, useRef } from 'react'
|
||||
|
||||
import { useRecoilValue } from 'recoil'
|
||||
|
||||
@ -14,20 +14,24 @@ import { useCanvasConfigInitialize } from '@/hooks/common/useCanvasConfigInitial
|
||||
import { currentMenuState } from '@/store/canvasAtom'
|
||||
import { totalDisplaySelector } from '@/store/settingAtom'
|
||||
import { MENU } from '@/common/common'
|
||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
|
||||
export default function CanvasFrame() {
|
||||
const canvasRef = useRef(null)
|
||||
const { canvas } = useCanvas('canvas')
|
||||
const { canvasLoadInit, gridInit } = useCanvasConfigInitialize()
|
||||
const currentMenu = useRecoilValue(currentMenuState)
|
||||
const { floorPlanState } = useContext(FloorPlanContext)
|
||||
const { contextMenu, handleClick } = useContextMenu()
|
||||
const { selectedPlan } = usePlan()
|
||||
const totalDisplay = useRecoilValue(totalDisplaySelector) // 집계표 표시 여부
|
||||
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||
|
||||
const loadCanvas = () => {
|
||||
if (canvas) {
|
||||
canvas?.clear() // 캔버스를 초기화합니다.
|
||||
if (selectedPlan?.canvasStatus) {
|
||||
if (selectedPlan?.canvasStatus && floorPlanState.objectNo === selectedPlan.objectNo) {
|
||||
canvas?.loadFromJSON(JSON.parse(selectedPlan.canvasStatus), function () {
|
||||
canvasLoadInit() //config된 상태로 캔버스 객체를 그린다
|
||||
canvas?.renderAll() // 캔버스를 다시 그립니다.
|
||||
@ -41,6 +45,10 @@ export default function CanvasFrame() {
|
||||
loadCanvas()
|
||||
}, [selectedPlan, canvas])
|
||||
|
||||
useEffect(() => {
|
||||
setIsGlobalLoading(false)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="canvas-frame">
|
||||
<canvas ref={canvasRef} id="canvas" style={{ position: 'relative' }}></canvas>
|
||||
|
||||
@ -41,7 +41,7 @@ import { isObjectNotEmpty } from '@/util/common-utils'
|
||||
import KO from '@/locales/ko.json'
|
||||
import JA from '@/locales/ja.json'
|
||||
|
||||
import { MENU } from '@/common/common'
|
||||
import { MENU, POLYGON_TYPE } from '@/common/common'
|
||||
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
|
||||
@ -167,7 +167,12 @@ export default function CanvasMenu(props) {
|
||||
setType('surface')
|
||||
break
|
||||
case 4:
|
||||
setType('module')
|
||||
if (!checkMenuAndCanvasState()) {
|
||||
swalFire({ text: getMessage('menu.validation.canvas.roof') })
|
||||
return
|
||||
} else {
|
||||
setType('module')
|
||||
}
|
||||
break
|
||||
case 5:
|
||||
// let pid = urlParams.get('pid')
|
||||
@ -240,6 +245,20 @@ export default function CanvasMenu(props) {
|
||||
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 placementInitialProps = {
|
||||
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)
|
||||
}
|
||||
|
||||
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(() => {
|
||||
if (isObjectNotEmpty(estimateRecoilState)) {
|
||||
if (estimateRecoilState?.createUser === 'T01') {
|
||||
@ -518,7 +545,7 @@ export default function CanvasMenu(props) {
|
||||
</div>
|
||||
<div className="btn-from">
|
||||
<button className="btn08" onClick={handleSaveCanvas}></button>
|
||||
<button className="btn09"></button>
|
||||
<button className="btn09" onClick={handleLeaveCanvas}></button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@ -1,18 +1,30 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
//import { useRecoilState } from 'recoil'
|
||||
import CanvasMenu from '@/components/floor-plan/CanvasMenu'
|
||||
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
|
||||
import { usePopup } from '@/hooks/usePopup'
|
||||
//import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||
//import { correntObjectNoState } from '@/store/settingAtom'
|
||||
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 }) {
|
||||
//const { floorPlanState, setFloorPlanState } = useContext(FloorPlanContext)
|
||||
//const [correntObjectNo, setCorrentObjectNo] = useRecoilState(correntObjectNoState)
|
||||
// const pathname = usePathname()
|
||||
// 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 { menuNumber, setMenuNumber } = useCanvasMenu()
|
||||
const { fetchSettings, fetchBasicSettings } = useCanvasSetting()
|
||||
|
||||
@ -11,6 +11,10 @@ import { usePopup } from '@/hooks/usePopup'
|
||||
import { Orientation } from '@/components/floor-plan/modal/basic/step/Orientation'
|
||||
import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
|
||||
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 } }) {
|
||||
const { getMessage } = useMessage()
|
||||
@ -20,13 +24,32 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
||||
const orientationRef = useRef(null)
|
||||
const { initEvent } = useEvent()
|
||||
const [isManualModuleSetup, setIsManualModuleSetup] = useRecoilState(isManualModuleSetupState)
|
||||
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
||||
const addedRoofs = useRecoilValue(addedRoofsState)
|
||||
|
||||
// const { initEvent } = useContext(EventContext)
|
||||
const { manualModuleSetup, autoModuleSetup, manualFlatroofModuleSetup, autoFlatroofModuleSetup } = useModuleBasicSetting()
|
||||
const handleBtnNextStep = () => {
|
||||
if (tabNum === 1) {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@ -8,12 +8,12 @@ import { useModuleSelection } from '@/hooks/module/useModuleSelection'
|
||||
import ModuleTabContents from './ModuleTabContents'
|
||||
import { useDebounceValue } from 'usehooks-ts'
|
||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||
|
||||
export default function Module({ setTabNum }) {
|
||||
const { getMessage } = useMessage()
|
||||
const addedRoofs = useRecoilValue(addedRoofsState) //지붕재 선택
|
||||
const [addedRoofs, setAddedRoofs] = useRecoilState(addedRoofsState) //지붕재 선택
|
||||
const [roofTab, setRoofTab] = useState(0) //지붕재 탭
|
||||
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
||||
|
||||
const {
|
||||
moduleSelectionInitParams,
|
||||
@ -22,7 +22,9 @@ export default function Module({ setTabNum }) {
|
||||
windSpeedCodes,
|
||||
managementState,
|
||||
moduleList,
|
||||
selectedSurfaceType,
|
||||
installHeight,
|
||||
standardWindSpeed,
|
||||
verticalSnowCover,
|
||||
handleChangeModule,
|
||||
handleChangeSurfaceType,
|
||||
@ -31,8 +33,8 @@ export default function Module({ setTabNum }) {
|
||||
handleChangeVerticalSnowCover,
|
||||
} = useModuleSelection({ addedRoofs })
|
||||
|
||||
const [inputInstallHeight, setInputInstallHeight] = useState(installHeight)
|
||||
const [inputVerticalSnowCover, setInputVerticalSnowCover] = useState(verticalSnowCover)
|
||||
const [inputInstallHeight, setInputInstallHeight] = useState()
|
||||
const [inputVerticalSnowCover, setInputVerticalSnowCover] = useState()
|
||||
|
||||
const [debouncedInstallHeight] = useDebounceValue(inputInstallHeight, 500)
|
||||
const [debouncedVerticalSnowCover] = useDebounceValue(inputVerticalSnowCover, 500)
|
||||
@ -43,15 +45,31 @@ export default function Module({ setTabNum }) {
|
||||
}, moduleSelectionData)
|
||||
|
||||
useEffect(() => {
|
||||
setModuleSelectionData(tempModuleSelectionData)
|
||||
if (installHeight) {
|
||||
setInputInstallHeight(installHeight)
|
||||
}
|
||||
if (verticalSnowCover) {
|
||||
setInputVerticalSnowCover(verticalSnowCover)
|
||||
}
|
||||
}, [installHeight, verticalSnowCover])
|
||||
|
||||
useEffect(() => {
|
||||
if (tempModuleSelectionData) {
|
||||
setModuleSelectionData(tempModuleSelectionData)
|
||||
// moduleSelectedDataTrigger(tempModuleSelectionData)
|
||||
}
|
||||
}, [tempModuleSelectionData])
|
||||
|
||||
useEffect(() => {
|
||||
handleChangeInstallHeight(debouncedInstallHeight)
|
||||
if (debouncedInstallHeight) {
|
||||
handleChangeInstallHeight(debouncedInstallHeight)
|
||||
}
|
||||
}, [debouncedInstallHeight])
|
||||
|
||||
useEffect(() => {
|
||||
handleChangeVerticalSnowCover(debouncedVerticalSnowCover)
|
||||
if (debouncedVerticalSnowCover) {
|
||||
handleChangeVerticalSnowCover(debouncedVerticalSnowCover)
|
||||
}
|
||||
}, [debouncedVerticalSnowCover])
|
||||
|
||||
const moduleData = {
|
||||
@ -71,6 +89,8 @@ export default function Module({ setTabNum }) {
|
||||
setRoofTab(tab)
|
||||
}
|
||||
|
||||
// const { trigger: moduleSelectedDataTrigger } = useCanvasPopupStatusController(2)
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="roof-module-tab2-overflow">
|
||||
@ -224,6 +244,7 @@ export default function Module({ setTabNum }) {
|
||||
key={index}
|
||||
index={index}
|
||||
addRoof={roof}
|
||||
setAddedRoofs={setAddedRoofs}
|
||||
roofTab={index}
|
||||
tempModuleSelectionData={tempModuleSelectionData}
|
||||
setTempModuleSelectionData={setTempModuleSelectionData}
|
||||
|
||||
@ -7,10 +7,14 @@ import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||
import { moduleSelectionDataState, moduleSelectionInitParamsState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||
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 [roofMaterial, setRoofMaterial] = useState(addRoof) //지붕재`
|
||||
|
||||
const addRoofsArray = useRecoilValue(addedRoofsState)
|
||||
|
||||
const globalPitchText = useRecoilValue(pitchTextSelector) //피치 텍스트
|
||||
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
||||
|
||||
@ -51,6 +55,40 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
|
||||
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(() => {
|
||||
setModuleConstructionSelectionData(moduleSelectionData.roofConstructions[roofTab])
|
||||
}, [moduleSelectionData])
|
||||
@ -76,7 +114,13 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
//공법 변경
|
||||
const handleChangeConstMthd = (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([]) //지붕밑바탕 초기화
|
||||
setConstructionList([]) //공법 초기화
|
||||
}
|
||||
@ -114,6 +158,14 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
selectedConstruction.setupSnowCover = false //눈막이금구 설치 여부
|
||||
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)
|
||||
setSnowGdPossYn(selectedConstruction.snowGdPossYn)
|
||||
setSelectedConstruction(selectedConstruction)
|
||||
@ -126,10 +178,12 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
|
||||
const handleCvrChecked = () => {
|
||||
setCvrChecked(!cvrChecked)
|
||||
setSelectedConstruction({ ...selectedConstruction, setupCover: !cvrChecked })
|
||||
}
|
||||
|
||||
const handleSnowGdChecked = () => {
|
||||
setSnowGdChecked(!snowGdChecked)
|
||||
setSelectedConstruction({ ...selectedConstruction, setupSnowCover: !snowGdChecked })
|
||||
}
|
||||
|
||||
const getModuleOptionsListData = async (params) => {
|
||||
@ -195,14 +249,6 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
}
|
||||
}, [selectedConstruction])
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedConstruction({ ...selectedConstruction, setupCover: cvrChecked })
|
||||
}, [cvrChecked])
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedConstruction({ ...selectedConstruction, setupSnowCover: snowGdChecked })
|
||||
}, [snowGdChecked])
|
||||
|
||||
useEffect(() => {
|
||||
if (isExistData) {
|
||||
setConstructionListParams({
|
||||
@ -215,7 +261,12 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
}, [selectedRoofBase])
|
||||
|
||||
useEffect(() => {
|
||||
if (isExistData && constructionList.length > 0) {
|
||||
if (
|
||||
isExistData &&
|
||||
constructionList.length > 0 &&
|
||||
isObjectNotEmpty(moduleConstructionSelectionData.construction) &&
|
||||
moduleConstructionSelectionData.construction.hasOwnProperty('constPossYn') ///키가 있으면
|
||||
) {
|
||||
const selectedIndex = moduleConstructionSelectionData.construction.selectedIndex
|
||||
const construction = constructionList[selectedIndex]
|
||||
if (construction.constPossYn === 'Y') {
|
||||
@ -245,15 +296,19 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
) {
|
||||
const isModuleLoaded = moduleSelectionInitParams.hasOwnProperty('moduleTpCd') //모듈컬럼이 있으면 모듈을 변경했다는 내용
|
||||
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([])
|
||||
|
||||
if (isObjectNotEmpty(moduleConstructionSelectionData)) {
|
||||
//기존에 데이터가 있으면 파라메터를 넣는다
|
||||
setConstructionParams({ ...moduleConstructionSelectionData.trestle, constMthdCd: '', roofBaseCd: '' })
|
||||
setRoofBaseParams({ ...moduleConstructionSelectionData.trestle, roofBaseCd: '' })
|
||||
setCvrChecked(moduleConstructionSelectionData.construction.setupCover)
|
||||
setSnowGdChecked(moduleConstructionSelectionData.construction.setupSnowCover)
|
||||
|
||||
setIsExistData(true)
|
||||
}
|
||||
}
|
||||
@ -286,11 +341,11 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
}
|
||||
}, [constructionListParams])
|
||||
|
||||
useEffect(() => {
|
||||
if (isObjectNotEmpty(tempModuleSelectionData)) {
|
||||
setModuleSelectionData(tempModuleSelectionData)
|
||||
}
|
||||
}, [tempModuleSelectionData])
|
||||
// useEffect(() => {
|
||||
// if (isObjectNotEmpty(tempModuleSelectionData)) {
|
||||
// setModuleSelectionData(tempModuleSelectionData)
|
||||
// }
|
||||
// }, [tempModuleSelectionData])
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -308,21 +363,21 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
<>
|
||||
<div className="eaves-keraba-th">L</div>
|
||||
<div className="eaves-keraba-td">
|
||||
<div className="keraba-flex">
|
||||
<div className="outline-form">
|
||||
<div className="grid-select">
|
||||
<input
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
value={roofMaterial.lenBase}
|
||||
disabled={roofMaterial.lenAuth === 'R' ? true : false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid-select">
|
||||
<input
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
value={lengthBase}
|
||||
onChange={(e) => setLengthBase(e.target.value)}
|
||||
disabled={roofMaterial.lenAuth === 'R' ? true : false}
|
||||
ref={lengthRef}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="eaves-keraba-item">
|
||||
{roofMaterial && ['C', 'R'].includes(roofMaterial.raftAuth) && (
|
||||
<>
|
||||
<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 className="eaves-keraba-item">
|
||||
{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="keraba-flex">
|
||||
<div className="outline-form">
|
||||
<span>垂木の間隔</span>
|
||||
<div className="grid-select">
|
||||
<input
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
value={roofMaterial.hajebichi}
|
||||
disabled={roofMaterial.roofPchAuth === 'R' ? true : false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid-select">
|
||||
<input
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
disabled={roofMaterial.roofPchAuth === 'R' ? true : false}
|
||||
onChange={(e) => setHajebichi(e.target.value)}
|
||||
value={hajebichi}
|
||||
ref={hajebichiRef}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
@ -464,7 +518,7 @@ export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectio
|
||||
type="checkbox"
|
||||
id={`ch01_${roofTab}`}
|
||||
disabled={cvrYn === 'N' ? true : false}
|
||||
defaultChecked={cvrChecked}
|
||||
checked={cvrChecked}
|
||||
onChange={handleCvrChecked}
|
||||
/>
|
||||
<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"
|
||||
id={`ch02_${roofTab}`}
|
||||
disabled={snowGdPossYn === 'N' ? true : false}
|
||||
defaultChecked={snowGdChecked}
|
||||
checked={snowGdChecked}
|
||||
onChange={handleSnowGdChecked}
|
||||
/>
|
||||
<label htmlFor={`ch02_${roofTab}`}>{getMessage('modal.module.basic.setting.module.blind.metal.fitting')}</label>
|
||||
|
||||
@ -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 { useOrientation } from '@/hooks/module/useOrientation'
|
||||
import { getDegreeInOrientation } from '@/util/canvas-util'
|
||||
@ -8,6 +8,8 @@ import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupSta
|
||||
export const Orientation = forwardRef(({ tabNum }, ref) => {
|
||||
const { getMessage } = useMessage()
|
||||
|
||||
const { trigger: canvasPopupStatusTrigger } = useCanvasPopupStatusController(1)
|
||||
|
||||
const { nextStep, compasDeg, setCompasDeg } = useOrientation()
|
||||
|
||||
const [hasAnglePassivity, setHasAnglePassivity] = useState(false)
|
||||
@ -21,6 +23,10 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
||||
canvasPopupStatusTrigger(compasDeg)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
checkDegree(compasDeg)
|
||||
}, [compasDeg])
|
||||
|
||||
const checkDegree = (e) => {
|
||||
if (numberCheck(Number(e)) && Number(e) >= -180 && Number(e) <= 180) {
|
||||
setCompasDeg(Number(e))
|
||||
@ -29,8 +35,6 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
||||
}
|
||||
}
|
||||
|
||||
const { trigger: canvasPopupStatusTrigger } = useCanvasPopupStatusController(1)
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="properties-setting-wrap">
|
||||
@ -67,7 +71,7 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
||||
</div>
|
||||
<div className="center-wrap">
|
||||
<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>
|
||||
</div>
|
||||
<div className="outline-form">
|
||||
@ -76,7 +80,7 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
value={compasDeg}
|
||||
readOnly={hasAnglePassivity}
|
||||
readOnly={!hasAnglePassivity}
|
||||
placeholder={0}
|
||||
onChange={
|
||||
(e) => checkDegree(e.target.value)
|
||||
|
||||
@ -16,10 +16,12 @@ export default function StepUp(props) {
|
||||
const [arrayLength, setArrayLength] = useState(3) //module-table-inner의 반복 개수
|
||||
const [pcsCheck, setPcsCheck] = useRecoilState(pcsCheckState)
|
||||
const { models } = props
|
||||
const { getPcsAutoRecommendList } = useMasterController()
|
||||
const { getPcsVoltageStepUpList, getPcsAutoRecommendList } = useMasterController()
|
||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||
const canvas = useRecoilValue(canvasState)
|
||||
const selectedModules = useRecoilValue(selectedModuleState)
|
||||
const [stepUpListData, setStepUpListData] = useState([])
|
||||
const [optCodes, setOptCodes] = useState([])
|
||||
|
||||
useEffect(() => {
|
||||
if (!managementState) {
|
||||
@ -68,7 +70,44 @@ export default function StepUp(props) {
|
||||
roofSurfaceList: roofSurfaceList,
|
||||
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)
|
||||
@ -81,112 +120,101 @@ export default function StepUp(props) {
|
||||
<div className="properties-setting-wrap outer">
|
||||
<div className="circuit-overflow">
|
||||
{/* 3개일때 className = by-max */}
|
||||
<div className={`module-table-box ${arrayLength === 3 ? 'by-max' : ''}`}>
|
||||
{Array.from({ length: arrayLength }).map((_, idx) => (
|
||||
<div key={idx} className="module-table-inner">
|
||||
<div className="mb-box">
|
||||
<div className="circuit-table-tit">HQJP-KA55-5</div>
|
||||
<div className="roof-module-table overflow-y min">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.serial.amount')}</th>
|
||||
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.total.amount')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr className="on">
|
||||
<td className="al-r">10</td>
|
||||
<td className="al-r">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="al-r">10</td>
|
||||
<td className="al-r">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="al-r">10</td>
|
||||
<td className="al-r">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="al-r">10</td>
|
||||
<td className="al-r">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="al-r">10</td>
|
||||
<td className="al-r">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="al-r">10</td>
|
||||
<td className="al-r">0</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{stepUpListData.map((stepUp, index) => (
|
||||
<div key={index} className={`module-table-box ${stepUp.pcsItemList.length === 3 ? 'by-max' : ''}`}>
|
||||
{Array.from({ length: stepUp.pcsItemList.length }).map((_, idx) => (
|
||||
<div key={idx} className="module-table-inner">
|
||||
<div className="mb-box">
|
||||
<div className="circuit-table-tit">{stepUp.pcsItemList[idx].goodsNo}</div>
|
||||
<div className="roof-module-table overflow-y min">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.serial.amount')}</th>
|
||||
<th>{getMessage('modal.circuit.trestle.setting.step.up.allocation.total.amount')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{stepUp.pcsItemList[idx].serQtyList.map((item) => {
|
||||
return (
|
||||
<tr className="on">
|
||||
<td className="al-r">{item.serQty}</td>
|
||||
<td className="al-r">{item.paralQty}</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div className="module-box-tab mb10">
|
||||
<button className={`module-btn ${moduleTab === 1 ? 'act' : ''}`} onClick={() => setModuleTab(1)}>
|
||||
{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">{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 className="module-box-tab mb10">
|
||||
<button className={`module-btn ${moduleTab === 1 ? 'act' : ''}`} onClick={() => setModuleTab(1)}>
|
||||
{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="outline-form">
|
||||
<span className="mr10" style={{ width: 'auto' }}>
|
||||
{getMessage('modal.circuit.trestle.setting.step.up.allocation.select.monitor')}
|
||||
</span>
|
||||
<div className="grid-select mr10">
|
||||
<QSelectBox title={'電力検出ユニット (モニター付き)'} />
|
||||
</div>
|
||||
{optCodes.length > 0 && (
|
||||
<div className="grid-select mr10">
|
||||
<QSelectBox title={'電力検出ユニット (モニター付き)'} />
|
||||
{/* <QSelectBox options={optCodes} value={optCodes.name} sourceKey="code" targetKey="code" showKey="name" /> */}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -18,7 +18,11 @@ export default function OuterLineWall({ props }) {
|
||||
className="input-origin block"
|
||||
value={length1}
|
||||
ref={length1Ref}
|
||||
onFocus={(e) => (length1Ref.current.value = '')}
|
||||
onFocus={(e) => {
|
||||
if (length1Ref.current.value === '0') {
|
||||
length1Ref.current.value = ''
|
||||
}
|
||||
}}
|
||||
onChange={(e) => onlyNumberInputChange(e, setLength1)}
|
||||
placeholder="3000"
|
||||
/>
|
||||
|
||||
@ -221,7 +221,7 @@ export default function Header(props) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{!isGlobalLoading && !(pathName.includes('login') || pathName.includes('join') || sessionState.pwdInitYn === 'N') && (
|
||||
{!(pathName.includes('login') || pathName.includes('join') || sessionState.pwdInitYn === 'N') && (
|
||||
<header className={isDimmed}>
|
||||
<div className="header-inner">
|
||||
<div className="header-right">
|
||||
|
||||
@ -10,12 +10,12 @@ import { useRecoilValue } from 'recoil'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { queryStringFormatter } from '@/util/common-utils'
|
||||
import MainSkeleton from '../ui/MainSkeleton'
|
||||
import { useMainContentsController } from '@/hooks/main/useMainContentsController'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
|
||||
import BoardDetailModal from '../community/modal/BoardDetailModal'
|
||||
import { handleFileDown } from '@/util/board-utils'
|
||||
|
||||
export default function MainContents() {
|
||||
const { swalFire } = useSwal()
|
||||
@ -23,26 +23,52 @@ export default function MainContents() {
|
||||
const { getMessage } = useMessage()
|
||||
const router = useRouter()
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
const { promiseGet } = useAxios(globalLocaleState)
|
||||
|
||||
const { promiseGet, get } = useAxios(globalLocaleState)
|
||||
//공지사항
|
||||
const [recentNoticeList, setRecentNoticeList] = useState([])
|
||||
|
||||
//FAQ
|
||||
const [recentFaqList, setRecentFaqList] = useState([])
|
||||
|
||||
const { qcastState } = useContext(QcastContext)
|
||||
const { qcastState, setIsGlobalLoading } = useContext(QcastContext)
|
||||
const { fetchObjectList, initObjectList } = useMainContentsController()
|
||||
|
||||
//첨부파일
|
||||
const [boardList, setBoardList] = useState([])
|
||||
useEffect(() => {
|
||||
fetchObjectList()
|
||||
fetchNoticeList()
|
||||
fetchFaqList()
|
||||
//첨부파일 목록 호출
|
||||
fetchArchiveList()
|
||||
return () => {
|
||||
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 () => {
|
||||
try {
|
||||
@ -105,6 +131,7 @@ export default function MainContents() {
|
||||
key={row.objectNo}
|
||||
className="recently-item"
|
||||
onClick={() => {
|
||||
setIsGlobalLoading(true)
|
||||
if (row.tempFlg === '0') {
|
||||
router.push(`/management/stuff/detail?objectNo=${row.objectNo.toString()}`, { scroll: false })
|
||||
} else {
|
||||
@ -114,7 +141,7 @@ export default function MainContents() {
|
||||
>
|
||||
<div className="item-inner">
|
||||
<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.saleStoreName}</span>
|
||||
</div>
|
||||
@ -183,14 +210,19 @@ export default function MainContents() {
|
||||
)}
|
||||
</ProductItem>
|
||||
<ProductItem num={4} name={'Data Download'}>
|
||||
<div className="data-download-wrap">
|
||||
<button className="data-down" type="button" onClick={() => swalFire({ text: getMessage('main.content.alert.noFile'), type: 'alert' })}>
|
||||
<span>{getMessage('main.content.download1')}</span>
|
||||
</button>
|
||||
<button className="data-down" type="button" onClick={() => swalFire({ text: getMessage('main.content.alert.noFile'), type: 'alert' })}>
|
||||
<span>{getMessage('main.content.download2')}</span>
|
||||
</button>
|
||||
</div>
|
||||
{boardList.length > 0 ? (
|
||||
<div className="data-download-wrap">
|
||||
{boardList?.map((board) => (
|
||||
<button type="button" className="data-down" onClick={() => handleFileDown(board.noticeNo, 'Y')}>
|
||||
<span>{board.title}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="file-down-nodata">
|
||||
<h3>{getMessage('common.message.no.data')}</h3>
|
||||
</div>
|
||||
)}
|
||||
</ProductItem>
|
||||
<ProductItem num={5} name={'Sales Contact info'}>
|
||||
<ul className="contact-info-list">
|
||||
|
||||
@ -222,7 +222,6 @@ export default function Stuff() {
|
||||
if (!params.saleStoreId) {
|
||||
params.saleStoreId = session.storeId
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
const apiUrl = `/api/object/list?${queryStringFormatter(params)}`
|
||||
await get({
|
||||
@ -278,6 +277,13 @@ export default function Stuff() {
|
||||
if (!stuffSearchParams.saleStoreId) {
|
||||
stuffSearchParams.saleStoreId = session.storeId
|
||||
}
|
||||
if (stuffSearchParams.schMyDataCheck) {
|
||||
if (session.storeLvl === '1') {
|
||||
//schOtherSelSaleStoreId 초기화 schSelSaleStoreId 에 saleStoreId 담아서 보내기
|
||||
stuffSearchParams.schOtherSelSaleStoreId = ''
|
||||
stuffSearchParams.schSelSaleStoreId = session.storeId
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}`
|
||||
@ -312,6 +318,12 @@ export default function Stuff() {
|
||||
if (!params.saleStoreId) {
|
||||
stuffSearchParams.saleStoreId = session.storeId
|
||||
}
|
||||
if (stuffSearchParams.schMyDataCheck) {
|
||||
//schOtherSelSaleStoreId 초기화 schSelSaleStoreId 에 saleStoreId 담아서 보내기
|
||||
stuffSearchParams.schOtherSelSaleStoreId = ''
|
||||
stuffSearchParams.schSelSaleStoreId = session.storeId
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
const apiUrl = `/api/object/list?${queryStringFormatter(stuffSearchParams)}`
|
||||
await get({ url: apiUrl }).then((res) => {
|
||||
@ -347,6 +359,7 @@ export default function Stuff() {
|
||||
code: 'S',
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
schMyDataCheck: false,
|
||||
}
|
||||
|
||||
setStuffSearch({
|
||||
|
||||
@ -4,7 +4,6 @@ import { useState, useEffect, useRef, useContext } from 'react'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import { Button } from '@nextui-org/react'
|
||||
import Select, { components } from 'react-select'
|
||||
import Link from 'next/link'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
|
||||
@ -289,10 +288,12 @@ export default function StuffDetail() {
|
||||
display: 'none',
|
||||
}
|
||||
}
|
||||
// if (managementState?.createUser === 'T01' && session?.userId !== 'T01') {
|
||||
//createUser가 T01인데 로그인사용자가 T01이 아니면 버튼숨기기 적용할지 미정!!!!!!!!
|
||||
//buttonStyle = { display: 'none' }
|
||||
// }
|
||||
if (managementState?.createUser === 'T01') {
|
||||
if (session.userId !== 'T01') {
|
||||
// #474
|
||||
buttonStyle = { display: 'none' }
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div className="grid-cell-btn">
|
||||
@ -301,7 +302,6 @@ export default function StuffDetail() {
|
||||
type="button"
|
||||
className="grid-btn"
|
||||
onClick={() => {
|
||||
//mid:5(견적서), /pid:플랜번호
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: params.data.objectNo })
|
||||
setIsGlobalLoading(true)
|
||||
setMenuNumber(5)
|
||||
@ -1025,6 +1025,8 @@ export default function StuffDetail() {
|
||||
const _objectNameOmit = watch('objectNameOmit')
|
||||
// saleStoreId: '', //1차 판매점ID
|
||||
const _saleStoreId = watch('saleStoreId')
|
||||
// 2차 판매점명
|
||||
const _otherSaleStoreId = watch('otherSaleStoreId')
|
||||
// zipNo: '', //우편번호
|
||||
const _zipNo = watch('zipNo')
|
||||
// prefId: '', //도도부현
|
||||
@ -1043,6 +1045,7 @@ export default function StuffDetail() {
|
||||
useEffect(() => {
|
||||
if (editMode === 'NEW') {
|
||||
const formData = form.getValues()
|
||||
|
||||
let errors = {}
|
||||
if (!formData.receiveUser || formData.receiveUser.trim().length === 0) {
|
||||
errors.receiveUser = true
|
||||
@ -1057,6 +1060,12 @@ export default function StuffDetail() {
|
||||
errors.saleStoreId = true
|
||||
}
|
||||
|
||||
if (session?.storeLvl === '2') {
|
||||
if (!formData.otherSaleStoreId) {
|
||||
errors.otherSaleStoreId = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!formData.zipNo) {
|
||||
errors.zipNo = true
|
||||
}
|
||||
@ -1099,6 +1108,12 @@ export default function StuffDetail() {
|
||||
errors.saleStoreId = true
|
||||
}
|
||||
|
||||
if (session?.storeLvl === '2') {
|
||||
if (!formData.otherSaleStoreId) {
|
||||
errors.otherSaleStoreId = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!formData.zipNo) {
|
||||
errors.zipNo = true
|
||||
}
|
||||
@ -1130,6 +1145,7 @@ export default function StuffDetail() {
|
||||
_objectName,
|
||||
_objectNameOmit,
|
||||
_saleStoreId,
|
||||
_otherSaleStoreId,
|
||||
_zipNo,
|
||||
_prefId,
|
||||
_address,
|
||||
@ -1368,13 +1384,12 @@ export default function StuffDetail() {
|
||||
setIsGlobalLoading(true)
|
||||
//상세화면으로 전환
|
||||
if (res.status === 201) {
|
||||
setIsGlobalLoading(false)
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.save'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
|
||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
@ -1391,12 +1406,12 @@ export default function StuffDetail() {
|
||||
setIsGlobalLoading(true)
|
||||
|
||||
if (res.status === 201) {
|
||||
setIsGlobalLoading(false)
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.save'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
@ -1468,11 +1483,11 @@ export default function StuffDetail() {
|
||||
.then((res) => {
|
||||
setIsGlobalLoading(true)
|
||||
if (res.status === 201) {
|
||||
setIsGlobalLoading(false)
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.tempSave.message1'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
@ -1487,11 +1502,11 @@ export default function StuffDetail() {
|
||||
.then((res) => {
|
||||
setIsGlobalLoading(true)
|
||||
if (res.status === 201) {
|
||||
setIsGlobalLoading(false)
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.tempSave.message1'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
@ -1519,7 +1534,7 @@ export default function StuffDetail() {
|
||||
confirmFn: () => {
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||
del({ url: `/api/object/${objectNo}?${queryStringFormatter(delParams)}` })
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
setIsGlobalLoading(true)
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||
if (session.storeId === 'T01') {
|
||||
@ -1595,6 +1610,13 @@ export default function StuffDetail() {
|
||||
|
||||
// 그리드 더블 클릭 해당플랜의 도면작성 화면으로 이동
|
||||
const getCellDoubleClicked = (params) => {
|
||||
//#474정책
|
||||
if (managementState.createUser === 'T01') {
|
||||
if (session.userId !== 'T01') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (params?.column?.colId !== 'estimateDate') {
|
||||
if (params?.data?.planNo && params?.data?.objectNo) {
|
||||
let objectNo = params?.data?.objectNo
|
||||
@ -1631,11 +1653,21 @@ export default function StuffDetail() {
|
||||
{getMessage('stuff.detail.btn.save')}
|
||||
</Button>
|
||||
)}
|
||||
<Link href="/management/stuff" scroll={false}>
|
||||
{/* <Link href="/management/stuff" scroll={false}>
|
||||
<button type="button" className="btn-origin grey">
|
||||
{getMessage('stuff.detail.btn.moveList')}
|
||||
</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 className="infomation-table">
|
||||
@ -2131,11 +2163,21 @@ export default function StuffDetail() {
|
||||
{getMessage('stuff.detail.btn.save')}
|
||||
</Button>
|
||||
)}
|
||||
<Link href="/management/stuff" scroll={false}>
|
||||
{/* <Link href="/management/stuff" scroll={false}>
|
||||
<button type="button" className="btn-origin grey">
|
||||
{getMessage('stuff.detail.btn.moveList')}
|
||||
</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>
|
||||
</form>
|
||||
@ -2150,11 +2192,21 @@ export default function StuffDetail() {
|
||||
{managementState?.tempFlg === '0' ? (
|
||||
<>
|
||||
<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">
|
||||
{getMessage('stuff.detail.btn.moveList')}
|
||||
</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 }}>
|
||||
{getMessage('stuff.detail.btn.save')}
|
||||
</Button>
|
||||
@ -2175,11 +2227,21 @@ export default function StuffDetail() {
|
||||
{getMessage('stuff.detail.btn.save')}
|
||||
</Button>
|
||||
)}
|
||||
<Link href="/management/stuff" scroll={false}>
|
||||
{/* <Link href="/management/stuff" scroll={false}>
|
||||
<button type="button" className="btn-origin grey">
|
||||
{getMessage('stuff.detail.btn.moveList')}
|
||||
</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>
|
||||
</>
|
||||
)}
|
||||
@ -2422,6 +2484,7 @@ export default function StuffDetail() {
|
||||
<td>
|
||||
<div className="flx-box">
|
||||
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||
상세
|
||||
<Select
|
||||
id="long-value-select2"
|
||||
instanceId="long-value-select2"
|
||||
@ -2433,16 +2496,18 @@ export default function StuffDetail() {
|
||||
onChange={onSelectionChange2}
|
||||
getOptionLabel={(x) => x.saleStoreName}
|
||||
getOptionValue={(x) => x.saleStoreId}
|
||||
// isDisabled={
|
||||
// managementState?.tempFlg === '0'
|
||||
// ? true
|
||||
// : session?.storeLvl === '1' && form.watch('saleStoreId') != ''
|
||||
// ? false
|
||||
// : false
|
||||
// }
|
||||
isDisabled={managementState?.tempFlg === '0' ? true : false}
|
||||
isDisabled={
|
||||
managementState?.tempFlg === '0'
|
||||
? true
|
||||
: session?.storeLvl === '1'
|
||||
? otherSaleStoreList.length > 0
|
||||
? false
|
||||
: true
|
||||
: otherSaleStoreList.length === 1
|
||||
? true
|
||||
: false
|
||||
}
|
||||
isClearable={managementState?.tempFlg === '0' ? false : true}
|
||||
// isClearable={managementState?.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : true}
|
||||
value={otherSaleStoreList.filter(function (option) {
|
||||
return option.saleStoreId === otherSelOptions
|
||||
})}
|
||||
@ -2729,11 +2794,21 @@ export default function StuffDetail() {
|
||||
</div>
|
||||
{/* 진짜R 플랜끝 */}
|
||||
<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">
|
||||
{getMessage('stuff.detail.btn.moveList')}
|
||||
</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 }}>
|
||||
{getMessage('stuff.detail.btn.save')}
|
||||
</Button>
|
||||
@ -2754,11 +2829,21 @@ export default function StuffDetail() {
|
||||
{getMessage('stuff.detail.btn.save')}
|
||||
</Button>
|
||||
)}
|
||||
<Link href="/management/stuff" scroll={false}>
|
||||
{/* <Link href="/management/stuff" scroll={false}>
|
||||
<button type="button" className="btn-origin grey">
|
||||
{getMessage('stuff.detail.btn.moveList')}
|
||||
</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>
|
||||
</>
|
||||
)}
|
||||
|
||||
@ -10,7 +10,7 @@ import JA from '@/locales/ja.json'
|
||||
import { stuffSearchState } from '@/store/stuffAtom'
|
||||
import { isEmptyArray } from '@/util/common-utils'
|
||||
import dayjs from 'dayjs'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import SingleDatePicker from '../common/datepicker/SingleDatePicker'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||
@ -20,6 +20,7 @@ import { SessionContext } from '@/app/SessionProvider'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
|
||||
export default function StuffSearchCondition() {
|
||||
const router = useRouter()
|
||||
const { session } = useContext(SessionContext)
|
||||
const setAppMessageState = useSetRecoilState(appMessageStore)
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
@ -342,7 +343,7 @@ export default function StuffSearchCondition() {
|
||||
})
|
||||
} else {
|
||||
if (session?.storeLvl === '2') {
|
||||
if (otherSaleStoreList.length > 1) {
|
||||
if (otherSaleStoreList.length === 1) {
|
||||
setOtherSaleStoreId(session.storeId)
|
||||
stuffSearch.schOtherSelSaleStoreId = session.storeId
|
||||
stuffSearch.schObjectNo = ''
|
||||
@ -355,6 +356,24 @@ export default function StuffSearchCondition() {
|
||||
stuffSearch.schTempFlg = ''
|
||||
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.endRow = 100
|
||||
stuffSearch.schSortType = 'U'
|
||||
@ -503,13 +522,23 @@ export default function StuffSearchCondition() {
|
||||
})
|
||||
} else {
|
||||
if (stuffSearch.code === 'S') {
|
||||
setOtherSaleStoreId(session?.storeId)
|
||||
setStuffSearch({
|
||||
...stuffSearch,
|
||||
code: 'S',
|
||||
schSelSaleStoreId: res[0].saleStoreId,
|
||||
schOtherSelSaleStoreId: otherList[0].saleStoreId,
|
||||
})
|
||||
if (otherList.length === 1) {
|
||||
setOtherSaleStoreId(session?.storeId)
|
||||
setStuffSearch({
|
||||
...stuffSearch,
|
||||
code: 'S',
|
||||
schSelSaleStoreId: res[0].saleStoreId,
|
||||
schOtherSelSaleStoreId: otherList[0].saleStoreId,
|
||||
})
|
||||
} else {
|
||||
setOtherSaleStoreId('')
|
||||
setStuffSearch({
|
||||
...stuffSearch,
|
||||
code: 'S',
|
||||
schSelSaleStoreId: res[0].saleStoreId,
|
||||
schOtherSelSaleStoreId: '',
|
||||
})
|
||||
}
|
||||
} else {
|
||||
setOtherSaleStoreId(stuffSearch?.schOtherSelSaleStoreId)
|
||||
setStuffSearch({
|
||||
@ -560,7 +589,6 @@ export default function StuffSearchCondition() {
|
||||
setOtherSaleStoreId('')
|
||||
setSchSelSaleStoreId(key.saleStoreId)
|
||||
stuffSearch.schSelSaleStoreId = key.saleStoreId
|
||||
//T01아닌 1차점은 본인으로 디폴트셋팅이고 수정할수없어서 여기안옴
|
||||
//고른 1차점의 saleStoreId로 2차점 API호출하기
|
||||
let url = `/api/object/saleStore/${key.saleStoreId}/list?firstFlg=0&userId=${session?.userId}`
|
||||
let otherList
|
||||
@ -719,19 +747,61 @@ export default function StuffSearchCondition() {
|
||||
setMyDataCheck(stuffSearch.schMyDataCheck)
|
||||
}
|
||||
} 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 = ''
|
||||
if (stuffSearch.code === 'DELETE') {
|
||||
//1차점인경우
|
||||
if (session.storeLvl === '1') {
|
||||
stuffSearch.schOtherSelSaleStoreId = ''
|
||||
setOtherSaleStoreId('')
|
||||
} else {
|
||||
//2차점 본인하나인경우
|
||||
//34있는경우
|
||||
stuffSearch.schOtherSelSaleStoreId = ''
|
||||
setOtherSaleStoreId('')
|
||||
}
|
||||
|
||||
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) {
|
||||
stuffSearch.schMyDataCheck = e.target.value
|
||||
setMyDataCheck(true)
|
||||
|
||||
if (otherSaleStoreList.length > 1) {
|
||||
stuffSearch.schSelSaleStoreId = otherSaleStoreId
|
||||
stuffSearch.schOtherSelSaleStoreId = ''
|
||||
stuffSearch.schOtherSelSaleStoreId = session.storeId
|
||||
setOtherSaleStoreId(session.storeId)
|
||||
} else {
|
||||
stuffSearch.schSelSaleStoreId = ''
|
||||
stuffSearch.schOtherSelSaleStoreId = session.storeId
|
||||
}
|
||||
} else {
|
||||
setMyDataCheck(false)
|
||||
@ -822,12 +894,21 @@ export default function StuffSearchCondition() {
|
||||
<h3>{getMessage('stuff.search.title')}</h3>
|
||||
</div>
|
||||
<div className="left-unit-box">
|
||||
<Link href="/management/stuff/tempReg" scroll={false}>
|
||||
{/* <Link href="/management/stuff/tempdetail" scroll={false}> */}
|
||||
{/* <Link href="/management/stuff/tempReg" scroll={false}>
|
||||
<button type="button" className="btn-origin navy mr5">
|
||||
{getMessage('stuff.search.btn.register')}
|
||||
</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}>
|
||||
{getMessage('stuff.search.btn.search')}
|
||||
</button>
|
||||
|
||||
@ -66,87 +66,85 @@ export default function StuffSubHeader({ type }) {
|
||||
}
|
||||
|
||||
return (
|
||||
!isGlobalLoading && (
|
||||
<>
|
||||
<div className="sub-header">
|
||||
<div className="sub-header-inner">
|
||||
{type === 'list' && (
|
||||
<>
|
||||
<Link href={'#'}>
|
||||
<h1 className="sub-header-title">{getMessage('header.menus.management')}</h1>
|
||||
</Link>
|
||||
<ul className="sub-header-location">
|
||||
<li className="location-item">
|
||||
<span className="home">
|
||||
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management')}</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management.stuffList')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
{type === 'temp' && (
|
||||
<>
|
||||
<ul className="sub-header-title-wrap">
|
||||
<li className="title-item">
|
||||
<Link className="sub-header-title" href={'#'}>
|
||||
{getMessage('stuff.temp.subTitle')}
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
<ul className="sub-header-location">
|
||||
<li className="location-item">
|
||||
<span className="home">
|
||||
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management')}</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management.newStuff')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
{type === 'detail' && (
|
||||
<>
|
||||
<ul className="sub-header-title-wrap">
|
||||
<li className="title-item">
|
||||
<Link className="sub-header-title" href={'#'}>
|
||||
{getMessage('stuff.temp.subTitle')}
|
||||
</Link>
|
||||
</li>
|
||||
<li className="title-item" style={{ display: buttonStyle }}>
|
||||
<a className="sub-header-title" onClick={moveFloorPlan}>
|
||||
<span className="icon drawing"></span>
|
||||
{getMessage('stuff.temp.subTitle2')}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul className="sub-header-location">
|
||||
<li className="location-item">
|
||||
<span className="home">
|
||||
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management')}</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management.detail')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<>
|
||||
<div className="sub-header">
|
||||
<div className="sub-header-inner">
|
||||
{type === 'list' && (
|
||||
<>
|
||||
<Link href={'#'}>
|
||||
<h1 className="sub-header-title">{getMessage('header.menus.management')}</h1>
|
||||
</Link>
|
||||
<ul className="sub-header-location">
|
||||
<li className="location-item">
|
||||
<span className="home">
|
||||
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management')}</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management.stuffList')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
{type === 'temp' && (
|
||||
<>
|
||||
<ul className="sub-header-title-wrap">
|
||||
<li className="title-item">
|
||||
<Link className="sub-header-title" href={'#'}>
|
||||
{getMessage('stuff.temp.subTitle')}
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
<ul className="sub-header-location">
|
||||
<li className="location-item">
|
||||
<span className="home">
|
||||
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management')}</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management.newStuff')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
{type === 'detail' && (
|
||||
<>
|
||||
<ul className="sub-header-title-wrap">
|
||||
<li className="title-item">
|
||||
<Link className="sub-header-title" href={'#'}>
|
||||
{getMessage('stuff.temp.subTitle')}
|
||||
</Link>
|
||||
</li>
|
||||
<li className="title-item" style={{ display: buttonStyle }}>
|
||||
<a className="sub-header-title" onClick={moveFloorPlan}>
|
||||
<span className="icon drawing"></span>
|
||||
{getMessage('stuff.temp.subTitle2')}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul className="sub-header-location">
|
||||
<li className="location-item">
|
||||
<span className="home">
|
||||
<Image src="/static/images/main/home_icon.svg" alt="react" width={16} height={16} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management')}</span>
|
||||
</li>
|
||||
<li className="location-item">
|
||||
<span>{getMessage('header.menus.management.detail')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -56,9 +56,6 @@ export default function FindAddressPop(props) {
|
||||
|
||||
//우편번호 검색
|
||||
const searchPostNum = () => {
|
||||
// //7830060
|
||||
// //9302226
|
||||
// //0790177 3개짜리
|
||||
const params = {
|
||||
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 (
|
||||
<div className="modal-popup">
|
||||
<div className="modal-dialog middle">
|
||||
@ -146,7 +165,7 @@ export default function FindAddressPop(props) {
|
||||
<button className="search-btn" onClick={searchPostNum}></button>
|
||||
</div>
|
||||
<div className="address-grid">
|
||||
<FindAddressPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} />
|
||||
<FindAddressPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} getCellDoubleClicked={getCellDoubleClicked} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="footer-btn-wrap">
|
||||
|
||||
@ -48,6 +48,11 @@ export default function FindAddressPopGrid(props) {
|
||||
props.getSelectedRowdata(selectedData)
|
||||
}
|
||||
|
||||
//더블클릭
|
||||
const onCellDoubleClicked = useCallback((event) => {
|
||||
props.getCellDoubleClicked(event)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="ag-theme-quartz" style={{ height: 400 }}>
|
||||
<AgGridReact
|
||||
@ -58,6 +63,7 @@ export default function FindAddressPopGrid(props) {
|
||||
defaultColDef={defaultColDef}
|
||||
pagination={isPageable}
|
||||
onSelectionChanged={onSelectionChanged}
|
||||
onCellDoubleClicked={onCellDoubleClicked}
|
||||
overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -243,6 +243,13 @@ export default function PlanRequestPop(props) {
|
||||
}
|
||||
}
|
||||
|
||||
// 더블클릭
|
||||
const getCellDoubleClicked = (event) => {
|
||||
setPlanReqObject(event.data)
|
||||
props.planReqInfo(event.data)
|
||||
props.setShowDesignRequestButtonValid(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="modal-popup">
|
||||
<div className="modal-dialog big">
|
||||
@ -409,7 +416,7 @@ export default function PlanRequestPop(props) {
|
||||
</div>
|
||||
</div>
|
||||
<div className="q-grid">
|
||||
<PlanRequestPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} />
|
||||
<PlanRequestPopQGrid {...gridProps} getSelectedRowdata={getSelectedRowdata} getCellDoubleClicked={getCellDoubleClicked} />
|
||||
<div className="pagination-wrap">
|
||||
<QPagination pageNo={pageNo} pageSize={pageSize} pagePerBlock={10} totalCount={totalCount} handleChangePage={handleChangePage} />
|
||||
</div>
|
||||
|
||||
@ -48,6 +48,11 @@ export default function PlanRequestPopQGrid(props) {
|
||||
props.getSelectedRowdata(selectedData)
|
||||
}
|
||||
|
||||
// 그리드 더블클릭
|
||||
const onCellDoubleClicked = useCallback((event) => {
|
||||
props.getCellDoubleClicked(event)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="ag-theme-quartz" style={{ height: 350 }}>
|
||||
<AgGridReact
|
||||
@ -58,6 +63,7 @@ export default function PlanRequestPopQGrid(props) {
|
||||
defaultColDef={defaultColDef}
|
||||
pagination={isPageable}
|
||||
onSelectionChanged={onSelectionChanged}
|
||||
onCellDoubleClicked={onCellDoubleClicked}
|
||||
autoSizeAllColumns={true}
|
||||
overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`}
|
||||
/>
|
||||
|
||||
@ -11,14 +11,14 @@ import { compasDegAtom } from '@/store/orientationAtom'
|
||||
import { currentCanvasPlanState } from '@/store/canvasAtom'
|
||||
|
||||
export function useCanvasPopupStatusController(param = 1) {
|
||||
const popupType = param
|
||||
const popupType = parseInt(param)
|
||||
|
||||
const [compasDeg, setCompasDeg] = useRecoilState(compasDegAtom)
|
||||
const [moduleSelectionDataStore, setModuleSelectionDataStore] = useRecoilState(moduleSelectionDataState)
|
||||
const { getFetcher, postFetcher } = useAxios()
|
||||
|
||||
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
||||
console.log('🚀 ~ Orientation ~ currentCanvasPlan:', currentCanvasPlan)
|
||||
// console.log('🚀 ~ Orientation ~ currentCanvasPlan:', currentCanvasPlan)
|
||||
|
||||
const {
|
||||
data: popupStatus,
|
||||
@ -30,7 +30,7 @@ export function useCanvasPopupStatusController(param = 1) {
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ useEffect ~ popupStatus:', popupStatus)
|
||||
// console.log('🚀 ~ useEffect ~ popupStatus:', popupStatus)
|
||||
if (popupStatus) {
|
||||
switch (parseInt(popupStatus?.popupType)) {
|
||||
case 1:
|
||||
@ -43,6 +43,10 @@ export function useCanvasPopupStatusController(param = 1) {
|
||||
break
|
||||
case 4:
|
||||
break
|
||||
case 5:
|
||||
break
|
||||
case 6:
|
||||
break
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
@ -56,6 +60,15 @@ export function useCanvasPopupStatusController(param = 1) {
|
||||
roofConstructions: [],
|
||||
})
|
||||
break
|
||||
case 3:
|
||||
break
|
||||
case 4:
|
||||
break
|
||||
case 5:
|
||||
break
|
||||
case 6:
|
||||
break
|
||||
default:
|
||||
}
|
||||
}
|
||||
}, [popupStatus])
|
||||
@ -67,7 +80,7 @@ export function useCanvasPopupStatusController(param = 1) {
|
||||
objectNo: currentCanvasPlan.objectNo,
|
||||
planNo: parseInt(currentCanvasPlan.planNo),
|
||||
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)
|
||||
},
|
||||
|
||||
@ -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
|
||||
})
|
||||
}
|
||||
@ -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 {
|
||||
getRoofMaterialList,
|
||||
getModuleTypeItemList,
|
||||
@ -177,5 +253,6 @@ export function useMasterController() {
|
||||
getPcsMakerList,
|
||||
getPcsModelList,
|
||||
getPcsAutoRecommendList,
|
||||
getPcsVoltageStepUpList,
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ export function useModuleBasicSetting() {
|
||||
|
||||
const makeModuleInstArea = () => {
|
||||
//지붕 객체 반환
|
||||
|
||||
const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof')
|
||||
let offsetLength = canvasSetting.roofSizeSet === 3 ? -90 : -20
|
||||
|
||||
@ -80,6 +81,50 @@ export function useModuleBasicSetting() {
|
||||
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) => {
|
||||
const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id)
|
||||
if (isExistSurface) {
|
||||
@ -190,15 +235,7 @@ export function useModuleBasicSetting() {
|
||||
}
|
||||
|
||||
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
|
||||
const batchObjects = canvas
|
||||
?.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 batchObjects = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.OBJECT_SURFACE) //도머s 객체
|
||||
|
||||
const moduleOptions = {
|
||||
fill: checkedModule[0].color,
|
||||
@ -449,17 +486,7 @@ export function useModuleBasicSetting() {
|
||||
//도머 객체를 가져옴
|
||||
if (batchObjects) {
|
||||
batchObjects.forEach((object) => {
|
||||
let dormerTurfPolygon
|
||||
|
||||
if (object.type === 'group') {
|
||||
//도머는 그룹형태임
|
||||
dormerTurfPolygon = batchObjectGroupToTurfPolygon(object)
|
||||
} else {
|
||||
//개구, 그림자
|
||||
object.set({ points: rectToPolygon(object) })
|
||||
dormerTurfPolygon = polygonToTurfPolygon(object)
|
||||
}
|
||||
|
||||
let dormerTurfPolygon = polygonToTurfPolygon(object, true)
|
||||
const intersection = turf.intersect(turf.featureCollection([dormerTurfPolygon, tempTurfModule])) //겹치는지 확인
|
||||
//겹치면 안됨
|
||||
if (intersection) {
|
||||
@ -520,15 +547,7 @@ export function useModuleBasicSetting() {
|
||||
?.getObjects()
|
||||
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && !moduleSetupSurfaces.includes(obj)) //설치면이 아닌것
|
||||
|
||||
const batchObjects = canvas
|
||||
?.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 batchObjects = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.OBJECT_SURFACE) //도머s 객체
|
||||
|
||||
if (moduleSetupSurfaces.length === 0) {
|
||||
swalFire({ text: getMessage('module.place.no.surface') })
|
||||
@ -582,18 +601,7 @@ export function useModuleBasicSetting() {
|
||||
const objectsIncludeSurface = (turfModuleSetupSurface) => {
|
||||
let containsBatchObjects = []
|
||||
containsBatchObjects = batchObjects.filter((batchObject) => {
|
||||
let convertBatchObject
|
||||
|
||||
if (batchObject.type === 'group') {
|
||||
//도머는 그룹형태임
|
||||
convertBatchObject = batchObjectGroupToTurfPolygon(batchObject)
|
||||
} else {
|
||||
//개구, 그림자
|
||||
batchObject.set({ points: rectToPolygon(batchObject) })
|
||||
canvas?.renderAll() // set된걸 바로 적용하기 위해
|
||||
convertBatchObject = polygonToTurfPolygon(batchObject) //rect를 폴리곤으로 변환 -> turf 폴리곤으로 변환
|
||||
}
|
||||
|
||||
let convertBatchObject = polygonToTurfPolygon(batchObject)
|
||||
// 폴리곤 안에 도머 폴리곤이 포함되어있는지 확인해서 반환하는 로직
|
||||
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 pointY2 = top
|
||||
|
||||
const finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], {
|
||||
stroke: 'red',
|
||||
strokeWidth: 1,
|
||||
selectable: true,
|
||||
})
|
||||
canvas?.add(finalLine)
|
||||
canvas?.renderAll()
|
||||
// const finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], {
|
||||
// stroke: 'red',
|
||||
// strokeWidth: 1,
|
||||
// selectable: true,
|
||||
// })
|
||||
// canvas?.add(finalLine)
|
||||
// canvas?.renderAll()
|
||||
|
||||
let rtnObj
|
||||
//평평하면
|
||||
@ -1432,13 +1440,13 @@ export function useModuleBasicSetting() {
|
||||
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 finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], {
|
||||
stroke: 'red',
|
||||
strokeWidth: 1,
|
||||
selectable: true,
|
||||
})
|
||||
canvas?.add(finalLine)
|
||||
canvas?.renderAll()
|
||||
// const finalLine = new QLine([pointX1, pointY1, pointX2, pointY2], {
|
||||
// stroke: 'red',
|
||||
// strokeWidth: 1,
|
||||
// selectable: true,
|
||||
// })
|
||||
// canvas?.add(finalLine)
|
||||
// canvas?.renderAll()
|
||||
|
||||
let rtnObj
|
||||
//평평하면
|
||||
|
||||
@ -28,7 +28,7 @@ export function useModulePlace() {
|
||||
roofBaseCd: item.trestle.roofBaseCd,
|
||||
constTp: item.construction.constTp,
|
||||
mixMatlNo: selectedModules.mixMatlNo,
|
||||
roofPitch: selectedModules.roofPchBase ? selectedModules.roofPchBase : null,
|
||||
roofPitch: item.addRoof.roofPchBase ? item.addRoof.roofPchBase : null,
|
||||
inclCd: String(item.addRoof.pitch),
|
||||
roofIndex: item.addRoof.index,
|
||||
workingWidth: item.addRoof.lenBase,
|
||||
|
||||
@ -4,7 +4,7 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||
|
||||
import { selectedModuleState, moduleSelectionInitParamsState } from '@/store/selectedModuleOptions'
|
||||
import { selectedModuleState, moduleSelectionInitParamsState, moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||
|
||||
export function useModuleSelection(props) {
|
||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||
@ -13,30 +13,38 @@ export function useModuleSelection(props) {
|
||||
const [windSpeedCodes, setWindSpeedCodes] = useState([]) //기준풍속 목록
|
||||
const [moduleList, setModuleList] = useState([{}]) //모듈 목록
|
||||
|
||||
const [selectedModules, setSelectedModules] = useRecoilState(selectedModuleState) //선택된 모듈
|
||||
const [selectedSurfaceType, setSelectedSurfaceType] = useState({}) //선택된 면조도
|
||||
const [installHeight, setInstallHeight] = useState(managementState?.installHeight) //설치 높이
|
||||
const [installHeight, setInstallHeight] = 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 { getModuleTypeItemList } = useMasterController()
|
||||
|
||||
const { findCommonCode } = useCommonCode()
|
||||
|
||||
//탭별 파라메터 초기화
|
||||
useEffect(() => {
|
||||
const bindInitData = () => {
|
||||
setInstallHeight(managementState?.installHeight)
|
||||
setStandardWindSpeed(managementState?.standardWindSpeedId)
|
||||
setVerticalSnowCover(managementState?.verticalSnowCover)
|
||||
setSelectedSurfaceType(managementState?.surfaceType)
|
||||
}
|
||||
|
||||
//탭별 파라메터 초기화
|
||||
useEffect(() => {
|
||||
bindInitData()
|
||||
const initParams = {
|
||||
illuminationTp: managementState?.surfaceTypeValue, //면조도
|
||||
instHt: managementState?.installHeight, //설치높이
|
||||
stdWindSpeed: managementState?.standardWindSpeedId, //기준풍속
|
||||
stdSnowLd: managementState?.verticalSnowCover, //기준적설량
|
||||
}
|
||||
|
||||
if (selectedModules) {
|
||||
initParams.moduleTpCd = selectedModules.itemTp
|
||||
initParams.moduleItemId = selectedModules.itemId
|
||||
}
|
||||
|
||||
setModuleSelectionInitParams(initParams)
|
||||
}, [managementState])
|
||||
|
||||
@ -65,8 +73,10 @@ export function useModuleSelection(props) {
|
||||
}
|
||||
|
||||
//새로고침시 데이터 날아가는거 방지
|
||||
if (!managementState) {
|
||||
if (managementState === null) {
|
||||
setManagementState(managementStateLoaded)
|
||||
} else {
|
||||
bindInitData()
|
||||
}
|
||||
|
||||
getModuleData(roofsIds)
|
||||
@ -101,12 +111,23 @@ export function useModuleSelection(props) {
|
||||
...moduleSelectionInitParams,
|
||||
illuminationTp: option.clCode,
|
||||
})
|
||||
|
||||
setManagementState({
|
||||
...managementState,
|
||||
surfaceType: option.clCodeNm,
|
||||
surfaceTypeValue: option.clCode,
|
||||
})
|
||||
}
|
||||
|
||||
const handleChangeWindSpeed = (option) => {
|
||||
setModuleSelectionInitParams({
|
||||
...moduleSelectionInitParams,
|
||||
surfaceType: option.clCode,
|
||||
stdWindSpeed: option.clCode,
|
||||
})
|
||||
|
||||
setManagementState({
|
||||
...managementState,
|
||||
standardWindSpeedId: option.clCode,
|
||||
})
|
||||
}
|
||||
|
||||
@ -116,15 +137,24 @@ export function useModuleSelection(props) {
|
||||
...moduleSelectionInitParams,
|
||||
instHt: option,
|
||||
})
|
||||
|
||||
setManagementState({
|
||||
...managementState,
|
||||
installHeight: option,
|
||||
})
|
||||
}
|
||||
|
||||
const handleChangeVerticalSnowCover = (option) => {
|
||||
setVerticalSnowCover(option)
|
||||
|
||||
setModuleSelectionInitParams({
|
||||
...moduleSelectionInitParams,
|
||||
stdSnowLd: option,
|
||||
})
|
||||
|
||||
setManagementState({
|
||||
...managementState,
|
||||
verticalSnowCover: option,
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -93,7 +93,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
})
|
||||
|
||||
if (!selectedSurface) {
|
||||
swalFire({ text: '지붕안에 그려야해요', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
initEvent() //이벤트 초기화
|
||||
if (setIsHidden) setIsHidden(false)
|
||||
return
|
||||
@ -150,7 +150,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '개구를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
@ -162,14 +162,14 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon))
|
||||
|
||||
if (isCross) {
|
||||
swalFire({ text: '겹치기 불가요...', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.notinstall.cross'), icon: 'error' })
|
||||
deleteTempObjects()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
isDown = false
|
||||
rect.set({ name: objName, parentId: selectedSurface.id })
|
||||
rect.set({ name: objName, parentId: selectedSurface.id, points: rectToPolygon(rect) })
|
||||
rect.setCoords()
|
||||
initEvent()
|
||||
|
||||
@ -232,7 +232,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '개구를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
@ -244,14 +244,14 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon))
|
||||
|
||||
if (isCross) {
|
||||
swalFire({ text: '겹치기 불가요...', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.notinstall.cross'), icon: 'error' })
|
||||
deleteTempObjects()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
isDown = false
|
||||
rect.set({ name: objName, parentId: selectedSurface.id })
|
||||
rect.set({ name: objName, parentId: selectedSurface.id, points: rectToPolygon(rect) })
|
||||
rect.setCoords()
|
||||
initEvent()
|
||||
if (setIsHidden) setIsHidden(false)
|
||||
@ -377,12 +377,9 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
const trianglePolygon = pointsToTurfPolygon(triangleToPolygon(dormer))
|
||||
const selectedSurfacePolygon = polygonToTurfPolygon(selectedSurface)
|
||||
|
||||
console.log('trianglePolygon', trianglePolygon)
|
||||
console.log('selectedSurfacePolygon', selectedSurfacePolygon)
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(trianglePolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '도머를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
@ -406,6 +403,8 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
direction = 'north'
|
||||
}
|
||||
|
||||
const groupPoints = offsetRef > 0 ? triangleToPolygon(dormerOffset) : triangleToPolygon(dormer)
|
||||
|
||||
let splitedTriangle = offsetRef > 0 ? splitDormerTriangle(dormerOffset, directionRef) : splitDormerTriangle(dormer, directionRef)
|
||||
canvas?.remove(offsetRef > 0 ? dormerOffset : dormer)
|
||||
|
||||
@ -499,6 +498,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
parentId: selectedSurface.id,
|
||||
originX: 'center',
|
||||
originY: 'center',
|
||||
groupPoints: groupPoints,
|
||||
})
|
||||
canvas?.add(objectGroup)
|
||||
|
||||
@ -604,7 +604,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(pentagonPolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '도머를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
@ -708,6 +708,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
}
|
||||
|
||||
const groupPolygon = offsetPolygon ? [leftPentagon, rightPentagon, offsetPolygon] : [leftPentagon, rightPentagon]
|
||||
const groupPoints = offsetRef > 0 ? pentagonOffsetPoints : pentagonPoints
|
||||
|
||||
const objectGroup = new fabric.Group(groupPolygon, {
|
||||
subTargetCheck: true,
|
||||
@ -717,6 +718,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
groupYn: true,
|
||||
originX: 'center',
|
||||
originY: 'center',
|
||||
groupPoints: groupPoints,
|
||||
})
|
||||
canvas?.add(objectGroup)
|
||||
|
||||
|
||||
@ -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 {
|
||||
adsorptionPointModeState,
|
||||
@ -35,6 +35,7 @@ import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementSha
|
||||
import { useCanvasMenu } from '../common/useCanvasMenu'
|
||||
import { menuTypeState } from '@/store/menuAtom'
|
||||
import { usePopup } from '../usePopup'
|
||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||
|
||||
const defaultDotLineGridSetting = {
|
||||
INTERVAL: {
|
||||
@ -122,6 +123,8 @@ export function useCanvasSetting() {
|
||||
|
||||
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
||||
|
||||
const { floorPlanState } = useContext(FloorPlanContext)
|
||||
|
||||
const { closeAll } = usePopup()
|
||||
|
||||
useEffect(() => {
|
||||
@ -170,7 +173,6 @@ export function useCanvasSetting() {
|
||||
const previousRoofMaterialsRef = useRef(null)
|
||||
|
||||
useEffect(() => {
|
||||
//console.log('🚀 ~ useEffect ~ roofMaterials 22 :', previousRoofMaterialsYn, roofMaterials.length , JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials))
|
||||
// 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음
|
||||
if (
|
||||
(!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo) ||
|
||||
@ -194,6 +196,9 @@ export function useCanvasSetting() {
|
||||
}
|
||||
const { column } = corridorDimension
|
||||
const lengthTexts = canvas.getObjects().filter((obj) => obj.name === 'lengthText')
|
||||
lengthTexts.forEach((obj) => {
|
||||
obj.set({ text: '' })
|
||||
})
|
||||
switch (column) {
|
||||
case 'corridorDimension':
|
||||
lengthTexts.forEach((obj) => {
|
||||
@ -219,7 +224,6 @@ export function useCanvasSetting() {
|
||||
}, [corridorDimension])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ useEffect ~ settingsDataSave:', settingsDataSave)
|
||||
if (settingsDataSave !== undefined) onClickOption2()
|
||||
}, [settingsData])
|
||||
|
||||
@ -297,9 +301,7 @@ export function useCanvasSetting() {
|
||||
// 기본설정(PlacementShapeSetting) 조회 및 초기화
|
||||
const fetchBasicSettings = async () => {
|
||||
try {
|
||||
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}` }).then((res) => {
|
||||
console.log('🚀 ~ fetchBasicSettings ~ res >>>>>>>>>> :', res)
|
||||
|
||||
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${floorPlanState.objectNo}` }).then((res) => {
|
||||
let roofsRow = {}
|
||||
let roofsArray = {}
|
||||
|
||||
@ -313,7 +315,7 @@ export function useCanvasSetting() {
|
||||
roofsArray = res.map((item) => {
|
||||
return {
|
||||
roofApply: item.roofApply,
|
||||
roofSeq: 0,
|
||||
roofSeq: item.roofSeq,
|
||||
roofMatlCd: item.roofMatlCd,
|
||||
roofWidth: item.roofWidth,
|
||||
roofHeight: item.roofHeight,
|
||||
@ -370,7 +372,6 @@ export function useCanvasSetting() {
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log('🚀 ~ fetchBasicSettings ~ addRoofs:', addRoofs)
|
||||
setAddedRoofs(addRoofs)
|
||||
setBasicSettings({
|
||||
...basicSetting,
|
||||
@ -378,16 +379,16 @@ export function useCanvasSetting() {
|
||||
roofSizeSet: roofsRow[0].roofSizeSet,
|
||||
roofAngleSet: roofsRow[0].roofAngleSet,
|
||||
roofsData: roofsArray,
|
||||
selectedRoofMaterial: addRoofs[0],
|
||||
selectedRoofMaterial: addRoofs.find((roof) => roof.selected),
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Data fetching error:', error)
|
||||
}
|
||||
|
||||
if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) {
|
||||
setBasicSettings({ ...canvasSetting })
|
||||
}
|
||||
// if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) {
|
||||
// setBasicSettings({ ...canvasSetting })
|
||||
// }
|
||||
setCanvasSetting({ ...basicSetting })
|
||||
}
|
||||
|
||||
@ -451,7 +452,7 @@ export function useCanvasSetting() {
|
||||
// CanvasSetting 조회 및 초기화
|
||||
const fetchSettings = async () => {
|
||||
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)
|
||||
|
||||
if (Object.keys(res).length > 0) {
|
||||
|
||||
@ -169,6 +169,7 @@ export function useRoofAllocationSetting(id) {
|
||||
roofSizeSet: res[0].roofSizeSet,
|
||||
roofAngleSet: res[0].roofAngleSet,
|
||||
roofsData: roofsArray,
|
||||
selectedRoofMaterial: selectRoofs.find((roof) => roof.selected),
|
||||
})
|
||||
setBasicInfo({
|
||||
roofSizeSet: '' + res[0].roofSizeSet,
|
||||
@ -188,7 +189,7 @@ export function useRoofAllocationSetting(id) {
|
||||
roofSizeSet: Number(basicSetting.roofSizeSet),
|
||||
roofAngleSet: basicSetting.roofAngleSet,
|
||||
roofAllocationList: currentRoofList.map((item, index) => ({
|
||||
roofApply: item.selected === null || item.selected === undefined ? 'true' : item.selected,
|
||||
roofApply: item.selected,
|
||||
roofSeq: index,
|
||||
roofMatlCd: item.roofMatlCd === null || item.roofMatlCd === undefined ? 'ROOF_ID_WA_53A' : item.roofMatlCd,
|
||||
roofWidth: item.width === null || item.width === undefined ? 0 : Number(item.width),
|
||||
|
||||
@ -181,6 +181,7 @@ export function usePlan(params = {}) {
|
||||
setPlans((plans) => [...plans, { id: res.data, objectNo: objectNo, planNo: planNo, userId: userId, canvasStatus: canvasStatus }])
|
||||
}
|
||||
updateCurrentPlan(res.data)
|
||||
swalFire({ text: getMessage('plan.message.save') })
|
||||
})
|
||||
.catch((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 })
|
||||
.then((res) => {
|
||||
setPlans((plans) => plans.map((plan) => (plan.id === currentCanvasPlan.id ? { ...plan, canvasStatus: canvasStatus } : plan)))
|
||||
swalFire({ text: getMessage('plan.message.save') })
|
||||
})
|
||||
.catch((error) => {
|
||||
swalFire({ text: error.message, icon: 'error' })
|
||||
|
||||
@ -429,7 +429,7 @@ export const usePolygon = () => {
|
||||
|
||||
const sameDirectionCnt = canvas.getObjects().filter((obj) => {
|
||||
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)
|
||||
@ -860,9 +860,9 @@ export const usePolygon = () => {
|
||||
})
|
||||
|
||||
polygonLines.forEach((line) => {
|
||||
line.set({ strokeWidth: 5, stroke: 'green' })
|
||||
/*line.set({ strokeWidth: 5, stroke: 'green' })
|
||||
canvas.add(line)
|
||||
canvas.renderAll()
|
||||
canvas.renderAll()*/
|
||||
const startPoint = line.startPoint // 시작점
|
||||
let arrivalPoint = line.endPoint // 도착점
|
||||
|
||||
|
||||
@ -311,6 +311,9 @@
|
||||
"plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?",
|
||||
"plan.message.save": "저장되었습니다.",
|
||||
"plan.message.delete": "삭제되었습니다.",
|
||||
"plan.message.leave": "물건현황(목록)으로 이동하시겠습니까? [예]를 선택한 경우, 저장하고 이동합니다.",
|
||||
"plan.message.confirm.yes": "예",
|
||||
"plan.message.confirm.no": "아니오",
|
||||
"setting": "設定",
|
||||
"delete": "삭제(JA)",
|
||||
"delete.all": "전체 삭제(JA)",
|
||||
@ -976,5 +979,6 @@
|
||||
"can.not.copy.module": "모듈을 복사할 수 없습니다.(JA)",
|
||||
"can.not.remove.module": "모듈을 삭제할 수 없습니다.(JA)",
|
||||
"can.not.insert.module": "모듈을 삽입할 수 없습니다.(JA)",
|
||||
"can.not.align.module": "모듈을 정렬할 수 없습니다.(JA)"
|
||||
"can.not.align.module": "모듈을 정렬할 수 없습니다.(JA)",
|
||||
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다."
|
||||
}
|
||||
|
||||
@ -95,6 +95,7 @@
|
||||
"modal.module.basic.setting.module.construction.method": "공법",
|
||||
"modal.module.basic.setting.module.under.roof": "지붕밑바탕",
|
||||
"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.info2": "※ 모듈 배치 시에는 시공 매뉴얼에 기재된 <모듈 배치 조건>을 반드시 확인해주십시오.",
|
||||
"modal.module.basic.setting.module.stuff.info": "물건정보",
|
||||
@ -311,6 +312,9 @@
|
||||
"plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?",
|
||||
"plan.message.save": "저장되었습니다.",
|
||||
"plan.message.delete": "삭제되었습니다.",
|
||||
"plan.message.leave": "물건현황(목록)으로 이동하시겠습니까? [예]를 선택한 경우, 저장하고 이동합니다.",
|
||||
"plan.message.corfirm.yes": "예",
|
||||
"plan.message.confirm.no": "아니오",
|
||||
"setting": "설정",
|
||||
"delete": "삭제",
|
||||
"delete.all": "전체 삭제",
|
||||
@ -988,5 +992,10 @@
|
||||
"module.place.no.surface": "선택된 모듈 설치면이 없습니다.",
|
||||
"module.place.select.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": "오브젝트는 겹쳐서 설치 할 수 없습니다."
|
||||
}
|
||||
|
||||
@ -81,6 +81,7 @@ export const moduleSelectionDataState = atom({
|
||||
key: 'moduleSelectionDataState',
|
||||
default: {
|
||||
common: {},
|
||||
module: {},
|
||||
roofConstructions: [],
|
||||
},
|
||||
dangerouslyAllowMutability: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user