Merge branch 'dev' into dev-yj
This commit is contained in:
commit
c2dc189739
@ -54,7 +54,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
const [seletedOption, setSeletedOption] = useState(null)
|
const [seletedOption, setSeletedOption] = useState(null)
|
||||||
const { setModuleStatisticsData } = useCircuitTrestle()
|
const { setModuleStatisticsData } = useCircuitTrestle()
|
||||||
const { handleCanvasToPng } = useImgLoader()
|
const { handleCanvasToPng } = useImgLoader()
|
||||||
const { saveCanvas } = usePlan()
|
|
||||||
const passivityCircuitAllocationRef = useRef()
|
const passivityCircuitAllocationRef = useRef()
|
||||||
const { setIsGlobalLoading } = useContext(QcastContext)
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
|
|
||||||
@ -361,11 +361,8 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
handleCanvasToPng(2)
|
handleCanvasToPng(2)
|
||||||
// 캔버스 저장
|
|
||||||
await saveCanvas(false)
|
|
||||||
// 견적서 저장
|
// 견적서 저장
|
||||||
await saveEstimate(result)
|
await saveEstimate(result)
|
||||||
setAllModuleSurfaceIsComplete(true)
|
|
||||||
} else {
|
} else {
|
||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import WithDraggable from '@/components/common/draggable/WithDraggable'
|
|||||||
|
|
||||||
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
|
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
|
||||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||||
import { addedRoofsState, roofMaterialsAtom } from '@/store/settingAtom'
|
import { addedRoofsState, roofDisplaySelector, roofMaterialsAtom } from '@/store/settingAtom'
|
||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
@ -18,6 +18,7 @@ import { onlyNumberInputChange } from '@/util/input-utils'
|
|||||||
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
||||||
import { usePolygon } from '@/hooks/usePolygon'
|
import { usePolygon } from '@/hooks/usePolygon'
|
||||||
import { canvasState } from '@/store/canvasAtom'
|
import { canvasState } from '@/store/canvasAtom'
|
||||||
|
import { useRoofFn } from '@/hooks/common/useRoofFn'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 지붕 레이아웃
|
* 지붕 레이아웃
|
||||||
@ -41,7 +42,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
|
|||||||
const [currentRoof, setCurrentRoof] = useState(null) /** 현재 선택된 지붕재 정보 */
|
const [currentRoof, setCurrentRoof] = useState(null) /** 현재 선택된 지붕재 정보 */
|
||||||
const { closePopup } = usePopup() /** usePopup에서 closePopup 함수 가져오기 */
|
const { closePopup } = usePopup() /** usePopup에서 closePopup 함수 가져오기 */
|
||||||
const { drawDirectionArrow } = usePolygon()
|
const { drawDirectionArrow } = usePolygon()
|
||||||
|
const { setSurfaceShapePattern } = useRoofFn()
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
|
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
||||||
|
|
||||||
const roofRef = {
|
const roofRef = {
|
||||||
roofCd: useRef(null),
|
roofCd: useRef(null),
|
||||||
@ -243,6 +246,8 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
|
|||||||
const roofs = canvas.getObjects().filter((obj) => obj.roofMaterial?.index === 0)
|
const roofs = canvas.getObjects().filter((obj) => obj.roofMaterial?.index === 0)
|
||||||
|
|
||||||
roofs.forEach((roof) => {
|
roofs.forEach((roof) => {
|
||||||
|
/** 모양 패턴 설정 */
|
||||||
|
setSurfaceShapePattern(roof, roofDisplay.column, false, { ...roofInfo })
|
||||||
roof.roofMaterial = { ...roofInfo }
|
roof.roofMaterial = { ...roofInfo }
|
||||||
drawDirectionArrow(roof)
|
drawDirectionArrow(roof)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
|||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
import { currentCanvasPlanState } from '@/store/canvasAtom'
|
import { currentCanvasPlanState } from '@/store/canvasAtom'
|
||||||
import { loginUserStore } from '@/store/commonAtom'
|
import { loginUserStore } from '@/store/commonAtom'
|
||||||
|
import { useTrestle } from '@/hooks/module/useTrestle'
|
||||||
|
import { usePlan } from '@/hooks/usePlan'
|
||||||
|
|
||||||
export function useEstimate() {
|
export function useEstimate() {
|
||||||
const { managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
@ -20,13 +22,15 @@ export function useEstimate() {
|
|||||||
const { promisePost } = useAxios()
|
const { promisePost } = useAxios()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
|
||||||
|
const { setAllModuleSurfaceIsComplete } = useTrestle()
|
||||||
|
const { saveCanvas } = usePlan()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 도면 견적서 저장
|
* 도면 견적서 저장
|
||||||
*
|
*
|
||||||
* @param {Object} estimateParam - 견적서 저장 데이터
|
* @param {Object} estimateParam - 견적서 저장 데이터
|
||||||
*/
|
*/
|
||||||
const saveEstimate = async (estimateParam) => {
|
const saveEstimate = async (estimateParam) => {
|
||||||
|
|
||||||
const userId = loginUserState.userId
|
const userId = loginUserState.userId
|
||||||
const saleStoreId = managementStateLoaded.saleStoreId
|
const saleStoreId = managementStateLoaded.saleStoreId
|
||||||
const objectNo = currentCanvasPlan.objectNo
|
const objectNo = currentCanvasPlan.objectNo
|
||||||
@ -56,6 +60,11 @@ export function useEstimate() {
|
|||||||
|
|
||||||
await promisePost({ url: '/api/estimate/save-estimate', data: saveEstimateData })
|
await promisePost({ url: '/api/estimate/save-estimate', data: saveEstimateData })
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
|
setAllModuleSurfaceIsComplete(true)
|
||||||
|
|
||||||
|
// 캔버스 저장
|
||||||
|
await saveCanvas(false)
|
||||||
|
|
||||||
/* 견적서 저장이 완료되면 견적서 페이지로 이동 */
|
/* 견적서 저장이 완료되면 견적서 페이지로 이동 */
|
||||||
moveEstimate(planNo, objectNo)
|
moveEstimate(planNo, objectNo)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user