From 472f674c26ec1a47098f36041ead6ee470e00d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=B5=B7?= <963808678@qq.com> Date: Thu, 22 Dec 2022 12:06:19 +0800 Subject: [PATCH] 12/22 --- src/api/modular/main/BookingLedger.js | 7 +- src/views/main/BookingLedger/detail/index.vue | 339 ++++++++++-------- .../detail/modules/operationArea.vue | 26 +- 3 files changed, 210 insertions(+), 162 deletions(-) diff --git a/src/api/modular/main/BookingLedger.js b/src/api/modular/main/BookingLedger.js index f71a9e0..9554c3a 100644 --- a/src/api/modular/main/BookingLedger.js +++ b/src/api/modular/main/BookingLedger.js @@ -315,7 +315,7 @@ export function SendBookingOrClosingEDI(parameter) { /** * 下载订舱、截单EDI */ - export function DownloadBookingOrClosingEDI(parameter) { +export function DownloadBookingOrClosingEDI(parameter) { return axios({ url: '/BookingOrder/DownloadBookingOrClosingEDI', method: 'get', @@ -544,11 +544,12 @@ export function BookingOrderDownload(parameter) { } // 上传ocr文件 -export function BookingOrderOcrUpFile(parameter) { +export function BookingOrderOcrUpFile(data) { return axios({ url: '/BookingOrder/OcrUpFile', method: 'post', - data: parameter + data: data.data, + params: data.parameter }) } diff --git a/src/views/main/BookingLedger/detail/index.vue b/src/views/main/BookingLedger/detail/index.vue index 45a1235..db82b3a 100644 --- a/src/views/main/BookingLedger/detail/index.vue +++ b/src/views/main/BookingLedger/detail/index.vue @@ -20,6 +20,7 @@ @changePage="changePageFun" @copy="copyBookingFun" @addSedList="addSedList" + @FnOcrChenga="FnOcrChenga" > @@ -39,15 +40,15 @@ - + - + @@ -110,108 +111,108 @@ import { import { mapActions, mapGetters } from 'vuex' import { string } from 'clipboard' const initDetail = { - id: 0, - parentId: 0, - // 基本信息 - customername: '', - customerid: '', - carrier: '', - carrierid: '', - forwarder: '', - pono: '', - mblno: '', - hblno: '', - bookingno: '', - contractno: '', - vessel: '', - voyno: '', - voynoinner: '', - lanecode: '', - etd: '', - atd: '', - lanename: '', - shipagency: '', - sale: '', - op: '', - doc: '', - custservice: '', - // 收发通信息 - shipper: '', - consignee: '', - notifyparty: '', - yard: '', - customser: '', - trucker: '', - agentid: '', - eta: '', - closingdate: '', - closedocdate: '', - closevgmdate: '', - portload: '', - portloadid: '', - transport: '', - transportid: '', - portdischarge: '', - portdischargeid: '', - destination: '', - destinationid: '', - placedelivery: '', - placedeliveryid: '', - placereceipt: '', - placereceiptid: '', - pkgs: 0, - kindpkgs: '', - kgs: 0, - cbm: 0, - // 货物信息 - marks: '', - cargoid: '', - hscode: '', - description: '', - totalno: '', - // 签单信息 - issuetype: '', - issuedate: '', - issueplace: '', - issueplaceid: '', - nobill: 'THREE', - copynobilll: 'THREE', - prepardat: '', - payableat: '', - blfrt: '', - thirdpayaddr: '', - service: 'CY-CY', - reeferf: '', - tempset: '', - tempid: '', - tempmin: '', - tempmax: '', - humidity: '', - dclass: '', - dunno: '', - dpage: '', - dlabel: '', - linkman: '', - // 备注信息 - soremark: '', - siremark: '', - // 箱型 - ctnInputs: [], - // edi补充信息 (edi联系人等暂无字段) - weituo: '', - freightpayer: '', - scaccode: '', - itncode: '', - iscontainersoc: 0, - bookingEDIExt: { - weiTuoFang: '', - ediAttn: '', - ediAttnTel: '', - ediAttnMail: '' - }, - // 分单信息未添加 - hbList: [] - } + id: 0, + parentId: 0, + // 基本信息 + customername: '', + customerid: '', + carrier: '', + carrierid: '', + forwarder: '', + pono: '', + mblno: '', + hblno: '', + bookingno: '', + contractno: '', + vessel: '', + voyno: '', + voynoinner: '', + lanecode: '', + etd: '', + atd: '', + lanename: '', + shipagency: '', + sale: '', + op: '', + doc: '', + custservice: '', + // 收发通信息 + shipper: '', + consignee: '', + notifyparty: '', + yard: '', + customser: '', + trucker: '', + agentid: '', + eta: '', + closingdate: '', + closedocdate: '', + closevgmdate: '', + portload: '', + portloadid: '', + transport: '', + transportid: '', + portdischarge: '', + portdischargeid: '', + destination: '', + destinationid: '', + placedelivery: '', + placedeliveryid: '', + placereceipt: '', + placereceiptid: '', + pkgs: 0, + kindpkgs: '', + kgs: 0, + cbm: 0, + // 货物信息 + marks: '', + cargoid: '', + hscode: '', + description: '', + totalno: '', + // 签单信息 + issuetype: '', + issuedate: '', + issueplace: '', + issueplaceid: '', + nobill: 'THREE', + copynobilll: 'THREE', + prepardat: '', + payableat: '', + blfrt: '', + thirdpayaddr: '', + service: 'CY-CY', + reeferf: '', + tempset: '', + tempid: '', + tempmin: '', + tempmax: '', + humidity: '', + dclass: '', + dunno: '', + dpage: '', + dlabel: '', + linkman: '', + // 备注信息 + soremark: '', + siremark: '', + // 箱型 + ctnInputs: [], + // edi补充信息 (edi联系人等暂无字段) + weituo: '', + freightpayer: '', + scaccode: '', + itncode: '', + iscontainersoc: 0, + bookingEDIExt: { + weiTuoFang: '', + ediAttn: '', + ediAttnTel: '', + ediAttnMail: '' + }, + // 分单信息未添加 + hbList: [] +} export default { name: 'BookingDetail', inject: ['reload'], @@ -275,9 +276,13 @@ export default { this.init() }, mounted() { - window.addEventListener('scroll', () => { - this.scrollTop = document.getElementById('app').scrollTop - }, true) + window.addEventListener( + 'scroll', + () => { + this.scrollTop = document.getElementById('app').scrollTop + }, + true + ) }, beforeRouteUpdate(to, from, next) { // console.log('fromId:', from.query.id, '| toId:', to.query.id) @@ -369,7 +374,7 @@ export default { next() setTimeout(() => { this.inChildLoading = false - }, 2000); + }, 2000) }, beforeRouteEnter(to, from, next) { next(vm => { @@ -379,10 +384,14 @@ export default { methods: { ...mapActions(['setNeedSavePages']), getRouterHis() { - console.log('Router 2.3 === beforeRouteEnter - getRouterHis ===', Object.keys(this.historyData), this.$route.query.id) + console.log( + 'Router 2.3 === beforeRouteEnter - getRouterHis ===', + Object.keys(this.historyData), + this.$route.query.id + ) this.inChildLoading = true const newId = this.$route.query.id - if (Object.keys(this.historyData).includes(`copy-${newId}`) && this.$route.query.isCopy === 'true') { + if (Object.keys(this.historyData).includes(`copy-${newId}`) && this.$route.query.isCopy === 'true') { this.id = this.$route.query.id const $data = JSON.parse(JSON.stringify(this.historyData[`copy-${newId}`])) this.bookingDetails = $data.bookingDetails @@ -477,7 +486,7 @@ export default { } this.inPageLoading = true this.inChildLoading = true - this.$message.loading({ content: '加载中...' }); + this.$message.loading({ content: '加载中...' }) // console.log('4.1 == 获取详情 ==', this.id) BookingOrderGet({ id: this.id @@ -505,9 +514,9 @@ export default { // 初始化箱型 累加 称重总重 if (res.data.ctnInputs.length > 0) { res.data.ctnInputs.map((item, index) => { - if (item.weightype === '累加') { - item.weighkgs = this.calc(Number(item['kgs']), Number(item['tareweight']), '+') - } + if (item.weightype === '累加') { + item.weighkgs = this.calc(Number(item['kgs']), Number(item['tareweight']), '+') + } }) } this.$set(this, 'bookingDetails', res.data) @@ -534,18 +543,17 @@ export default { }, ifCompare(object1, object2) { - var o1keys = Object.keys(object1); - var o2keys = Object.keys(object2); - if (o2keys.length !== o1keys.length) return false; + var o1keys = Object.keys(object1) + var o2keys = Object.keys(object2) + if (o2keys.length !== o1keys.length) return false for (let i = 0; i <= o1keys.length - 1; i++) { - let key = o1keys[i]; - if (!o2keys.includes(key)) return false; - if (object2[key] !== object1[key]) return false; + let key = o1keys[i] + if (!o2keys.includes(key)) return false + if (object2[key] !== object1[key]) return false } - return true; + return true }, - bookingOrderUpdate() { if (!this.bookingDetails.mblno) { this.$message.error('请输入提单号') @@ -566,13 +574,18 @@ export default { // console.log('1.2 == 保存成功 - 刷新路由 ==', this.id) this.$router.replace({ name: 'BookingDetail', - query: { id: this.id, type: this.bookingDetails.carrierid, noOpenTab: true, mblno: this.bookingDetails.mblno } + query: { + id: this.id, + type: this.bookingDetails.carrierid, + noOpenTab: true, + mblno: this.bookingDetails.mblno + } }) } // this.init() this.$forceUpdate() } else { - if (typeof (res.message) === 'string') { + if (typeof res.message === 'string') { this.$message.error(res.message) } else { this.$message.error('保存失败') @@ -599,11 +612,16 @@ export default { this.$message.success('保存成功') this.$router.replace({ name: 'BookingDetail', - query: { id: res.data, type: this.bookingDetails.carrierid, noOpenTab: true, mblno: this.bookingDetails.mblno } + query: { + id: res.data, + type: this.bookingDetails.carrierid, + noOpenTab: true, + mblno: this.bookingDetails.mblno + } }) this.$forceUpdate() } else { - if (typeof (res.message) === 'string') { + if (typeof res.message === 'string') { this.$message.error(res.message) } else { this.$message.error('保存失败') @@ -642,7 +660,10 @@ export default { changePageFun(type) { const _this = this const key = this.$route.fullPath - if (Object.keys(this.needSavePages).includes(key) && (this.needSavePages[key].details || this.needSavePages[key].hbList)) { + if ( + Object.keys(this.needSavePages).includes(key) && + (this.needSavePages[key].details || this.needSavePages[key].hbList) + ) { // console.log('== 切换上一票下一票 - biu 弹窗出现 ==') this.$confirm({ title: '请确认无未保存数据!', @@ -659,7 +680,7 @@ export default { this.changePage(type) } }, - changePage (type) { + changePage(type) { const nowId = this.$route.query.id const arr = Object.keys(this.bookingList) const index = arr.indexOf(nowId.toString()) @@ -704,6 +725,10 @@ export default { query: { id: this.id, isCopy: true, type: this.bookingDetails.carrierid } }) }, + FnOcrChenga(data) { + this.bookingDetails = data + console.log(this.bookingDetails) + }, addSedList() { if (this.isAdd) { this.$message.error('请先保存主单') @@ -720,7 +745,7 @@ export default { this.tabActiveKey = '2' this.Showtabs = true }, - changeHBFun (data) { + changeHBFun(data) { const arr = data.map((item, index) => { return item.isNoSave }) @@ -731,7 +756,7 @@ export default { this.checkSaveFun({ type: 'hbList', hasChange: false }) } }, - checkSaveFun (data) { + checkSaveFun(data) { // if (this.inPageLoading) { // return false // } @@ -749,16 +774,16 @@ export default { // console.log('== vuex 配置更新信息 ==', this.needSavePages) }, calc(num1, num2, calcStr) { - var str1; // 转换为字符串的数字 - var str2; - var ws1 = 0; // ws1,ws2 用来存储传入的num的小数点后的数字的位数 - var ws2 = 0; // 赋默认值,解决当整数和小数运算时倍数计算错误导致的结果误差 - var bigger; // bigger和smaller用于加,减,除法找出小的那个数字,给后面补0,解决位数不对从而造成的计算错误的问题;乘法需要将结果除两个数字的倍数之和 - var smaller; // 例如:加减除法中1.001 + 2.03 ,如果不给2.03进行补0,最后会变成1001+203,数字错位导致结果错误;乘法中1.12*1.1会放大为112*11,所以结果需要除以1000才会是正确的结果,112*11/1000=1.232 - var zeroCount; // 需要补充0的个数 - var isExistDot1; // 传入的数字是否存在小数点 - var isExistDot2; - var sum; + var str1 // 转换为字符串的数字 + var str2 + var ws1 = 0 // ws1,ws2 用来存储传入的num的小数点后的数字的位数 + var ws2 = 0 // 赋默认值,解决当整数和小数运算时倍数计算错误导致的结果误差 + var bigger // bigger和smaller用于加,减,除法找出小的那个数字,给后面补0,解决位数不对从而造成的计算错误的问题;乘法需要将结果除两个数字的倍数之和 + var smaller // 例如:加减除法中1.001 + 2.03 ,如果不给2.03进行补0,最后会变成1001+203,数字错位导致结果错误;乘法中1.12*1.1会放大为112*11,所以结果需要除以1000才会是正确的结果,112*11/1000=1.232 + var zeroCount // 需要补充0的个数 + var isExistDot1 // 传入的数字是否存在小数点 + var isExistDot2 + var sum var beishu = 1 // 将数字转换为字符串 str1 = num1.toString() @@ -912,47 +937,47 @@ export default { // // padding-top: 4px !important; // background: #f99 !important; // } -.ant-input-affix-wrapper .ant-input:not(:last-child){ +.ant-input-affix-wrapper .ant-input:not(:last-child) { height: 28px !important; // margin-top: 4px !important; // background: #9f9 !important; } -.ant-select-selection{ +.ant-select-selection { height: 28px !important; // margin-top: 4px !important; // background: #f00 !important; } -.ant-input:placeholder-shown{ +.ant-input:placeholder-shown { height: 28px !important; // margin-top: 4px !important; // background: #99f !important; } -.ant-calendar-picker-input.ant-input{ +.ant-calendar-picker-input.ant-input { height: 28px !important; // margin-top: 4px !important; } -.ant-form-item-label{ +.ant-form-item-label { // line-height: 30px !important; // border: 1px solid #f00; } -.ant-form-item-control-wrapper{ +.ant-form-item-control-wrapper { // border: 1px solid #f99; // height: 30px; // vertical-align: top; // padding: 0; } -.left-box{ +.left-box { // padding-top: 60px; } -.normal-nav{ - transition: .5s all; +.normal-nav { + transition: 0.5s all; } -.fixed-nav{ +.fixed-nav { position: fixed; top: 56px; - box-shadow:0px 15px 10px -15px #ccc; + box-shadow: 0px 15px 10px -15px #ccc; z-index: 999; - background:#fff; - transition: .5s all; + background: #fff; + transition: 0.5s all; } diff --git a/src/views/main/BookingLedger/detail/modules/operationArea.vue b/src/views/main/BookingLedger/detail/modules/operationArea.vue index 2cb6c35..dbef0c7 100644 --- a/src/views/main/BookingLedger/detail/modules/operationArea.vue +++ b/src/views/main/BookingLedger/detail/modules/operationArea.vue @@ -633,6 +633,27 @@ export default { methods: { // ========== OCR ========== FnClickCvBox(data) { + // let Arr = ['pkgs', 'cbm', 'kgs', 'portdischarge', 'destination', 'kindpkgs'] + // let Type = false + // Arr.forEach(item => { + // if (data.code == item) { + // Type = true + // } + // }) + // if (Type) { + // if (data.code == 'pkgs' || data.code == 'cbm' || data.code == 'kgs') { + // this.details[data.code] = parseInt(this.Rdata) + // } else { + // this.details[data.code] = this.Rdata + // } + // } else { + // this.details[data.code] = this.details[data.code] + this.Rdata + // } + console.log(data) + console.log(data.code) + console.log(this.details) + console.log(this.details[data.code]) + console.log(this.Rdata) this.details[data.code] = this.details[data.code] + this.Rdata this.CvBoxType = false this.BCvData.forEach((item, index) => { @@ -641,6 +662,7 @@ export default { this.BCvData.push(item) } }) + this.$emit('FnOcrChenga', this.details) }, drawRect(e) { if (this.flag) { @@ -704,10 +726,10 @@ export default { uploadFile(file) { const formData = new FormData() formData.append('file', file.file) - formData.append('bookingId', this.id) + // formData.append('bookingId', this.id) const type = file.file.type console.log(type) - BookingOrderOcrUpFile(formData).then(res => { + BookingOrderOcrUpFile({ data: formData, parameter: { bookingId: this.id } }).then(res => { this.fileName = res.data BookingOrderOcrGetImg({ fileName: this.fileName, scale: this.scale }).then(res => { this.imgSrc = window.URL.createObjectURL(new Blob([res], { type: `${type};chartset=UTF-8` }))