打印改版

dev
张同海 2 years ago
parent 5256437b9b
commit ecdc31f4e0

@ -568,3 +568,11 @@ export function BookingOrderAddOrUpdate(parameter) {
data: parameter data: parameter
}) })
} }
export function BookingOrderPrintTemplateList(parameter) {
return axios({
url: '/BookingOrder/PrintTemplateList',
method: 'get',
params: parameter
})
}
//

@ -414,28 +414,30 @@
<a-modal width="50vw" v-model="PrintModalVisible" title="打印"> <a-modal width="50vw" v-model="PrintModalVisible" title="打印">
<template slot="footer"> <span></span> </template> <template slot="footer"> <span></span> </template>
<div class="PrintMain"> <div class="PrintMain">
<div class="PrintRadio"> <div class="PrintTitle">
<a-radio-group default-value="1" button-style="solid" v-model="PrintType"> <p>默认打印格式为<span>pdf</span>,如需其他格式请选择</p>
<a-radio-button value="1"> <p>
pdf 打印格式
</a-radio-button> <a-radio-group v-model="PrintType" name="radioGroup">
<a-radio-button value="2"> <a-radio value="1">pdf</a-radio>
xlsx <a-radio value="2">xlsx</a-radio>
</a-radio-button> <a-radio value="3">docx</a-radio>
<a-radio-button value="3">
docx
</a-radio-button>
</a-radio-group> </a-radio-group>
</p>
</div> </div>
<span v-for="item in templateType" :key="item.id" @click="FnCilckTemplateType(item.code)" class="items"> <a-row class="PrintMainBox">
{{ item.name }} <a-col
</span> v-for="(item, index) in templateType"
</div> :key="item.id"
<!-- <a-row> @click="FnCilckTemplateType(item.typeCode)"
<a-col class="Citems" :span="6" v-for="item in templateType" :key="item.id"> class="items"
<span @click="FnCilckTemplateType(item.code)" class="items">{{ item.name }}</span> :span="11"
:offset="index % 2 == 0 ? 0 : 1"
>
<span>·</span>{{ item.typeName }}
</a-col> </a-col>
</a-row> --> </a-row>
</div>
</a-modal> </a-modal>
<!-- 打印弹窗 end --> <!-- 打印弹窗 end -->
@ -499,7 +501,8 @@ import {
BookingOrderDownloadPrint, BookingOrderDownloadPrint,
BookingOrderOcrUpFile, BookingOrderOcrUpFile,
BookingOrderOcrGetImg, BookingOrderOcrGetImg,
BookingOrderOcrGetText BookingOrderOcrGetText,
BookingOrderPrintTemplateList
} from '@/api/modular/main/BookingLedger' } from '@/api/modular/main/BookingLedger'
import axios from 'axios' import axios from 'axios'
@ -597,7 +600,10 @@ export default {
}, },
mounted() { mounted() {
this.BCvData = [...this.CvData] this.BCvData = [...this.CvData]
this.templateType = this.$options.filters['dictData']('booking_template_type') // this.templateType = this.$options.filters['dictData']('booking_template_type')
BookingOrderPrintTemplateList().then(res => {
this.templateType = res.data
})
// if (this.id) { // if (this.id) {
// this.getLetterYard() // this.getLetterYard()
// } // }
@ -710,23 +716,32 @@ export default {
this.$message.error(res.message) this.$message.error(res.message)
} else { } else {
this.$message.success(`预览打印文件 ${res.data} 中...`) this.$message.success(`预览打印文件 ${res.data} 中...`)
console.log(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 => { BookingOrderDownloadPrint({ fileName: res.data }).then(res2 => {
const blob = new Blob([res2], { type: 'application/pdf;chartset=UTF-8' }) const blob = new Blob([res2], { type: `application/${PrintType};chartset=UTF-8` })
if (this.PrintType == '1') {
// const exportName = res.data
// const link = document.createElement('a')
// link.download = exportName
// link.style.display = 'none'
// link.href = URL.createObjectURL(blob)
// console.log(URL.createObjectURL(blob))
window.open(URL.createObjectURL(blob), '_blank') window.open(URL.createObjectURL(blob), '_blank')
// link.setAttribute('download', exportName) } else {
// document.body.appendChild(link) const link = document.createElement('a')
// console.log(link) link.style.display = 'none'
// link.click() link.href = URL.createObjectURL(blob)
// URL.revokeObjectURL(link.href) link.download = res.data
// document.body.removeChild(link) document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href) // URL
document.body.removeChild(link)
}
}) })
} }
}) })
@ -1301,18 +1316,41 @@ export default {
.PrintMain { .PrintMain {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.PrintTitle {
width: 100%;
display: flex;
padding: 20px;
box-sizing: border-box;
background: #f7f8fe;
border: 2px dotted #cdcdcd;
p {
margin: 0;
&:nth-child(2) {
margin-left: 35px;
}
span {
color: #ff6646;
}
}
}
.PrintMainBox {
max-height: 50vh; max-height: 50vh;
overflow-y: auto; overflow-y: auto;
.items { .items {
display: inline-block; padding-left: 1rem;
height: 28px; height: 2.5rem;
line-height: 26px; line-height: 2.5rem;
border: 1px dashed #ccc; border-bottom: 1px solid #ebebeb;
border-radius: 4px;
padding: 0 10px;
font-size: 13px;
cursor: pointer; cursor: pointer;
margin: 5px 10px; &:hover {
color: #2f54eb;
}
span {
font-weight: bolder;
margin-right: 0.6rem;
}
}
} }
} }
/*订舱弹窗文件功能对齐 */ /*订舱弹窗文件功能对齐 */
@ -1339,7 +1377,7 @@ export default {
height: 100%; height: 100%;
z-index: -1; z-index: -1;
background-color: @primary-color !important; background-color: @primary-color !important;
opacity: .04; opacity: 0.04;
} }
} }
/deep/ .ant-modal-body .ant-input { /deep/ .ant-modal-body .ant-input {

Loading…
Cancel
Save