초기화
This commit is contained in:
parent
8cdebdae4a
commit
26bd4ac9e0
@ -221,7 +221,6 @@ export default function Estimate({}) {
|
|||||||
files.map((row) => {
|
files.map((row) => {
|
||||||
fileList.push(row.data)
|
fileList.push(row.data)
|
||||||
setEstimateContextState({ fileList: row.data, newFileList: fileList })
|
setEstimateContextState({ fileList: row.data, newFileList: fileList })
|
||||||
// setEstimateContextState({ fileList: row.data })
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
setEstimateContextState({ fileList: [], newFileList: [] })
|
setEstimateContextState({ fileList: [], newFileList: [] })
|
||||||
@ -234,6 +233,9 @@ export default function Estimate({}) {
|
|||||||
//드래그영역 비워주기
|
//드래그영역 비워주기
|
||||||
setFiles([])
|
setFiles([])
|
||||||
setOriginFiles(estimateContextState.fileList)
|
setOriginFiles(estimateContextState.fileList)
|
||||||
|
} else {
|
||||||
|
if (estimateContextState?.resetFlag === 'Y') {
|
||||||
|
originReset()
|
||||||
} else {
|
} else {
|
||||||
if (originFiles.length > 0) {
|
if (originFiles.length > 0) {
|
||||||
if (isEmptyArray(files)) {
|
if (isEmptyArray(files)) {
|
||||||
@ -246,8 +248,12 @@ export default function Estimate({}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, [estimateContextState?.fileList])
|
}, [estimateContextState?.fileList])
|
||||||
|
|
||||||
|
const originReset = () => {
|
||||||
|
setOriginFiles([])
|
||||||
|
}
|
||||||
// 삭제누른 첨부파일 복원
|
// 삭제누른 첨부파일 복원
|
||||||
const returnOriginFile = (no) => {
|
const returnOriginFile = (no) => {
|
||||||
originFiles.map((file) => {
|
originFiles.map((file) => {
|
||||||
@ -338,19 +344,6 @@ export default function Estimate({}) {
|
|||||||
//프라이싱 했을때 priceCd setEstimateContextState
|
//프라이싱 했을때 priceCd setEstimateContextState
|
||||||
//화면에 보여지는 값은 showPriceCd로 관리
|
//화면에 보여지는 값은 showPriceCd로 관리
|
||||||
setShowPriceCd(priceCd)
|
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) => {
|
const makeUniqueSpecialNoteCd = (itemList) => {
|
||||||
@ -648,6 +641,7 @@ export default function Estimate({}) {
|
|||||||
updates.openFlg = res.openFlg
|
updates.openFlg = res.openFlg
|
||||||
|
|
||||||
if (estimateContextState.estimateType === 'YJSS') {
|
if (estimateContextState.estimateType === 'YJSS') {
|
||||||
|
// console.log('YJSS:::,', res.pkgMaterialFlg)
|
||||||
if (res.pkgMaterialFlg === '0') {
|
if (res.pkgMaterialFlg === '0') {
|
||||||
updates.showSalePrice = '0'
|
updates.showSalePrice = '0'
|
||||||
updates.showSaleTotPrice = '0'
|
updates.showSaleTotPrice = '0'
|
||||||
@ -662,6 +656,7 @@ export default function Estimate({}) {
|
|||||||
//104671
|
//104671
|
||||||
let bomList = res.itemBomList
|
let bomList = res.itemBomList
|
||||||
|
|
||||||
|
// console.log('updates::', updates)
|
||||||
updateList = estimateContextState.itemList.map((item) => {
|
updateList = estimateContextState.itemList.map((item) => {
|
||||||
if (item.dispOrder === dispOrder) {
|
if (item.dispOrder === dispOrder) {
|
||||||
if (item?.addFlg) {
|
if (item?.addFlg) {
|
||||||
@ -816,6 +811,7 @@ export default function Estimate({}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const calculateYJSSTotals = (itemList) => {
|
const calculateYJSSTotals = (itemList) => {
|
||||||
|
// console.log(':::itemList::', itemList)
|
||||||
itemList.sort((a, b) => a.dispOrder - b.dispOrder)
|
itemList.sort((a, b) => a.dispOrder - b.dispOrder)
|
||||||
makeUniqueSpecialNoteCd(itemList)
|
makeUniqueSpecialNoteCd(itemList)
|
||||||
itemList.forEach((item) => {
|
itemList.forEach((item) => {
|
||||||
@ -926,6 +922,10 @@ export default function Estimate({}) {
|
|||||||
setEstimateContextState({ remarks: e.target.value })
|
setEstimateContextState({ remarks: e.target.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// console.log('리셋여부::', estimateContextState.resetFlag)
|
||||||
|
}, [estimateContextState.resetFlag])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="sub-content estimate">
|
<div className="sub-content estimate">
|
||||||
<div className="sub-content-inner">
|
<div className="sub-content-inner">
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export default function CanvasMenu(props) {
|
|||||||
const { handleZoomClear, handleZoom } = useCanvasEvent()
|
const { handleZoomClear, handleZoom } = useCanvasEvent()
|
||||||
const { handleMenu } = useMenu()
|
const { handleMenu } = useMenu()
|
||||||
|
|
||||||
const { handleEstimateSubmit } = useEstimateController()
|
const { handleEstimateSubmit, fetchSetting } = useEstimateController()
|
||||||
const estimateRecoilState = useRecoilValue(estimateState)
|
const estimateRecoilState = useRecoilValue(estimateState)
|
||||||
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
|
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
|
||||||
const [estimateCopyPopupOpen, setEstimateCopyPopupOpen] = useState(false)
|
const [estimateCopyPopupOpen, setEstimateCopyPopupOpen] = useState(false)
|
||||||
@ -252,16 +252,21 @@ export default function CanvasMenu(props) {
|
|||||||
|
|
||||||
// 견적서 초기화 버튼
|
// 견적서 초기화 버튼
|
||||||
const handleEstimateReset = () => {
|
const handleEstimateReset = () => {
|
||||||
return alert('개발전입니다;;;')
|
|
||||||
// console.log('estimateRecoilState::', estimateRecoilState)
|
|
||||||
//objectNo, planNo
|
|
||||||
swalFire({
|
swalFire({
|
||||||
//저장된 견적서 정보가 초기화되고, 도면정보가 반영됩니다. 정말로 초기화 하시겠습니까?
|
//저장된 견적서 정보가 초기화되고, 도면정보가 반영됩니다. 정말로 초기화 하시겠습니까?
|
||||||
//물건정보
|
//물건정보
|
||||||
text: getMessage('estimate.detail.reset.confirmMsg'),
|
text: getMessage('estimate.detail.reset.confirmMsg'),
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
confirmFn: () => {
|
confirmFn: async () => {
|
||||||
console.log('내용초기화 및 변경일시 갱신')
|
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: () => {
|
denyFn: () => {
|
||||||
console.log('초기화하지 않음. 변경일시 갱신안함')
|
console.log('초기화하지 않음. 변경일시 갱신안함')
|
||||||
|
|||||||
@ -51,12 +51,17 @@ export const useEstimateController = (planNo) => {
|
|||||||
}, [fileList])
|
}, [fileList])
|
||||||
|
|
||||||
// 상세 조회
|
// 상세 조회
|
||||||
const fetchSetting = async (objectNo, planNo) => {
|
const fetchSetting = async (objectNo, planNo, resetFlag) => {
|
||||||
try {
|
try {
|
||||||
await promiseGet({ url: `/api/estimate/${objectNo}/${planNo}/detail` }).then((res) => {
|
await promiseGet({ url: `/api/estimate/${objectNo}/${planNo}/detail` }).then((res) => {
|
||||||
setIsGlobalLoading(true)
|
setIsGlobalLoading(true)
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
if (isObjectNotEmpty(res.data)) {
|
if (isObjectNotEmpty(res.data)) {
|
||||||
|
if (resetFlag) {
|
||||||
|
res.data.originFiles = []
|
||||||
|
res.data.originFile = []
|
||||||
|
res.data.resetFlag = 'Y'
|
||||||
|
}
|
||||||
if (res.data.itemList.length > 0) {
|
if (res.data.itemList.length > 0) {
|
||||||
res.data.itemList.map((item) => {
|
res.data.itemList.map((item) => {
|
||||||
item.delFlg = '0'
|
item.delFlg = '0'
|
||||||
|
|||||||
@ -939,7 +939,7 @@
|
|||||||
"estimate.detail.save.requiredItemId": "제품을 선택해주세요.",
|
"estimate.detail.save.requiredItemId": "제품을 선택해주세요.",
|
||||||
"estimate.detail.save.requiredAmount": "수량은 0보다 큰값을 입력해주세요.",
|
"estimate.detail.save.requiredAmount": "수량은 0보다 큰값을 입력해주세요.",
|
||||||
"estimate.detail.save.requiredSalePrice": "단가는 0보다 큰값을 입력해주세요.",
|
"estimate.detail.save.requiredSalePrice": "단가는 0보다 큰값을 입력해주세요.",
|
||||||
"estimate.detail.reset.confirmMsg": "저장된 견적서 정보가 초기화되고, 도면정보가 반영됩니다. 정말로 초기화 하시겠습니까?",
|
"estimate.detail.reset.confirmMsg": "수기 변경(저장)한 견적 정보가 초기화되고, 최근 저장된 도면정보가 반영됩니다. 정말로 초기화하시겠습니까?",
|
||||||
"estimate.detail.alert.delFile": "첨부파일을 완전히 삭제하려면 [저장]버튼을 클릭하십시오.",
|
"estimate.detail.alert.delFile": "첨부파일을 완전히 삭제하려면 [저장]버튼을 클릭하십시오.",
|
||||||
"estimate.detail.alert.selectDelItem": "삭제할 제품을 선택하세요.",
|
"estimate.detail.alert.selectDelItem": "삭제할 제품을 선택하세요.",
|
||||||
"simulator.title.sub1": "물건번호",
|
"simulator.title.sub1": "물건번호",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user