szh_zidingyibiaoti
张同海 2 years ago
parent 481b0e58e5
commit eff1e82cfa

@ -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
}
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')
// this.$message.success(res.data)
if (this.PrintType == 1) {
window.open(` http://60.209.125.238:25805/BookingOrder/ViewPrintPdf/${res.data}`, '_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)
window.open(` http://60.209.125.238:25805/BookingOrder/downloadPrint?filename=${res.data}`, '_blank')
}
})
}
})
.catch(err => {

Loading…
Cancel
Save