diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx
index f0cd97fb..d3edfbea 100644
--- a/src/components/estimate/Estimate.jsx
+++ b/src/components/estimate/Estimate.jsx
@@ -221,7 +221,6 @@ export default function Estimate({}) {
files.map((row) => {
fileList.push(row.data)
setEstimateContextState({ fileList: row.data, newFileList: fileList })
- // setEstimateContextState({ fileList: row.data })
})
} else {
setEstimateContextState({ fileList: [], newFileList: [] })
@@ -235,19 +234,26 @@ export default function Estimate({}) {
setFiles([])
setOriginFiles(estimateContextState.fileList)
} else {
- if (originFiles.length > 0) {
- if (isEmptyArray(files)) {
- let file
- file = originFiles.filter((item) => item.delFlg === '0')
- setEstimateContextState({
- originFiles: file,
- })
- setOriginFiles(file)
+ if (estimateContextState?.resetFlag === 'Y') {
+ originReset()
+ } else {
+ if (originFiles.length > 0) {
+ if (isEmptyArray(files)) {
+ let file
+ file = originFiles.filter((item) => item.delFlg === '0')
+ setEstimateContextState({
+ originFiles: file,
+ })
+ setOriginFiles(file)
+ }
}
}
}
}, [estimateContextState?.fileList])
+ const originReset = () => {
+ setOriginFiles([])
+ }
// 삭제누른 첨부파일 복원
const returnOriginFile = (no) => {
originFiles.map((file) => {
@@ -338,19 +344,6 @@ export default function Estimate({}) {
//프라이싱 했을때 priceCd setEstimateContextState
//화면에 보여지는 값은 showPriceCd로 관리
setShowPriceCd(priceCd)
- // return
- // const param = {
- // saleStoreId: session.storeId,
- // sapSalesStoreCd: session.custCd,
- // docTpCd: priceCd,
- // }
-
- // const apiUrl = `/api/estimate/price/store-price-list?${queryStringFormatter(param)}`
- // get({ url: apiUrl }).then((res) => {
- // if (isNotEmptyArray(res?.data)) {
- // setStorePriceList(res.data)
- // }
- // })
}
const makeUniqueSpecialNoteCd = (itemList) => {
@@ -648,6 +641,7 @@ 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'
@@ -662,6 +656,7 @@ 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) {
@@ -816,6 +811,7 @@ export default function Estimate({}) {
}
const calculateYJSSTotals = (itemList) => {
+ // console.log(':::itemList::', itemList)
itemList.sort((a, b) => a.dispOrder - b.dispOrder)
makeUniqueSpecialNoteCd(itemList)
itemList.forEach((item) => {
@@ -926,6 +922,10 @@ export default function Estimate({}) {
setEstimateContextState({ remarks: e.target.value })
}
+ useEffect(() => {
+ // console.log('리셋여부::', estimateContextState.resetFlag)
+ }, [estimateContextState.resetFlag])
+
return (
diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx
index 91173b89..79108d67 100644
--- a/src/components/floor-plan/CanvasMenu.jsx
+++ b/src/components/floor-plan/CanvasMenu.jsx
@@ -63,7 +63,7 @@ export default function CanvasMenu(props) {
const { handleZoomClear, handleZoom } = useCanvasEvent()
const { handleMenu } = useMenu()
- const { handleEstimateSubmit } = useEstimateController()
+ const { handleEstimateSubmit, fetchSetting } = useEstimateController()
const estimateRecoilState = useRecoilValue(estimateState)
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
const [estimateCopyPopupOpen, setEstimateCopyPopupOpen] = useState(false)
@@ -252,16 +252,21 @@ export default function CanvasMenu(props) {
// 견적서 초기화 버튼
const handleEstimateReset = () => {
- return alert('개발전입니다;;;')
- // console.log('estimateRecoilState::', estimateRecoilState)
- //objectNo, planNo
swalFire({
//저장된 견적서 정보가 초기화되고, 도면정보가 반영됩니다. 정말로 초기화 하시겠습니까?
//물건정보
text: getMessage('estimate.detail.reset.confirmMsg'),
type: 'confirm',
- confirmFn: () => {
- console.log('내용초기화 및 변경일시 갱신')
+ confirmFn: async () => {
+ const params = {
+ objectNo: objectNo,
+ planNo: pid,
+ userId: sessionState.userId,
+ }
+ //디테일 호출
+ await promisePost({ url: '/api/estimate/reset-estimate', data: params }).then((res) => {
+ fetchSetting(objectNo, pid, 'R')
+ })
},
denyFn: () => {
console.log('초기화하지 않음. 변경일시 갱신안함')
diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js
index 75eb43ab..981d81a2 100644
--- a/src/hooks/floorPlan/estimate/useEstimateController.js
+++ b/src/hooks/floorPlan/estimate/useEstimateController.js
@@ -51,12 +51,17 @@ export const useEstimateController = (planNo) => {
}, [fileList])
// 상세 조회
- const fetchSetting = async (objectNo, planNo) => {
+ const fetchSetting = async (objectNo, planNo, resetFlag) => {
try {
await promiseGet({ url: `/api/estimate/${objectNo}/${planNo}/detail` }).then((res) => {
setIsGlobalLoading(true)
if (res.status === 200) {
if (isObjectNotEmpty(res.data)) {
+ if (resetFlag) {
+ res.data.originFiles = []
+ res.data.originFile = []
+ res.data.resetFlag = 'Y'
+ }
if (res.data.itemList.length > 0) {
res.data.itemList.map((item) => {
item.delFlg = '0'
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 7a86f924..7293b7fe 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -939,7 +939,7 @@
"estimate.detail.save.requiredItemId": "제품을 선택해주세요.",
"estimate.detail.save.requiredAmount": "수량은 0보다 큰값을 입력해주세요.",
"estimate.detail.save.requiredSalePrice": "단가는 0보다 큰값을 입력해주세요.",
- "estimate.detail.reset.confirmMsg": "저장된 견적서 정보가 초기화되고, 도면정보가 반영됩니다. 정말로 초기화 하시겠습니까?",
+ "estimate.detail.reset.confirmMsg": "수기 변경(저장)한 견적 정보가 초기화되고, 최근 저장된 도면정보가 반영됩니다. 정말로 초기화하시겠습니까?",
"estimate.detail.alert.delFile": "첨부파일을 완전히 삭제하려면 [저장]버튼을 클릭하십시오.",
"estimate.detail.alert.selectDelItem": "삭제할 제품을 선택하세요.",
"simulator.title.sub1": "물건번호",