Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into qcast-pub
This commit is contained in:
commit
cd788a3941
@ -1,13 +1,13 @@
|
|||||||
import { useEffect, useState, useReducer } from 'react'
|
import { useEffect, useState, useReducer } from 'react'
|
||||||
import { useRecoilValue, useRecoilState } from 'recoil'
|
import { useRecoilValue, useRecoilState } from 'recoil'
|
||||||
import { addedRoofsState } from '@/store/settingAtom'
|
import { addedRoofsState } from '@/store/settingAtom'
|
||||||
import { canvasSettingState, pitchSelector } from '@/store/canvasAtom'
|
import { canvasSettingState, currentCanvasPlanState, pitchSelector } from '@/store/canvasAtom'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
import { useModuleSelection } from '@/hooks/module/useModuleSelection'
|
import { useModuleSelection } from '@/hooks/module/useModuleSelection'
|
||||||
import ModuleTabContents from './ModuleTabContents'
|
import ModuleTabContents from './ModuleTabContents'
|
||||||
import { useDebounceCallback, useDebounceValue } from 'usehooks-ts'
|
import { useDebounceCallback, useDebounceValue } from 'usehooks-ts'
|
||||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataPlanListState, moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
|
|
||||||
export default function Module({ setTabNum }) {
|
export default function Module({ setTabNum }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -38,6 +38,9 @@ export default function Module({ setTabNum }) {
|
|||||||
const [debouncedVerticalSnowCover] = useDebounceValue(inputVerticalSnowCover, 500)
|
const [debouncedVerticalSnowCover] = useDebounceValue(inputVerticalSnowCover, 500)
|
||||||
|
|
||||||
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
||||||
|
const [moduleSelectionDataPlanList, setModuleSelectionDataPlanList] = useRecoilState(moduleSelectionDataPlanListState)
|
||||||
|
|
||||||
|
const [currentCanvasPlan, setCurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
||||||
|
|
||||||
const [tempModuleSelectionData, setTempModuleSelectionData] = useReducer((prevState, nextState) => {
|
const [tempModuleSelectionData, setTempModuleSelectionData] = useReducer((prevState, nextState) => {
|
||||||
return { ...prevState, ...nextState }
|
return { ...prevState, ...nextState }
|
||||||
@ -69,11 +72,15 @@ export default function Module({ setTabNum }) {
|
|||||||
rows: [],
|
rows: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('currentCanvasPlan', currentCanvasPlan)
|
||||||
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {}, [roofTab])
|
useEffect(() => {}, [roofTab])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('moduleSelectionData', moduleSelectionData)
|
setModuleSelectionDataPlanList({ ...moduleSelectionDataPlanList, [currentCanvasPlan.id]: moduleSelectionData })
|
||||||
}, [])
|
}, [moduleSelectionData])
|
||||||
|
|
||||||
const handleRoofTab = (tab) => {
|
const handleRoofTab = (tab) => {
|
||||||
setRoofTab(tab)
|
setRoofTab(tab)
|
||||||
@ -239,6 +246,7 @@ export default function Module({ setTabNum }) {
|
|||||||
setModuleSelectionData={setModuleSelectionData}
|
setModuleSelectionData={setModuleSelectionData}
|
||||||
tempModuleSelectionData={tempModuleSelectionData}
|
tempModuleSelectionData={tempModuleSelectionData}
|
||||||
setTempModuleSelectionData={setTempModuleSelectionData}
|
setTempModuleSelectionData={setTempModuleSelectionData}
|
||||||
|
selectedModule={selectedModules}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ export default function ModuleTabContents({
|
|||||||
setModuleSelectionData,
|
setModuleSelectionData,
|
||||||
tempModuleSelectionData,
|
tempModuleSelectionData,
|
||||||
setTempModuleSelectionData,
|
setTempModuleSelectionData,
|
||||||
|
selectedModule,
|
||||||
}) {
|
}) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [roofMaterial, setRoofMaterial] = useState(addRoof) //지붕재`
|
const [roofMaterial, setRoofMaterial] = useState(addRoof) //지붕재`
|
||||||
@ -242,6 +243,7 @@ export default function ModuleTabContents({
|
|||||||
setConstructionList([])
|
setConstructionList([])
|
||||||
|
|
||||||
if (isObjectNotEmpty(moduleConstructionSelectionData)) {
|
if (isObjectNotEmpty(moduleConstructionSelectionData)) {
|
||||||
|
//기존에 데이터가 있으면
|
||||||
setConstructionParams({ ...moduleConstructionSelectionData.trestle, constMthdCd: '', roofBaseCd: '' })
|
setConstructionParams({ ...moduleConstructionSelectionData.trestle, constMthdCd: '', roofBaseCd: '' })
|
||||||
setRoofBaseParams({ ...moduleConstructionSelectionData.trestle, roofBaseCd: '' })
|
setRoofBaseParams({ ...moduleConstructionSelectionData.trestle, roofBaseCd: '' })
|
||||||
setCvrChecked(moduleConstructionSelectionData.construction.setupCover)
|
setCvrChecked(moduleConstructionSelectionData.construction.setupCover)
|
||||||
@ -251,7 +253,7 @@ export default function ModuleTabContents({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTempModuleSelectionData({ common: moduleSelectionInitParams })
|
setTempModuleSelectionData({ common: moduleSelectionInitParams, module: selectedModule })
|
||||||
}, [moduleSelectionInitParams])
|
}, [moduleSelectionInitParams])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -8,7 +8,9 @@ import { useModulePlace } from '@/hooks/module/useModulePlace'
|
|||||||
|
|
||||||
const Placement = forwardRef((props, refs) => {
|
const Placement = forwardRef((props, refs) => {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [isChidori, setIsChidori] = useState('false')
|
const [isChidori, setIsChidori] = useState(false)
|
||||||
|
const [isChidoriNotAble, setIsChidoriNotAble] = useState(false)
|
||||||
|
|
||||||
const [setupLocation, setSetupLocation] = useState('center')
|
const [setupLocation, setSetupLocation] = useState('center')
|
||||||
const [isMaxSetup, setIsMaxSetup] = useState('false')
|
const [isMaxSetup, setIsMaxSetup] = useState('false')
|
||||||
const [selectedItems, setSelectedItems] = useState({})
|
const [selectedItems, setSelectedItems] = useState({})
|
||||||
@ -21,9 +23,13 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
|
|
||||||
//모듈 배치면 생성
|
//모듈 배치면 생성
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('🚀 ~ Placement ~ moduleSelectionData:', moduleSelectionData)
|
|
||||||
console.log('🚀 ~ Placement ~ selectedModules:', selectedModules)
|
|
||||||
makeModuleInstArea()
|
makeModuleInstArea()
|
||||||
|
|
||||||
|
//1개라도 치도리 불가가 있으면 치도리 불가
|
||||||
|
const isChidroriValue = moduleSelectionData.roofConstructions.some((item) => item.construction.plvrYn === 'N')
|
||||||
|
if (isChidroriValue) {
|
||||||
|
setIsChidoriNotAble(true)
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//체크된 모듈 데이터
|
//체크된 모듈 데이터
|
||||||
@ -127,19 +133,19 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
<div className="self-item-td">
|
<div className="self-item-td">
|
||||||
<div className="pop-form-radio">
|
<div className="pop-form-radio">
|
||||||
<div className="d-check-radio pop">
|
<div className="d-check-radio pop">
|
||||||
<input type="radio" name="radio01" id="ra01" checked={isChidori === 'true'} value={'true'} onChange={handleChangeChidori} />
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="radio01"
|
||||||
|
id="ra01"
|
||||||
|
checked={isChidori}
|
||||||
|
disabled={isChidoriNotAble}
|
||||||
|
value={true}
|
||||||
|
onChange={handleChangeChidori}
|
||||||
|
/>
|
||||||
<label htmlFor="ra01">{getMessage('modal.module.basic.setting.module.placement.do')}</label>
|
<label htmlFor="ra01">{getMessage('modal.module.basic.setting.module.placement.do')}</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="d-check-radio pop">
|
<div className="d-check-radio pop">
|
||||||
<input
|
<input type="radio" name="radio02" id="ra02" value={false} checked={isChidori === false} onChange={handleChangeChidori} />
|
||||||
type="radio"
|
|
||||||
name="radio02"
|
|
||||||
id="ra02"
|
|
||||||
value={'false'}
|
|
||||||
defaultChecked
|
|
||||||
checked={isChidori === 'false'}
|
|
||||||
onChange={handleChangeChidori}
|
|
||||||
/>
|
|
||||||
<label htmlFor="ra02">{getMessage('modal.module.basic.setting.module.placement.do.not')}</label>
|
<label htmlFor="ra02">{getMessage('modal.module.basic.setting.module.placement.do.not')}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -479,7 +479,8 @@ export function useModuleBasicSetting() {
|
|||||||
//안겹치면 넣는다
|
//안겹치면 넣는다
|
||||||
// tempModule.setCoords()
|
// tempModule.setCoords()
|
||||||
moduleOptions.surfaceId = trestlePolygon.id
|
moduleOptions.surfaceId = trestlePolygon.id
|
||||||
let manualModule = new QPolygon(tempModule.points, { ...moduleOptions })
|
|
||||||
|
let manualModule = new QPolygon(tempModule.points, { ...moduleOptions, moduleInfo: checkedModule[0] })
|
||||||
canvas?.add(manualModule)
|
canvas?.add(manualModule)
|
||||||
manualDrawModules.push(manualModule)
|
manualDrawModules.push(manualModule)
|
||||||
} else {
|
} else {
|
||||||
@ -747,7 +748,7 @@ export function useModuleBasicSetting() {
|
|||||||
leftMargin = i === 0 ? 0 : intvHor * i
|
leftMargin = i === 0 ? 0 : intvHor * i
|
||||||
chidoriLength = 0
|
chidoriLength = 0
|
||||||
if (isChidori) {
|
if (isChidori) {
|
||||||
chidoriLength = j % 2 === 0 ? 0 : width / 2
|
chidoriLength = j % 2 === 0 ? 0 : width / 2 - intvHor
|
||||||
}
|
}
|
||||||
|
|
||||||
square = [
|
square = [
|
||||||
@ -762,7 +763,7 @@ export function useModuleBasicSetting() {
|
|||||||
let turfCoordnates = squarePolygon.geometry.coordinates[0].slice(0, -1)
|
let turfCoordnates = squarePolygon.geometry.coordinates[0].slice(0, -1)
|
||||||
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
||||||
|
|
||||||
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id }
|
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id, moduleInfo: module }
|
||||||
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
||||||
|
|
||||||
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
||||||
@ -848,7 +849,7 @@ export function useModuleBasicSetting() {
|
|||||||
leftMargin = j === 0 ? 0 : intvVer * j
|
leftMargin = j === 0 ? 0 : intvVer * j
|
||||||
chidoriLength = 0
|
chidoriLength = 0
|
||||||
if (isChidori) {
|
if (isChidori) {
|
||||||
chidoriLength = i % 2 === 0 ? 0 : height / 2
|
chidoriLength = i % 2 === 0 ? 0 : height / 2 - intvHor
|
||||||
}
|
}
|
||||||
|
|
||||||
square = [
|
square = [
|
||||||
@ -864,7 +865,7 @@ export function useModuleBasicSetting() {
|
|||||||
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
||||||
|
|
||||||
// if (disjointFromTrestle && isDisjoint) {
|
// if (disjointFromTrestle && isDisjoint) {
|
||||||
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id }
|
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id, moduleInfo: module }
|
||||||
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
||||||
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
||||||
let isDisjoint = checkModuleDisjointObjects(squarePolygon, containsBatchObjects)
|
let isDisjoint = checkModuleDisjointObjects(squarePolygon, containsBatchObjects)
|
||||||
@ -959,7 +960,7 @@ export function useModuleBasicSetting() {
|
|||||||
leftMargin = i === 0 ? 0 : intvHor * i
|
leftMargin = i === 0 ? 0 : intvHor * i
|
||||||
chidoriLength = 0
|
chidoriLength = 0
|
||||||
if (isChidori) {
|
if (isChidori) {
|
||||||
chidoriLength = j % 2 === 0 ? 0 : width / 2
|
chidoriLength = j % 2 === 0 ? 0 : width / 2 - intvHor
|
||||||
}
|
}
|
||||||
|
|
||||||
square = [
|
square = [
|
||||||
@ -975,7 +976,7 @@ export function useModuleBasicSetting() {
|
|||||||
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
||||||
|
|
||||||
// if (disjointFromTrestle && isDisjoint) {
|
// if (disjointFromTrestle && isDisjoint) {
|
||||||
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id }
|
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id, moduleInfo: module }
|
||||||
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
||||||
|
|
||||||
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
||||||
@ -1059,7 +1060,7 @@ export function useModuleBasicSetting() {
|
|||||||
|
|
||||||
chidoriLength = 0
|
chidoriLength = 0
|
||||||
if (isChidori) {
|
if (isChidori) {
|
||||||
chidoriLength = i % 2 === 0 ? 0 : height / 2
|
chidoriLength = i % 2 === 0 ? 0 : height / 2 - intvHor
|
||||||
}
|
}
|
||||||
|
|
||||||
square = [
|
square = [
|
||||||
@ -1075,7 +1076,7 @@ export function useModuleBasicSetting() {
|
|||||||
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
let points = turfCoordnates.map((coord) => ({ x: coord[0], y: coord[1] }))
|
||||||
|
|
||||||
// if (disjointFromTrestle && isDisjoint) {
|
// if (disjointFromTrestle && isDisjoint) {
|
||||||
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id }
|
moduleOptions = { ...moduleOptions, fill: module.color, surfaceId: moduleSetupSurface.id, moduleInfo: module }
|
||||||
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
let tempModule = new QPolygon(points, { ...moduleOptions, turfPoints: squarePolygon })
|
||||||
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
let disjointFromTrestle = checkModuleDisjointSurface(squarePolygon, polygonToTurfPolygon(moduleSetupSurface, true))
|
||||||
let isDisjoint = checkModuleDisjointObjects(squarePolygon, containsBatchObjects)
|
let isDisjoint = checkModuleDisjointObjects(squarePolygon, containsBatchObjects)
|
||||||
|
|||||||
@ -12,10 +12,6 @@ export function useModulePlace() {
|
|||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
const { getTrestleDetailList } = useMasterController()
|
const { getTrestleDetailList } = useMasterController()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log('🚀 ~ useModulePlace ~ moduleSelectionData:', moduleSelectionData)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const common = moduleSelectionData.common
|
const common = moduleSelectionData.common
|
||||||
const roofConstructions = moduleSelectionData.roofConstructions
|
const roofConstructions = moduleSelectionData.roofConstructions
|
||||||
|
|||||||
@ -85,3 +85,9 @@ export const moduleSelectionDataState = atom({
|
|||||||
},
|
},
|
||||||
dangerouslyAllowMutability: true,
|
dangerouslyAllowMutability: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export const moduleSelectionDataPlanListState = atom({
|
||||||
|
key: 'moduleSelectionDataPlanListState',
|
||||||
|
default: {},
|
||||||
|
dangerouslyAllowMutability: true,
|
||||||
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user