Merge branch 'dev' into dev-yj

# Conflicts:
#	src/hooks/common/useCommonUtils.js
This commit is contained in:
yjnoh 2025-03-05 13:48:46 +09:00
commit fc003ceca8
12 changed files with 82 additions and 51 deletions

View File

@ -1263,7 +1263,7 @@ export default function Estimate({}) {
}} }}
getOptionLabel={(x) => x.clCodeNm} getOptionLabel={(x) => x.clCodeNm}
getOptionValue={(x) => x.clCode} getOptionValue={(x) => x.clCode}
isClearable={false} isClearable={true}
isSearchable={false} isSearchable={false}
value={honorificCodeList.filter(function (option) { value={honorificCodeList.filter(function (option) {
return option.clCodeNm === estimateContextState.objectNameOmit return option.clCodeNm === estimateContextState.objectNameOmit

View File

@ -28,6 +28,8 @@ export default function EstimateFileUploader({ uploadFiles, setUploadFiles }) {
'application/pdf', 'application/pdf',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel', 'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.presentationml.presentation', // PPTX
'application/vnd.ms-powerpoint', // PPT
] ]
Array.from(e.target.files).forEach((file) => { Array.from(e.target.files).forEach((file) => {
//, pdf, //, pdf,
@ -61,6 +63,8 @@ export default function EstimateFileUploader({ uploadFiles, setUploadFiles }) {
'application/pdf', 'application/pdf',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel', 'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.presentationml.presentation', // PPTX
'application/vnd.ms-powerpoint', // PPT
] ]
Array.from(e.dataTransfer.files).forEach((file) => { Array.from(e.dataTransfer.files).forEach((file) => {

View File

@ -106,7 +106,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
useEffect(() => { useEffect(() => {
if (estimateContextState?.charger) { if (estimateContextState?.charger) {
setCopyReceiveUser(estimateContextState.charger) setCopyReceiveUser(session?.userNm)
} }
}, [estimateContextState?.charger]) }, [estimateContextState?.charger])

View File

@ -159,7 +159,7 @@ export default function CanvasMenu(props) {
roof.set({ selectable: true }) roof.set({ selectable: true })
setSurfaceShapePattern(roof, null, false, roof.roofMaterial) setSurfaceShapePattern(roof, null, false, roof.roofMaterial)
delete roof.moduleCompass delete roof.moduleCompass
drawDirectionArrow(roof) drawDirectionArrow(roof, false)
}) })
} }
@ -184,13 +184,13 @@ export default function CanvasMenu(props) {
break break
case 'surface': case 'surface':
const modules = canvas.getObjects().filter((module) => module.name === POLYGON_TYPE.MODULE) const modules = canvas.getObjects().filter((module) => module.name === POLYGON_TYPE.MODULE)
initRoofs()
if (modules.length > 0) { if (modules.length > 0) {
swalFire({ swalFire({
text: getMessage('module.delete.confirm'), text: getMessage('module.delete.confirm'),
type: 'confirm', type: 'confirm',
confirmFn: () => { confirmFn: () => {
// //
initRoofs()
const moduleSurfacesArray = canvas const moduleSurfacesArray = canvas
.getObjects() .getObjects()
@ -204,6 +204,7 @@ export default function CanvasMenu(props) {
moduleSurfacesArray.forEach((moduleSurface) => { moduleSurfacesArray.forEach((moduleSurface) => {
canvas.remove(moduleSurface) canvas.remove(moduleSurface)
}) })
canvas.renderAll() canvas.renderAll()
onClickNav(menu) onClickNav(menu)
} }

View File

@ -563,8 +563,8 @@ export default function CircuitTrestleSetting({ id }) {
goodsNo: model.goodsNo, goodsNo: model.goodsNo,
serQtyList: [ serQtyList: [
{ {
serQty: result[index + 1].maxValue, serQty: result[(index + 1).toString()] ? result[(index + 1).toString()].maxValue : 0,
paralQty: result[index + 1].count, paralQty: result[(index + 1).toString()] ? result[(index + 1).toString()].count : 0,
rmdYn: 'Y', rmdYn: 'Y',
usePossYn: 'Y', usePossYn: 'Y',
roofSurfaceList: canvas roofSurfaceList: canvas

View File

@ -23,7 +23,7 @@ export default function StuffSubHeader({ type }) {
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState)
const { managementState } = useContext(GlobalDataContext) const { managementState, setManagementState } = useContext(GlobalDataContext)
const [buttonStyle, setButtonStyle] = useState('') const [buttonStyle, setButtonStyle] = useState('')
@ -31,17 +31,20 @@ export default function StuffSubHeader({ type }) {
useEffect(() => { useEffect(() => {
window.scrollTo(0, 0) window.scrollTo(0, 0)
setManagementState({})
}, []) }, [])
useEffect(() => { useEffect(() => {
if (isObjectNotEmpty(managementState)) { if (type === 'detail') {
if (managementState?.createSaleStoreId === 'T01') { if (isObjectNotEmpty(managementState)) {
if (session?.storeId !== 'T01') { if (managementState?.createSaleStoreId === 'T01') {
setButtonStyle('none') if (session?.storeId !== 'T01') {
setButtonStyle('none')
}
} }
} }
} }
}, [managementState?.createSaleStoreId]) }, [type, managementState])
const searchParams = useSearchParams() const searchParams = useSearchParams()
const objectNo = searchParams.get('objectNo') //url set const objectNo = searchParams.get('objectNo') //url set

View File

@ -11,6 +11,7 @@ import { usePopup } from '@/hooks/usePopup'
import Distance from '@/components/floor-plan/modal/distance/Distance' import Distance from '@/components/floor-plan/modal/distance/Distance'
import { usePolygon } from '@/hooks/usePolygon' import { usePolygon } from '@/hooks/usePolygon'
import { useObjectBatch } from '@/hooks/object/useObjectBatch' import { useObjectBatch } from '@/hooks/object/useObjectBatch'
import { BATCH_TYPE } from '@/common/common'
export function useCommonUtils() { export function useCommonUtils() {
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
@ -18,6 +19,7 @@ export function useCommonUtils() {
const { addCanvasMouseEventListener, addDocumentEventListener, initEvent } = useEvent() const { addCanvasMouseEventListener, addDocumentEventListener, initEvent } = useEvent()
const dimensionSettings = useRecoilValue(dimensionLineSettingsState) const dimensionSettings = useRecoilValue(dimensionLineSettingsState)
const dimensionLineTextFont = useRecoilValue(fontSelector('dimensionLineText')) const dimensionLineTextFont = useRecoilValue(fontSelector('dimensionLineText'))
const lengthTextFont = useRecoilValue(fontSelector('lengthText'))
const commonTextFont = useRecoilValue(fontSelector('commonText')) const commonTextFont = useRecoilValue(fontSelector('commonText'))
const [commonUtils, setCommonUtilsState] = useRecoilState(commonUtilsState) const [commonUtils, setCommonUtilsState] = useRecoilState(commonUtilsState)
const { addPopup } = usePopup() const { addPopup } = usePopup()
@ -559,7 +561,9 @@ export function useCommonUtils() {
const commonCopyObject = (obj) => { const commonCopyObject = (obj) => {
if (obj) { if (obj) {
if (obj.name.indexOf('triangleDormer') || obj.name.indexOf('pentagonDormer')) { //도머는 복사하기 보다 새로 호출해서 만드는 방법으로 함
if (obj.name == BATCH_TYPE.TRIANGLE_DORMER || obj.name == BATCH_TYPE.PENTAGON_DORMER) {
//그룹 객체 0번에 도머 속성을 넣어둠
const dormerAttributes = obj._objects[0].dormerAttributes const dormerAttributes = obj._objects[0].dormerAttributes
const dormerName = obj._objects[0].name const dormerName = obj._objects[0].name
@ -572,14 +576,14 @@ export function useCommonUtils() {
directionRef: dormerAttributes.directionRef, directionRef: dormerAttributes.directionRef,
} }
const buttonAct = dormerName == 'triangleDormer' ? 3 : 4 const buttonAct = dormerName == BATCH_TYPE.TRIANGLE_DORMER ? 3 : 4
applyDormers(dormerParams, buttonAct) applyDormers(dormerParams, buttonAct)
} else { } else {
let clonedObj = null let clonedObj = null
obj.clone((cloned) => { obj.clone((cloned) => {
clonedObj = cloned clonedObj = cloned
clonedObj.fontSize = lengthTextFont.fontSize.value
}) })
addCanvasMouseEventListener('mouse:move', (e) => { addCanvasMouseEventListener('mouse:move', (e) => {
@ -614,6 +618,7 @@ export function useCommonUtils() {
//배치면일 경우 //배치면일 경우
if (obj.name === 'roof') { if (obj.name === 'roof') {
clonedObj.setCoords() clonedObj.setCoords()
clonedObj.fire('modified')
clonedObj.fire('polygonMoved') clonedObj.fire('polygonMoved')
clonedObj.set({ direction: obj.direction, directionText: obj.directionText, roofMaterial: obj.roofMaterial }) clonedObj.set({ direction: obj.direction, directionText: obj.directionText, roofMaterial: obj.roofMaterial })

View File

@ -27,6 +27,13 @@ export function useOrientation() {
setCompasDeg(0) setCompasDeg(0)
} }
const roofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) const roofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
const hasModules = canvas.getObjects().some((obj) => obj.name === 'module')
if (!hasModules) {
roofs.forEach((roof) => {
delete roof.directionText
})
}
roofs.forEach((roof) => { roofs.forEach((roof) => {
roof.set({ roof.set({
moduleCompass: isNaN(compasDeg) ? 0 : compasDeg, moduleCompass: isNaN(compasDeg) ? 0 : compasDeg,

View File

@ -9,6 +9,7 @@ import { basicSettingState, trestleDisplaySelector } from '@/store/settingAtom'
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import { useContext } from 'react' import { useContext } from 'react'
import { QcastContext } from '@/app/QcastProvider' import { QcastContext } from '@/app/QcastProvider'
import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
// 모듈간 같은 행, 열의 마진이 10 이하인 경우는 같은 행, 열로 간주 // 모듈간 같은 행, 열의 마진이 10 이하인 경우는 같은 행, 열로 간주
const MODULE_MARGIN = 10 const MODULE_MARGIN = 10
@ -22,6 +23,9 @@ export const useTrestle = () => {
const isTrestleDisplay = useRecoilValue(trestleDisplaySelector) const isTrestleDisplay = useRecoilValue(trestleDisplaySelector)
const { swalFire } = useSwal() const { swalFire } = useSwal()
const { setIsGlobalLoading } = useContext(QcastContext) const { setIsGlobalLoading } = useContext(QcastContext)
const { getSelectedPcsItemList } = useCircuitTrestle()
const apply = () => { const apply = () => {
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit) const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
if (notAllocationModules.length > 0) { if (notAllocationModules.length > 0) {
@ -723,11 +727,7 @@ export const useTrestle = () => {
// circuitItemList 중복제거 // circuitItemList 중복제거
circuitItemList = circuitItemList.filter((item, index) => circuitItemList.indexOf(item) === index) circuitItemList = circuitItemList.filter((item, index) => circuitItemList.indexOf(item) === index)
circuitItemList = circuitItemList.map((circuitId) => { circuitItemList = getSelectedPcsItemList()
return {
itemId: circuitId,
}
})
return { itemList, northArrangement, roofSurfaceList, circuitItemList } return { itemList, northArrangement, roofSurfaceList, circuitItemList }
} }

View File

@ -5,7 +5,7 @@ import { useRecoilValue } from 'recoil'
import { canvasState } from '@/store/canvasAtom' import { canvasState } from '@/store/canvasAtom'
import { BATCH_TYPE, INPUT_TYPE, POLYGON_TYPE } from '@/common/common' import { BATCH_TYPE, INPUT_TYPE, POLYGON_TYPE } from '@/common/common'
import { useEvent } from '@/hooks/useEvent' import { useEvent } from '@/hooks/useEvent'
import { pointsToTurfPolygon, polygonToTurfPolygon, rectToPolygon, triangleToPolygon, toFixedWithoutRounding } from '@/util/canvas-util' import { pointsToTurfPolygon, polygonToTurfPolygon, rectToPolygon, triangleToPolygon, getDegreeByChon } from '@/util/canvas-util'
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import * as turf from '@turf/turf' import * as turf from '@turf/turf'
import { usePolygon } from '@/hooks/usePolygon' import { usePolygon } from '@/hooks/usePolygon'
@ -273,6 +273,9 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
const dormerName = buttonAct === 3 ? BATCH_TYPE.TRIANGLE_DORMER : BATCH_TYPE.PENTAGON_DORMER const dormerName = buttonAct === 3 ? BATCH_TYPE.TRIANGLE_DORMER : BATCH_TYPE.PENTAGON_DORMER
const dormerTempName = buttonAct === 3 ? BATCH_TYPE.TRIANGLE_DORMER_TEMP : BATCH_TYPE.PENTAGON_DORMER_TEMP const dormerTempName = buttonAct === 3 ? BATCH_TYPE.TRIANGLE_DORMER_TEMP : BATCH_TYPE.PENTAGON_DORMER_TEMP
//도머의 각도
const dormerAngle = getDegreeByChon(pitch)
let dormer, dormerOffset, isDown, selectedSurface, pentagonPoints, pentagonOffsetPoints let dormer, dormerOffset, isDown, selectedSurface, pentagonPoints, pentagonOffsetPoints
const surfaceShapePolygons = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) const surfaceShapePolygons = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
@ -284,11 +287,10 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
return return
} }
let theta = 0
//삼각형 도머 //삼각형 도머
if (buttonAct === 3) { if (buttonAct === 3) {
const bottomLength = Math.floor((height / Math.cos(Math.atan(pitch / 10))) * 10) / 10
const bottomOffsetLength = Math.floor(((height + offsetRef) / Math.cos(Math.atan(pitch / 10))) * 10) / 10
let groupDormerPoints = [] //나중에 offset을 위한 포인트 저장용 let groupDormerPoints = [] //나중에 offset을 위한 포인트 저장용
addCanvasMouseEventListener('mouse:move', (e) => { addCanvasMouseEventListener('mouse:move', (e) => {
@ -306,6 +308,13 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
console.log('selectedSurface', selectedSurface) console.log('selectedSurface', selectedSurface)
const roofAngle = selectedSurface.roofMaterial.angle
theta = Math.atan(Math.tan((roofAngle * Math.PI) / 180) / Math.tan((dormerAngle * Math.PI) / 180))
const bottomLength = Number((Math.tan(theta) * height).toFixed())
const bottomOffsetLength = Number((Math.tan(theta) * (height + offsetRef)).toFixed())
let angle = 0 let angle = 0
if (directionRef === 'left') { if (directionRef === 'left') {
//서 //서

View File

@ -181,7 +181,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
const batchSurface = new QPolygon(obj.getCurrentPoints(), { const batchSurface = new QPolygon(obj.getCurrentPoints(), {
fill: 'transparent', fill: 'transparent',
stroke: 'red', stroke: 'red',
strokeWidth: 1, strokeWidth: 3,
strokeDasharray: [10, 4], strokeDasharray: [10, 4],
fontSize: 12, fontSize: 12,
selectable: true, selectable: true,

View File

@ -172,8 +172,9 @@ export const usePolygon = () => {
/** /**
* poolygon의 방향에 따라 화살표를 추가한다. * poolygon의 방향에 따라 화살표를 추가한다.
* @param polygon * @param polygon
* @param showDirectionText
*/ */
const drawDirectionArrow = (polygon) => { const drawDirectionArrow = (polygon, showDirectionText = true) => {
if (polygon.points.length < 3) { if (polygon.points.length < 3) {
return return
} }
@ -319,17 +320,16 @@ export const usePolygon = () => {
pitch: polygon.roofMaterial?.pitch ?? 4, pitch: polygon.roofMaterial?.pitch ?? 4,
parentId: polygon.id, parentId: polygon.id,
}) })
arrow.setViewLengthText(false) arrow.setViewLengthText(false)
polygon.arrow = arrow polygon.arrow = arrow
polygon.canvas.add(arrow) polygon.canvas.add(arrow)
polygon.canvas.renderAll() polygon.canvas.renderAll()
drawDirectionStringToArrow2(polygon) drawDirectionStringToArrow2(polygon, showDirectionText)
// drawDirectionStringToArrow() // drawDirectionStringToArrow()
} }
//arrow의 compass 값으로 방향 글자 설정 필요 //arrow의 compass 값으로 방향 글자 설정 필요
const drawDirectionStringToArrow2 = (polygon) => { const drawDirectionStringToArrow2 = (polygon, showDirectionText) => {
const { direction, surfaceCompass, moduleCompass, arrow } = polygon const { direction, surfaceCompass, moduleCompass, arrow } = polygon
if (moduleCompass === null || moduleCompass === undefined) { if (moduleCompass === null || moduleCompass === undefined) {
const textObj = new fabric.Text(`${currentAngleType === ANGLE_TYPE.SLOPE ? arrow.pitch : getDegreeByChon(arrow.pitch)}${pitchText}`, { const textObj = new fabric.Text(`${currentAngleType === ANGLE_TYPE.SLOPE ? arrow.pitch : getDegreeByChon(arrow.pitch)}${pitchText}`, {
@ -510,24 +510,27 @@ export const usePolygon = () => {
text = text + (sameDirectionCnt.length + 1) text = text + (sameDirectionCnt.length + 1)
polygon.set('directionText', text) polygon.set('directionText', text)
const textObj = new fabric.Text(`${text} (${currentAngleType === ANGLE_TYPE.SLOPE ? arrow.pitch : getDegreeByChon(arrow.pitch)}${pitchText})`, { const textObj = new fabric.Text(
fontFamily: flowFontOptions.fontFamily.value, `${showDirectionText && text} (${currentAngleType === ANGLE_TYPE.SLOPE ? arrow.pitch : getDegreeByChon(arrow.pitch)}${pitchText})`,
fontWeight: flowFontOptions.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal', {
fontStyle: flowFontOptions.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal', fontFamily: flowFontOptions.fontFamily.value,
fontSize: flowFontOptions.fontSize.value, fontWeight: flowFontOptions.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
fill: flowFontOptions.fontColor.value, fontStyle: flowFontOptions.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
pitch: arrow.pitch, fontSize: flowFontOptions.fontSize.value,
originX: 'center', fill: flowFontOptions.fontColor.value,
originY: 'center', pitch: arrow.pitch,
name: 'flowText', originX: 'center',
originText: text, originY: 'center',
selectable: false, name: 'flowText',
left: arrow.stickeyPoint.x, originText: text,
top: arrow.stickeyPoint.y, selectable: false,
parent: arrow, left: arrow.stickeyPoint.x,
parentId: arrow.id, top: arrow.stickeyPoint.y,
visible: isFlowDisplay, parent: arrow,
}) parentId: arrow.id,
visible: isFlowDisplay,
},
)
polygon.canvas.add(textObj) polygon.canvas.add(textObj)
} }
@ -755,10 +758,7 @@ export const usePolygon = () => {
// innerLine이 세팅이 안되어있는경우 찾아서 세팅한다. // innerLine이 세팅이 안되어있는경우 찾아서 세팅한다.
if (!innerLines || innerLines.length === 0) { if (!innerLines || innerLines.length === 0) {
let innerLineTypes = [] let innerLineTypes = Object.keys(LINE_TYPE.SUBLINE).map((key, value) => LINE_TYPE.SUBLINE[key])
Object.keys(LINE_TYPE.SUBLINE).forEach((key, value) => {
innerLineTypes.push(LINE_TYPE.SUBLINE[key])
})
polygon.innerLines = canvas polygon.innerLines = canvas
.getObjects() .getObjects()
.filter( .filter(
@ -1102,6 +1102,8 @@ export const usePolygon = () => {
} }
}) })
// blue로 생성된 것들은 대표라인이 될 수 없음.
representLines = representLines.filter((line) => line.stroke !== 'blue')
// representLines중 가장 긴 line을 찾는다. // representLines중 가장 긴 line을 찾는다.
representLines.forEach((line) => { representLines.forEach((line) => {
if (!representLine) { if (!representLine) {