초기화

This commit is contained in:
basssy 2025-01-10 18:33:12 +09:00
parent 8cdebdae4a
commit 26bd4ac9e0
4 changed files with 40 additions and 30 deletions

View File

@ -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 (
<div className="sub-content estimate">
<div className="sub-content-inner">

View File

@ -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('초기화하지 않음. 변경일시 갱신안함')

View File

@ -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'

View File

@ -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": "물건번호",