From 9d923990dd8a25caefb1f4355981639d6a4a8ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=B5=B7?= <963808678@qq.com> Date: Fri, 21 Apr 2023 15:55:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BE=E8=BD=A6=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modular/main/SendCar.js | 13 + src/views/main/SendCar/addForm.vue | 230 ++++++++++++++---- .../main/Taskmanage/TaskmanageList/index.vue | 3 + 3 files changed, 199 insertions(+), 47 deletions(-) diff --git a/src/api/modular/main/SendCar.js b/src/api/modular/main/SendCar.js index 244ea20..499b274 100644 --- a/src/api/modular/main/SendCar.js +++ b/src/api/modular/main/SendCar.js @@ -95,6 +95,19 @@ export function apibookingtruck(parameter) { method: 'DELETE' }) } + +/** + * 获取订舱打印模板列表(带有当前用户打印历史排序) + * + * @author Myshipping + */ +export function BookingTruckPrintTemplateWithHistoryList(parameter) { + return axios({ + url: '/BookingTruck/PrintTemplateWithHistoryList', + method: 'get', + params: parameter + }) +} /** * 打印派车 * diff --git a/src/views/main/SendCar/addForm.vue b/src/views/main/SendCar/addForm.vue index 2e0c64f..b4910a2 100644 --- a/src/views/main/SendCar/addForm.vue +++ b/src/views/main/SendCar/addForm.vue @@ -487,6 +487,38 @@ + + + + + + 默认打印格式为pdf,如需其他格式请选择 + + 打印格式: + + pdf + xlsx + docx + 精确打印 + + + + + + + ·{{ item.displayName }} + + + + + @@ -510,7 +542,8 @@ import { TaskManageTruckSave, TaskManageTruckPrint, TaskManageTruckCancelDispatch, - TaskManageTruckSendDispatchBatch + TaskManageTruckSendDispatchBatch, + BookingTruckPrintTemplateWithHistoryList } from '@/api/modular/main/SendCar' import { GetCtn } from '@/api/modular/main/BookingLedger' import { GetSysUserPage } from '@/api/modular/main/BookingLedger' @@ -518,7 +551,12 @@ import { merge, values } from 'xe-utils' export default { data() { return { + templateType: [], + PrintType: '1', + spinning: false, + PrintModalVisible: false, isGuaJi: false, + taskPKId: null, id: null, type: null, BookingId: null, @@ -623,39 +661,123 @@ export default { } }, watch: { - $route: { + '$route.query': { + // $route: { immediate: true, - deep: true, handler(To, from) { - console.log(To.path) - if (To.path == '/SendCarAdd') { - if ( - this.id == this.$route.query.id && - this.type == this.$route.query.type && - this.BookingId == this.$route.query.BookingId && - this.taskPKId == this.$route.query.taskPKId - ) { - console.log( - this.id, - this.$route.query.id, - this.type, - this.$route.query.type, - this.BookingId, - this.$route.query.BookingId - ) - } else { - this.taskPKId = this.$route.query.taskPKId - this.id = this.$route.query.id - this.type = this.$route.query.type - this.BookingId = this.$route.query.BookingId - this.init() - } + console.log(To) + // if (To.path == '/SendCarAdd') { + // if ( + // this.id == this.$route.query.id && + // this.type == this.$route.query.type && + // this.BookingId == this.$route.query.BookingId && + // this.taskPKId == this.$route.query.taskPKId + // ) { + // console.log( + // this.id, + // this.$route.query.id, + // this.type, + // this.$route.query.type, + // this.BookingId, + // this.$route.query.BookingId + // ) + // } else { + console.log(To.type) + if (To.type) { + this.taskPKId = this.$route.query.taskPKId + this.id = this.$route.query.id + this.type = this.$route.query.type + this.BookingId = this.$route.query.BookingId + 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() {}, 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() { TaskManageTruckSendDispatchBatch([this.WebData.pK_ID]).then(res => { @@ -743,23 +865,31 @@ export default { return Rdata }, FnPrint() { - 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}`) - } - }) + let printType = '' + if (this.PrintType == 4) { + printType = 20 } else { - BookingTruckPrint({ id: this.WebData.id }).then(res => { - if (res.data.succ) { - this.$message.success('打印成功') - } else { - this.$message.error(`打印失败,${res.data.msg}`) - } - }) + printType = 10 } + this.PrintType = '1' + this.GetPrintData('truckBill', printType) + // 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() { BookingTruckCancel({ id: this.WebData.id }).then(res => { @@ -853,10 +983,10 @@ export default { // this.$data = this.$options.data() - DjyCustomerQuerytDjyCustomerInfo({ queryType: 'fleet' }).then(res => { - this.truckIdData = res.data - this.AlltruckIdData = res.data - }) + // DjyCustomerQuerytDjyCustomerInfo({ queryType: 'fleet' }).then(res => { + // this.truckIdData = res.data + // this.AlltruckIdData = res.data + // }) commondbYardlist().then(res => { this.inYardIDData = res.data this.yardidData = res.data @@ -903,6 +1033,9 @@ export default { }) }, Changeyardcontract(e) { + if (!this.yardcontractaData) { + this.yardcontractaData = [] + } this.yardcontractaData.forEach(item => { if (item.id == e) { this.form.setFieldsValue({ @@ -922,7 +1055,7 @@ export default { }) }, 100) DjyCustomerQuerytDjyCustomerInfo({ queryItem: e }).then(res => { - if (res.data[0]) { + if (res.data[0] && res.data[0].contacts) { this.inYardContactData = res.data[0].contacts if (res.data[0].contacts.length) { setTimeout(() => { @@ -943,7 +1076,7 @@ export default { }) }, 100) DjyCustomerQuerytDjyCustomerInfo({ queryItem: e }).then(res => { - if (res.data[0]) { + if (res.data[0] && res.data[0].contacts) { this.yardcontractaData = res.data[0].contacts if (res.data[0].contacts.length) { setTimeout(() => { @@ -1152,6 +1285,9 @@ export default { } } +
默认打印格式为pdf,如需其他格式请选择
+ 打印格式: + + pdf + xlsx + docx + 精确打印 + +