This commit is contained in:
hyojun.choi 2025-01-22 14:12:56 +09:00
commit c5aefaa457
21 changed files with 632 additions and 309 deletions

View File

@ -42,9 +42,19 @@ export const FloorPlanContext = createContext({
})
const FloorPlanProvider = ({ children }) => {
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])
//useEffect(() => { // 오류 발생으로 useEffect 사용
// if (pathname === '/floor-plan') {

View File

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

View File

@ -31,7 +31,7 @@ export default function CanvasFrame() {
const loadCanvas = () => {
if (canvas) {
canvas?.clear() // .
if (selectedPlan?.canvasStatus && floorPlanState.objectNo === selectedPlan.objectNo && floorPlanState.pid === selectedPlan.planNo) {
if (selectedPlan?.canvasStatus && floorPlanState.objectNo === selectedPlan.objectNo) {
canvas?.loadFromJSON(JSON.parse(selectedPlan.canvasStatus), function () {
canvasLoadInit() //config
canvas?.renderAll() // .

View File

@ -254,10 +254,7 @@ export default function CanvasMenu(props) {
cancelButtonText: getMessage('plan.message.confirm.no'),
confirmFn: async () => {
await handleSaveCanvas()
router.push(`/management/stuff/detail?objectNo=${objectNo}`)
},
denyFn: () => {
router.push(`/management/stuff/detail?objectNo=${objectNo}`)
router.push(`/management/stuff`)
},
})
}

View File

@ -11,17 +11,19 @@ import { useSetRecoilState } from 'recoil'
import { correntObjectNoState } from '@/store/settingAtom'
export default function FloorPlan({ children }) {
const pathname = usePathname()
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
const searchParams = useSearchParams()
const objectNo = searchParams.get('objectNo')
const pid = searchParams.get('pid')
if (pathname === '/floor-plan') {
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
notFound()
}
setCurrentObjectNo(objectNo)
}
// 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()

View File

@ -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)
}

View File

@ -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}

View File

@ -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>

View File

@ -20,6 +20,8 @@ export default function StepUp(props) {
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,
}
getPcsVoltageStepUpList(null)
//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>

View File

@ -15,6 +15,7 @@ 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()
@ -22,8 +23,7 @@ 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([])
@ -33,15 +33,42 @@ export default function MainContents() {
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 {
@ -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">

View File

@ -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({

View File

@ -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
@ -2462,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"
@ -2473,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
})}

View File

@ -343,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 = ''
@ -356,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'
@ -504,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({
@ -561,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
@ -720,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 = ''
}
}
}
@ -802,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)

View File

@ -18,7 +18,7 @@ export function useCanvasPopupStatusController(param = 1) {
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:

View File

@ -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
//평평하면

View File

@ -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,

View File

@ -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(() => {

View File

@ -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)

View File

@ -311,7 +311,7 @@
"plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?",
"plan.message.save": "저장되었습니다.",
"plan.message.delete": "삭제되었습니다.",
"plan.message.leave": "작성한 물건을 저장하시겠습니까? [아니오]를 선택한 경우, 저장하지 않고 물건현황 목록으로 이동합니다.",
"plan.message.leave": "물건현황(목록)으로 이동하시겠습니까? [예]를 선택한 경우, 저장하고 이동합니다.",
"plan.message.confirm.yes": "예",
"plan.message.confirm.no": "아니오",
"setting": "設定",

View File

@ -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,7 +312,7 @@
"plan.message.confirm.delete": "PLAN을 삭제하시겠습니까?",
"plan.message.save": "저장되었습니다.",
"plan.message.delete": "삭제되었습니다.",
"plan.message.leave": "작성한 물건을 저장하시겠습니까? [아니오]를 선택한 경우, 저장하지 않고 물건현황 목록으로 이동합니다.",
"plan.message.leave": "물건현황(목록)으로 이동하시겠습니까? [예]를 선택한 경우, 저장하고 이동합니다.",
"plan.message.corfirm.yes": "예",
"plan.message.confirm.no": "아니오",
"setting": "설정",
@ -992,5 +993,9 @@
"module.place.select.module": "모듈을 선택해주세요.",
"module.place.select.one.module": "모듈은 하나만 선택해주세요.",
"batch.canvas.delete.all": "배치면 내용을 전부 삭제하시겠습니까?",
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다."
"module.not.found": "설치 모듈을 선택하세요.",
"construction.length.difference": "지붕면 공법을 전부 선택해주세요.",
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다.",
"batch.object.outside.roof": "오브젝트는 지붕내에 설치해야 합니다.",
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다."
}

View File

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