diff --git a/src/utils/http.js b/src/utils/http.js index 16bae854..ab8ab8ab 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -21,7 +21,7 @@ service.interceptors.request.use( } config.headers['Content-Type'] = config.contentType || 'application/x-www-form-urlencoded' let token = localStorage.getItem('token'); - // let token='4099761587129c46b03c9316c9e866c9' + // let token='eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBTkNIQU5HIiwidXNlcklkIjo0NTY3MSwibmFtZSI6IuWuieeVhSIsInVzZXJOYW1lIjoiQU5DSEFORyIsInN1cHBsaWVySWQiOjExMjgsImlzWmQiOjAsImV4cCI6MTc1MjEzNDc2M30.q1O7C8thZzEMVKYDhBQ-N_14Fh9Bqejj7j11EKLF5Aw' // let token='eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJTSEhQWEIiLCJ1c2VySWQiOjU0NzI2LCJuYW1lIjoiI-a1i-ivleWwj-eZveeZvSIsInVzZXJOYW1lIjoiU0hIUFhCIiwic3VwcGxpZXJJZCI6MTAwMDE2NSwiZXhwIjoxNzQ0NTEwNzkwfQ.JPk0OA7slYJN3FIi_uhW4Y0CiWRvl6R1dK8MRTbyhD8' if(!(reqUrl=='/supplier/supplierTraining/trainingTask' || reqUrl=='/supplier/supplierTraining/normalList' || reqUrl=='/supplier/supplierTraining/trainingList')){ config.headers['Authorization'] = `${token}`; diff --git a/src/views/report/reportIndex.vue b/src/views/report/reportIndex.vue index e4941e4a..fdefbd0f 100644 --- a/src/views/report/reportIndex.vue +++ b/src/views/report/reportIndex.vue @@ -150,6 +150,7 @@ userOrderId: '', userOrderCode: '', driverId: '', + clickFlag: true, } }, async mounted() { @@ -191,48 +192,56 @@ this.recordList = recordList.data; }, async saveHandler() { - let data = { - source: Number(this.type), - reportContent: this.remark, - userOrderId: Number(this.userOrderId), - reportConfigId: this.currentInfo.id, - userOrderCode: this.userOrderCode, - driverId: this.driverId, - } - if(this.currentInfo.component == 'time') { - if( !this.appointTime ) { - Toast('预约时间不能为空') + if( this.clickFlag ) { + this.clickFlag = false; + let data = { + source: Number(this.type), + reportContent: this.remark, + userOrderId: Number(this.userOrderId), + reportConfigId: this.currentInfo.id, + userOrderCode: this.userOrderCode, + driverId: this.driverId, + } + if(this.currentInfo.component == 'time') { + if( !this.appointTime ) { + Toast('预约时间不能为空') + return + } + if( new Date(this.appointTime).getTime() <= new Date().getTime() ) { + Toast('预约时间不能小于当前时间') + return + } + data.time = this.appointTime + } + if(this.currentInfo.component == 'address') { + if( !this.address ) { + Toast('地址不能为空') + return + } + data.address = this.address + data.lat = this.lat; + data.lng = this.lng; + } + if( !this.remark ) { + Toast('备注内容不能为空') return } - if( new Date(this.appointTime).getTime() <= new Date().getTime() ) { - Toast('预约时间不能小于当前时间') - return + try { + await newOrderReporting(data) + Dialog.alert({ + title: '提示', + message: "报备添加成功" + }).then(async () => { + await this.getRecordList() + this.addReportShow = false + this.scrollToBottom(); + this.initDialogData(); + this.clickFlag = true + }); + } finally { + this.clickFlag = true } - data.time = this.appointTime } - if(this.currentInfo.component == 'address') { - if( !this.address ) { - Toast('地址不能为空') - return - } - data.address = this.address - data.lat = this.lat; - data.lng = this.lng; - } - if( !this.remark ) { - Toast('备注内容不能为空') - return - } - await newOrderReporting(data) - Dialog.alert({ - title: '提示', - message: "报备添加成功" - }).then(async () => { - await this.getRecordList() - this.addReportShow = false - this.scrollToBottom(); - this.initDialogData(); - }); }, initDialogData() { this.appointTime = '';