Merge branch 'dev' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
066cd03dc1
@ -296,7 +296,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
type="button"
|
||||
className="btn-origin navy mr5"
|
||||
onClick={() => {
|
||||
handleEstimateCopy(sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId)
|
||||
handleEstimateCopy(sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId, setEstimateCopyPopupOpen)
|
||||
}}
|
||||
>
|
||||
{getMessage('estimate.detail.estimateCopyPopup.copyBtn')}
|
||||
|
||||
@ -221,6 +221,7 @@ export default function CanvasMenu(props) {
|
||||
await reloadCanvasStatus(objectNo, pid)
|
||||
break
|
||||
case 5:
|
||||
setIsGlobalLoading(true)
|
||||
promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => {
|
||||
if (res.status === 200) {
|
||||
const estimateDetail = res.data
|
||||
@ -230,6 +231,9 @@ export default function CanvasMenu(props) {
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||
setIsGlobalLoading(false)
|
||||
router.push(`/floor-plan/estimate/${menu.index}?pid=${selectedPlan.planNo}&objectNo=${objectNo}`)
|
||||
if (pathname === '/floor-plan/estimate/5') {
|
||||
setIsGlobalLoading(false)
|
||||
}
|
||||
} else {
|
||||
setIsGlobalLoading(false)
|
||||
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||
@ -239,7 +243,6 @@ export default function CanvasMenu(props) {
|
||||
break
|
||||
case 6:
|
||||
setIsGlobalLoading(true)
|
||||
//로딩바해제는 발전시뮬레이션 조회쪽에서(Simulator.jsx) setIsGlobalLoading(false)
|
||||
promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => {
|
||||
if (res.status === 200) {
|
||||
const estimateDetail = res.data
|
||||
@ -247,7 +250,9 @@ export default function CanvasMenu(props) {
|
||||
setMenuNumber(menu.index)
|
||||
setCurrentMenu(menu.title)
|
||||
router.push(`/floor-plan/simulator/${menu.index}?pid=${selectedPlan.planNo}&objectNo=${objectNo}`)
|
||||
setIsGlobalLoading(false)
|
||||
if (pathname === '/floor-plan/simulator/6') {
|
||||
setIsGlobalLoading(false)
|
||||
}
|
||||
} else {
|
||||
setIsGlobalLoading(false)
|
||||
swalFire({ text: getMessage('simulator.menu.move.valid1') })
|
||||
|
||||
@ -7,10 +7,14 @@ import { LINE_TYPE } from '@/common/common'
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
|
||||
export default function PlacementSurfaceLineProperty(props) {
|
||||
const { id, pos = { x: 50, y: 230 }, roof } = props
|
||||
const { id, pos = { x: 50, y: 230 }, roof, setIsHidden } = props
|
||||
const { closePopup } = usePopup()
|
||||
// const { handleSetEaves, handleSetGable, handleRollback, handleFix, closeModal } = usePropertiesSetting(id)
|
||||
const { roofLinesInit, handleSetRidge, handleSetEaves, handleSetGable, handleRollback, handleFix } = useRoofLinePropertySetting(id, roof)
|
||||
const { roofLinesInit, handleSetRidge, handleSetEaves, handleSetGable, handleRollback, handleFix } = useRoofLinePropertySetting({
|
||||
id,
|
||||
roof,
|
||||
setIsHidden,
|
||||
})
|
||||
const { getMessage } = useMessage()
|
||||
const { swalFire } = useSwal()
|
||||
|
||||
@ -29,6 +33,10 @@ export default function PlacementSurfaceLineProperty(props) {
|
||||
}
|
||||
|
||||
closePopup(id)
|
||||
|
||||
if (setIsHidden) {
|
||||
setIsHidden(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@ -83,6 +83,10 @@ export const useEstimateController = (planNo, flag) => {
|
||||
res.data.pkgAsp = roundedNumber.toString()
|
||||
}
|
||||
setEstimateContextState(res.data)
|
||||
} else {
|
||||
swalFire({ text: getMessage('stuff.detail.header.notExistObjectNo'), type: 'alert', icon: 'error' })
|
||||
setIsLoading(true)
|
||||
setIsGlobalLoading(false)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -90,8 +94,7 @@ export const useEstimateController = (planNo, flag) => {
|
||||
setIsGlobalLoading(false)
|
||||
} catch (error) {
|
||||
console.error('견적서 상세조회 Error: ', error)
|
||||
|
||||
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||
swalFire({ text: getMessage('stuff.detail.header.notExistObjectNo'), type: 'alert', icon: 'error' })
|
||||
setIsLoading(true)
|
||||
setIsGlobalLoading(false)
|
||||
}
|
||||
@ -415,7 +418,7 @@ export const useEstimateController = (planNo, flag) => {
|
||||
* (견적서 번호(estimateData.docNo)가 생성된 이후 버튼 활성화 )
|
||||
* T01관리자 계정 및 1차판매점에게만 제공
|
||||
*/
|
||||
const handleEstimateCopy = async (sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId) => {
|
||||
const handleEstimateCopy = async (sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId, setEstimateCopyPopupOpen) => {
|
||||
//todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요
|
||||
if (estimateData.estimateType === 'YJSS') {
|
||||
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
|
||||
@ -455,6 +458,7 @@ export const useEstimateController = (planNo, flag) => {
|
||||
text: getMessage('estimate.detail.estimateCopyPopup.copy.alertMessage'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setEstimateCopyPopupOpen(false) //팝업닫고
|
||||
router.push(`/management/stuff/detail?objectNo=${newObjectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
|
||||
@ -501,6 +501,67 @@ export function useCanvasSetting() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본설정(PlacementShapeSetting) 복사 저장
|
||||
*/
|
||||
const basicSettingCopySave = async (params) => {
|
||||
try {
|
||||
const patternData = {
|
||||
objectNo: correntObjectNo,
|
||||
planNo: Number(params.planNo),
|
||||
roofSizeSet: Number(params.roofSizeSet),
|
||||
roofAngleSet: params.roofAngleSet,
|
||||
roofMaterialsAddList: params.roofsData.map((item) => ({
|
||||
planNo: Number(item.planNo),
|
||||
roofApply: item.roofApply,
|
||||
roofSeq: item.roofSeq,
|
||||
roofMatlCd: item.roofMatlCd,
|
||||
roofWidth: item.roofWidth,
|
||||
roofHeight: item.roofHeight,
|
||||
roofHajebichi: item.roofHajebichi,
|
||||
roofGap: item.roofGap,
|
||||
roofLayout: item.roofLayout,
|
||||
roofPitch: item.roofPitch,
|
||||
roofAngle: item.roofAngle,
|
||||
})),
|
||||
}
|
||||
|
||||
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData }).then((res) => {
|
||||
swalFire({ text: getMessage(res.returnMessage) })
|
||||
})
|
||||
|
||||
/* CanvasSetting Recoil 설정 - roofSizeSet을 문자열로 변환 */
|
||||
setCanvasSetting({
|
||||
...basicSetting,
|
||||
roofSizeSet: String(params.roofSizeSet),
|
||||
})
|
||||
|
||||
/* 배치면초기설정 조회 */
|
||||
fetchBasicSettings(Number(params.planNo), null)
|
||||
|
||||
/* 메뉴 설정 */
|
||||
if (['2', '3'].includes(params?.roofSizeSet)) {
|
||||
setMenuNumber(3)
|
||||
setType('surface')
|
||||
setCurrentMenu(MENU.BATCH_CANVAS.BATCH_DRAWING)
|
||||
} else {
|
||||
setMenuNumber(2)
|
||||
setType('outline')
|
||||
setCurrentMenu(MENU.ROOF_COVERING.EXTERIOR_WALL_LINE)
|
||||
}
|
||||
|
||||
/* 모듈 선택 데이터 초기화 */
|
||||
resetModuleSelectionData()
|
||||
moduleSelectedDataTrigger({ common: {}, module: {}, roofConstructions: [] })
|
||||
const isModuleExist = canvas.getObjects().some((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||
if (!isModuleExist) {
|
||||
resetSelectedModules()
|
||||
}
|
||||
} catch (error) {
|
||||
swalFire({ text: error.message, icon: 'error' })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CanvasSetting 조회 및 초기화
|
||||
*/
|
||||
@ -915,6 +976,7 @@ export function useCanvasSetting() {
|
||||
setAdsorptionRange,
|
||||
fetchSettings,
|
||||
fetchBasicSettings,
|
||||
basicSettingCopySave,
|
||||
frontSettings,
|
||||
globalFont,
|
||||
setGlobalFont,
|
||||
|
||||
@ -15,7 +15,8 @@ const LINE_COLOR = {
|
||||
ACTIVE: '#EA10AC',
|
||||
}
|
||||
|
||||
export function useRoofLinePropertySetting(id, roof) {
|
||||
export function useRoofLinePropertySetting(props) {
|
||||
const { id, roof, setIsHidden } = props
|
||||
const canvas = useRecoilValue(canvasState)
|
||||
const currentObject = useRecoilValue(currentObjectState)
|
||||
const history = useRef([])
|
||||
@ -25,10 +26,20 @@ export function useRoofLinePropertySetting(id, roof) {
|
||||
|
||||
useEffect(() => {
|
||||
if (currentObject && currentObject.name === 'roofLine') {
|
||||
roof.lines.forEach((line) => {
|
||||
const lineType = line.attributes?.type
|
||||
if (!lineType) {
|
||||
line.set({
|
||||
stroke: '#000000',
|
||||
strokeWidth: 4,
|
||||
})
|
||||
}
|
||||
})
|
||||
currentObject.set({
|
||||
stroke: LINE_COLOR.ACTIVE,
|
||||
strokeWidth: 4,
|
||||
})
|
||||
canvas.renderAll()
|
||||
}
|
||||
}, [currentObject])
|
||||
|
||||
@ -97,11 +108,8 @@ export function useRoofLinePropertySetting(id, roof) {
|
||||
}
|
||||
const lastLine = history.current.pop()
|
||||
|
||||
// delete lastLine.attributes
|
||||
lastLine.attributes = {
|
||||
...lastLine.attributes,
|
||||
type: null,
|
||||
}
|
||||
delete lastLine.attributes
|
||||
|
||||
lastLine.set({
|
||||
stroke: LINE_COLOR.DEFAULT,
|
||||
strokeWidth: 4,
|
||||
@ -132,6 +140,7 @@ export function useRoofLinePropertySetting(id, roof) {
|
||||
|
||||
canvas.renderAll()
|
||||
closePopup(id)
|
||||
if (setIsHidden) setIsHidden(false)
|
||||
}
|
||||
|
||||
const nextLineFocus = (selectedLine) => {
|
||||
|
||||
@ -19,6 +19,8 @@ import { QLine } from '@/components/fabric/QLine'
|
||||
import { useRoofFn } from '@/hooks/common/useRoofFn'
|
||||
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
||||
import PlacementSurfaceLineProperty from '@/components/floor-plan/modal/placementShape/PlacementSurfaceLineProperty'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
const { getMessage } = useMessage()
|
||||
@ -34,7 +36,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
const { swalFire } = useSwal()
|
||||
const { addCanvasMouseEventListener, initEvent } = useEvent()
|
||||
// const { addCanvasMouseEventListener, initEvent } = useContext(EventContext)
|
||||
const { closePopup } = usePopup()
|
||||
const { addPopup, closePopup } = usePopup()
|
||||
const { setSurfaceShapePattern } = useRoofFn()
|
||||
|
||||
const applySurfaceShape = (surfaceRefs, selectedType, id) => {
|
||||
@ -113,9 +115,13 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
let imageRotate = 0
|
||||
if (xInversion && !yInversion) {
|
||||
if (rotate % 180 === 0 || rotate < 0) {
|
||||
imageRotate = Math.abs((rotate - 180) % 360)
|
||||
imageRotate = Math.abs(rotate % 360)
|
||||
} else {
|
||||
imageRotate = Math.abs((rotate + 180) % 4)
|
||||
if (rotate < 0) {
|
||||
imageRotate = Math.abs((rotate - 180) % 360)
|
||||
} else {
|
||||
imageRotate = Math.abs((rotate + 180) % 360)
|
||||
}
|
||||
}
|
||||
} else if (xInversion && yInversion) {
|
||||
imageRotate = Math.abs((rotate + 360) % 360)
|
||||
@ -132,7 +138,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
imageRotate = (rotate + 360) % 360
|
||||
imageRotate = (rotate + 4) % 4
|
||||
}
|
||||
obj.set({ angle: imageRotate })
|
||||
obj.setCoords() //좌표 변경 적용
|
||||
@ -188,10 +194,12 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
setSurfaceShapePattern(batchSurface, roofDisplay.column)
|
||||
drawDirectionArrow(batchSurface)
|
||||
|
||||
if (setIsHidden) setIsHidden(false)
|
||||
// if (setIsHidden) setIsHidden(false)
|
||||
|
||||
// closePopup(id)
|
||||
initEvent()
|
||||
const popupId = uuidv4()
|
||||
addPopup(popupId, 2, <PlacementSurfaceLineProperty roof={batchSurface} id={popupId} setIsHidden={setIsHidden} />)
|
||||
})
|
||||
} else {
|
||||
if (setIsHidden) setIsHidden(false)
|
||||
|
||||
@ -5,7 +5,7 @@ import { usePathname, useRouter } from 'next/navigation'
|
||||
|
||||
import { useRecoilState, useResetRecoilState } from 'recoil'
|
||||
|
||||
import { canvasState, currentCanvasPlanState, plansState } from '@/store/canvasAtom'
|
||||
import { canvasState, currentCanvasPlanState, plansState, canvasSettingState } from '@/store/canvasAtom'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
@ -39,7 +39,8 @@ export function usePlan(params = {}) {
|
||||
const resetOuterLinePoints = useResetRecoilState(outerLinePointsState)
|
||||
const resetPlacementShapeDrawingPoints = useResetRecoilState(placementShapeDrawingPointsState)
|
||||
|
||||
const { fetchBasicSettings } = useCanvasSetting()
|
||||
const { fetchBasicSettings, basicSettingCopySave } = useCanvasSetting()
|
||||
const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState)
|
||||
|
||||
/**
|
||||
* 마우스 포인터의 가이드라인 제거
|
||||
@ -184,41 +185,55 @@ export function usePlan(params = {}) {
|
||||
objectNo: objectNo,
|
||||
copyFlg: '0',
|
||||
}
|
||||
await promisePost({ url: '/api/object/add-plan', data: planData })
|
||||
.then((res) => {
|
||||
let newPlan = {
|
||||
id: res.data.canvasId,
|
||||
objectNo: objectNo,
|
||||
planNo: res.data.planNo,
|
||||
userId: userId,
|
||||
canvasStatus: '',
|
||||
isCurrent: true,
|
||||
bgImageName: null,
|
||||
mapPositionAddress: null,
|
||||
}
|
||||
try {
|
||||
const res = await promisePost({ url: '/api/object/add-plan', data: planData })
|
||||
let newPlan = {
|
||||
id: res.data.canvasId,
|
||||
objectNo: objectNo,
|
||||
planNo: res.data.planNo,
|
||||
userId: userId,
|
||||
canvasStatus: '',
|
||||
isCurrent: true,
|
||||
bgImageName: null,
|
||||
mapPositionAddress: null,
|
||||
}
|
||||
|
||||
if (isInitPlan) {
|
||||
/* 초기 플랜 생성인 경우 플랜 목록 초기화 */
|
||||
setCurrentCanvasPlan(newPlan)
|
||||
setPlans([newPlan])
|
||||
} else {
|
||||
if (isCopy) {
|
||||
/* 복제 플랜 생성인 경우 현재 캔버스 데이터를 복제 */
|
||||
newPlan.canvasStatus = currentCanvasData()
|
||||
newPlan.bgImageName = currentCanvasPlan?.bgImageName ?? null
|
||||
newPlan.mapPositionAddress = currentCanvasPlan?.mapPositionAddress ?? null
|
||||
}
|
||||
setCurrentCanvasPlan(newPlan)
|
||||
setPlans((plans) => [...plans.map((plan) => ({ ...plan, isCurrent: false })), newPlan])
|
||||
swalFire({ text: getMessage('plan.message.save') })
|
||||
}
|
||||
if (isInitPlan) {
|
||||
/* 초기 플랜 생성인 경우 플랜 목록 초기화 */
|
||||
setCurrentCanvasPlan(newPlan)
|
||||
setPlans([newPlan])
|
||||
|
||||
/* 플랜 추가 시 배치면초기설정 정보 조회 */
|
||||
fetchBasicSettings(newPlan.planNo, null)
|
||||
})
|
||||
.catch((error) => {
|
||||
swalFire({ text: error.response.data.message, icon: 'error' })
|
||||
})
|
||||
} else {
|
||||
if (isCopy) {
|
||||
/* 복제 플랜 생성인 경우 현재 캔버스 데이터를 복제 */
|
||||
newPlan.canvasStatus = currentCanvasData()
|
||||
newPlan.bgImageName = currentCanvasPlan?.bgImageName ?? null
|
||||
newPlan.mapPositionAddress = currentCanvasPlan?.mapPositionAddress ?? null
|
||||
|
||||
/* 복제 시 배치면 초기설정 복사 */
|
||||
basicSettingCopySave({
|
||||
...canvasSetting,
|
||||
planNo: newPlan.planNo,
|
||||
selectedRoofMaterial: {
|
||||
...canvasSetting.selectedRoofMaterial,
|
||||
planNo: newPlan.planNo,
|
||||
},
|
||||
roofsData: canvasSetting.roofsData.map((roof) => ({
|
||||
...roof,
|
||||
planNo: newPlan.planNo,
|
||||
})),
|
||||
})
|
||||
}
|
||||
setCurrentCanvasPlan(newPlan)
|
||||
setPlans((plans) => [...plans.map((plan) => ({ ...plan, isCurrent: false })), newPlan])
|
||||
|
||||
swalFire({ text: getMessage('plan.message.save') })
|
||||
}
|
||||
} catch (error) {
|
||||
swalFire({ text: error.response.data.message, icon: 'error' })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,7 +290,6 @@ export function usePlan(params = {}) {
|
||||
const objectNo = floorPlanState.objectNo
|
||||
|
||||
//견적서 or 발전시뮬
|
||||
|
||||
if (pathname !== '/floor-plan') {
|
||||
await promiseGet({ url: `/api/estimate/${objectNo}/${planNo}/detail` })
|
||||
.then((res) => {
|
||||
@ -304,9 +318,6 @@ export function usePlan(params = {}) {
|
||||
// 클릭한 플랜 탭으로 이동
|
||||
setCurrentCanvasPlan(plans.find((plan) => plan.id === newCurrentId))
|
||||
setPlans((plans) => plans.map((plan) => ({ ...plan, isCurrent: plan.id === newCurrentId })))
|
||||
|
||||
/* 플랜 이동 시 배치면초기설정 정보 조회 (견적서 메뉴 제외) */
|
||||
fetchBasicSettings(planNo, null)
|
||||
} else {
|
||||
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||
}
|
||||
@ -494,7 +505,13 @@ export function usePlan(params = {}) {
|
||||
* @param {string} planNo - 플랜번호
|
||||
*/
|
||||
const deleteBasicSettings = async (objectNo, planNo) => {
|
||||
await promiseDel({ url: `/api/canvas-management/canvas-basic-settings/delete-basic-settings/${objectNo}/${planNo}` })
|
||||
try {
|
||||
await promiseDel({ url: `/api/canvas-management/canvas-basic-settings/delete-basic-settings/${objectNo}/${planNo}` })
|
||||
} catch (error) {
|
||||
/* 오류를 무시하고 계속 진행 */
|
||||
console.log('Basic settings delete failed or not found:', error)
|
||||
// swalFire({ text: error.message, icon: 'error' })
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@ -663,9 +663,9 @@
|
||||
"stuff.planReqPopup.title": "設計依頼のインポート",
|
||||
"stuff.temp.subTitle": "商品情報",
|
||||
"stuff.temp.subTitle2": "作図",
|
||||
"stuff.detail.header.notExistObjectNo": "存在しないものです。",
|
||||
"stuff.detail.header.successCopy": "物件番号がコピーされました。",
|
||||
"stuff.detail.header.failCopy": "物件番号のコピーに失敗しました。",
|
||||
"stuff.detail.header.notExistObjectNo": "存在しないもの番号です.",
|
||||
"stuff.detail.header.successCopy": "物件番号がコピーされました.",
|
||||
"stuff.detail.header.failCopy": "物件番号のコピーに失敗しました.",
|
||||
"stuff.detail.header.objectNo": "物件番号",
|
||||
"stuff.detail.header.specificationConfirmDate": "仕様確認日",
|
||||
"stuff.detail.header.lastEditDatetime": "更新日時",
|
||||
|
||||
@ -663,7 +663,7 @@
|
||||
"stuff.planReqPopup.title": "설계의뢰 불러오기",
|
||||
"stuff.temp.subTitle": "물건정보",
|
||||
"stuff.temp.subTitle2": "도면작성",
|
||||
"stuff.detail.header.notExistObjectNo": "존재하지 않는 물건입니다.",
|
||||
"stuff.detail.header.notExistObjectNo": "존재하지 않는 물건번호 입니다.",
|
||||
"stuff.detail.header.successCopy": "물건번호가 복사되었습니다.",
|
||||
"stuff.detail.header.failCopy": "물건번호 복사에 실패했습니다.",
|
||||
"stuff.detail.header.objectNo": "물건번호",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user