打印改版

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"> </a-radio-group>
docx </p>
</a-radio-button>
</a-radio-group>
</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"
:key="item.id"
@click="FnCilckTemplateType(item.typeCode)"
class="items"
:span="11"
:offset="index % 2 == 0 ? 0 : 1"
>
<span>·</span>{{ item.typeName }}
</a-col>
</a-row>
</div> </div>
<!-- <a-row>
<a-col class="Citems" :span="6" v-for="item in templateType" :key="item.id">
<span @click="FnCilckTemplateType(item.code)" class="items">{{ item.name }}</span>
</a-col>
</a-row> -->
</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 window.open(URL.createObjectURL(blob), '_blank')
// const link = document.createElement('a') } else {
// link.download = exportName const link = document.createElement('a')
// link.style.display = 'none' link.style.display = 'none'
// link.href = URL.createObjectURL(blob) link.href = URL.createObjectURL(blob)
// console.log(URL.createObjectURL(blob)) link.download = res.data
window.open(URL.createObjectURL(blob), '_blank') document.body.appendChild(link)
// link.setAttribute('download', exportName) link.click()
// document.body.appendChild(link) URL.revokeObjectURL(link.href) // URL
// console.log(link) document.body.removeChild(link)
// link.click() }
// URL.revokeObjectURL(link.href)
// document.body.removeChild(link)
}) })
} }
}) })
@ -1301,18 +1316,41 @@ export default {
.PrintMain { .PrintMain {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
max-height: 50vh;
overflow-y: auto; .PrintTitle {
.items { width: 100%;
display: inline-block; display: flex;
height: 28px; padding: 20px;
line-height: 26px; box-sizing: border-box;
border: 1px dashed #ccc; background: #f7f8fe;
border-radius: 4px; border: 2px dotted #cdcdcd;
padding: 0 10px; p {
font-size: 13px; margin: 0;
cursor: pointer; &:nth-child(2) {
margin: 5px 10px; margin-left: 35px;
}
span {
color: #ff6646;
}
}
}
.PrintMainBox {
max-height: 50vh;
overflow-y: auto;
.items {
padding-left: 1rem;
height: 2.5rem;
line-height: 2.5rem;
border-bottom: 1px solid #ebebeb;
cursor: pointer;
&:hover {
color: #2f54eb;
}
span {
font-weight: bolder;
margin-right: 0.6rem;
}
}
} }
} }
/*订舱弹窗文件功能对齐 */ /*订舱弹窗文件功能对齐 */
@ -1330,19 +1368,19 @@ export default {
/deep/ .ant-modal-body .ant-input-affix-wrapper { /deep/ .ant-modal-body .ant-input-affix-wrapper {
position: relative; position: relative;
z-index: 1; z-index: 1;
&::after{ &::after {
content:''; content: '';
position:absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
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 {
background: none; background: none;
} }
.PrintRadio { .PrintRadio {

Loading…
Cancel
Save