Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # src/hooks/module/useModule.js
This commit is contained in:
commit
391a8220dc
@ -18,7 +18,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown
|
||||
//다운로드 파일 EXCEL
|
||||
const [schUnitPriceFlg, setSchUnitPriceFlg] = useState('0')
|
||||
//견적제출서 표시명
|
||||
const [schDisplayFlg, setSchSchDisplayFlg] = useState('0')
|
||||
const [schDisplayFlg, setSchDisplayFlg] = useState('0')
|
||||
//가대 중량표 포함(포함:1 미포함 : 0)
|
||||
const [schWeightFlg, setSchWeightFlg] = useState('1')
|
||||
//도면/시뮬레이션 파일 포함
|
||||
@ -208,7 +208,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown
|
||||
value={'0'}
|
||||
checked={schDisplayFlg === '0'}
|
||||
onChange={(e) => {
|
||||
setSchSchDisplayFlg(e.target.value)
|
||||
setSchDisplayFlg(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="schDisplayFlg0">{getMessage('estimate.detail.docPopup.schDisplayFlg.schDisplayFlg0')}</label>
|
||||
@ -221,7 +221,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown
|
||||
value={'1'}
|
||||
checked={schDisplayFlg === '1'}
|
||||
onChange={(e) => {
|
||||
setSchSchDisplayFlg(e.target.value)
|
||||
setSchDisplayFlg(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="schDisplayFlg1">{getMessage('estimate.detail.docPopup.schDisplayFlg.schDisplayFlg1')}</label>
|
||||
|
||||
@ -69,7 +69,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
get({ url: url }).then((res) => {
|
||||
if (!isEmptyArray(res)) {
|
||||
res.map((row) => {
|
||||
row.value == row.saleStoreId
|
||||
row.value = row.saleStoreId
|
||||
row.label = row.saleStoreName
|
||||
})
|
||||
otherList = res
|
||||
|
||||
@ -7,16 +7,16 @@ export default function ProductFeaturesPop({ popShowSpecialNoteList, showProduct
|
||||
|
||||
useEffect(() => {
|
||||
let pushData = []
|
||||
popShowSpecialNoteList.map((row) => {
|
||||
popShowSpecialNoteList.forEach((row) => {
|
||||
let option = showProductFeatureData.split('、')
|
||||
option.map((row2) => {
|
||||
option.forEach((row2) => {
|
||||
if (row.code === row2) {
|
||||
pushData.push(row)
|
||||
}
|
||||
})
|
||||
})
|
||||
setShowSpecialNoteList(pushData)
|
||||
}, [popShowSpecialNoteList])
|
||||
}, [popShowSpecialNoteList, showProductFeatureData])
|
||||
|
||||
return (
|
||||
<div className="modal-popup">
|
||||
|
||||
@ -57,13 +57,13 @@ export default function PanelEdit(props) {
|
||||
moduleMove(length, direction)
|
||||
break
|
||||
case PANEL_EDIT_TYPE.MOVE_ALL:
|
||||
moduleMoveAll(length, direction)
|
||||
moduleMoveAll(length, direction, props.arrayData)
|
||||
break
|
||||
case PANEL_EDIT_TYPE.COPY:
|
||||
moduleCopy(length, direction)
|
||||
break
|
||||
case PANEL_EDIT_TYPE.COPY_ALL:
|
||||
moduleCopyAll(length, direction)
|
||||
moduleCopyAll(length, direction, props.arrayData)
|
||||
break
|
||||
case PANEL_EDIT_TYPE.COLUMN_MOVE:
|
||||
moduleMultiMove('column', length, direction)
|
||||
|
||||
@ -145,105 +145,113 @@ export function useModule() {
|
||||
}
|
||||
}
|
||||
|
||||
const moduleMoveAll = (length, direction) => {
|
||||
const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
|
||||
const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE)
|
||||
const objects = getObjects()
|
||||
const moduleMoveAll = (length, direction, surfaceArray) => {
|
||||
surfaceArray.forEach((surface) => {
|
||||
const modules = canvas
|
||||
.getObjects()
|
||||
.filter((module) => module.name === POLYGON_TYPE.MODULE)
|
||||
.filter((module) => module.surfaceId === surface.id)
|
||||
const objects = getObjects()
|
||||
|
||||
let isWarning = false
|
||||
let isWarning = false
|
||||
|
||||
modules.forEach((module) => {
|
||||
const { top, left } = getPosotion(module, direction, length, false)
|
||||
module.originPos = {
|
||||
top: module.top,
|
||||
left: module.left,
|
||||
fill: module.fill,
|
||||
}
|
||||
modules.forEach((module) => {
|
||||
const { top, left } = getPosotion(module, direction, length, false)
|
||||
module.originPos = {
|
||||
top: module.top,
|
||||
left: module.left,
|
||||
fill: module.fill,
|
||||
}
|
||||
|
||||
module.set({ top, left })
|
||||
module.setCoords()
|
||||
canvas.renderAll()
|
||||
|
||||
if (isOverlapObjects(module, objects) || isOutsideSurface(module, surface)) {
|
||||
isWarning = true
|
||||
module.set({ fill: 'red' })
|
||||
}
|
||||
})
|
||||
|
||||
module.set({ top, left })
|
||||
module.setCoords()
|
||||
canvas.renderAll()
|
||||
|
||||
if (isOverlapObjects(module, objects) || isOutsideSurface(module, moduleSetupSurface)) {
|
||||
isWarning = true
|
||||
module.set({ fill: 'red' })
|
||||
if (isWarning) {
|
||||
swalFire({
|
||||
title: getMessage('can.not.move.module'),
|
||||
icon: 'error',
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
modules.forEach((module) => {
|
||||
module.set({ top: module.originPos.top, left: module.originPos.left, fill: module.originPos.fill })
|
||||
module.setCoords()
|
||||
})
|
||||
canvas.renderAll()
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
canvas.renderAll()
|
||||
if (isWarning) {
|
||||
swalFire({
|
||||
title: getMessage('can.not.move.module'),
|
||||
icon: 'error',
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
modules.forEach((module) => {
|
||||
module.set({ top: module.originPos.top, left: module.originPos.left, fill: module.originPos.fill })
|
||||
module.setCoords()
|
||||
})
|
||||
canvas.renderAll()
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const moduleCopyAll = (length, direction) => {
|
||||
const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
|
||||
const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE)
|
||||
const objects = getObjects()
|
||||
const copyModules = []
|
||||
let copyModule = null
|
||||
let isWarning = false
|
||||
let moduleLength = 0
|
||||
if (['up', 'down'].includes(direction)) {
|
||||
modules.sort((a, b) => a.top - b.top)
|
||||
moduleLength = Number(modules[modules.length - 1].top) + Number(modules[modules.length - 1].height) - Number(modules[0].top)
|
||||
} else if (['left', 'right'].includes(direction)) {
|
||||
modules.sort((a, b) => a.left - b.left)
|
||||
moduleLength = Number(modules[modules.length - 1].left) + Number(modules[modules.length - 1].width) - Number(modules[0].left)
|
||||
}
|
||||
const moduleCopyAll = (length, direction, surfaceArray) => {
|
||||
surfaceArray.forEach((surface) => {
|
||||
const modules = canvas
|
||||
.getObjects()
|
||||
.filter((module) => module.name === POLYGON_TYPE.MODULE)
|
||||
.filter((module) => module.surfaceId === surface.id)
|
||||
const objects = getObjects()
|
||||
const copyModules = []
|
||||
|
||||
modules.forEach((module) => {
|
||||
const { top, left } = getPosotion(module, direction, Number(length) + Number(moduleLength), false)
|
||||
module.clone((obj) => {
|
||||
obj.set({
|
||||
parentId: module.parentId,
|
||||
initOptions: module.initOptions,
|
||||
direction: module.direction,
|
||||
arrow: module.arrow,
|
||||
name: module.name,
|
||||
type: module.type,
|
||||
length: module.length,
|
||||
points: module.points,
|
||||
surfaceId: module.surfaceId,
|
||||
left,
|
||||
top,
|
||||
id: uuidv4(),
|
||||
})
|
||||
copyModule = obj
|
||||
canvas.add(obj)
|
||||
copyModules.push(obj)
|
||||
obj.setCoords()
|
||||
})
|
||||
if (isOverlapObjects(copyModule, objects) || isOutsideSurface(copyModule, moduleSetupSurface)) {
|
||||
isWarning = true
|
||||
copyModule.set({ fill: 'red' })
|
||||
let copyModule = null
|
||||
let isWarning = false
|
||||
let moduleLength = 0
|
||||
if (['up', 'down'].includes(direction)) {
|
||||
modules.sort((a, b) => a.top - b.top)
|
||||
moduleLength = Number(modules[modules.length - 1].top) + Number(modules[modules.length - 1].height) - Number(modules[0].top)
|
||||
} else if (['left', 'right'].includes(direction)) {
|
||||
modules.sort((a, b) => a.left - b.left)
|
||||
moduleLength = Number(modules[modules.length - 1].left) + Number(modules[modules.length - 1].width) - Number(modules[0].left)
|
||||
}
|
||||
canvas.renderAll()
|
||||
})
|
||||
|
||||
if (isWarning) {
|
||||
swalFire({
|
||||
title: getMessage('can.not.copy.module'),
|
||||
icon: 'error',
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
canvas.remove(...copyModules)
|
||||
canvas.renderAll()
|
||||
},
|
||||
modules.forEach((module) => {
|
||||
const { top, left } = getPosotion(module, direction, Number(length) + Number(moduleLength), false)
|
||||
module.clone((obj) => {
|
||||
obj.set({
|
||||
parentId: module.parentId,
|
||||
initOptions: module.initOptions,
|
||||
direction: module.direction,
|
||||
arrow: module.arrow,
|
||||
name: module.name,
|
||||
type: module.type,
|
||||
length: module.length,
|
||||
points: module.points,
|
||||
surfaceId: module.surfaceId,
|
||||
left,
|
||||
top,
|
||||
id: uuidv4(),
|
||||
})
|
||||
copyModule = obj
|
||||
canvas.add(obj)
|
||||
copyModules.push(obj)
|
||||
obj.setCoords()
|
||||
})
|
||||
if (isOverlapObjects(copyModule, objects) || isOutsideSurface(copyModule, surface)) {
|
||||
isWarning = true
|
||||
copyModule.set({ fill: 'red' })
|
||||
}
|
||||
canvas.renderAll()
|
||||
})
|
||||
}
|
||||
setModuleStatisticsData()
|
||||
|
||||
if (isWarning) {
|
||||
swalFire({
|
||||
title: getMessage('can.not.copy.module'),
|
||||
icon: 'error',
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
canvas.remove(...copyModules)
|
||||
canvas.renderAll()
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const moduleCopy = (length, direction) => {
|
||||
@ -304,7 +312,6 @@ export function useModule() {
|
||||
},
|
||||
})
|
||||
}
|
||||
setModuleStatisticsData()
|
||||
}
|
||||
|
||||
const moduleMultiCopy = (type, length, direction) => {
|
||||
@ -379,7 +386,6 @@ export function useModule() {
|
||||
},
|
||||
})
|
||||
}
|
||||
setModuleStatisticsData()
|
||||
}
|
||||
|
||||
const moduleColumnRemove = (type) => {
|
||||
@ -494,7 +500,6 @@ export function useModule() {
|
||||
},
|
||||
})
|
||||
}
|
||||
setModuleStatisticsData()
|
||||
}
|
||||
|
||||
const moduleRowRemove = (type) => {
|
||||
@ -610,7 +615,6 @@ export function useModule() {
|
||||
},
|
||||
})
|
||||
}
|
||||
setModuleStatisticsData()
|
||||
}
|
||||
|
||||
const moduleColumnInsert = (type) => {
|
||||
@ -706,8 +710,6 @@ export function useModule() {
|
||||
},
|
||||
})
|
||||
}
|
||||
moduleSetupSurface.set({ modules: [...moduleSetupSurface.modules, ...copyModules] })
|
||||
setModuleStatisticsData()
|
||||
}
|
||||
|
||||
const muduleRowInsert = (type) => {
|
||||
@ -805,9 +807,6 @@ export function useModule() {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
moduleSetupSurface.set({ modules: [...moduleSetupSurface.modules, ...copyModules] })
|
||||
setModuleStatisticsData()
|
||||
}
|
||||
|
||||
const alignModule = (type, surfaceArray) => {
|
||||
@ -880,7 +879,6 @@ export function useModule() {
|
||||
surface.set({ modules: modules })
|
||||
canvas.remove(activeModule)
|
||||
canvas.renderAll()
|
||||
setModuleStatisticsData()
|
||||
}
|
||||
|
||||
const moduleRoofRemove = (surfaceArray) => {
|
||||
@ -976,7 +974,7 @@ export function useModule() {
|
||||
]
|
||||
const surfaceObjects = {}
|
||||
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||
surfaces.forEach((surface) => {
|
||||
const rows = surfaces.map((surface) => {
|
||||
surfaceObjects[surface.id] = {
|
||||
roofSurface: canvas.getObjects().filter((obj) => obj.id === surface.parentId)[0].directionText,
|
||||
circuit: '-',
|
||||
@ -1013,12 +1011,11 @@ export function useModule() {
|
||||
})
|
||||
})
|
||||
let tempRows = []
|
||||
console.log('surfaceObjects', surfaceObjects)
|
||||
Object.keys(surfaceObjects).forEach((key) => {
|
||||
let tempRow = {
|
||||
name: surfaceObjects[key].roofSurface,
|
||||
circuit: surfaceObjects[key].circuit,
|
||||
wpOut: parseFloat(surfaceObjects[key].wpOut / 1000),
|
||||
wpOut: parseInt((surfaceObjects[key].wpOut / 1000).toFixed(3)),
|
||||
}
|
||||
selectedModules.itemList.forEach((module) => {
|
||||
tempRow[module.itemId] = surfaceObjects[key][module.itemId]
|
||||
@ -1029,7 +1026,7 @@ export function useModule() {
|
||||
let row = {
|
||||
name: surfaceObjects[key].roofSurface,
|
||||
circuit: surfaceObjects[key].circuits[circuit].circuit,
|
||||
wpOut: parseFloat(surfaceObjects[key].circuits[circuit].circuits.wpOut / 1000),
|
||||
wpOut: parseInt((surfaceObjects[key].circuits[circuit].circuits.wpOut / 1000).toFixed(3)),
|
||||
}
|
||||
selectedModules.itemList.forEach((module) => {
|
||||
row[module.itemId] = surfaceObjects[key].circuits[circuit].circuits[module.itemId]
|
||||
@ -1037,14 +1034,14 @@ export function useModule() {
|
||||
tempRows.push(row)
|
||||
})
|
||||
})
|
||||
console.log('tempRows', tempRows)
|
||||
|
||||
const tempFooter = {
|
||||
name: getMessage('modal.panel.batch.statistic.total'),
|
||||
circuit: '-',
|
||||
wpOut: tempRows.reduce((acc, row) => acc + row.wpOut, 0),
|
||||
}
|
||||
selectedModules.itemList.forEach((module) => {
|
||||
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + (row[module.itemId] ? parseFloat(row[module.itemId]) : 0), 0)
|
||||
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + row[module.itemId], 0)
|
||||
})
|
||||
setModuleStatistics({ header: tempHeader, rows: tempRows.filter((row) => row.wpOut !== 0), footer: tempFooter })
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
makeModuleInstArea(roof, detail.data)
|
||||
//surface에 상세 데이터 추가
|
||||
} else {
|
||||
console.log('가대 데이터가 없네요...')
|
||||
swalFire({ text: getMessage('module.roof.not.exist'), icon: 'warning' })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -747,18 +747,18 @@ export function useContextMenu() {
|
||||
{
|
||||
id: 'moduleMove',
|
||||
name: getMessage('contextmenu.module.move'),
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.MOVE_ALL} />,
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.MOVE_ALL} arrayData={currentObject.arrayData} />,
|
||||
},
|
||||
{
|
||||
id: 'moduleCopy',
|
||||
name: getMessage('contextmenu.module.copy'),
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.COPY_ALL} />,
|
||||
},
|
||||
{
|
||||
id: 'moduleCircuitNumberEdit',
|
||||
name: getMessage('contextmenu.module.circuit.number.edit'),
|
||||
component: <CircuitNumberEdit id={popupId} />,
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.COPY_ALL} arrayData={currentObject.arrayData} />,
|
||||
},
|
||||
// {
|
||||
// id: 'moduleCircuitNumberEdit',
|
||||
// name: getMessage('contextmenu.module.circuit.number.edit'),
|
||||
// component: <CircuitNumberEdit id={popupId} />,
|
||||
// },
|
||||
],
|
||||
])
|
||||
break
|
||||
|
||||
@ -998,5 +998,6 @@
|
||||
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다.",
|
||||
"batch.object.outside.roof": "오브젝트는 지붕내에 설치해야 합니다.",
|
||||
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다.",
|
||||
"module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다."
|
||||
"module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다.",
|
||||
"module.trestleDetail.not.exist": "가대 상세 정보가 없습니다."
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user