견적서 문서다운로드
This commit is contained in:
parent
160874c6c7
commit
eb5bb77f1f
@ -9,6 +9,8 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) {
|
||||
const { getMessage } = useMessage()
|
||||
const { promisePost } = useAxios()
|
||||
|
||||
//EXCEL, PDF 구분
|
||||
const [schDownload, setSchDownload] = useState('EXCEL')
|
||||
//다운로드 파일 EXCEL
|
||||
const [schUnitPriceFlg, setSchUnitPriceFlg] = useState('0')
|
||||
|
||||
@ -24,38 +26,45 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) {
|
||||
|
||||
//문서 다운로드
|
||||
const handleFileDown = async () => {
|
||||
// console.log('물건번호:::', objectRecoil.floorPlanObjectNo)
|
||||
// console.log('planNo::', planNo)
|
||||
// 고른 옵션값들
|
||||
//0 : 견적가 Excel 1 : 정가용Excel 2: 견적가 PDF 3 :정가용PDF
|
||||
// console.log(schUnitPriceFlg)
|
||||
// console.log(schDisplayFlg)
|
||||
// console.log(schWeightFlg)
|
||||
// console.log(schDrawingFlg)
|
||||
//post방식
|
||||
const url = '/api/estimate/excel-download'
|
||||
let sendUnitPriceFlg
|
||||
if (schUnitPriceFlg === '0') {
|
||||
sendUnitPriceFlg = '0'
|
||||
} else if (schUnitPriceFlg === '1') {
|
||||
sendUnitPriceFlg = '1'
|
||||
} else if (schUnitPriceFlg === '2') {
|
||||
sendUnitPriceFlg = '0'
|
||||
} else {
|
||||
sendUnitPriceFlg = '1'
|
||||
}
|
||||
|
||||
const params = {
|
||||
objectNo: objectRecoil.floorPlanObjectNo,
|
||||
planNo: planNo,
|
||||
schUnitPriceFlg: schUnitPriceFlg,
|
||||
schDownload: schDownload,
|
||||
schUnitPriceFlg: sendUnitPriceFlg,
|
||||
schDisplayFlg: schDisplayFlg,
|
||||
schWeightFlg: schWeightFlg,
|
||||
schDrawingFlg: schDrawingFlg,
|
||||
}
|
||||
const options = { responseType: 'blob' }
|
||||
|
||||
let fileName
|
||||
console.log('다운로드 PARAM:::', params)
|
||||
return
|
||||
await promisePost({ url: url, data: params, option: options })
|
||||
.then((resultData) => {
|
||||
console.log('결과::::::', resultData)
|
||||
if (resultData) {
|
||||
console.log('결과::::::', resultData)
|
||||
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
|
||||
const fileUrl = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
|
||||
link.href = fileUrl
|
||||
// link.download = originFile.faileName //resultData에내려주는 파일명으로 변경??
|
||||
|
||||
if (schDownload === 'EXCEL') {
|
||||
fileName = 'EXCEL_DOWN.xlsx'
|
||||
} else {
|
||||
fileName = 'PDF_DOWN.pdf'
|
||||
}
|
||||
link.download = fileName
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
@ -104,28 +113,30 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) {
|
||||
<div className="d-check-radio light mr10">
|
||||
<input
|
||||
type="radio"
|
||||
id="schUnitPriceFlg0"
|
||||
id="schUnitPriceExcelFlg0"
|
||||
name="schUnitPriceFlg"
|
||||
value={'0'}
|
||||
checked={schUnitPriceFlg === '0'}
|
||||
onChange={(e) => {
|
||||
setSchDownload('EXCEL')
|
||||
setSchUnitPriceFlg(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="schUnitPriceFlg0">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg0')}</label>
|
||||
<label htmlFor="schUnitPriceExcelFlg0">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.excelFlg0')}</label>
|
||||
</div>
|
||||
<div className="d-check-radio light mr10">
|
||||
<input
|
||||
type="radio"
|
||||
id="schUnitPriceFlg1"
|
||||
id="schUnitPriceExcelFlg1"
|
||||
name="schUnitPriceFlg"
|
||||
value={'1'}
|
||||
checked={schUnitPriceFlg === '1'}
|
||||
onChange={(e) => {
|
||||
setSchDownload('EXCEL')
|
||||
setSchUnitPriceFlg(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="schUnitPriceFlg1">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg1')}</label>
|
||||
<label htmlFor="schUnitPriceExcelFlg1">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.excelFlg1')}</label>
|
||||
</div>
|
||||
<div className="d-check-radio light mr10">
|
||||
<input
|
||||
@ -135,10 +146,11 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) {
|
||||
value={'2'}
|
||||
checked={schUnitPriceFlg === '2'}
|
||||
onChange={(e) => {
|
||||
setSchDownload('PDF')
|
||||
setSchUnitPriceFlg(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="schUnitPricePdfFlg0">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg2')}</label>
|
||||
<label htmlFor="schUnitPricePdfFlg0">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.pdfFlg0')}</label>
|
||||
</div>
|
||||
<div className="d-check-radio light ">
|
||||
<input
|
||||
@ -148,10 +160,11 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen }) {
|
||||
value={'3'}
|
||||
checked={schUnitPriceFlg === '3'}
|
||||
onChange={(e) => {
|
||||
setSchDownload('PDF')
|
||||
setSchUnitPriceFlg(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="schUnitPricePdfFlg1">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg3')}</label>
|
||||
<label htmlFor="schUnitPricePdfFlg1">{getMessage('estimate.detail.docPopup.schUnitPriceFlg.pdfFlg1')}</label>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@ -860,10 +860,10 @@
|
||||
"estimate.detail.docPopup.title": "ドキュメントダウンロードオプションの設定",
|
||||
"estimate.detail.docPopup.explane": "ダウンロードする文書のオプションを選択したら、 [文書のダウンロード]ボタンをクリックします.",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg": "ダウンロードファイル",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg0": "見積もり Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg1": "定価用 Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg2": "見積もり PDF",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg3": "定価用 PDF",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.excelFlg0": "見積もり Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.excelFlg1": "定価用 Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.pdfFlg0": "見積もり PDF",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.pdfFlg1": "定価用 PDF",
|
||||
"estimate.detail.docPopup.schDisplayFlg": "見積提出先表示名",
|
||||
"estimate.detail.docPopup.schDisplayFlg.schDisplayFlg0": "販売店名",
|
||||
"estimate.detail.docPopup.schDisplayFlg.schDisplayFlg1": "案件名",
|
||||
|
||||
@ -870,10 +870,10 @@
|
||||
"estimate.detail.docPopup.title": "문서다운로드 옵션설정",
|
||||
"estimate.detail.docPopup.explane": "다운로드할 문서 옵션을 선택한 후 문서 다운로드 버튼을 클릭합니다.",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg": "다운로드 파일",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg0": "견적가 Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg1": "정가용 Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg2": "견적가 PDF",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.schUnitPriceFlg3": "정가용 PDF",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.excelFlg0": "견적가 Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.excelFlg1": "정가용 Excel",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.pdfFlg0": "견적가 PDF",
|
||||
"estimate.detail.docPopup.schUnitPriceFlg.pdfFlg1": "정가용 PDF",
|
||||
"estimate.detail.docPopup.schDisplayFlg": "견적제출서 표시명",
|
||||
"estimate.detail.docPopup.schDisplayFlg.schDisplayFlg0": "판매점명",
|
||||
"estimate.detail.docPopup.schDisplayFlg.schDisplayFlg1": "안건명",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user