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',
'seq',
'smartRackId',
'quotationParam',
'pcses',
]
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>
</div>
</div>
<div className="modal-foot modal-handle"></div>
</div>
<div className="modal-foot modal-handle"></div>
</WithDraggable>
)
}

View File

@ -42,7 +42,6 @@ export default function Stuff() {
//
const copyNo = async (value) => {
if (navigator.clipboard && window.isSecureContext) {
console.log('trttt')
await navigator.clipboard
.writeText(value)
.then(() => {
@ -51,9 +50,11 @@ export default function Stuff() {
type: 'alert',
})
})
.catch((e) => {
console.log(e)
alert(getMessage('stuff.detail.header.failCopy'))
.catch(() => {
swalFire({
text: getMessage('stuff.detail.header.failCopy'),
type: 'alert',
})
})
} else {
// 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'),
startRow: (stuffSearch.pageNo - 1) * stuffSearchParams.pageSize + 1,
endRow: stuffSearchParams?.endRow,
schSelSaleStoreId: stuffSearchParams?.schSelSaleStoreId ? stuffSearchParams.schSelSaleStoreId : '',
schOtherSelSaleStoreId: stuffSearchParams?.schOtherSelSaleStoreId ? stuffSearchParams.schOtherSelSaleStoreId : '',
schSaleStoreId: stuffSearchParams?.schMyDataCheck ? stuffSearchParams.schSaleStoreId : '',
// schSelSaleStoreId: stuffSearchParams?.schSelSaleStoreId ? stuffSearchParams.schSelSaleStoreId : '',
// schOtherSelSaleStoreId: stuffSearchParams?.schOtherSelSaleStoreId ? stuffSearchParams.schOtherSelSaleStoreId : '',
schSelSaleStoreId: stuffSearchParams?.schMyDataCheck ? '' : stuffSearchParams.schSelSaleStoreId,
schOtherSelSaleStoreId: stuffSearchParams?.schMyDataCheck ? '' : stuffSearchParams.schOtherSelSaleStoreId,
schSortType: stuffSearchParams.schSortType,
pageNo: stuffSearchParams?.pageNo ? stuffSearchParams.pageNo : 1,
pageSize: stuffSearchParams?.pageSize ? stuffSearchParams.pageSize : 100,
@ -223,6 +227,7 @@ export default function Stuff() {
if (!params.saleStoreId) {
params.saleStoreId = session.storeId
}
async function fetchData() {
const apiUrl = `/api/object/list?${queryStringFormatter(params)}`
await get({
@ -279,11 +284,15 @@ export default function Stuff() {
stuffSearchParams.saleStoreId = session.storeId
}
if (stuffSearchParams.schMyDataCheck) {
if (session.storeLvl === '1') {
//schOtherSelSaleStoreId schSelSaleStoreId saleStoreId
stuffSearchParams.schOtherSelSaleStoreId = ''
stuffSearchParams.schSelSaleStoreId = session.storeId
}
//0203 schSaleStoreId storeId schSelSaleStoreId, schOtherSelSaleStoreId
stuffSearchParams.schSaleStoreId = session.storeId
stuffSearchParams.schOtherSelSaleStoreId = ''
stuffSearchParams.schSelSaleStoreId = ''
// if (session.storeLvl === '1') {
// stuffSearchParams.schSaleStoreId = session.storeId
// stuffSearchParams.schOtherSelSaleStoreId = ''
// stuffSearchParams.schSelSaleStoreId = ''
// }
}
async function fetchData() {

View File

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

View File

@ -4,11 +4,13 @@ import { POLYGON_TYPE } from '@/common/common'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { getDegreeByChon, getTrestleLength } from '@/util/canvas-util'
import { v4 as uuidv4 } from 'uuid'
import { useMasterController } from '@/hooks/common/useMasterController'
// 회로 및 가대설정
export const useTrestle = () => {
const canvas = useRecoilValue(canvasState)
const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
const { getQuotationItem } = useMasterController()
const apply = () => {
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
@ -17,7 +19,7 @@ export const useTrestle = () => {
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
// 기존 eaveBar를 삭제
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)
}
})
@ -96,7 +98,7 @@ export const useTrestle = () => {
canvas
.getObjects()
.filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parent === surface)
.filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parentId === surface.id)
.forEach((obj) => {
canvas.remove(obj)
})
@ -435,7 +437,18 @@ export const useTrestle = () => {
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 }) => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10
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',
stroke: 'blue',
stroke: 'red',
strokeWidth: 4,
selectable: false,
shadow: {
@ -706,7 +719,7 @@ export const useTrestle = () => {
if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], {
name: 'smartRack',
stroke: 'blue',
stroke: 'red',
strokeWidth: 4,
selectable: false,
shadow: {
@ -775,7 +788,7 @@ export const useTrestle = () => {
if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], {
name: 'smartRack',
stroke: 'blue',
stroke: 'red',
strokeWidth: 4,
selectable: false,
shadow: {
@ -840,9 +853,9 @@ export const useTrestle = () => {
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10
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',
stroke: 'blue',
stroke: 'red',
strokeWidth: 4,
selectable: false,
shadow: {
@ -906,7 +919,7 @@ export const useTrestle = () => {
modules.forEach((module) => {
canvas
.getObjects()
.filter((obj) => obj.name === 'rack')
.filter((obj) => obj.name === 'rack' || obj.name === 'smartRack')
.forEach((rack) => {
if (rack.parentId === module.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) => {
if (n < 2) {
throw new Error('Number of points must be at least 2')
return []
}
const points = []
@ -1479,6 +1492,7 @@ export const useTrestle = () => {
return groups
}
// 견적서 아이템 조회 api parameter 생성
const getTrestleParams = (surface) => {
const result = calculateForApi(surface)
@ -1505,8 +1519,24 @@ export const useTrestle = () => {
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 {
moduleTpCd: module.itemTp,
roofMatlCd: parent.roofMaterial.roofMatlCd,
mixMatlNo: module.mixMatlNo,
raftBaseCd: addRoof.raft,
roofPitch: addRoof.roofPchBase,
exposedLowerBottomTotCnt: result.exposedBottom, // 노출 최하면 갯수
exposedHalfBottomTotCnt: result.exposedHalfBottom, // 노출 반하면 갯수
exposedTopTotCnt: result.exposedTop, // 노출 상면 총 수
@ -1521,9 +1551,56 @@ export const useTrestle = () => {
rackTotCnt: rackList.length ?? 0 + smartRackGroup.length ?? 0,
rackFittingCnt: bracketList.length,
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 { direction, modules } = surface

View File

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

View File

@ -95,8 +95,8 @@ export const useLine = () => {
const textStr =
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 ? '-∠' + getDegreeByChon(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 : ''}`
if (direction === 'top') {
left = (startPoint.x + endPoint.x) / 2

View File

@ -4,16 +4,16 @@ export const settingModalFirstOptionsState = atom({
key: 'settingModalFirstOptions',
default: {
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: 3, column: 'gridDisplay', name: 'modal.canvas.setting.first.option.grid', selected: false },
{ id: 4, column: 'lineDisplay', name: 'modal.canvas.setting.first.option.roof.line', selected: false },
{ id: 5, column: 'wordDisplay', name: 'modal.canvas.setting.first.option.word', selected: false },
{ id: 6, column: 'circuitNumDisplay', name: 'modal.canvas.setting.first.option.circuit.num', selected: false },
{ id: 7, column: 'flowDisplay', name: 'modal.canvas.setting.first.option.flow', selected: false },
{ id: 8, column: 'trestleDisplay', name: 'modal.canvas.setting.first.option.trestle', 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: true },
{ 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: true },
{ 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: true },
{ 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: [
{

View File

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