Merge branch 'qcast-pub' into dev

This commit is contained in:
김민식 2025-02-27 18:15:24 +09:00
commit 98b8bb674f
7 changed files with 110 additions and 26 deletions

View File

@ -408,7 +408,7 @@ export default function CanvasMenu(props) {
const checkMenuState = (menu) => { const checkMenuState = (menu) => {
return ( return (
(['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.type === 'outline') || (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.type === 'outline') ||
(selectedMenu === 'module' && ['drawing', 'placement'].includes(menu.type)) || (selectedMenu === 'module' && ['placement', 'outline', 'surface'].includes(menu.type)) ||
(isExistModule() && ['placement', 'outline'].some((num) => num === menu.type)) || (isExistModule() && ['placement', 'outline'].some((num) => num === menu.type)) ||
(['estimate', 'simulation'].includes(selectedMenu) && ['placement', 'outline', 'surface'].includes(menu.type)) (['estimate', 'simulation'].includes(selectedMenu) && ['placement', 'outline', 'surface'].includes(menu.type))
) )

View File

@ -521,6 +521,15 @@ export default function CircuitTrestleSetting({ id }) {
const handlePassivityAllocationCkeck = () => { const handlePassivityAllocationCkeck = () => {
let pcsCount = {} let pcsCount = {}
let result = {} let result = {}
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
if (notAllocationModules.length > 0) {
swalFire({
text: getMessage('not.allocation.exist.module'),
type: 'alert',
icon: 'warning',
})
return
}
canvas canvas
.getObjects() .getObjects()
.filter((obj) => obj.name === POLYGON_TYPE.MODULE) .filter((obj) => obj.name === POLYGON_TYPE.MODULE)

View File

@ -31,6 +31,7 @@ export default function DimensionLineSetting(props) {
useEffect(() => { useEffect(() => {
if (canvas) { if (canvas) {
const dimensionObject = canvas.getActiveObject() const dimensionObject = canvas.getActiveObject()
console.log(dimensionObject)
const id = dimensionObject.groupId const id = dimensionObject.groupId
const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.group.groupId === id)[0] const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.group.groupId === id)[0]
if (!textObj) return if (!textObj) return
@ -38,6 +39,7 @@ export default function DimensionLineSetting(props) {
setBasicLength(+dimensionObject.length) setBasicLength(+dimensionObject.length)
setSelectedSlope1(dimensionObject.angle1) setSelectedSlope1(dimensionObject.angle1)
setSelectedSlope2(dimensionObject.angle2) setSelectedSlope2(dimensionObject.angle2)
setSlopeAble(dimensionObject.slopeAble)
} }
if (basicSetting.roofAngleSet === 'slope') { if (basicSetting.roofAngleSet === 'slope') {
@ -65,13 +67,13 @@ export default function DimensionLineSetting(props) {
}, []) }, [])
useEffect(() => { useEffect(() => {
if (!slopeAble) { // if (!slopeAble) {
const dimensionObject = canvas.getActiveObject() // const dimensionObject = canvas.getActiveObject()
dimensionObject.set({ // dimensionObject.set({
angle1: null, // angle1: null,
angle2: null, // angle2: null,
}) // })
} // }
}, [slopeAble]) }, [slopeAble])
const handleChangeLength = () => { const handleChangeLength = () => {
@ -79,19 +81,24 @@ export default function DimensionLineSetting(props) {
const dimensionObject = canvas.getActiveObject() const dimensionObject = canvas.getActiveObject()
const id = dimensionObject.groupId const id = dimensionObject.groupId
const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.group.groupId === id)[0] const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.group.groupId === id)[0]
let resultText = +changeLength > 0 ? +changeLength : '0' let resultText = +changeLength > 0 ? +changeLength : dimensionObject.length
console.log(changeLength)
if (slopeAble) { if (slopeAble) {
resultText = !selectedSlope2 resultText = !selectedSlope2
? calculateLength(basicLength, selectedSlope1.value).toFixed(0) ? calculateLength(resultText, selectedSlope1.value).toFixed(0)
: calculateLength(basicLength, selectedSlope1.value, selectedSlope2.value).toFixed(0) : calculateLength(resultText, selectedSlope1.value, selectedSlope2.value).toFixed(0)
} }
textObj.set({ textObj.set({
text: String(resultText), text: String(resultText),
}) })
dimensionObject.set({ length: +resultText }) dimensionObject.set({
length: +changeLength > 0 ? +changeLength : dimensionObject.length,
slopeAble: slopeAble,
angle1: selectedSlope1,
angle2: selectedSlope2,
})
setBasicLength(resultText) setBasicLength(resultText)
setChangeLength('') setChangeLength('')
canvas.renderAll() canvas.renderAll()
@ -153,7 +160,7 @@ export default function DimensionLineSetting(props) {
</div> </div>
</div> </div>
<div className="d-check-box pop"> <div className="d-check-box pop">
<input type="checkbox" id="ch99" onChange={() => setSlopeAble(!slopeAble)} /> <input type="checkbox" id="ch99" checked={slopeAble} onChange={() => setSlopeAble(!slopeAble)} />
<label htmlFor="ch99">{getMessage('modal.display.edit.input.slope')}</label> <label htmlFor="ch99">{getMessage('modal.display.edit.input.slope')}</label>
</div> </div>
</div> </div>

View File

@ -428,7 +428,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
</div> </div>
)} )}
</div> </div>
{currentRoof && ( {/* {currentRoof && (
<div className="placement-roof-btn-wrap"> <div className="placement-roof-btn-wrap">
<div className="icon-btn-wrap mt10"> <div className="icon-btn-wrap mt10">
<button <button
@ -450,7 +450,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
</button> </button>
</div> </div>
</div> </div>
)} )} */}
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -282,6 +282,10 @@ export function useCommonUtils() {
originY: 'center', originY: 'center',
lineDirection: lineDirection, lineDirection: lineDirection,
groupId: uuid, groupId: uuid,
length: distance * 10,
slopeAble: false,
angle1: null,
angle2: null,
}) })
canvas.add(group) canvas.add(group)

View File

@ -536,14 +536,7 @@ export function useModule() {
const moduleRowRemove = (type) => { const moduleRowRemove = (type) => {
const activeModule = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0] const activeModule = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
if (activeModule.circuit) { c
swalFire({
title: getMessage('can.not.remove.module'),
icon: 'error',
type: 'alert',
})
return
}
const rowModules = getRowModules(activeModule) const rowModules = getRowModules(activeModule)
const otherModules = getOtherModules(rowModules) const otherModules = getOtherModules(rowModules)
const objects = getObjects() const objects = getObjects()
@ -671,6 +664,9 @@ export function useModule() {
const moduleSetupSurface = canvas const moduleSetupSurface = canvas
.getObjects() .getObjects()
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.id === activeModule.surfaceId)[0] .filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.id === activeModule.surfaceId)[0]
if (moduleSetupSurface.modules.filter((module) => module.circuit).length > 0) {
return
}
let width = -1 let width = -1
let isWarning = false let isWarning = false
if (targetModules.length === 0) { if (targetModules.length === 0) {
@ -776,6 +772,9 @@ export function useModule() {
const moduleSetupSurface = canvas const moduleSetupSurface = canvas
.getObjects() .getObjects()
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.id === activeModule.surfaceId)[0] .filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.id === activeModule.surfaceId)[0]
if (moduleSetupSurface.modules.filter((module) => module.circuit).length > 0) {
return
}
let height = -1 let height = -1
let isWarning = false let isWarning = false
canvas.discardActiveObject() canvas.discardActiveObject()
@ -855,6 +854,14 @@ export function useModule() {
} }
const alignModule = (type, surfaceArray) => { const alignModule = (type, surfaceArray) => {
if (activeModule.circuit) {
swalFire({
title: getMessage('can.not.remove.module'),
icon: 'error',
type: 'alert',
})
return
}
surfaceArray.forEach((surface) => { surfaceArray.forEach((surface) => {
const modules = surface.modules const modules = surface.modules
@ -939,6 +946,7 @@ export function useModule() {
.getObjects() .getObjects()
.filter((module) => module.name === POLYGON_TYPE.MODULE && module.surfaceId === surface.id) .filter((module) => module.name === POLYGON_TYPE.MODULE && module.surfaceId === surface.id)
.forEach((module) => { .forEach((module) => {
canvas.remove(module.circuit)
canvas.remove(module) canvas.remove(module)
}) })
}) })

View File

@ -706,12 +706,68 @@ export function useContextMenu() {
{ {
id: 'moduleVerticalCenterAlign', id: 'moduleVerticalCenterAlign',
name: getMessage('contextmenu.module.vertical.align'), name: getMessage('contextmenu.module.vertical.align'),
fn: () => alignModule(MODULE_ALIGN_TYPE.VERTICAL, currentObject.arrayData ?? [currentObject]), fn: () => {
if (currentObject.arrayData) {
let existCircuit = false
currentObject.arrayData.forEach((surface) => {
surface.modules.forEach((module) => {
if (module.circuit) existCircuit = true
})
})
if (existCircuit) {
swalFire({
title: getMessage('can.not.move.module'),
icon: 'error',
type: 'alert',
})
return
}
} else {
const allocatedModules = currentObject.modules.filter((module) => module.circuit !== null)
if (allocatedModules.length > 0) {
swalFire({
title: getMessage('can.not.move.module'),
icon: 'error',
type: 'alert',
})
return
}
}
alignModule(MODULE_ALIGN_TYPE.VERTICAL, currentObject.arrayData ?? [currentObject])
},
}, },
{ {
id: 'moduleHorizonCenterAlign', id: 'moduleHorizonCenterAlign',
name: getMessage('contextmenu.module.horizon.align'), name: getMessage('contextmenu.module.horizon.align'),
fn: () => alignModule(MODULE_ALIGN_TYPE.HORIZONTAL, currentObject.arrayData ?? [currentObject]), fn: () => {
if (currentObject.arrayData) {
let existCircuit = false
currentObject.arrayData.forEach((surface) => {
surface.modules.forEach((module) => {
if (module.circuit) existCircuit = true
})
})
if (existCircuit) {
swalFire({
title: getMessage('can.not.move.module'),
icon: 'error',
type: 'alert',
})
return
}
} else {
const allocatedModules = currentObject.modules.filter((module) => module.circuit !== null)
if (allocatedModules.length > 0) {
swalFire({
title: getMessage('can.not.move.module'),
icon: 'error',
type: 'alert',
})
return
}
}
alignModule(MODULE_ALIGN_TYPE.HORIZONTAL, currentObject.arrayData ?? [currentObject])
},
}, },
{ {
id: 'moduleRemove', id: 'moduleRemove',