diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 5ef2c9da..21e87620 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -99,7 +99,9 @@ export default function Estimate({}) { const initEstimate = (currPid = currentPid) => { console.log('๐Ÿš€ ~ initEstimate ~ currPid:', currPid) + closeAll() setMenuNumber(5) + setObjectNo(objectRecoil.floorPlanObjectNo) setPlanNo(currPid) @@ -137,7 +139,6 @@ export default function Estimate({}) { }, [selectedPlan]) useEffect(() => { - closeAll() initEstimate() }, []) @@ -619,7 +620,7 @@ export default function Estimate({}) { updates.partAdd = '0' updates.saleTotPrice = (Number(amount.replaceAll(',', '')) * estimateContextState.itemList[index].salePrice.replaceAll(',', '')).toLocaleString() updates.showSaleTotPrice = ( - Number(amount.replaceAll(',', '')) * estimateContextState.itemList[index].showSalePrice?.replaceAll(',', '') + Number(amount.replaceAll(',', '')) * estimateContextState.itemList[index].salePrice?.replaceAll(',', '') ).toLocaleString() updateList = estimateContextState.itemList.map((item) => { @@ -681,7 +682,6 @@ export default function Estimate({}) { let updateList = [] let updates = {} get({ url: apiUrl }).then((res) => { - // console.log('์•„์ดํ…œ๋””ํ…Œ์ผ::::::::', res) updates.objectNo = objectNo updates.planNo = planNo updates.itemId = res.itemId @@ -706,7 +706,6 @@ export default function Estimate({}) { updates.openFlg = res.openFlg if (estimateContextState.estimateType === 'YJSS') { - // console.log('YJSS:::,', res.pkgMaterialFlg) if (res.pkgMaterialFlg === '0') { updates.showSalePrice = '0' updates.showSaleTotPrice = '0' @@ -721,14 +720,19 @@ export default function Estimate({}) { //104671 let bomList = res.itemBomList - // console.log('updates::', updates) updateList = estimateContextState.itemList.map((item) => { if (item.dispOrder === dispOrder) { if (item?.addFlg) { return { ...item, ...updates, saleTotPrice: '' } } else { if (estimateContextState.estimateType === 'YJSS') { - return { ...item, ...updates, salePrice: '', saleTotPrice: '' } + // return { ...item, ...updates, salePrice: '', saleTotPrice: '' } + //ํ™•์ธ + if (updates.pkgMaterialFlg === '1') { + return { ...item, ...updates, showSalePrice: updates.salePrice } + } else { + return { ...item, ...updates, salePrice: '', saleTotPrice: '' } + } } else { return { ...item, ...updates } } @@ -739,7 +743,6 @@ export default function Estimate({}) { return item } }) - //paDispOrder if (bomList) { bomList.map((bomItem, index) => { @@ -879,7 +882,6 @@ export default function Estimate({}) { } const calculateYJSSTotals = (itemList) => { - // console.log(':::itemList::', itemList) itemList.sort((a, b) => a.dispOrder - b.dispOrder) makeUniqueSpecialNoteCd(itemList) itemList.forEach((item) => { @@ -918,7 +920,6 @@ export default function Estimate({}) { } } }) - // console.log('itemList::', itemList) let pkgAsp = estimateContextState.pkgAsp ? Number(estimateContextState.pkgAsp.replaceAll(',', '')) : 0 totals.pkgTotPrice = pkgAsp * totals.totVolKw * 1000 @@ -949,30 +950,138 @@ export default function Estimate({}) { setItemChangeYn(false) } else { - estimateContextState.itemList.forEach((item) => { - if (estimateContextState.estimateType === 'YJSS' && !item.paDispOrder && item.pkgMaterialFlg === '0') { - item.showSalePrice = '0' - item.showSaleTotPrice = '0' - } - if (estimateContextState.estimateType === 'YJSS' && item.openFlg === '1') { - item.showSalePrice = '0' - item.showSaleTotPrice = '0' - } - if (estimateContextState.estimateType === 'YJSS' && item.paDispOrder) { - item.showSalePrice = '0' - item.showSaleTotPrice = '0' - } - }) - estimateContextState.itemList.forEach((item) => { - if (estimateContextState.estimateType === 'YJOD' && item.openFlg === '1') { - item.showSalePrice = '0' - item.showSaleTotPrice = '0' - } - if (estimateContextState.estimateType === 'YJOD' && item.paDispOrder) { - item.showSalePrice = '0' - item.showSaleTotPrice = '0' - } - }) + let totals = { + totAmount: 0, + totVolKw: 0, + supplyPrice: 0, + vatPrice: 0, + totPrice: 0, + addSupplyPrice: 0, + pkgTotPrice: 0, + } + estimateContextState.itemList.sort((a, b) => a.dispOrder - b.dispOrder) + makeUniqueSpecialNoteCd(estimateContextState.itemList) + + if (estimateContextState.estimateType === 'YJSS') { + estimateContextState.itemList.forEach((item) => { + if (estimateContextState.estimateType === 'YJSS' && !item.paDispOrder && item.pkgMaterialFlg === '0') { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + if (estimateContextState.estimateType === 'YJSS' && item.openFlg === '1') { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + if (estimateContextState.estimateType === 'YJSS' && item.paDispOrder) { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + }) + + estimateContextState.itemList.forEach((item) => { + if (item.delFlg === '0') { + let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 + let salePrice + if (item.moduleFlg === '1') { + const volKw = (item.pnowW * amount) / 1000 + totals.totVolKw += volKw + } + if (amount === 0) { + salePrice = 0 + } else { + salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0 + } + + totals.totAmount += amount + if (item.pkgMaterialFlg === '1') { + const saleTotPrice = amount * salePrice + totals.addSupplyPrice += saleTotPrice + } + + if (!item.paDispOrder) { + if (item.pkgMaterialFlg === '0') { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + } else { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + + if (item.openFlg === '1') { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + } + }) + let pkgAsp = estimateContextState.pkgAsp ? Number(estimateContextState.pkgAsp.replaceAll(',', '')) : 0 + + totals.pkgTotPrice = pkgAsp * totals.totVolKw * 1000 + totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice + totals.vatPrice = totals.supplyPrice * 0.1 + totals.totPrice = totals.supplyPrice + totals.vatPrice + + setEstimateContextState({ + pkgTotPrice: totals.pkgTotPrice, + totAmount: totals.totAmount, + totVolKw: totals.totVolKw.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(0), //์†Œ์ˆ˜์ฒซ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผ + vatPrice: totals.vatPrice.toFixed(0), //์†Œ์ˆ˜์ฒซ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผ + totPrice: totals.totPrice.toFixed(0), //์†Œ์ˆ˜์ฒซ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผ + }) + } else { + estimateContextState.itemList.forEach((item) => { + if (estimateContextState.estimateType === 'YJOD' && item.openFlg === '1') { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + if (estimateContextState.estimateType === 'YJOD' && item.paDispOrder) { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + }) + + estimateContextState.itemList.forEach((item) => { + delete item.showSalePrice + delete item.showSaleTotPrice + if (item.delFlg === '0') { + let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 + let price + if (amount === 0) { + price = 0 + } else { + price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 + } + + if (item.moduleFlg === '1') { + const volKw = (item.pnowW * amount) / 1000 + totals.totVolKw += volKw + } + totals.supplyPrice += price + totals.totAmount += amount + + if (item.paDispOrder) { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + if (item.openFlg === '1') { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + } + }) + + totals.vatPrice = totals.supplyPrice * 0.1 + totals.totPrice = totals.supplyPrice + totals.vatPrice + + setEstimateContextState({ + totAmount: totals.totAmount, + totVolKw: totals.totVolKw.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(0), //์†Œ์ˆ˜์ฒซ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผ + vatPrice: totals.vatPrice.toFixed(0), //์†Œ์ˆ˜์ฒซ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผ + totPrice: totals.totPrice.toFixed(0), //์†Œ์ˆ˜์ฒซ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผ + }) + } } }, [itemChangeYn, estimateContextState.itemList]) @@ -1006,7 +1115,7 @@ export default function Estimate({}) {
{getMessage('estimate.detail.objectNo')}
{/* {objectNo} (Plan No: {estimateContextState.planNo}) */} - {objectNo} (Plan No: {planNo}) + {currentObjectNo} (Plan No: {planNo})
@@ -1076,7 +1185,6 @@ export default function Estimate({}) {
- {/* */}
- {/* */} { diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index a9619c2f..66fa021e 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -56,20 +56,25 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set ] // ๋ฐ์ดํ„ฐ๋ฅผ ์ตœ์ดˆ ํ•œ ๋ฒˆ๋งŒ ์กฐํšŒ - useEffect(() => { - if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return - const raftCodeList = findCommonCode('203800') - setRaftCodes(raftCodeList) - - if (addedRoofs[0].roofAngleSet && addedRoofs[0].roofAngleSet?.length > 0) { - setCurrentRoof({ ...currentRoof, roofSizeSet: String(addedRoofs[0].roofSizeSet), roofAngleSet: addedRoofs[0].roofAngleSet }) - } else if (basicSetting.roofAngleSet && basicSetting.roofAngleSet?.length > 0) { - setCurrentRoof({ ...currentRoof, roofSizeSet: String(basicSetting.roofSizeSet), roofAngleSet: basicSetting.roofAngleSet }) - } - }, []) + // useEffect(() => { + // if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return + // const raftCodeList = findCommonCode('203800') + // setRaftCodes(raftCodeList) + // console.log('๐Ÿš€ ~ useEffect ~ >>>>>>>>>>>>> raftCodeList 11 :', raftCodeList) + + + // if (addedRoofs[0].roofAngleSet && addedRoofs[0].roofAngleSet?.length > 0) { + // setCurrentRoof({ ...currentRoof, roofSizeSet: String(addedRoofs[0].roofSizeSet), roofAngleSet: addedRoofs[0].roofAngleSet }) + // } else if (basicSetting.roofAngleSet && basicSetting.roofAngleSet?.length > 0) { + // setCurrentRoof({ ...currentRoof, roofSizeSet: String(basicSetting.roofSizeSet), roofAngleSet: basicSetting.roofAngleSet }) + // } + // }, []) useEffect(() => { if (addedRoofs.length > 0) { + const raftCodeList = findCommonCode('203800') + setRaftCodes(raftCodeList) + setCurrentRoof({ ...addedRoofs[0] }) } }, [addedRoofs]) @@ -155,20 +160,20 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set ...roofInfo, }, //roofs: addedRoofs, - roofsData: { - roofApply: true, - roofSeq: 0, - roofMatlCd: currentRoof.roofMatlCd, - roofWidth: currentRoof.width, - roofHeight: currentRoof.length, - roofHajebichi: currentRoof.hajebichi, - roofGap: currentRoof.raft, - roofLayout: currentRoof.layout, - roofSizeSet: currentRoof.roofSizeSet, - roofAngleSet: currentRoof.roofAngleSet, - roofPitch: currentRoof.pitch, - roofAngle: currentRoof.angle, - }, + // roofsData: { + // roofApply: true, + // roofSeq: 0, + // roofMatlCd: currentRoof.roofMatlCd, + // roofWidth: currentRoof.width, + // roofHeight: currentRoof.length, + // roofHajebichi: currentRoof.hajebichi, + // roofGap: currentRoof.raft, + // roofLayout: currentRoof.layout, + // roofSizeSet: currentRoof.roofSizeSet, + // roofAngleSet: currentRoof.roofAngleSet, + // roofPitch: currentRoof.pitch, + // roofAngle: currentRoof.angle, + // }, }) basicSettingSave() @@ -338,13 +343,13 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set {currentRoof && ['C', 'R'].includes(currentRoof.raftAuth) && (
{getMessage('modal.placement.initial.setting.rafter')} - {raftCodes.length > 0 && ( + {raftCodes?.length > 0 && (
r.clCode === (currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft)).clCodeNm + raftCodes?.find((r) => r.clCode === (currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft)).clCodeNm } value={currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft} onChange={(e) => handleRafterChange(e.clCode)} diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 15ea41fc..6b57e111 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -304,6 +304,7 @@ export default function StuffDetail() { //mid:5(๊ฒฌ์ ์„œ), /pid:ํ”Œ๋žœ๋ฒˆํ˜ธ setFloorPlanObjectNo({ floorPlanObjectNo: params.data.objectNo }) setIsGlobalLoading(true) + setMenuNumber(5) router.push(`/floor-plan/estimate/5?pid=${params.data.planNo}&objectNo=${params.data.objectNo}`) }} > @@ -1357,7 +1358,7 @@ export default function StuffDetail() { //๋กœ๊ทธ์ธ์ด 2์ฐจ์ ์ธ๋ฐ otherSaleStoreId๊ฐ€ ์—†์œผ๋ฉด ์•Œ๋Ÿฟ if (session.storeLvl !== '1') { if (params.saleStoreLevel === '1') { - return swalFire({ text: getMessage('stuff.detail.tempSave.message4'), type: 'alert' }) + return swalFire({ text: getMessage('stuff.detail.tempSave.message3'), type: 'alert' }) } } @@ -1447,6 +1448,13 @@ export default function StuffDetail() { params.saleStoreLevel = session.storeLvl } + if (session.storeLvl !== '1') { + //๋กœ๊ทธ์ธ์ด 1์ฐจ์ ์ด ์•„๋‹Œ๋ฐ 2์ฐจ์ ์„ ์•ˆ๊ณจ๋ผ์„œ saleStoreLevel = 1๋กœ ์…‹ํŒ…๋˜์–ด์žˆ์œผ๋ฉด ์•Œ๋Ÿฟ + if (params.saleStoreLevel === '1') { + return swalFire({ text: getMessage('stuff.detail.tempSave.message3'), type: 'alert' }) + } + } + // ๋‹ด๋‹น์ž ์ž๋ฆฌ์ˆ˜ ์ฒดํฌ if (params?.receiveUser !== '') { if (params?.receiveUser.trim().length > 10) { diff --git a/src/components/management/StuffSubHeader.jsx b/src/components/management/StuffSubHeader.jsx index 6dc316cb..18bd5969 100644 --- a/src/components/management/StuffSubHeader.jsx +++ b/src/components/management/StuffSubHeader.jsx @@ -40,8 +40,8 @@ export default function StuffSubHeader({ type }) { if (isObjectNotEmpty(managementState)) { if (managementState.createUser === 'T01') { if (session.userId !== 'T01') { - //๋„๋ฉด ์ž‘์„ฑ์€ ์ด๋™ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ณ€๊ฒฝ #457 - // setButtonStyle('none') + //๋„๋ฉด ์ž‘์„ฑ์€ ์ด๋™ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ณ€๊ฒฝ #457 ๋‹ค์‹œ ๋ชปํ•˜๋„๋ก ๋ณ€๊ฒฝ#474 + setButtonStyle('none') } } } diff --git a/src/components/management/popup/PlanRequestPop.jsx b/src/components/management/popup/PlanRequestPop.jsx index 23a041be..38df870f 100644 --- a/src/components/management/popup/PlanRequestPop.jsx +++ b/src/components/management/popup/PlanRequestPop.jsx @@ -8,19 +8,12 @@ import SingleDatePicker from '@/components/common/datepicker/SingleDatePicker' import dayjs from 'dayjs' import PlanRequestPopQGrid from './PlanRequestPopQGrid' import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils' -import { useCommonCode } from '@/hooks/common/useCommonCode' -import Select from 'react-select' import QPagination from '@/components/common/pagination/QPagination' export default function PlanRequestPop(props) { const [pageNo, setPageNo] = useState(1) //ํ˜„์žฌ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ const [pageSize, setPageSize] = useState(20) //ํŽ˜์ด์ง€ ๋‹น ๊ฒŒ์‹œ๋ฌผ ๊ฐœ์ˆ˜ const [totalCount, setTotalCount] = useState(0) //์ด ๊ฐฏ์ˆ˜ - //๊ณตํ†ต์ฝ”๋“œ - const { commonCode, findCommonCode } = useCommonCode() - - // const [planStatCdList, setPlanStatCdList] = useState([]) - const globalLocaleState = useRecoilValue(globalLocaleStore) const [planReqObject, setPlanReqObject] = useState({}) @@ -71,16 +64,6 @@ export default function PlanRequestPop(props) { } } - // ์ƒํƒœ ๊ฒ€์ƒ‰์กฐ๊ฑด ๋ณ€๊ฒฝ - const onSelectionChange = (key) => { - if (isObjectNotEmpty(key)) { - setSchPlanStatCd(key.clCode) - } else { - //X๋ˆ„๋ฆ„ - setSchPlanStatCd('') - } - } - // ์กฐํšŒ const onSubmit = (page, type) => { const params = { @@ -194,7 +177,8 @@ export default function PlanRequestPop(props) { { field: 'title', headerName: getMessage('stuff.planReqPopup.gridHeader.title'), - minWidth: 150, + minWidth: 250, + cellStyle: { textAlign: 'left' }, }, { field: 'address1', @@ -234,13 +218,6 @@ export default function PlanRequestPop(props) { } } - // useEffect(() => { - // const code1 = findCommonCode(115800) //์ƒํƒœ - // if (code1 != null) { - // setPlanStatCdList(code1) - // } - // }, [commonCode]) - useEffect(() => { onSubmit(pageNo, 'S') }, []) @@ -431,9 +408,11 @@ export default function PlanRequestPop(props) {
- -
- +
+ +
+ +
diff --git a/src/components/management/popup/PlanRequestPopQGrid.jsx b/src/components/management/popup/PlanRequestPopQGrid.jsx index f7dbba0f..0e5117e3 100644 --- a/src/components/management/popup/PlanRequestPopQGrid.jsx +++ b/src/components/management/popup/PlanRequestPopQGrid.jsx @@ -22,8 +22,8 @@ export default function PlanRequestPopQGrid(props) { flex: 1, minWidth: 100, sortable: false, - suppressMovable: false, - resizable: false, + suppressMovable: true, + resizable: true, suppressSizeToFit: false, } }, []) @@ -58,6 +58,7 @@ export default function PlanRequestPopQGrid(props) { defaultColDef={defaultColDef} pagination={isPageable} onSelectionChanged={onSelectionChanged} + autoSizeAllColumns={true} overlayNoRowsTemplate={`${getMessage('stuff.grid.noData')}`} />
diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index 66b0974c..ebd1ad88 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -80,6 +80,7 @@ export const useEstimateController = (planNo) => { res.data.pkgAsp = roundedNumber.toString() } + setEstimateContextState(res.data) } } @@ -384,7 +385,7 @@ export const useEstimateController = (planNo) => { if (res.status === 201) { estimateData.newFileList = [] swalFire({ text: getMessage('estimate.detail.save.alertMsg'), type: 'alert' }) - fetchSetting(objectRecoil.floorPlanObjectNo, estimateData.planNo) + fetchSetting(estimateData.objectNo, estimateData.planNo) } }) } catch (e) { @@ -409,7 +410,7 @@ export const useEstimateController = (planNo) => { const params = { saleStoreId: session.storeId, sapSalesStoreCd: session.custCd, - objectNo: objectRecoil.floorPlanObjectNo, + objectNo: estimateData.objectNo, planNo: sendPlanNo, copySaleStoreId: otherSaleStoreId ? otherSaleStoreId : saleStoreId, copyReceiveUser: copyReceiveUser, diff --git a/src/hooks/option/useCanvasSetting.js b/src/hooks/option/useCanvasSetting.js index 951d9801..6afced52 100644 --- a/src/hooks/option/useCanvasSetting.js +++ b/src/hooks/option/useCanvasSetting.js @@ -48,7 +48,7 @@ const defaultDotLineGridSetting = { LINE: false, } -let previousRoofMaterialsYn = 'N' // ์ง€๋ถ•์žฌ select ์ •๋ณด ๋น„๊ต ํ›„ ๋ณ€๊ฒฝ๋œ ๊ฒƒ์ด ์—†์œผ๋ฉด 1ํšŒ๋งŒ ์‹คํ–‰ +//let previousRoofMaterialsYn = 'N' // ์ง€๋ถ•์žฌ select ์ •๋ณด ๋น„๊ต ํ›„ ๋ณ€๊ฒฝ๋œ ๊ฒƒ์ด ์—†์œผ๋ฉด 1ํšŒ๋งŒ ์‹คํ–‰ export function useCanvasSetting() { const canvas = useRecoilValue(canvasState) @@ -159,21 +159,23 @@ export function useCanvasSetting() { setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial }) } + const previousObjectNoRef = useRef(null) const previousRoofMaterialsRef = useRef(null) useEffect(() => { // ์ง€๋ถ•์žฌ select ์ •๋ณด๊ฐ€ ์กด์žฌํ•ด์•ผ ๋ฐฐ์น˜๋ฉด์ดˆ๊ธฐ์„ค์ • DB ์ •๋ณด ๋น„๊ต ํ›„ ์ง€๋ถ•์žฌ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Œ - if (roofMaterials.length !== 0 && JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials)) { - // ์ง€๋ถ•์žฌ select ์ •๋ณด ๋น„๊ต ํ›„ ๋ณ€๊ฒฝ๋œ ๊ฒƒ์ด ์—†์œผ๋ฉด 1ํšŒ๋งŒ ์‹คํ–‰ - if (roofMaterials && previousRoofMaterialsYn === 'N') { + if (!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo + || roofMaterials.length !== 0 && JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials)) { + + if (roofMaterials) { fetchBasicSettings() - previousRoofMaterialsYn = 'Y' } // ์ด์ „ ๊ฐ’์„ ์—…๋ฐ์ดํŠธ + previousObjectNoRef.current = correntObjectNo previousRoofMaterialsRef.current = roofMaterials } - }, [roofMaterials]) + }, [roofMaterials, correntObjectNo]) useEffect(() => { if (!canvas) { @@ -297,7 +299,7 @@ export function useCanvasSetting() { }) roofsArray = res.map((item) => { return { - roofApply: true, + roofApply: item.roofApply, roofSeq: 0, roofMatlCd: item.roofMatlCd, roofWidth: item.roofWidth, @@ -328,6 +330,7 @@ export function useCanvasSetting() { roofGap: 'HEI_455', roofLayout: 'P', roofPitch: 4, + roofAngle: 21.8, }, ] } diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js index 86b6aee3..fb743828 100644 --- a/src/hooks/usePlan.js +++ b/src/hooks/usePlan.js @@ -207,49 +207,54 @@ export function usePlan(params = {}) { const orderingNo = plans?.find((obj) => obj.id === newCurrentId).ordering const objectNo = floorPlanState.objectNo //๊ฒฌ์ ์„œ or ๋ฐœ์ „์‹œ๋ฎฌ + if (pathname !== '/floor-plan') { await promiseGet({ url: `/api/estimate/${objectNo}/${orderingNo}/detail` }) .then((res) => { if (res.status === 200) { const estimateDetail = res.data - if (estimateDetail.docNo) { - res.data.resetFlag = 'N' + if (pathname === '/floor-plan/estimate/5') { + if (estimateDetail.tempFlg === '0' && estimateDetail.estimateDate !== null) { + console.log('์ด๋™') + res.data.resetFlag = 'N' - if (res.data.itemList.length > 0) { - res.data.itemList.map((item) => { - item.delFlg = '0' - }) - } - if (res.data.pkgAsp === null || res.data.pkgAsp == undefined) { - res.data.pkgAsp = '0.00' - } else { - const number = parseFloat(res.data.pkgAsp) - const roundedNumber = isNaN(number) ? '0.00' : number.toFixed(2) - - res.data.pkgAsp = roundedNumber.toString() - } - setEstimateContextState(res.data) - - if (pathname === '/floor-plan') { - if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) { - saveCanvas() + if (res.data.itemList.length > 0) { + res.data.itemList.map((item) => { + item.delFlg = '0' + }) } + if (res.data.pkgAsp === null || res.data.pkgAsp == undefined) { + res.data.pkgAsp = '0.00' + } else { + const number = parseFloat(res.data.pkgAsp) + const roundedNumber = isNaN(number) ? '0.00' : number.toFixed(2) + + res.data.pkgAsp = roundedNumber.toString() + } + setEstimateContextState(res.data) + // ํด๋ฆญํ•œ ํ”Œ๋žœ ํƒญ์œผ๋กœ ์ด๋™ + updateCurrentPlan(newCurrentId) + } else { + swalFire({ text: getMessage('estimate.menu.move.valid1') }) } - updateCurrentPlan(newCurrentId) } else { - swalFire({ text: getMessage('estimate.menu.move.valid1') }) + //๋ฐœ์ „์‹œ๋ฎฌ๋ ˆ์ด์…˜ + // ํด๋ฆญํ•œ ํ”Œ๋žœ ํƒญ์œผ๋กœ ์ด๋™ + // updateCurrentPlan(newCurrentId) } } }) .catch((error) => { - swalFire({ text: getMessage('estimate.menu.move.valid1') }) + if (pathname === '/floor-plan/estimate/5') { + swalFire({ text: getMessage('estimate.menu.move.valid1') }) + } else { + swalFire({ text: getMessage('simulator.menu.move.valid1') }) + } }) } else { - // if (pathname === '/floor-plan') { if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) { saveCanvas() } - // } updateCurrentPlan(newCurrentId) } } diff --git a/src/locales/ja.json b/src/locales/ja.json index 900165c5..3c36a2cc 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -673,6 +673,7 @@ "stuff.detail.tooltip.surfaceType": "ๅกฉๅฎณๅœฐๅŸŸใฎๅฎš็พฉใฏๅ„ใƒกใƒผใ‚ซใƒผใฎ่จญ็ฝฎใƒžใƒ‹ใƒฅใ‚ขใƒซใ‚’ใ”็ขบ่ชใใ ใ•ใ„", "stuff.detail.tempSave.message1": "ไธ€ๆ™‚ไฟๅญ˜ใ•ใ‚Œใพใ—ใŸใ€‚ๅ•†ๅ“็•ชๅทใ‚’ๅ–ๅพ—ใ™ใ‚‹ใซใฏใ€ๅฟ…้ ˆ้ …็›ฎใ‚’ใ™ในใฆๅ…ฅๅŠ›ใ—ใฆใใ ใ•ใ„ใ€‚", "stuff.detail.tempSave.message2": "ๆ‹…ๅฝ“่€…ใฏ10ๆกไปฅไธ‹ใงๅ…ฅๅŠ›ใ—ใฆใใ ใ•ใ„.", + "stuff.detail.tempSave.message3": "ไบŒๆฌก่ฒฉๅฃฒๅบ—ใ‚’้ธๆŠžใ—ใฆใใ ใ•ใ„.", "stuff.detail.confirm.message1": "่ฒฉๅฃฒๅบ—ๆƒ…ๅ ฑใ‚’ๅค‰ๆ›ดใ™ใ‚‹ใจใ€่จญ่จˆไพ้ ผๆ–‡ๆ›ธ็•ชๅทใŒๅ‰Š้™คใ•ใ‚Œใพใ™ใ€‚ๅค‰ๆ›ดใ—ใพใ™ใ‹๏ผŸ", "stuff.detail.delete.message1": "ไป•ๆง˜ใŒ็ขบๅฎšใ—ใŸใ‚‚ใฎใฏๅ‰Š้™คใงใใพใ›ใ‚“ใ€‚", "stuff.detail.planList.title": "ใƒ—ใƒฉใƒณใƒชใ‚นใƒˆ", diff --git a/src/locales/ko.json b/src/locales/ko.json index c5ba4658..c928a2f1 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -682,6 +682,7 @@ "stuff.detail.tooltip.surfaceType": "์—ผํ•ด์ง€์—ญ ์ •์˜๋Š” ๊ฐ ๋ฉ”์ด์ปค์˜ ์„ค์น˜ ๋ฉ”๋‰ด์–ผ์„ ํ™•์ธํ•ด์ฃผ์‹ญ์‹œ์˜ค", "stuff.detail.tempSave.message1": "์ž„์‹œ์ €์žฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฌผ๊ฑด๋ฒˆํ˜ธ๋ฅผ ํš๋“ํ•˜๋ ค๋ฉด ํ•„์ˆ˜ ํ•ญ๋ชฉ์„ ๋ชจ๋‘ ์ž…๋ ฅํ•ด ์ฃผ์‹ญ์‹œ์˜ค.", "stuff.detail.tempSave.message2": "๋‹ด๋‹น์ž๋Š” 10์ž๋ฆฌ ์ดํ•˜๋กœ ์ž…๋ ฅํ•ด ์ฃผ์‹ญ์‹œ์˜ค.", + "stuff.detail.tempSave.message3": "2์ฐจ ํŒ๋งค์ ์„ ์„ ํƒํ•ด์ฃผ์„ธ์š”.", "stuff.detail.confirm.message1": "ํŒ๋งค์  ์ •๋ณด๋ฅผ ๋ณ€๊ฒฝํ•˜๋ฉด, ์„ค๊ณ„์˜๋ขฐ ๋ฌธ์„œ๋ฒˆํ˜ธ๊ฐ€ ์‚ญ์ œ๋ฉ๋‹ˆ๋‹ค. ๋ณ€๊ฒฝํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?", "stuff.detail.delete.message1": "์‚ฌ์–‘์ด ํ™•์ •๋œ ๋ฌผ๊ฑด์€ ์‚ญ์ œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.", "stuff.detail.planList.title": "ํ”Œ๋žœ๋ฆฌ์ŠคํŠธ",