Merge branch 'dev' into dev-yj

# Conflicts:
#	src/hooks/common/useMasterController.js
This commit is contained in:
yjnoh 2025-02-03 15:14:44 +09:00
commit 4c1708d0dd
10 changed files with 171 additions and 50 deletions

View File

@ -177,6 +177,8 @@ export const SAVE_KEY = [
'moduleRowsTotCnt', 'moduleRowsTotCnt',
'seq', 'seq',
'smartRackId', 'smartRackId',
'quotationParam',
'pcses',
] ]
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype] export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype]

View File

@ -292,8 +292,8 @@ export default function DotLineGrid(props) {
</button> </button>
</div> </div>
</div> </div>
<div className="modal-foot modal-handle"></div>
</div> </div>
<div className="modal-foot modal-handle"></div>
</WithDraggable> </WithDraggable>
) )
} }

View File

@ -42,7 +42,6 @@ export default function Stuff() {
// //
const copyNo = async (value) => { const copyNo = async (value) => {
if (navigator.clipboard && window.isSecureContext) { if (navigator.clipboard && window.isSecureContext) {
console.log('trttt')
await navigator.clipboard await navigator.clipboard
.writeText(value) .writeText(value)
.then(() => { .then(() => {
@ -51,9 +50,11 @@ export default function Stuff() {
type: 'alert', type: 'alert',
}) })
}) })
.catch((e) => { .catch(() => {
console.log(e) swalFire({
alert(getMessage('stuff.detail.header.failCopy')) text: getMessage('stuff.detail.header.failCopy'),
type: 'alert',
})
}) })
} else { } else {
// Use the 'out of viewport hidden text area' trick // Use the 'out of viewport hidden text area' trick
@ -213,8 +214,11 @@ export default function Stuff() {
schToDt: dayjs(new Date()).format('YYYY-MM-DD'), schToDt: dayjs(new Date()).format('YYYY-MM-DD'),
startRow: (stuffSearch.pageNo - 1) * stuffSearchParams.pageSize + 1, startRow: (stuffSearch.pageNo - 1) * stuffSearchParams.pageSize + 1,
endRow: stuffSearchParams?.endRow, endRow: stuffSearchParams?.endRow,
schSelSaleStoreId: stuffSearchParams?.schSelSaleStoreId ? stuffSearchParams.schSelSaleStoreId : '', schSaleStoreId: stuffSearchParams?.schMyDataCheck ? stuffSearchParams.schSaleStoreId : '',
schOtherSelSaleStoreId: stuffSearchParams?.schOtherSelSaleStoreId ? stuffSearchParams.schOtherSelSaleStoreId : '', // schSelSaleStoreId: stuffSearchParams?.schSelSaleStoreId ? stuffSearchParams.schSelSaleStoreId : '',
// schOtherSelSaleStoreId: stuffSearchParams?.schOtherSelSaleStoreId ? stuffSearchParams.schOtherSelSaleStoreId : '',
schSelSaleStoreId: stuffSearchParams?.schMyDataCheck ? '' : stuffSearchParams.schSelSaleStoreId,
schOtherSelSaleStoreId: stuffSearchParams?.schMyDataCheck ? '' : stuffSearchParams.schOtherSelSaleStoreId,
schSortType: stuffSearchParams.schSortType, schSortType: stuffSearchParams.schSortType,
pageNo: stuffSearchParams?.pageNo ? stuffSearchParams.pageNo : 1, pageNo: stuffSearchParams?.pageNo ? stuffSearchParams.pageNo : 1,
pageSize: stuffSearchParams?.pageSize ? stuffSearchParams.pageSize : 100, pageSize: stuffSearchParams?.pageSize ? stuffSearchParams.pageSize : 100,
@ -223,6 +227,7 @@ export default function Stuff() {
if (!params.saleStoreId) { if (!params.saleStoreId) {
params.saleStoreId = session.storeId params.saleStoreId = session.storeId
} }
async function fetchData() { async function fetchData() {
const apiUrl = `/api/object/list?${queryStringFormatter(params)}` const apiUrl = `/api/object/list?${queryStringFormatter(params)}`
await get({ await get({
@ -279,11 +284,15 @@ export default function Stuff() {
stuffSearchParams.saleStoreId = session.storeId stuffSearchParams.saleStoreId = session.storeId
} }
if (stuffSearchParams.schMyDataCheck) { if (stuffSearchParams.schMyDataCheck) {
if (session.storeLvl === '1') { //0203 schSaleStoreId storeId schSelSaleStoreId, schOtherSelSaleStoreId
//schOtherSelSaleStoreId schSelSaleStoreId saleStoreId stuffSearchParams.schSaleStoreId = session.storeId
stuffSearchParams.schOtherSelSaleStoreId = '' stuffSearchParams.schOtherSelSaleStoreId = ''
stuffSearchParams.schSelSaleStoreId = session.storeId stuffSearchParams.schSelSaleStoreId = ''
} // if (session.storeLvl === '1') {
// stuffSearchParams.schSaleStoreId = session.storeId
// stuffSearchParams.schOtherSelSaleStoreId = ''
// stuffSearchParams.schSelSaleStoreId = ''
// }
} }
async function fetchData() { async function fetchData() {

View File

@ -87,6 +87,7 @@ export default function StuffSearchCondition() {
} }
setIsGlobalLoading(true) setIsGlobalLoading(true)
if (stuffSearch.code === 'S') { if (stuffSearch.code === 'S') {
if (stuffSearch.pageNo !== 1) { if (stuffSearch.pageNo !== 1) {
setStuffSearch({ setStuffSearch({
@ -95,8 +96,11 @@ export default function StuffSearchCondition() {
schAddress: address ? address.trim() : '', schAddress: address ? address.trim() : '',
schObjectName: objectName ? objectName.trim() : '', schObjectName: objectName ? objectName.trim() : '',
schDispCompanyName: dispCompanyName ? dispCompanyName.trim() : '', schDispCompanyName: dispCompanyName ? dispCompanyName.trim() : '',
schSelSaleStoreId: stuffSearch?.schSelSaleStoreId ? stuffSearch.schSelSaleStoreId : '', // schSelSaleStoreId: stuffSearch?.schSelSaleStoreId ? stuffSearch.schSelSaleStoreId : '',
schOtherSelSaleStoreId: stuffSearch?.schOtherSelSaleStoreId ? stuffSearch.schOtherSelSaleStoreId : '', // schOtherSelSaleStoreId: stuffSearch?.schOtherSelSaleStoreId ? stuffSearch.schOtherSelSaleStoreId : '',
schSaleStoreId: stuffSearch?.schMyDataCheck ? stuffSearch?.schSaleStoreId : '',
schSelSaleStoreId: stuffSearch?.schMyDataCheck ? '' : stuffSearch.schSelSaleStoreId,
schOtherSelSaleStoreId: stuffSearch?.schMyDataCheck ? '' : stuffSearch.schOtherSelSaleStoreId,
schReceiveUser: receiveUser ? receiveUser.trim() : '', schReceiveUser: receiveUser ? receiveUser.trim() : '',
schDateType: dateType, schDateType: dateType,
schTempFlg: tempFlg, // schTempFlg: tempFlg, //
@ -307,6 +311,7 @@ export default function StuffSearchCondition() {
stuffSearch.schDateType = 'U' stuffSearch.schDateType = 'U'
stuffSearch.schTempFlg = '' stuffSearch.schTempFlg = ''
stuffSearch.schMyDataCheck = false stuffSearch.schMyDataCheck = false
stuffSearch.schSaleStoreId = ''
setObjectNo('') setObjectNo('')
setAddress('') setAddress('')
setobjectName('') setobjectName('')
@ -332,6 +337,7 @@ export default function StuffSearchCondition() {
schDispCompanyName: '', schDispCompanyName: '',
schSelSaleStoreId: '', schSelSaleStoreId: '',
schOtherSelSaleStoreId: '', schOtherSelSaleStoreId: '',
schSaleStoreId: '',
schDateType: 'U', schDateType: 'U',
schTempFlg: '', schTempFlg: '',
schMyDataCheck: false, schMyDataCheck: false,
@ -346,6 +352,7 @@ export default function StuffSearchCondition() {
if (otherSaleStoreList.length === 1) { if (otherSaleStoreList.length === 1) {
setOtherSaleStoreId(session.storeId) setOtherSaleStoreId(session.storeId)
stuffSearch.schOtherSelSaleStoreId = session.storeId stuffSearch.schOtherSelSaleStoreId = session.storeId
stuffSearch.schSaleStoreId = ''
stuffSearch.schObjectNo = '' stuffSearch.schObjectNo = ''
stuffSearch.schAddress = '' stuffSearch.schAddress = ''
stuffSearch.schObjectName = '' stuffSearch.schObjectName = ''
@ -364,6 +371,7 @@ export default function StuffSearchCondition() {
} else if (otherSaleStoreList.length > 1) { } else if (otherSaleStoreList.length > 1) {
setOtherSaleStoreId('') setOtherSaleStoreId('')
stuffSearch.schOtherSelSaleStoreId = session.storeId stuffSearch.schOtherSelSaleStoreId = session.storeId
stuffSearch.schSaleStoreId = ''
stuffSearch.schObjectNo = '' stuffSearch.schObjectNo = ''
stuffSearch.schAddress = '' stuffSearch.schAddress = ''
stuffSearch.schObjectName = '' stuffSearch.schObjectName = ''
@ -394,11 +402,13 @@ export default function StuffSearchCondition() {
stuffSearch.schSortType = 'U' stuffSearch.schSortType = 'U'
stuffSearch.pageNo = 1 stuffSearch.pageNo = 1
stuffSearch.pageSize = 100 stuffSearch.pageSize = 100
stuffSearch.schSaleStoreId = ''
} }
} else if (session?.storeLvl === '1') { } else if (session?.storeLvl === '1') {
if (otherSaleStoreList.length > 0) { if (otherSaleStoreList.length > 0) {
handleClear2() handleClear2()
setOtherSaleStoreId('') setOtherSaleStoreId('')
stuffSearch.schSaleStoreId = ''
stuffSearch.schObjectNo = '' stuffSearch.schObjectNo = ''
stuffSearch.schAddress = '' stuffSearch.schAddress = ''
stuffSearch.schObjectName = '' stuffSearch.schObjectName = ''
@ -414,6 +424,7 @@ export default function StuffSearchCondition() {
stuffSearch.pageNo = 1 stuffSearch.pageNo = 1
stuffSearch.pageSize = 100 stuffSearch.pageSize = 100
} else { } else {
stuffSearch.schSaleStoreId = ''
stuffSearch.schObjectNo = '' stuffSearch.schObjectNo = ''
stuffSearch.schAddress = '' stuffSearch.schAddress = ''
stuffSearch.schObjectName = '' stuffSearch.schObjectName = ''
@ -583,8 +594,8 @@ export default function StuffSearchCondition() {
// //
const onSelectionChange = (key) => { const onSelectionChange = (key) => {
// //
setMyDataCheck(false) setMyDataCheck(stuffSearch.schMyDataCheck)
stuffSearch.schMyDataCheck = false // stuffSearch.schMyDataCheck = false
if (isObjectNotEmpty(key)) { if (isObjectNotEmpty(key)) {
setOtherSaleStoreId('') setOtherSaleStoreId('')
@ -695,6 +706,7 @@ export default function StuffSearchCondition() {
stuffSearch.endRow = 100 stuffSearch.endRow = 100
stuffSearch.schSelSaleStoreId = '' stuffSearch.schSelSaleStoreId = ''
stuffSearch.schOtherSelSaleStoreId = '' stuffSearch.schOtherSelSaleStoreId = ''
stuffSearch.schSaleStoreId = ''
stuffSearch.schSortType = 'U' stuffSearch.schSortType = 'U'
stuffSearch.pageNo = 1 stuffSearch.pageNo = 1
stuffSearch.pageSize = 100 stuffSearch.pageSize = 100
@ -729,6 +741,7 @@ export default function StuffSearchCondition() {
stuffSearch.endRow = 100 stuffSearch.endRow = 100
stuffSearch.schSelSaleStoreId = '' stuffSearch.schSelSaleStoreId = ''
stuffSearch.schOtherSelSaleStoreId = '' stuffSearch.schOtherSelSaleStoreId = ''
stuffSearch.schSaleStoreId = ''
stuffSearch.schSortType = 'U' stuffSearch.schSortType = 'U'
stuffSearch.pageNo = 1 stuffSearch.pageNo = 1
stuffSearch.pageSize = 100 stuffSearch.pageSize = 100
@ -759,7 +772,6 @@ export default function StuffSearchCondition() {
stuffSearch.schOtherSelSaleStoreId = '' stuffSearch.schOtherSelSaleStoreId = ''
setOtherSaleStoreId('') setOtherSaleStoreId('')
} }
setObjectNo('') setObjectNo('')
setSaleStoreName('') setSaleStoreName('')
setAddress('') setAddress('')
@ -841,47 +853,59 @@ export default function StuffSearchCondition() {
// //
const checkMyData = (e) => { const checkMyData = (e) => {
//0203 schSaleStoreId storeId schSelSaleStoreId, schOtherSelSaleStoreId
if (session?.storeId === 'T01') { if (session?.storeId === 'T01') {
if (e.target.checked) { if (e.target.checked) {
stuffSearch.schMyDataCheck = e.target.value stuffSearch.schMyDataCheck = e.target.checked
setMyDataCheck(true) setMyDataCheck(true)
setOtherSaleStoreId('') //2 setOtherSaleStoreId('') //2
setSchSelSaleStoreId('T01') setSchSelSaleStoreId('T01')
stuffSearch.schSelSaleStoreId = 'T01'
stuffSearch.schSaleStoreId = session.storeId
stuffSearch.schSelSaleStoreId = ''
stuffSearch.schOtherSelSaleStoreId = '' stuffSearch.schOtherSelSaleStoreId = ''
const key = { saleStoreId: session.storeId }
onSelectionChange(key)
} else { } else {
stuffSearch.schMyDataCheck = e.target.value stuffSearch.schSaleStoreId = ''
stuffSearch.schMyDataCheck = e.target.checked
setSchSelSaleStoreId('')
setMyDataCheck(false) setMyDataCheck(false)
onSelectionChange(null)
} }
} else if (session?.storeLvl === '1') { } else if (session?.storeLvl === '1') {
if (e.target.checked) { if (e.target.checked) {
stuffSearch.schMyDataCheck = e.target.value stuffSearch.schMyDataCheck = e.target.checked
setMyDataCheck(true) setMyDataCheck(true)
//schOtherSelSaleStoreId
//schSelSaleStoreId saleStoreId
setOtherSaleStoreId('') //2 setOtherSaleStoreId('') //2
setSchSelSaleStoreId(schSelSaleStoreId) setSchSelSaleStoreId(schSelSaleStoreId)
stuffSearch.schSelSaleStoreId = schSelSaleStoreId stuffSearch.schSaleStoreId = session.storeId
stuffSearch.schSelSaleStoreId = ''
stuffSearch.schOtherSelSaleStoreId = '' stuffSearch.schOtherSelSaleStoreId = ''
} else { } else {
stuffSearch.schMyDataCheck = e.target.checked
stuffSearch.schSaleStoreId = ''
setMyDataCheck(false) setMyDataCheck(false)
} }
} else { } else {
//2 3,4 //2 3,4
//3,4 //3,4
if (e.target.checked) { if (e.target.checked) {
stuffSearch.schMyDataCheck = e.target.value stuffSearch.schMyDataCheck = e.target.checked
setMyDataCheck(true) setMyDataCheck(true)
if (otherSaleStoreList.length > 1) { if (otherSaleStoreList.length > 1) {
stuffSearch.schOtherSelSaleStoreId = session.storeId stuffSearch.schSaleStoreId = session.storeId
stuffSearch.schOtherSelSaleStoreId = ''
setOtherSaleStoreId(session.storeId) setOtherSaleStoreId(session.storeId)
} else { } else {
stuffSearch.schSaleStoreId = session.storeId
stuffSearch.schSelSaleStoreId = '' stuffSearch.schSelSaleStoreId = ''
stuffSearch.schOtherSelSaleStoreId = session.storeId stuffSearch.schOtherSelSaleStoreId = ''
} }
} else { } else {
setMyDataCheck(false) setMyDataCheck(false)
stuffSearch.schMyDataCheck = e.target.value stuffSearch.schMyDataCheck = e.target.checked
stuffSearch.schSaleStoreId = ''
} }
} }
} }

View File

@ -216,6 +216,12 @@ export function useMasterController() {
}) })
} }
const getQuotationItem = async (params) => {
return await post({ url: '/api/v1/master/getQuotationItem', data: params }).then((res) => {
return res
})
}
/** /**
* 물건 정보 업데이트 api 호출 * 물건 정보 업데이트 api 호출
* @param {objectNo standardWindSpeedId verticalSnowCover surfaceType installHeight userId} params * @param {objectNo standardWindSpeedId verticalSnowCover surfaceType installHeight userId} params
@ -224,7 +230,7 @@ export function useMasterController() {
*/ */
const updateObjectDate = async (params = null) => { const updateObjectDate = async (params = null) => {
return await put({ url: '/api/object/update-object-date', data: params }).then((res) => { return await put({ url: '/api/object/update-object-date', data: params }).then((res) => {
return res console.log('updateObjectDate', res)
}) })
} }
@ -241,5 +247,6 @@ export function useMasterController() {
getPcsManualConfChk, getPcsManualConfChk,
getPcsVoltageStepUpList, getPcsVoltageStepUpList,
updateObjectDate, updateObjectDate,
getQuotationItem,
} }
} }

View File

@ -4,11 +4,13 @@ import { POLYGON_TYPE } from '@/common/common'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions' import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { getDegreeByChon, getTrestleLength } from '@/util/canvas-util' import { getDegreeByChon, getTrestleLength } from '@/util/canvas-util'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { useMasterController } from '@/hooks/common/useMasterController'
// 회로 및 가대설정 // 회로 및 가대설정
export const useTrestle = () => { export const useTrestle = () => {
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터 const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
const { getQuotationItem } = useMasterController()
const apply = () => { const apply = () => {
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함. //처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
@ -17,7 +19,7 @@ export const useTrestle = () => {
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
// 기존 eaveBar를 삭제 // 기존 eaveBar를 삭제
canvas.getObjects().forEach((obj) => { canvas.getObjects().forEach((obj) => {
if (obj.name === 'eaveBar' || obj.name === 'rack') { if (obj.name === 'eaveBar' || obj.name === 'rack' || obj.name === 'halfEaveBar' || obj.name === 'smartRack') {
canvas.remove(obj) canvas.remove(obj)
} }
}) })
@ -96,7 +98,7 @@ export const useTrestle = () => {
canvas canvas
.getObjects() .getObjects()
.filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parent === surface) .filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parentId === surface.id)
.forEach((obj) => { .forEach((obj) => {
canvas.remove(obj) canvas.remove(obj)
}) })
@ -435,7 +437,18 @@ export const useTrestle = () => {
installBracket(surface) installBracket(surface)
} }
console.log(getTrestleParams(surface)) const quotationParam = getTrestleParams(surface)
surface.set({ quotationParam })
getQuoationItems()
})
}
const getQuoationItems = () => {
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
const params = { trestles: surfaces.map((surface) => surface.quotationParam) }
getQuotationItem(params).then((res) => {
console.log(res)
}) })
} }
@ -633,9 +646,9 @@ export const useTrestle = () => {
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => { smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10 rackLength = getTrestleLength(setRackTpLen, degree) / 10
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY - rackLength], {
name: 'smartRack', name: 'smartRack',
stroke: 'blue', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
shadow: { shadow: {
@ -706,7 +719,7 @@ export const useTrestle = () => {
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], {
name: 'smartRack', name: 'smartRack',
stroke: 'blue', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
shadow: { shadow: {
@ -775,7 +788,7 @@ export const useTrestle = () => {
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], {
name: 'smartRack', name: 'smartRack',
stroke: 'blue', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
shadow: { shadow: {
@ -840,9 +853,9 @@ export const useTrestle = () => {
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => { smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10 rackLength = getTrestleLength(setRackTpLen, degree) / 10
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY + rackLength], {
name: 'smartRack', name: 'smartRack',
stroke: 'blue', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
shadow: { shadow: {
@ -906,7 +919,7 @@ export const useTrestle = () => {
modules.forEach((module) => { modules.forEach((module) => {
canvas canvas
.getObjects() .getObjects()
.filter((obj) => obj.name === 'rack') .filter((obj) => obj.name === 'rack' || obj.name === 'smartRack')
.forEach((rack) => { .forEach((rack) => {
if (rack.parentId === module.id) { if (rack.parentId === module.id) {
canvas.remove(canvas.getObjects().filter((obj) => obj.name === 'bracket' && obj.parentId === rack.id)) canvas.remove(canvas.getObjects().filter((obj) => obj.name === 'bracket' && obj.parentId === rack.id))
@ -1171,7 +1184,7 @@ export const useTrestle = () => {
const getBracketPoints = (n, percent) => { const getBracketPoints = (n, percent) => {
if (n < 2) { if (n < 2) {
throw new Error('Number of points must be at least 2') return []
} }
const points = [] const points = []
@ -1479,6 +1492,7 @@ export const useTrestle = () => {
return groups return groups
} }
// 견적서 아이템 조회 api parameter 생성
const getTrestleParams = (surface) => { const getTrestleParams = (surface) => {
const result = calculateForApi(surface) const result = calculateForApi(surface)
@ -1505,8 +1519,24 @@ export const useTrestle = () => {
rackRows: rack.rackRowsCd, rackRows: rack.rackRowsCd,
} }
}) })
const parent = canvas.getObjects().find((obj) => obj.id === surface.parentId)
const roofMaterialIndex = parent.roofMaterial.index
const moduleSelection = moduleSelectionData?.roofConstructions?.find((construction) => construction.roofIndex === roofMaterialIndex)
const { common, module } = moduleSelectionData
// const { constTp } = construction
let { cvrPlvrYn } = surface.trestleDetail
const { trestleMkrCd, constMthdCd, roofBaseCd } = moduleSelection.trestle
const { illuminationTp, instHt, stdSnowLd, stdWindSpeed } = common
const { constTp } = moduleSelection.construction
const { addRoof } = moduleSelection
return { return {
moduleTpCd: module.itemTp,
roofMatlCd: parent.roofMaterial.roofMatlCd,
mixMatlNo: module.mixMatlNo,
raftBaseCd: addRoof.raft,
roofPitch: addRoof.roofPchBase,
exposedLowerBottomTotCnt: result.exposedBottom, // 노출 최하면 갯수 exposedLowerBottomTotCnt: result.exposedBottom, // 노출 최하면 갯수
exposedHalfBottomTotCnt: result.exposedHalfBottom, // 노출 반하면 갯수 exposedHalfBottomTotCnt: result.exposedHalfBottom, // 노출 반하면 갯수
exposedTopTotCnt: result.exposedTop, // 노출 상면 총 수 exposedTopTotCnt: result.exposedTop, // 노출 상면 총 수
@ -1521,9 +1551,56 @@ export const useTrestle = () => {
rackTotCnt: rackList.length ?? 0 + smartRackGroup.length ?? 0, rackTotCnt: rackList.length ?? 0 + smartRackGroup.length ?? 0,
rackFittingCnt: bracketList.length, rackFittingCnt: bracketList.length,
moduleRows: getMostLeftModules(surface), moduleRows: getMostLeftModules(surface),
cvrYn: moduleSelection.construction.setupCover ? 'Y' : 'N',
snowGuardYn: moduleSelection.construction.setupSnowCover ? 'Y' : 'N',
plvrYn: cvrPlvrYn,
modules: getModules(surface),
pcses: surface.pcses ?? [],
trestleMkrCd,
constMthdCd,
roofBaseCd,
illuminationTp,
instHt,
stdSnowLd,
stdWindSpeed,
constTp,
} }
} }
const getModules = (surface) => {
const { modules } = surface
const params = modules.map((module, index) => {
return {
moduleTpCd: module.moduleInfo.itemTp,
moduleItemId: module.moduleInfo.itemId,
}
})
//params를 moduleTpCd, moduleItemId로 그룹화 하면서 cnt를 계산
const groupedParams = params.reduce((acc, cur) => {
const key = `${cur.moduleTpCd}-${cur.moduleItemId}`
if (!acc[key]) {
acc[key] = {
moduleTpCd: cur.moduleTpCd,
moduleItemId: cur.moduleItemId,
cnt: 0,
}
}
acc[key].cnt++
return acc
}, {})
// map 형태의 데이터를 배열로 변환
return Object.values(groupedParams).map((groupedParam, index) => {
return {
moduleTpCd: groupedParam.moduleTpCd,
moduleItemId: groupedParam.moduleItemId,
moduleCnt: groupedParam.cnt,
}
})
}
// 가장 왼쪽에 있는 모듈을 기준으로 같은 단에 있는 모듈들 파라미터 생성 // 가장 왼쪽에 있는 모듈을 기준으로 같은 단에 있는 모듈들 파라미터 생성
const getMostLeftModules = (surface) => { const getMostLeftModules = (surface) => {
const { direction, modules } = surface const { direction, modules } = surface

View File

@ -487,6 +487,7 @@ export function useRoofShapeSetting(id) {
offset: eavesOffset / 10, offset: eavesOffset / 10,
pitch: pitchRef.current, pitch: pitchRef.current,
type: LINE_TYPE.WALLLINE.EAVES, type: LINE_TYPE.WALLLINE.EAVES,
onlyOffset: false,
} }
// hideLine(line) // hideLine(line)
}) })

View File

@ -95,8 +95,8 @@ export const useLine = () => {
const textStr = const textStr =
currentAngleType === ANGLE_TYPE.SLOPE currentAngleType === ANGLE_TYPE.SLOPE
? `${attributes.offset ? attributes.offset * 10 : attributes.width * 10}${onlyOffset && attributes.pitch ? '-∠' + attributes.pitch + angleUnit : ''}` ? `${attributes.offset ? attributes.offset * 10 : attributes.width * 10}${!onlyOffset && attributes.pitch ? '-∠' + attributes.pitch + angleUnit : ''}`
: `${attributes.offset ? attributes.offset * 10 : attributes.width * 10}${onlyOffset && attributes.pitch ? '-∠' + getDegreeByChon(attributes.pitch) + angleUnit : ''}` : `${attributes.offset ? attributes.offset * 10 : attributes.width * 10}${!onlyOffset && attributes.pitch ? '-∠' + getDegreeByChon(attributes.pitch) + angleUnit : ''}`
if (direction === 'top') { if (direction === 'top') {
left = (startPoint.x + endPoint.x) / 2 left = (startPoint.x + endPoint.x) / 2

View File

@ -4,16 +4,16 @@ export const settingModalFirstOptionsState = atom({
key: 'settingModalFirstOptions', key: 'settingModalFirstOptions',
default: { default: {
option1: [ option1: [
{ id: 1, column: 'allocDisplay', name: 'modal.canvas.setting.first.option.alloc', selected: false }, { id: 1, column: 'allocDisplay', name: 'modal.canvas.setting.first.option.alloc', selected: true },
{ id: 2, column: 'outlineDisplay', name: 'modal.canvas.setting.first.option.outline', selected: true }, { id: 2, column: 'outlineDisplay', name: 'modal.canvas.setting.first.option.outline', selected: true },
{ id: 3, column: 'gridDisplay', name: 'modal.canvas.setting.first.option.grid', selected: false }, { id: 3, column: 'gridDisplay', name: 'modal.canvas.setting.first.option.grid', selected: true },
{ id: 4, column: 'lineDisplay', name: 'modal.canvas.setting.first.option.roof.line', selected: false }, { id: 4, column: 'lineDisplay', name: 'modal.canvas.setting.first.option.roof.line', selected: true },
{ id: 5, column: 'wordDisplay', name: 'modal.canvas.setting.first.option.word', selected: false }, { id: 5, column: 'wordDisplay', name: 'modal.canvas.setting.first.option.word', selected: true },
{ id: 6, column: 'circuitNumDisplay', name: 'modal.canvas.setting.first.option.circuit.num', selected: false }, { id: 6, column: 'circuitNumDisplay', name: 'modal.canvas.setting.first.option.circuit.num', selected: true },
{ id: 7, column: 'flowDisplay', name: 'modal.canvas.setting.first.option.flow', selected: false }, { id: 7, column: 'flowDisplay', name: 'modal.canvas.setting.first.option.flow', selected: true },
{ id: 8, column: 'trestleDisplay', name: 'modal.canvas.setting.first.option.trestle', selected: false }, { id: 8, column: 'trestleDisplay', name: 'modal.canvas.setting.first.option.trestle', selected: true },
{ id: 9, column: 'imageDisplay', name: 'modal.canvas.setting.first.option.image', selected: false }, { id: 9, column: 'imageDisplay', name: 'modal.canvas.setting.first.option.image', selected: false },
{ id: 10, column: 'totalDisplay', name: 'modal.canvas.setting.first.option.total', selected: false }, { id: 10, column: 'totalDisplay', name: 'modal.canvas.setting.first.option.total', selected: true },
], ],
dimensionDisplay: [ dimensionDisplay: [
{ {

View File

@ -13,6 +13,7 @@ export const stuffSearchState = atom({
schFromDt: dayjs(new Date()).add(-1, 'year').format('YYYY-MM-DD'), //시작일 schFromDt: dayjs(new Date()).add(-1, 'year').format('YYYY-MM-DD'), //시작일
schToDt: dayjs(new Date()).format('YYYY-MM-DD'), //종료일 schToDt: dayjs(new Date()).format('YYYY-MM-DD'), //종료일
code: 'S', code: 'S',
schSaleStoreId: '', //내물건보기 체크용
schSelSaleStoreId: '', //1차판매대리점 선택 schSelSaleStoreId: '', //1차판매대리점 선택
schOtherSelSaleStoreId: '', //1차 이외 판매대리점 선택 schOtherSelSaleStoreId: '', //1차 이외 판매대리점 선택
startRow: 1, startRow: 1,