|
@@ -240,6 +240,7 @@ export default{
|
|
|
formData.append('customerName', this.customerName);
|
|
|
formData.append('companyName', this.companyName);
|
|
|
formData.append('billNum', this.billNum);
|
|
|
+ formData.append('billNumN', this.billNum);
|
|
|
formData.append('plateNum', this.plateNum);
|
|
|
// formData.append('batchNumber', this.batchNumber);
|
|
|
formData.append('startBegin', this.startBegin);
|
|
@@ -286,51 +287,101 @@ export default{
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-async exportExcel() {
|
|
|
-const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
|
|
|
- spinner: 'el-icon-loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- });
|
|
|
- let curr = this.currenttwo;
|
|
|
- let pagesize1 = this.pagesizetwo;
|
|
|
- this.currenttwo = 1;
|
|
|
- this.pagesizetwo = this.totaltwo;
|
|
|
- await this.loadDataCar();
|
|
|
- // 设置当前日期
|
|
|
- let time = new Date();
|
|
|
- //console.log(time);
|
|
|
- let year = time.getFullYear();
|
|
|
- let month = time.getMonth() + 1;
|
|
|
- let day = time.getDate();
|
|
|
- let name = "无车运单导出列表_"+year + "" + month + "" + day;
|
|
|
- // console.log(name)
|
|
|
- /* generate workbook object from table */
|
|
|
- // .table要导出的是哪一个表格
|
|
|
- var wb = XLSX.utils.table_to_book(document.querySelector(".table"),{ raw: true });
|
|
|
- this.formartNum(wb);
|
|
|
- /* get binary string as output */
|
|
|
- var wbout = XLSX.write(wb, {
|
|
|
- bookType: "xlsx",
|
|
|
- bookSST: true,
|
|
|
- type: "array"
|
|
|
- });
|
|
|
- try {
|
|
|
- // name+'.xlsx'表示导出的excel表格名字
|
|
|
- FileSaver.saveAs(
|
|
|
- new Blob([wbout], { type: "application/octet-stream" }),
|
|
|
- name + ".xlsx"
|
|
|
- );
|
|
|
- } catch (e) {
|
|
|
- if (typeof console !== "undefined") console.log(e, wbout);
|
|
|
- }
|
|
|
- this.currenttwo = curr;
|
|
|
- this.pagesizetwo = pagesize1;
|
|
|
- this.loadDataCar();
|
|
|
- loading.close();
|
|
|
- return wbout;
|
|
|
- },
|
|
|
+async exportExcel() {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('current', 1);
|
|
|
+ formData.append('size', this.totaltwo);
|
|
|
+ formData.append('success', this.success);
|
|
|
+ formData.append('customerName', this.customerName);
|
|
|
+ formData.append('companyName', this.companyName);
|
|
|
+ formData.append('billNum', this.billNum);
|
|
|
+ formData.append('billNumN', this.billNum);
|
|
|
+ formData.append('plateNum', this.plateNum);
|
|
|
+ // formData.append('batchNumber', this.batchNumber);
|
|
|
+ formData.append('startBegin', this.startBegin);
|
|
|
+ formData.append('startEnd', this.startEnd);
|
|
|
+ formData.append('endBegin', this.endBegin);
|
|
|
+ formData.append('endEnd', this.endEnd);
|
|
|
+ // formData.append('isSuccess', 1);
|
|
|
+ const response = await this.$http.post(`noCar/findBillWayCust`, formData);
|
|
|
+ if (response.data.code === 0) {
|
|
|
+ // 设置当前日期
|
|
|
+ let time = new Date();
|
|
|
+ //console.log(time);
|
|
|
+ let year = time.getFullYear();
|
|
|
+ let month = time.getMonth() + 1;
|
|
|
+ let day = time.getDate();
|
|
|
+ let name = "无车运单查询列表_"+year + "" + month + "" + day;
|
|
|
+ let cloums = [
|
|
|
+ {"title":"公司名称","key":"companyName"},
|
|
|
+ {"title":"运单号","key":"billNum"},
|
|
|
+ {"title":"税号","key":"taxplayerCode"},
|
|
|
+ {"title":"车牌号码","key":"plateNum"},
|
|
|
+ {"title":"运单开始时间","key":"startTime"},
|
|
|
+ {"title":"运单结束时间","key":"predictEndTime"},
|
|
|
+ {"title":"运单开始地址","key":"sourceAddr"},
|
|
|
+ {"title":"运单结束地址","key":"destAddr"},
|
|
|
+ {"title":"运单费用(分)","key":"fee"},
|
|
|
+ {"title":"运单状态","key":"billwayStatus"},
|
|
|
+ {"title":"失败原因","key":"failReason"},
|
|
|
+ {"title":"运单类型","key":"hisFlag"},
|
|
|
+ ];
|
|
|
+ debugger;
|
|
|
+ await this.exportExcelComm(cloums,response.data.data.records,name)
|
|
|
+
|
|
|
+ loading.close();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ formatJson (filterVal, jsonData) {
|
|
|
+ return jsonData.map(v => filterVal.map(j => {
|
|
|
+ if(j == 'billwayStatus'){
|
|
|
+ if(v[j] == 1){
|
|
|
+ return "未结束";
|
|
|
+ } else if(v[j] == -2){
|
|
|
+ return "上传失败";
|
|
|
+ }else if(v[j] == -3){
|
|
|
+ return "指令结束上传失败";
|
|
|
+ }else if(v[j] == 2){
|
|
|
+ return "开票中";
|
|
|
+ }else if(v[j] == 3){
|
|
|
+ return "开票完成";
|
|
|
+ }else {
|
|
|
+ return "超时运单";
|
|
|
+ }
|
|
|
+ }else if(j=='hisFlag'){
|
|
|
+ if(v[j] == 0){
|
|
|
+ return "历史运单";
|
|
|
+ }else{
|
|
|
+ return "实时运单";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return v[j];
|
|
|
+ }
|
|
|
+
|
|
|
+ }));
|
|
|
+ },
|
|
|
+ // 导出Excel
|
|
|
+ exportExcelComm(columns,list,excelName){
|
|
|
+ require.ensure([], () => {
|
|
|
+ const { export_json_to_excel } = require('@/vendor/Export2Excel');
|
|
|
+ let tHeader = []
|
|
|
+ let filterVal = []
|
|
|
+ columns.forEach(item =>{
|
|
|
+ tHeader.push(item.title)
|
|
|
+ filterVal.push(item.key)
|
|
|
+ })
|
|
|
+ const data = this.formatJson(filterVal, list);
|
|
|
+ debugger;
|
|
|
+ export_json_to_excel(tHeader, data, excelName);
|
|
|
+ })
|
|
|
+ },
|
|
|
// 分页方法
|
|
|
handleSize(val) {
|
|
|
this.pagesizetwo = val;
|