派车打印

szh_zidingyibiaoti
张同海 2 years ago
parent 02dd4a2e48
commit 9d923990dd

@ -95,6 +95,19 @@ export function apibookingtruck(parameter) {
method: 'DELETE' method: 'DELETE'
}) })
} }
/**
* 获取订舱打印模板列表带有当前用户打印历史排序
*
* @author Myshipping
*/
export function BookingTruckPrintTemplateWithHistoryList(parameter) {
return axios({
url: '/BookingTruck/PrintTemplateWithHistoryList',
method: 'get',
params: parameter
})
}
/** /**
* 打印派车 * 打印派车
* *

@ -487,6 +487,38 @@
</a-row> </a-row>
</a-form> </a-form>
</a-spin> </a-spin>
<a-modal :zIndex="1005" width="50vw" :maskClosable="false" v-model="PrintModalVisible" title="打印">
<template slot="footer"> <span></span> </template>
<a-spin tip="数据加载中..." :spinning="spinning">
<div class="PrintMain">
<div class="PrintTitle">
<p>默认打印格式为<span>pdf</span>,如需其他格式请选择</p>
<p>
打印格式
<a-radio-group v-model="PrintType" name="radioGroup">
<a-radio value="1">pdf</a-radio>
<a-radio value="2">xlsx</a-radio>
<a-radio value="3">docx</a-radio>
<a-radio value="4">精确打印</a-radio>
</a-radio-group>
</p>
</div>
<a-row class="PrintMainBox">
<a-col
v-for="(item, index) in templateType"
:key="item.id"
@click="FnCilckTemplateType(item.id)"
class="items"
:span="11"
:offset="index % 2 == 0 ? 0 : 1"
>
<span>·</span>{{ item.displayName }}
</a-col>
</a-row>
</div>
</a-spin>
</a-modal>
</div> </div>
<!-- </a-modal> --> <!-- </a-modal> -->
@ -510,7 +542,8 @@ import {
TaskManageTruckSave, TaskManageTruckSave,
TaskManageTruckPrint, TaskManageTruckPrint,
TaskManageTruckCancelDispatch, TaskManageTruckCancelDispatch,
TaskManageTruckSendDispatchBatch TaskManageTruckSendDispatchBatch,
BookingTruckPrintTemplateWithHistoryList
} from '@/api/modular/main/SendCar' } from '@/api/modular/main/SendCar'
import { GetCtn } from '@/api/modular/main/BookingLedger' import { GetCtn } from '@/api/modular/main/BookingLedger'
import { GetSysUserPage } from '@/api/modular/main/BookingLedger' import { GetSysUserPage } from '@/api/modular/main/BookingLedger'
@ -518,7 +551,12 @@ import { merge, values } from 'xe-utils'
export default { export default {
data() { data() {
return { return {
templateType: [],
PrintType: '1',
spinning: false,
PrintModalVisible: false,
isGuaJi: false, isGuaJi: false,
taskPKId: null,
id: null, id: null,
type: null, type: null,
BookingId: null, BookingId: null,
@ -623,39 +661,123 @@ export default {
} }
}, },
watch: { watch: {
$route: { '$route.query': {
// $route: {
immediate: true, immediate: true,
deep: true,
handler(To, from) { handler(To, from) {
console.log(To.path) console.log(To)
if (To.path == '/SendCarAdd') { // if (To.path == '/SendCarAdd') {
if ( // if (
this.id == this.$route.query.id && // this.id == this.$route.query.id &&
this.type == this.$route.query.type && // this.type == this.$route.query.type &&
this.BookingId == this.$route.query.BookingId && // this.BookingId == this.$route.query.BookingId &&
this.taskPKId == this.$route.query.taskPKId // this.taskPKId == this.$route.query.taskPKId
) { // ) {
console.log( // console.log(
this.id, // this.id,
this.$route.query.id, // this.$route.query.id,
this.type, // this.type,
this.$route.query.type, // this.$route.query.type,
this.BookingId, // this.BookingId,
this.$route.query.BookingId // this.$route.query.BookingId
) // )
} else { // } else {
console.log(To.type)
if (To.type) {
this.taskPKId = this.$route.query.taskPKId this.taskPKId = this.$route.query.taskPKId
this.id = this.$route.query.id this.id = this.$route.query.id
this.type = this.$route.query.type this.type = this.$route.query.type
this.BookingId = this.$route.query.BookingId this.BookingId = this.$route.query.BookingId
this.init() this.init()
} }
// }
// }
} }
},
PrintType(newdata, oldData) {
let printType = newdata == 4 ? 20 : 10
let print = oldData == 4 ? 20 : 10
if (printType != print) {
this.GetPrintData('truckBill', printType)
} }
} }
}, },
mounted() {}, mounted() {},
methods: { methods: {
GetPrintData(cateCode, printType) {
let Data = {
cateCode,
printType
}
this.spinning = true
BookingTruckPrintTemplateWithHistoryList(Data).then(res => {
this.templateType = res.data
this.spinning = false
this.PrintModalVisible = true
})
},
//
FnCilckTemplateType(templateId) {
this.$message.success(`搜索文件中...`)
let printType = this.PrintType == 4 ? 20 : 10
if (this.taskPKId) {
TaskManageTruckPrint({ pkId: this.WebData.pK_ID }).then(res => {
if (res.data.succ) {
this.$message.success('打印成功')
} else {
this.$message.error(`打印失败,${res.data.msg}`)
}
})
} else {
BookingTruckPrint({
id: this.WebData.id,
templateId,
cateCode: 'truckBill',
type: this.PrintType,
printType
}).then(res => {
if (!res.success) {
this.$message.error(res.message)
} else {
// this.$message.success(res.data)
if (this.PrintType == 1) {
window.open(` ${process.env.VUE_APP_API_BASE_URL}/BookingOrder/ViewPrintPdf/${res.data}`, '_blank')
} else {
window.open(
` ${process.env.VUE_APP_API_BASE_URL}/BookingOrder/downloadPrint?filename=${res.data}`,
'_blank'
)
}
}
})
}
// BookingOrderPrintOrder({
// templateId,
// bookingId: this.id,
// cateCode: 'truckBill',
// type: this.PrintType,
// printType
// })
// .then(res => {
// if (!res.success) {
// this.$message.error(res.message)
// } else {
// // this.$message.success(res.data)
// if (this.PrintType == 1) {
// window.open(` ${process.env.VUE_APP_API_BASE_URL}/BookingOrder/ViewPrintPdf/${res.data}`, '_blank')
// } else {
// window.open(
// ` ${process.env.VUE_APP_API_BASE_URL}/BookingOrder/downloadPrint?filename=${res.data}`,
// '_blank'
// )
// }
// }
// })
// .catch(err => {
// console.log(err)
// })
},
// //
FnSendCar() { FnSendCar() {
TaskManageTruckSendDispatchBatch([this.WebData.pK_ID]).then(res => { TaskManageTruckSendDispatchBatch([this.WebData.pK_ID]).then(res => {
@ -743,23 +865,31 @@ export default {
return Rdata return Rdata
}, },
FnPrint() { FnPrint() {
if (this.taskPKId) { let printType = ''
TaskManageTruckPrint({ pkId: this.WebData.pK_ID }).then(res => { if (this.PrintType == 4) {
if (res.data.succ) { printType = 20
this.$message.success('打印成功')
} else {
this.$message.error(`打印失败,${res.data.msg}`)
}
})
} else { } else {
BookingTruckPrint({ id: this.WebData.id }).then(res => { printType = 10
if (res.data.succ) { }
this.$message.success('打印成功') this.PrintType = '1'
} else { this.GetPrintData('truckBill', printType)
this.$message.error(`打印失败,${res.data.msg}`) // if (this.taskPKId) {
} // TaskManageTruckPrint({ pkId: this.WebData.pK_ID }).then(res => {
}) // if (res.data.succ) {
} // this.$message.success('')
// } else {
// this.$message.error(`,${res.data.msg}`)
// }
// })
// } else {
// BookingTruckPrint({ id: this.WebData.id }).then(res => {
// if (res.data.succ) {
// this.$message.success('')
// } else {
// this.$message.error(`,${res.data.msg}`)
// }
// })
// }
}, },
FnCancel() { FnCancel() {
BookingTruckCancel({ id: this.WebData.id }).then(res => { BookingTruckCancel({ id: this.WebData.id }).then(res => {
@ -853,10 +983,10 @@ export default {
// this.$data = this.$options.data() // this.$data = this.$options.data()
DjyCustomerQuerytDjyCustomerInfo({ queryType: 'fleet' }).then(res => { // DjyCustomerQuerytDjyCustomerInfo({ queryType: 'fleet' }).then(res => {
this.truckIdData = res.data // this.truckIdData = res.data
this.AlltruckIdData = res.data // this.AlltruckIdData = res.data
}) // })
commondbYardlist().then(res => { commondbYardlist().then(res => {
this.inYardIDData = res.data this.inYardIDData = res.data
this.yardidData = res.data this.yardidData = res.data
@ -903,6 +1033,9 @@ export default {
}) })
}, },
Changeyardcontract(e) { Changeyardcontract(e) {
if (!this.yardcontractaData) {
this.yardcontractaData = []
}
this.yardcontractaData.forEach(item => { this.yardcontractaData.forEach(item => {
if (item.id == e) { if (item.id == e) {
this.form.setFieldsValue({ this.form.setFieldsValue({
@ -922,7 +1055,7 @@ export default {
}) })
}, 100) }, 100)
DjyCustomerQuerytDjyCustomerInfo({ queryItem: e }).then(res => { DjyCustomerQuerytDjyCustomerInfo({ queryItem: e }).then(res => {
if (res.data[0]) { if (res.data[0] && res.data[0].contacts) {
this.inYardContactData = res.data[0].contacts this.inYardContactData = res.data[0].contacts
if (res.data[0].contacts.length) { if (res.data[0].contacts.length) {
setTimeout(() => { setTimeout(() => {
@ -943,7 +1076,7 @@ export default {
}) })
}, 100) }, 100)
DjyCustomerQuerytDjyCustomerInfo({ queryItem: e }).then(res => { DjyCustomerQuerytDjyCustomerInfo({ queryItem: e }).then(res => {
if (res.data[0]) { if (res.data[0] && res.data[0].contacts) {
this.yardcontractaData = res.data[0].contacts this.yardcontractaData = res.data[0].contacts
if (res.data[0].contacts.length) { if (res.data[0].contacts.length) {
setTimeout(() => { setTimeout(() => {
@ -1152,6 +1285,9 @@ export default {
} }
} }
</script> </script>
<style lang="less" scoped>
@import url('../BookingLedger/detail/style/operationArea.less');
</style>
<style scoped lang="less"> <style scoped lang="less">
.SendCarMain { .SendCarMain {
display: flex; display: flex;

@ -183,6 +183,9 @@
> >
<a-button class="list-btn" type="primary" icon="check">完成</a-button> <a-button class="list-btn" type="primary" icon="check">完成</a-button>
</a-popconfirm> </a-popconfirm>
<a-button class="list-btn" type="primary" icon="check">打印</a-button>
<a-button class="list-btn" type="primary" icon="check">发送派车</a-button>
<a-button class="list-btn" type="primary" icon="check">撤销派车</a-button>
<template v-if="taskType === 'BC'"> <template v-if="taskType === 'BC'">
<a-popconfirm <a-popconfirm
title="确定批量下载当前选择项?" title="确定批量下载当前选择项?"

Loading…
Cancel
Save