|
|
|
@ -56,11 +56,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
BookingOrderPrintTemplateWithHistoryList,
|
|
|
|
|
BookingOrderPrint,
|
|
|
|
|
BookingOrderDownloadPrint
|
|
|
|
|
} from '@/api/modular/main/BookingLedger'
|
|
|
|
|
import { BookingOrderPrintTemplateWithHistoryList, BookingOrderPrintOrder } from '@/api/modular/main/BookingLedger'
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
details: {
|
|
|
|
@ -142,41 +138,26 @@ export default {
|
|
|
|
|
this.$message.warning('请先保存分单')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
FnCilckTemplateType(typeCode) {
|
|
|
|
|
FnCilckTemplateType(templateId) {
|
|
|
|
|
this.$message.success(`搜索文件中...`)
|
|
|
|
|
BookingOrderPrint({ typeCode, bookingId: this.details.id, type: this.PrintType })
|
|
|
|
|
let printType = this.PrintType == 4 ? 20 : 10
|
|
|
|
|
BookingOrderPrintOrder({
|
|
|
|
|
templateId,
|
|
|
|
|
bookingId: this.id,
|
|
|
|
|
cateCode: this.cateCode,
|
|
|
|
|
type: this.PrintType,
|
|
|
|
|
printType
|
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (!res.success) {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.success(`预览打印文件 ${res.data} 中...`)
|
|
|
|
|
let PrintType = 'pdf'
|
|
|
|
|
switch (this.PrintType) {
|
|
|
|
|
case '1':
|
|
|
|
|
PrintType = 'pdf'
|
|
|
|
|
break
|
|
|
|
|
case '2':
|
|
|
|
|
PrintType = 'xlsx'
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
PrintType = 'docx'
|
|
|
|
|
break
|
|
|
|
|
// this.$message.success(res.data)
|
|
|
|
|
if (this.PrintType == 1) {
|
|
|
|
|
window.open(` http://60.209.125.238:25805/BookingOrder/ViewPrintPdf/${res.data}`, '_blank')
|
|
|
|
|
} else {
|
|
|
|
|
window.open(` http://60.209.125.238:25805/BookingOrder/downloadPrint?filename=${res.data}`, '_blank')
|
|
|
|
|
}
|
|
|
|
|
BookingOrderDownloadPrint({ fileName: res.data }).then(res2 => {
|
|
|
|
|
const blob = new Blob([res2], { type: `application/${PrintType};chartset=UTF-8` })
|
|
|
|
|
if (this.PrintType == '1') {
|
|
|
|
|
window.open(URL.createObjectURL(blob), '_blank')
|
|
|
|
|
} else {
|
|
|
|
|
const link = document.createElement('a')
|
|
|
|
|
link.style.display = 'none'
|
|
|
|
|
link.href = URL.createObjectURL(blob)
|
|
|
|
|
link.download = res.data
|
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
link.click()
|
|
|
|
|
URL.revokeObjectURL(link.href) // 释放URL对象
|
|
|
|
|
document.body.removeChild(link)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|