초기화

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) => { 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: [] })
@ -235,19 +234,26 @@ export default function Estimate({}) {
setFiles([]) setFiles([])
setOriginFiles(estimateContextState.fileList) setOriginFiles(estimateContextState.fileList)
} else { } else {
if (originFiles.length > 0) { if (estimateContextState?.resetFlag === 'Y') {
if (isEmptyArray(files)) { originReset()
let file } else {
file = originFiles.filter((item) => item.delFlg === '0') if (originFiles.length > 0) {
setEstimateContextState({ if (isEmptyArray(files)) {
originFiles: file, let file
}) file = originFiles.filter((item) => item.delFlg === '0')
setOriginFiles(file) setEstimateContextState({
originFiles: file,
})
setOriginFiles(file)
}
} }
} }
} }
}, [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">

View File

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

View File

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

View File

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