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

This commit is contained in:
김민식 2025-03-17 14:12:19 +09:00
commit 65e77ad2ed
22 changed files with 273 additions and 156 deletions

View File

@ -202,6 +202,7 @@ export const SAVE_KEY = [
'fontStyle',
'fontWeight',
'dormerAttributes',
'toFixed',
]
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype]

View File

@ -2,9 +2,13 @@
import { useState } from 'react'
import Draggable from 'react-draggable'
import PopSpinner from '../spinner/PopSpinner'
import { popSpinnerState } from '@/store/popupAtom'
import { useRecoilState } from 'recoil'
export default function WithDraggable({ isShow, children, pos = { x: 0, y: 0 }, handle = '', className = '', hasFooter = true, isHidden = false }) {
const [position, setPosition] = useState(pos)
const [popSpinnerStore, setPopSpinnerStore] = useRecoilState(popSpinnerState)
const handleOnDrag = (e, data) => {
e.stopPropagation()
@ -25,6 +29,7 @@ export default function WithDraggable({ isShow, children, pos = { x: 0, y: 0 },
<div className={`modal-pop-wrap ${className}`} style={{ visibility: isHidden ? 'hidden' : 'visible' }}>
{children}
{hasFooter && <WithDraggableFooter />}
{popSpinnerStore && <PopSpinner />}
</div>
</Draggable>
)}

View File

@ -480,10 +480,6 @@ export default function Estimate({}) {
//Pricing
const handlePricing = async (showPriceCd) => {
//todo: YJSS swalFire
if (estimateContextState.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
const param = {
saleStoreId: session.storeId,
sapSalesStoreCd: session.custCd,
@ -699,14 +695,10 @@ export default function Estimate({}) {
/* 케이블 select 변경시 */
const onChangeDisplayCableItem = (value, itemList) => {
//todo: YJSS swalFire
if (estimateContextState.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
itemList.map((item, index) => {
if (item.dispCableFlg === '1') {
if (value !== '') {
onChangeDisplayItem(value, item.dispOrder, index)
onChangeDisplayItem(value, item.dispOrder, index, true)
}
}
})
@ -714,11 +706,7 @@ export default function Estimate({}) {
}
// /
const onChangeDisplayItem = (itemId, dispOrder, index) => {
//todo: YJSS swalFire
if (estimateContextState.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
const onChangeDisplayItem = (itemId, dispOrder, index, flag) => {
const param = {
itemId: itemId,
coldZoneFlg: estimateContextState?.coldRegionFlg,
@ -748,7 +736,7 @@ export default function Estimate({}) {
updates.itemGroup = res.itemGroup
updates.delFlg = '0' // 0
updates.saleTotPrice = (res.salePrice * estimateContextState.itemList[index].amount).toString()
updates.amount = ''
updates.amount = flag ? estimateContextState.itemList[index].amount : ''
updates.openFlg = res.openFlg
if (estimateContextState.estimateType === 'YJSS') {
@ -1032,7 +1020,6 @@ export default function Estimate({}) {
})
let dispCableFlgCnt = 0
estimateContextState.itemList.forEach((item) => {
// console.log('YJSS::::::::', item)
if (item.delFlg === '0') {
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
let salePrice
@ -1068,7 +1055,6 @@ export default function Estimate({}) {
}
if (item.dispCableFlg === '1') {
// console.log('YJSS22222::::::::', item)
dispCableFlgCnt++
setCableItem(item.itemId)
}
@ -1356,7 +1342,7 @@ export default function Estimate({}) {
</th>
<td colSpan={3}>
<div className="radio-wrap">
{/* <div className="d-check-radio light mr10">
<div className="d-check-radio light mr10">
<input
type="radio"
name="estimateType"
@ -1370,7 +1356,7 @@ export default function Estimate({}) {
}}
/>
<label htmlFor="YJSS">{getMessage('estimate.detail.estimateType.yjss')}</label>
</div> */}
</div>
<div className="d-check-radio light">
<input
type="radio"
@ -1379,8 +1365,7 @@ export default function Estimate({}) {
value={'YJOD'}
checked={estimateContextState?.estimateType === 'YJOD' ? true : false}
onChange={(e) => {
//todo: YJSS
// setHandlePricingFlag(true)
setHandlePricingFlag(true)
setEstimateContextState({ estimateType: e.target.value })
}}
/>
@ -1677,9 +1662,8 @@ export default function Estimate({}) {
</div>
</div>
</div>
{/* //todo: 추후 YJSS가 다시 나타날 경우 주석 풀기 */}
{/* YJOD면 아래영역 숨김 */}
{/* <div className="common-table bt-able" style={{ display: estimateContextState?.estimateType === 'YJSS' ? '' : 'none' }}>
<div className="common-table bt-able" style={{ display: estimateContextState?.estimateType === 'YJSS' ? '' : 'none' }}>
<table>
<colgroup>
<col style={{ width: '160px' }} />
@ -1714,7 +1698,7 @@ export default function Estimate({}) {
</tr>
</tbody>
</table>
</div> */}
</div>
{/* 제품정보 끝 */}
{/* 가격표시영역시작 */}
<div className="estimate-product-option">
@ -1871,7 +1855,7 @@ export default function Estimate({}) {
options={originDisplayItemList}
onChange={(e) => {
if (isObjectNotEmpty(e)) {
onChangeDisplayItem(e.itemId, item.dispOrder, index)
onChangeDisplayItem(e.itemId, item.dispOrder, index, false)
}
}}
menuPlacement={'auto'}
@ -1895,11 +1879,6 @@ export default function Estimate({}) {
classNamePrefix="custom"
placeholder="Select"
options={cableItemList}
onChange={(e) => {
if (isObjectNotEmpty(e)) {
onChangeDisplayItem(e.clRefChr1, item.dispOrder, index)
}
}}
menuPlacement={'auto'}
getOptionLabel={(x) => x.clRefChr3}
getOptionValue={(x) => x.clRefChr1}

View File

@ -23,6 +23,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
initOptions: null,
direction: null,
arrow: null,
toFixed: 1,
initialize: function (points, options, canvas) {
this.lines = []
this.texts = []
@ -33,11 +34,12 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
this.innerLines = []
this.children = []
this.separatePolygon = []
this.toFixed = options.toFixed ?? 1
// 소수점 전부 제거
points.forEach((point) => {
point.x = Number(point.x.toFixed(1))
point.y = Number(point.y.toFixed(1))
point.x = Number(point.x.toFixed(this.toFixed))
point.y = Number(point.y.toFixed(this.toFixed))
})
options.selectable = options.selectable ?? true
options.sort = options.sort ?? true

View File

@ -89,11 +89,11 @@ export default function CanvasMenu(props) {
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
//
const [buttonStyle1, setButtonStyle1] = useState('') //
const [buttonStyle2, setButtonStyle2] = useState('') //
const [buttonStyle3, setButtonStyle3] = useState('') //
const [buttonStyle4, setButtonStyle4] = useState('') //
const [buttonStyle5, setButtonStyle5] = useState('') //
const [docDownButtonStyle, setDocDownButtonStyle] = useState('') //
const [saveButtonStyle, setSaveButtonStyle] = useState('') //
const [resetButtonStyle, setResetButtonStyle] = useState('') //
const [copyButtonStyle, setCopyButtonStyle] = useState('') //
const [lockButtonStyle, setLockButtonStyle] = useState('') //
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) //
@ -365,11 +365,6 @@ export default function CanvasMenu(props) {
//
const handleEstimateReset = () => {
//todo: YJSS swalFire
if (estimateRecoilState.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
swalFire({
text: getMessage('estimate.detail.reset.confirmMsg'),
type: 'confirm',
@ -447,28 +442,28 @@ export default function CanvasMenu(props) {
}, [estimateContextState?.createUser, estimateContextState?.tempFlg, estimateContextState?.lockFlg, estimateContextState.docNo])
const setAllButtonStyles = (style) => {
setButtonStyle1(style)
setButtonStyle2(style)
setButtonStyle3(style)
setButtonStyle4(style)
setButtonStyle5(style)
setDocDownButtonStyle(style)
setSaveButtonStyle(style)
setResetButtonStyle(style)
setCopyButtonStyle(style)
setLockButtonStyle(style)
}
const handleButtonStyles = (tempFlg, lockFlg, docNo) => {
if (tempFlg === '1') {
setAllButtonStyles('none')
setButtonStyle2('')
setSaveButtonStyle('')
} else if (tempFlg === '0' && lockFlg === '0') {
setAllButtonStyles('')
} else {
setButtonStyle1('')
setButtonStyle2('none')
setButtonStyle3('none')
setButtonStyle4('')
setButtonStyle5('')
setDocDownButtonStyle('')
setSaveButtonStyle('none')
setResetButtonStyle('none')
setCopyButtonStyle('')
setLockButtonStyle('')
}
if (!docNo) {
setButtonStyle1('none')
setDocDownButtonStyle('none')
}
}
@ -518,11 +513,11 @@ export default function CanvasMenu(props) {
//
const docDownPopLockFlg = () => {
setButtonStyle1('')
setButtonStyle2('none')
setButtonStyle3('none')
setButtonStyle4('')
setButtonStyle5('')
setDocDownButtonStyle('')
setSaveButtonStyle('none')
setResetButtonStyle('none')
setCopyButtonStyle('')
setLockButtonStyle('')
}
return (
@ -632,17 +627,22 @@ export default function CanvasMenu(props) {
>
<span className="name">{getMessage('stuff.search.btn.register')}</span>
</button>
<button type="button" style={{ display: buttonStyle1 }} className="btn-frame gray ico-flx" onClick={() => setEstimatePopupOpen(true)}>
<button
type="button"
style={{ display: docDownButtonStyle }}
className="btn-frame gray ico-flx"
onClick={() => setEstimatePopupOpen(true)}
>
<span className="ico ico01"></span>
<span className="name">{getMessage('plan.menu.estimate.docDown')}</span>
</button>
<button type="button" style={{ display: buttonStyle2 }} className="btn-frame gray ico-flx" onClick={handleEstimateSubmit}>
<button type="button" style={{ display: saveButtonStyle }} className="btn-frame gray ico-flx" onClick={handleEstimateSubmit}>
<span className="ico ico02"></span>
<span className="name">{getMessage('plan.menu.estimate.save')}</span>
</button>
<button
type="button"
style={{ display: buttonStyle3 }}
style={{ display: resetButtonStyle }}
className="btn-frame gray ico-flx"
onClick={() => {
handleEstimateReset()
@ -655,7 +655,7 @@ export default function CanvasMenu(props) {
{estimateRecoilState?.docNo !== null && (sessionState.storeId === 'T01' || sessionState.storeLvl === '1') && (
<button
type="button"
style={{ display: buttonStyle4 }}
style={{ display: copyButtonStyle }}
className="btn-frame gray ico-flx"
onClick={() => {
setEstimateCopyPopupOpen(true)
@ -667,7 +667,7 @@ export default function CanvasMenu(props) {
)}
<button
type="button"
style={{ display: buttonStyle5 }}
style={{ display: lockButtonStyle }}
className="btn-frame gray ico-flx"
onClick={() => {
handleEstimateLockController(estimateRecoilState)

View File

@ -46,10 +46,14 @@ export default function PlanSizeSetting(props) {
const changeInput = (value, e) => {
const { name } = e.target
if (Number(value) > 100000) {
value = 100000
}
setPlanSizeSettingMode((prev) => {
return {
...prev,
[name]: Number(value),
[name]: Number(value) / 10,
}
})
}
@ -72,7 +76,7 @@ export default function PlanSizeSetting(props) {
type="text"
className="input-origin block"
name={`originHorizon`}
value={planSizeSettingMode.originHorizon}
value={planSizeSettingMode.originHorizon * 10}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
/>
</div>
@ -85,7 +89,7 @@ export default function PlanSizeSetting(props) {
type="text"
className="input-origin block"
name={`originVertical`}
value={planSizeSettingMode.originVertical}
value={planSizeSettingMode.originVertical * 10}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
/>
</div>

View File

@ -23,7 +23,7 @@ export default function Offset({ length1Ref, arrow1Ref, currentWallLineRef }) {
const keyDown = (e) => {
if (currentWallLineRef.current === null) {
alert('보조선을 먼저 선택하세요')
// alert(' ')
return
}

View File

@ -0,0 +1,71 @@
import React, { useEffect } from 'react'
import { popSpinnerState, promisePopupState } from '@/store/popupAtom'
import { useRecoilState } from 'recoil'
import WithDraggable from '../common/draggable/WithDraggable'
import { useMessage } from '@/hooks/useMessage'
export default function PromisePopup() {
const { getMessage } = useMessage()
const [promisePopupStore, setPromisePopupStore] = useRecoilState(promisePopupState)
const [popSpinnerStore, setPopSpinnerStore] = useRecoilState(popSpinnerState)
const handleSpinner = () => {
setPopSpinnerStore(true)
setTimeout(() => {
setPopSpinnerStore(false)
}, 1000)
}
return (
<WithDraggable isShow={promisePopupStore} pos={{ x: 1000, y: 200 }} className="r">
<WithDraggable.Header title={'popup promise test'} onClose={() => setPromisePopupStore(false)} />
<WithDraggable.Body>
<div className="img-flex-box">
<span className="normal-font mr10">{getMessage('modal.image.load.size.rotate')}</span>
<label className="toggle-btn">
<input type="checkbox" checked={true} value="1" />
<span className="slider"></span>
</label>
</div>
<div className="img-load-from">
<div className="img-load-item">
<div className="d-check-radio pop">
<input type="radio" name="radio03" id="ra06" value={'1'} />
<label htmlFor="ra06">{getMessage('common.input.file')}</label>
</div>
<div className="img-flex-box">
<div className="img-edit-wrap">
<label className="img-edit-btn" htmlFor="img_file">
<span className="img-edit"></span>
{getMessage('common.load')}
</label>
<input type="file" id="img_file" style={{ display: 'none' }} />
</div>
<div className="img-name-wrap">
<input type="text" className="input-origin al-l" value={'test'} readOnly />
</div>
</div>
</div>
<div className="img-load-item">
<div className="d-check-radio pop">
<input type="radio" name="radio03" id="ra07" value={'2'} />
<label htmlFor="ra07">{getMessage('common.input.address.load')}</label>
</div>
<div className="img-flex-box for-address">
<input type="text" className="input-origin al-l mr10" placeholder={'住所入力'} value={'test'} />
<div className="img-edit-wrap">
<button className={`img-edit-btn`}>{getMessage('common.finish')}</button>
</div>
</div>
</div>
</div>
<div className="grid-btn-wrap">
<button className="btn-frame modal act" onClick={handleSpinner}>
{getMessage('common.finish')}
</button>
</div>
</WithDraggable.Body>
</WithDraggable>
)
}

View File

@ -140,6 +140,7 @@ export default function StuffDetail() {
headerName: getMessage('stuff.detail.planGridHeader.moduleModel'),
flex: 1,
wrapText: true,
autoHeight: true,
cellStyle: { alignItems: 'flex-start' /* 좌측정렬*/, cursor: 'pointer' },
cellRenderer: (params) => {
let origin = params.value
@ -282,17 +283,17 @@ export default function StuffDetail() {
autoHeight: true,
cellStyle: { justifyContent: 'center' },
cellRenderer: (params) => {
let buttonStyle = ''
let buttonStyle2 = ''
let estimateDetailButtonStyle = ''
let docDownButtonStyle = ''
if (params.value == null) {
buttonStyle = 'none'
buttonStyle2 = 'none'
estimateDetailButtonStyle = 'none'
docDownButtonStyle = 'none'
} else {
if (params?.data?.createSaleStoreId === 'T01' && session?.storeId !== 'T01') {
buttonStyle = 'none'
estimateDetailButtonStyle = 'none'
}
if (params?.data?.tempFlg === '1' || !params?.data?.docNo) {
buttonStyle2 = 'none'
docDownButtonStyle = 'none'
}
}
@ -300,7 +301,7 @@ export default function StuffDetail() {
<>
<div className="grid-cell-btn">
<button
style={{ display: buttonStyle }}
style={{ display: estimateDetailButtonStyle }}
type="button"
className="grid-btn"
onClick={() => {
@ -314,7 +315,7 @@ export default function StuffDetail() {
{getMessage('stuff.detail.planGrid.btn1')}
</button>
<button
style={{ display: buttonStyle2 }}
style={{ display: docDownButtonStyle }}
type="button"
className="grid-btn"
onClick={() => {
@ -370,6 +371,7 @@ export default function StuffDetail() {
swalFire({
text: getMessage('stuff.detail.header.notExistObjectNo'),
type: 'alert',
icon: 'error',
confirmFn: () => {
router.push('/management/stuff', { scroll: false })
},
@ -387,6 +389,7 @@ export default function StuffDetail() {
swalFire({
text: getMessage('stuff.detail.header.notExistObjectNo'),
type: 'alert',
icon: 'error',
confirmFn: () => {
router.push('/management/stuff', { scroll: false })
},

View File

@ -166,11 +166,6 @@ export const useEstimateController = (planNo, flag) => {
//견적서 저장
const handleEstimateSubmit = async () => {
//todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요
if (estimateData.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
//0. 필수체크
let flag = true
let originFileFlg = false
@ -300,6 +295,18 @@ export const useEstimateController = (planNo, flag) => {
}
}
} else {
if (item.salePrice === null) {
item.salePrice = '0'
} else if (isNaN(item.salePrice)) {
item.salePrice = '0'
}
if (item.unitPrice === null) {
item.unitPrice = '0'
} else if (isNaN(item.unitPrice)) {
item.unitPrice = '0'
}
//봄 컴포넌트 제품은 0으로
item.openFlg = '0'
}
@ -386,6 +393,7 @@ export const useEstimateController = (planNo, flag) => {
estimateData.estimateOption = estimateOptions
// console.log('최종아이템:::', estimateData.itemList)
if (fileList?.length > 0) {
estimateData.fileList = fileList
} else {
@ -413,7 +421,7 @@ export const useEstimateController = (planNo, flag) => {
})
} catch (e) {
setIsGlobalLoading(false)
console.log('error::::::::::::', e.response.data.message)
console.error('error::::::::::::', e.response.data.message)
}
}
@ -423,10 +431,6 @@ export const useEstimateController = (planNo, flag) => {
* T01관리자 계정 1차판매점에게만 제공
*/
const handleEstimateCopy = async (sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId, setEstimateCopyPopupOpen) => {
//todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요
if (estimateData.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
if (saleStoreId === '') {
return swalFire({
text: getMessage('estimate.detail.productFeaturesPopup.requiredStoreId'),

View File

@ -1,7 +1,7 @@
import { useState } from 'react'
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
import { canvasSettingState, canvasState, checkedModuleState, currentObjectState, isManualModuleSetupState } from '@/store/canvasAtom'
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon } from '@/util/canvas-util'
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon, toFixedWithoutRounding } from '@/util/canvas-util'
import { basicSettingState, roofDisplaySelector } from '@/store/settingAtom'
import offsetPolygon, { calculateAngle, createLinesFromPolygon } from '@/util/qpolygon-utils'
import { QPolygon } from '@/components/fabric/QPolygon'
@ -424,6 +424,8 @@ export function useModuleBasicSetting(tabNum) {
* 확인 셀을 이동시킴
*/
const manualModuleSetup = (placementRef) => {
console.log('isManualModuleSetup', isManualModuleSetup)
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
if (isManualModuleSetup) {
@ -493,20 +495,20 @@ export function useModuleBasicSetting(tabNum) {
const points = [
{
x: Number(mousePoint.x.toFixed(1)) + Number((width / 2).toFixed(1)),
y: Number(mousePoint.y.toFixed(1)) - Number((height / 2).toFixed(1)),
x: toFixedWithoutRounding(mousePoint.x, 2) + toFixedWithoutRounding(width / 2, 2),
y: toFixedWithoutRounding(mousePoint.y, 2) - toFixedWithoutRounding(height / 2, 2),
},
{
x: Number(mousePoint.x.toFixed(1)) + Number((width / 2).toFixed(1)),
y: Number(mousePoint.y.toFixed(1)) + Number((height / 2).toFixed(1)),
x: toFixedWithoutRounding(mousePoint.x, 2) + toFixedWithoutRounding(width / 2, 2),
y: toFixedWithoutRounding(mousePoint.y, 2) + toFixedWithoutRounding(height / 2, 2),
},
{
x: Number(mousePoint.x.toFixed(1)) - Number((width / 2).toFixed(1)),
y: Number(mousePoint.y.toFixed(1)) - Number((height / 2).toFixed(1)),
x: toFixedWithoutRounding(mousePoint.x, 2) - toFixedWithoutRounding(width / 2, 2),
y: toFixedWithoutRounding(mousePoint.y, 2) - toFixedWithoutRounding(height / 2, 2),
},
{
x: Number(mousePoint.x.toFixed(1)) - Number((width / 2).toFixed(1)),
y: Number(mousePoint.y.toFixed(1)) + Number((height / 2).toFixed(1)),
x: toFixedWithoutRounding(mousePoint.x, 2) - toFixedWithoutRounding(width / 2, 2),
y: toFixedWithoutRounding(mousePoint.y, 2) + toFixedWithoutRounding(height / 2, 2),
},
]
@ -522,10 +524,10 @@ export function useModuleBasicSetting(tabNum) {
fill: 'white',
stroke: 'black',
strokeWidth: 0.3,
width: Number(width.toFixed(1)),
height: Number(height.toFixed(1)),
left: Number(mousePoint.x.toFixed(1) - Number((width / 2).toFixed(1))),
top: Number(mousePoint.y.toFixed(1) - Number((height / 2).toFixed(1))),
width: toFixedWithoutRounding(width, 2),
height: toFixedWithoutRounding(height, 2),
left: toFixedWithoutRounding(mousePoint.x, 2) - toFixedWithoutRounding(width / 2, 2),
top: toFixedWithoutRounding(mousePoint.y, 2) - toFixedWithoutRounding(height / 2, 2),
selectable: false,
lockMovementX: true,
lockMovementY: true,
@ -546,7 +548,7 @@ export function useModuleBasicSetting(tabNum) {
/**
* 스냅기능
*/
let snapDistance = flowDirection === 'south' || flowDirection === 'north' ? 5 : 5
let snapDistance = flowDirection === 'south' || flowDirection === 'north' ? 70 : 40
let trestleSnapDistance = 15
let intvHor =
@ -558,67 +560,84 @@ export function useModuleBasicSetting(tabNum) {
? moduleSetupSurfaces[i].trestleDetail.moduleIntvlVer / 10
: moduleSetupSurfaces[i].trestleDetail.moduleIntvlHor / 10
const trestleLeft = Number(moduleSetupSurfaces[i].left.toFixed(1)) - Number((moduleSetupSurfaces[i].width / 2).toFixed(1))
const trestleTop = Number(moduleSetupSurfaces[i].top.toFixed(1)) - Number((moduleSetupSurfaces[i].height / 2).toFixed(1))
const trestleRight = Number(moduleSetupSurfaces[i].left.toFixed(1)) + Number((moduleSetupSurfaces[i].width / 2).toFixed(1))
const trestleBottom = Number(moduleSetupSurfaces[i].top.toFixed(1)) + Number((moduleSetupSurfaces[i].height / 2).toFixed(1))
const trestleLeft = toFixedWithoutRounding(moduleSetupSurfaces[i].left, 2) - toFixedWithoutRounding(moduleSetupSurfaces[i].width / 2, 2)
const trestleTop = toFixedWithoutRounding(moduleSetupSurfaces[i].top, 2) - toFixedWithoutRounding(moduleSetupSurfaces[i].height / 2, 2)
const trestleRight =
toFixedWithoutRounding(moduleSetupSurfaces[i].left, 2) + toFixedWithoutRounding(moduleSetupSurfaces[i].width / 2, 2)
const trestleBottom =
toFixedWithoutRounding(moduleSetupSurfaces[i].top, 2) + toFixedWithoutRounding(moduleSetupSurfaces[i].height / 2, 2)
const bigCenterY = (trestleTop + trestleTop + moduleSetupSurfaces[i].height) / 2
// 이동하는 모듈의 경계 좌표
const smallLeft = Number(tempModule.left.toFixed(1))
const smallTop = Number(tempModule.top.toFixed(1))
const smallRight = smallLeft + Number(tempModule.width.toFixed(1))
const smallBottom = smallTop + Number(tempModule.height.toFixed(1))
const smallCenterX = smallLeft + Number((tempModule.width / 2).toFixed(1))
const smallCenterY = smallTop + Number((tempModule.height / 2).toFixed(1))
const smallLeft = toFixedWithoutRounding(tempModule.left, 2)
const smallTop = toFixedWithoutRounding(tempModule.top, 2)
const smallRight = smallLeft + toFixedWithoutRounding(tempModule.width, 2)
const smallBottom = smallTop + toFixedWithoutRounding(tempModule.height, 2)
const smallCenterX = smallLeft + toFixedWithoutRounding(tempModule.width / 2, 2)
const smallCenterY = smallTop + toFixedWithoutRounding(tempModule.height / 2, 2)
/**
* 미리 깔아놓은 셀이 있을때 셀에 흡착됨
*/
if (manualDrawModules) {
manualDrawModules.forEach((cell) => {
const holdCellLeft = cell.left
const holdCellTop = cell.top
const holdCellRight = holdCellLeft + Number(cell.width.toFixed(1))
const holdCellBottom = holdCellTop + Number(cell.height.toFixed(1))
const holdCellCenterX = holdCellLeft + Number((cell.width / 2).toFixed(1))
const holdCellCenterY = holdCellTop + Number((cell.height / 2).toFixed(1))
const holdCellLeft = toFixedWithoutRounding(cell.left, 2)
const holdCellTop = toFixedWithoutRounding(cell.top, 2)
const holdCellRight = holdCellLeft + toFixedWithoutRounding(cell.width, 2)
const holdCellBottom = holdCellTop + toFixedWithoutRounding(cell.height, 2)
const holdCellCenterX = holdCellLeft + toFixedWithoutRounding(cell.width / 2, 2)
const holdCellCenterY = holdCellTop + toFixedWithoutRounding(cell.height / 2, 2)
//가운데 -> 가운대
if (Math.abs(smallCenterX - holdCellCenterX) < snapDistance) {
tempModule.left = holdCellCenterX - toFixedWithoutRounding(width / 2, 2)
}
//왼쪽 -> 가운데
if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) {
// console.log('holdCellCenterX', holdCellCenterX)
// console.log('smallLeft', smallLeft)
// console.log('모듈 센터에 스냅')
tempModule.left = holdCellCenterX + intvHor / 2
// console.log('tempModule.left', tempModule.left)
}
// 오른쪽 -> 가운데
if (Math.abs(smallRight - holdCellCenterX) < snapDistance) {
tempModule.left = holdCellCenterX - width - intvHor / 2
}
//설치된 셀에 좌측에 스냅
if (Math.abs(smallRight - holdCellLeft) < snapDistance) {
// console.log('모듈 좌측 스냅')
tempModule.left = holdCellLeft - width - intvHor
}
//설치된 셀에 우측에 스냅
if (Math.abs(smallLeft - holdCellRight) < snapDistance) {
// console.log('모듈 우측 스냅')
tempModule.left = holdCellRight + intvHor
}
//설치된 셀에 위쪽에 스냅
if (Math.abs(smallBottom - holdCellTop) < snapDistance) {
if (Math.abs(smallBottom - holdCellTop) < 10) {
tempModule.top = holdCellTop - height - intvVer
}
//설치된 셀에 밑쪽에 스냅
if (Math.abs(smallTop - holdCellBottom) < snapDistance) {
if (Math.abs(smallTop - holdCellBottom) < 10) {
tempModule.top = holdCellBottom + intvVer
}
//가운데 -> 가운데
if (Math.abs(smallCenterX - holdCellCenterX) < snapDistance) {
tempModule.left = holdCellCenterX - Number((width / 2).toFixed(1))
}
//왼쪽 -> 가운데
if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) {
tempModule.left = holdCellCenterX + intvHor
}
// 오른쪽 -> 가운데
if (Math.abs(smallRight - holdCellCenterX) < snapDistance) {
tempModule.left = holdCellCenterX - width - intvHor
//설치된 셀에 윗쪽에 스냅
if (Math.abs(smallTop - holdCellTop) < 10) {
tempModule.top = holdCellTop
}
//세로 가운데 -> 가운데
if (Math.abs(smallCenterY - holdCellCenterY) < snapDistance) {
tempModule.top = holdCellCenterY - Number((height / 2).toFixed(1))
}
// if (Math.abs(smallCenterY - holdCellCenterY) < snapDistance) {
// tempModule.top = holdCellCenterY - toFixedWithoutRounding(height / 2, 1)
// }
// //위쪽 -> 가운데
// if (Math.abs(smallTop - holdCellCenterY) < cellSnapDistance) {
// tempModule.top = holdCellCenterY
@ -700,13 +719,19 @@ export function useModuleBasicSetting(tabNum) {
if (!inside) return
if (tempModule) {
const rectPoints = [
{ x: Number(tempModule.left.toFixed(1)), y: Number(tempModule.top.toFixed(1)) },
{ x: Number(tempModule.left.toFixed(1)) + Number(tempModule.width.toFixed(1)), y: Number(tempModule.top.toFixed(1)) },
{ x: toFixedWithoutRounding(tempModule.left, 2), y: toFixedWithoutRounding(tempModule.top, 2) },
{
x: Number(tempModule.left.toFixed(1)) + Number(tempModule.width.toFixed(1)),
y: Number(tempModule.top.toFixed(1)) + Number(tempModule.height.toFixed(1)),
x: toFixedWithoutRounding(tempModule.left, 2) + toFixedWithoutRounding(tempModule.width, 2),
y: toFixedWithoutRounding(tempModule.top, 2),
},
{
x: toFixedWithoutRounding(tempModule.left, 2) + toFixedWithoutRounding(tempModule.width, 2),
y: toFixedWithoutRounding(tempModule.top, 2) + toFixedWithoutRounding(tempModule.height, 2),
},
{
x: toFixedWithoutRounding(tempModule.left, 2),
y: toFixedWithoutRounding(tempModule.top, 2) + toFixedWithoutRounding(tempModule.height, 2),
},
{ x: Number(tempModule.left.toFixed(1)), y: Number(tempModule.top.toFixed(1)) + Number(tempModule.height.toFixed(1)) },
]
tempModule.set({ points: rectPoints })
@ -743,11 +768,13 @@ export function useModuleBasicSetting(tabNum) {
let manualModule = new QPolygon(tempModule.points, {
...moduleOptions,
moduleInfo: checkedModule[0],
left: Number(tempModule.left.toFixed(1)),
top: Number(tempModule.top.toFixed(1)),
width: Number(tempModule.width.toFixed(1)),
height: Number(tempModule.height.toFixed(1)),
left: toFixedWithoutRounding(tempModule.left, 2),
top: toFixedWithoutRounding(tempModule.top, 2),
width: toFixedWithoutRounding(tempModule.width, 2),
height: toFixedWithoutRounding(tempModule.height, 2),
toFixed: 2,
})
canvas?.add(manualModule)
manualDrawModules.push(manualModule)
setModuleStatisticsData()

View File

@ -612,6 +612,9 @@ export function useCanvasSetting(executeEffect = true) {
/** 도면크기 설정 */
setPlanSizeSettingMode({ ...planSizeSettingMode, originHorizon: res.originHorizon, originVertical: res.originVertical })
canvas.setWidth(res.originHorizon)
canvas.setHeight(res.originVertical)
canvas.renderAll()
/** 데이터 설정 */
setSettingModalFirstOptions({

View File

@ -22,6 +22,7 @@ import { useSwal } from '@/hooks/useSwal'
import { usePopup } from '@/hooks/usePopup'
import { calculateAngle, isSamePoint } from '@/util/qpolygon-utils'
import { POLYGON_TYPE } from '@/common/common'
import { useMessage } from '../useMessage'
// 보조선 작성
export function useAuxiliaryDrawing(id, isUseEffect = true) {
@ -34,6 +35,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
const { swalFire } = useSwal()
const { getAdsorptionPoints } = useAdsorptionPoint()
const { closePopup } = usePopup()
const { getMessage } = useMessage()
const adsorptionRange = useRecoilValue(adsorptionRangeState)
@ -411,7 +413,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
const length1Value = length1Ref.current.value
if (diagonalLength <= length1Value) {
alert('대각선 길이는 직선 길이보다 길어야 합니다.')
// alert('대각선 길이는 직선 길이보다 길어야 합니다.')
return
}
@ -832,7 +834,8 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
}
const handleFix = () => {
if (!confirm('보조선 작성을 완료하시겠습니까?')) {
// if (!confirm('보조선 작성을 완료하시겠습니까?')) {
if (!confirm(getMessage('want.to.complete.auxiliary.creation'))) {
return
}

View File

@ -567,7 +567,7 @@ export function useOuterLineWall(id, propertiesId) {
const length1Value = length1Ref.current.value
if (diagonalLength <= length1Value) {
alert('대각선 길이는 직선 길이보다 길어야 합니다.')
// alert('대각선 길이는 직선 길이보다 길어야 합니다.')
return
}
@ -890,7 +890,7 @@ export function useOuterLineWall(id, propertiesId) {
})
if (isAllRightAngle) {
alert('부정확한 다각형입니다.')
// alert('부정확한 다각형입니다.')
return
}

View File

@ -192,7 +192,7 @@ export function useWallLineOffsetSetting(id) {
const handleSave = () => {
if (currentWallLineRef.current === null) {
alert('보조선을 먼저 선택하세요')
// alert('보조선을 먼저 선택하세요')
return
}
switch (type) {

View File

@ -564,7 +564,7 @@ export function usePlacementShapeDrawing(id) {
const length1Value = length1Ref.current.value
if (diagonalLength <= length1Value) {
alert('대각선 길이는 직선 길이보다 길어야 합니다.')
// alert('대각선 길이는 직선 길이보다 길어야 합니다.')
return
}
@ -886,7 +886,7 @@ export function usePlacementShapeDrawing(id) {
})
if (isAllRightAngle) {
alert('부정확한 다각형입니다.')
// alert('부정확한 다각형입니다.')
return
}

View File

@ -64,9 +64,10 @@ export function useEstimate() {
// 캔버스 저장
await saveCanvas(false)
setIsGlobalLoading(false)
/* 견적서 저장이 완료되면 견적서 페이지로 이동 */
moveEstimate(planNo, objectNo)
// moveEstimate(planNo, objectNo)
})
.catch((error) => {
setIsGlobalLoading(false)

View File

@ -1033,5 +1033,6 @@
"canvas.infomation.text": "数字は [半角] 入力のみ可能です。",
"roof.exceed.count": "屋根材は4つまで選択可能です。",
"outerLine.property.fix": "外壁線の属性設定 を完了しますか?",
"outerLine.property.close": "外壁線の属性設定 を終了しますか?"
"outerLine.property.close": "外壁線の属性設定 を終了しますか?",
"want.to.complete.auxiliary.creation": "보補助線の作成を完了しますか?"
}

View File

@ -1033,5 +1033,6 @@
"canvas.infomation.text": "숫자는 [반각] 입력만 가능합니다.",
"roof.exceed.count": "지붕재는 4개까지 선택 가능합니다.",
"outerLine.property.fix": "외벽선 속성 설정을 완료하시겠습니까?",
"outerLine.property.close": "외벽선 속성 설정을 종료하시겠습니까?"
"outerLine.property.close": "외벽선 속성 설정을 종료하시겠습니까?",
"want.to.complete.auxiliary.creation": "보조선 작성을 완료하시겠습니까?"
}

View File

@ -43,7 +43,7 @@ export const fontSizeState = atom({
export const canvasSizeState = atom({
key: 'canvasSize',
default: {
vertical: 1000,
vertical: 1600,
horizontal: 1600,
},
})

View File

@ -27,3 +27,15 @@ export const contextPopupPositionState = atom({
},
dangerouslyAllowMutability: true,
})
/** 팝업 스피너 상태 */
export const popSpinnerState = atom({
key: 'popSpinnerStore',
default: false,
})
/** 프로미스 팝업 상태 - 테스트용(삭제 예정) */
export const promisePopupState = atom({
key: 'promisePopupStore',
default: false,
})

View File

@ -320,7 +320,7 @@ export const drawGabledRoof = (roofId, canvas, textMode) => {
const wallLines = canvas?.getObjects().find((object) => object.name === POLYGON_TYPE.WALL && object.attributes.roofId === roof.id).lines
const hasNonParallelLines = roofLines.filter((line) => line.x1 !== line.x2 && line.y1 !== line.y2)
if (hasNonParallelLines.length > 0) {
alert('대각선이 존재합니다.')
// alert('대각선이 존재합니다.')
return
}
@ -648,7 +648,7 @@ export const drawShedRoof = (roofId, canvas, textMode) => {
const roof = canvas?.getObjects().find((object) => object.id === roofId)
const hasNonParallelLines = roof.lines.filter((line) => Math.abs(line.x1 - line.x2) > 1 && Math.abs(line.y1 - line.y2) > 1)
if (hasNonParallelLines.length > 0) {
alert('대각선이 존재합니다.')
// alert('대각선이 존재합니다.')
return
}
@ -739,7 +739,7 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
//Math.abs(line.x1 - line.x2) > 1 && Math.abs(line.y1 - line.y2) > 1
const hasNonParallelLines = roof.lines.filter((line) => Big(line.x1).minus(Big(line.x2)).gt(1) && Big(line.y1).minus(Big(line.y2)).gt(1))
if (hasNonParallelLines.length > 0) {
alert('대각선이 존재합니다.')
// alert('대각선이 존재ㄴ합니다.')
return
}