浏览代码

前端代码合并提交

mashengyi 3 年之前
父节点
当前提交
0b65e49135
共有 4 个文件被更改,包括 278 次插入77 次删除
  1. 65 18
      src/views/noCar/billway.vue
  2. 71 15
      src/views/noCar/invoice.vue
  3. 69 21
      src/views/selfCar/invoice.vue
  4. 73 23
      src/views/selfCar/selfCarTrade.vue

+ 65 - 18
src/views/noCar/billway.vue

@@ -3,20 +3,10 @@
       <div class="title">
         <el-row>
           <el-col :span="24">
-             <div class="top" >
-               <span style="margin-top: 10px;margin-bottom: 10px;">导入文件:</span>
-              <el-upload
-                class="upload-demo"
-                ref="upload"
-                style="margin-bottom: 10px;display: inline-block"
-                action="http://invoice.back.jkcredit.com/dishonestuser/upload"
-                :on-preview="handlePreview"
-                :on-remove="handleRemove"
-                :on-change="handleSuccess"
-                :auto-upload="false">
-                <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-                <el-button style="margin-left: 10px;" size="small" type="success" @click="batchUpload" v-loading.fullscreen.lock="fullscreenLoading">批量查询</el-button>
-              <el-select style="margin-left: 30px;" v-model="noCarWayBill.billwayStatus" placeholder="运单状态">
+            <div class="demo-input-suffix" style="margin-left: 10px;margin-top: 15px;">
+                  <el-upload  :action="url" :http-request="importExcel" list-type="text" :show-file-list="false" >
+                            <el-button  type="primary">导入参数</el-button>
+                             <el-select style="margin-left: 120px;" v-model="noCarWayBill.billwayStatus" placeholder="运单状态">
                       <el-option
                         v-for="item in tradeStatus"
                         :key="item.value"
@@ -24,9 +14,12 @@
                         :value="item.value">
                       </el-option>
                 </el-select>
-              </el-upload>
-            </div>
-              <div class="demo-input-suffix">
+
+                </el-upload>
+               
+              </div>
+            
+              <div class="demo-input-suffix" style="margin-top: 5px;">
                <el-input  placeholder="公司名称" class="input-demo" v-model="noCarWayBill.companyName"></el-input>
                 <el-input  placeholder="运单编号" class="input-demo" v-model="noCarWayBill.billNum"></el-input>
                 <el-input  placeholder="税号" class="input-demo" v-model="noCarWayBill.taxplayerCode"></el-input>
@@ -194,6 +187,7 @@ import XLSX from "xlsx";
         data(){
           return{
             noCarWayBill:{
+              billNum:''
             },
              formUserList: {
             "file": ""
@@ -250,7 +244,60 @@ import XLSX from "xlsx";
               this.billWayTable = response.data.data.records;
               this.total = response.data.data.total;
             }
-          },
+          }, 
+    importExcel (content) {
+    const file = content.file
+    // let file = file.files[0] // 使用传统的input方法需要加上这一步
+    const types = file.name.split('.')[1]
+    const fileType = ['xlsx', 'xlc', 'xlm', 'xls', 'xlt', 'xlw', 'csv'].some(item => item === types)
+    if (!fileType) {
+      this.$message('格式错误!请重新选择')
+      return
+    }
+    this.file2Xce(file).then(tabJson => {
+      var billNums = '';
+      if (tabJson && tabJson.length > 0) {
+        this.xlsxJson = tabJson
+        this.fileList = this.xlsxJson[0].sheet
+        this.fileList.forEach((item, index, arr) => {
+           if(item['运单编号']!=null && item['运单编号']!='' && typeof item['运单编号']!='undefined'){
+               billNums+= item['运单编号']+',';
+           }
+        });
+      
+      }
+      if(billNums!=''){
+        this.noCarWayBill.billNum =billNums.substring(0,billNums.length-1);
+      }
+     
+      
+    })
+  },
+  file2Xce (file) {
+    return new Promise(function (resolve, reject) {
+      const reader = new FileReader()
+      reader.onload = function (e) {
+        const data = e.target.result
+        this.wb = XLSX.read(data, {
+          type: 'binary'
+        })
+        const result = []
+        console.log((this.wb.Sheets.Sheet1)['!ref'])
+        var are = (this.wb.Sheets.Sheet1)['!ref'];
+        var areRe = are.replace('A1','A2');
+        (this.wb.Sheets.Sheet1)['!ref'] = areRe;
+        this.wb.SheetNames.forEach((sheetName) => {
+          result.push({
+            sheetName: sheetName,
+            sheet: XLSX.utils.sheet_to_json(this.wb.Sheets[sheetName])
+          })
+        })
+        resolve(result)
+      }
+      // reader.readAsBinaryString(file.raw)
+      reader.readAsBinaryString(file) // 传统input方法
+    })
+  },
            // 下载模板
           DownloadTemplate() {
             var url = hostUrl+"noCar/templateDownload?fileName=5"

+ 71 - 15
src/views/noCar/invoice.vue

@@ -3,22 +3,12 @@
       <div class="title">
         <el-row>
           <el-col :span="24">
-            <div class="top">
-               <span style="margin-top: 10px;margin-bottom: 10px;">导入文件:</span>
-              <el-upload
-                class="upload-demo"
-                ref="upload"
-                style="margin-bottom: 10px;display: inline-block"
-                action="http://invoice.back.jkcredit.com/dishonestuser/upload"
-                :on-preview="handlePreview"
-                :on-remove="handleRemove"
-                :on-change="handleSuccess"
-                :auto-upload="false">
-                <el-button slot="trigger"  size="small" type="primary">选取文件</el-button>
-                <el-button style="margin-left: 10px;" size="small" type="success" @click="batchUpload" v-loading.fullscreen.lock="fullscreenLoading">批量查询</el-button>
-              </el-upload>
+            <div class="top"  >
+              <el-upload style="margin-left: 10px;"  :action="url" :http-request="importExcel" list-type="text" :show-file-list="false" >
+                            <el-button  type="primary">导入参数</el-button>
+                </el-upload>
 
-              <div class="demo-input-suffix">
+              <div class="demo-input-suffix" style="margin-top: 5px;">
                 <el-input  placeholder="公司名称" class="input-demo" v-model="formCondition.companyName"></el-input>
                 <el-input  placeholder="运单编号" class="input-demo" v-model="formCondition.waybillNum"></el-input>
                 <el-input  placeholder="税号" class="input-demo" v-model="formCondition.buyerTaxpayerCode"></el-input>
@@ -215,6 +205,9 @@ import XLSX from "xlsx";
         data(){
           return{
             formCondition:{
+              invoiceCode:'',
+              invoiceNum:'',
+              waybillNum:''
             },
             formUserList: {
             "file": ""
@@ -255,6 +248,69 @@ import XLSX from "xlsx";
               this.total = response.data.data.total;
             }
           },
+          importExcel (content) {
+    const file = content.file
+    // let file = file.files[0] // 使用传统的input方法需要加上这一步
+    const types = file.name.split('.')[1]
+    const fileType = ['xlsx', 'xlc', 'xlm', 'xls', 'xlt', 'xlw', 'csv'].some(item => item === types)
+    if (!fileType) {
+      this.$message('格式错误!请重新选择')
+      return
+    }
+    this.file2Xce(file).then(tabJson => {
+      var billNums = '';
+      var invoiceCodes = '';
+      var invoiceNums = '';
+      if (tabJson && tabJson.length > 0) {
+        this.xlsxJson = tabJson
+        this.fileList = this.xlsxJson[0].sheet
+        this.fileList.forEach((item, index, arr) => {
+           if(item['运单编号']!=null && item['运单编号']!='' && typeof item['运单编号']!='undefined'){
+               billNums+= item['运单编号']+',';
+           }
+           if(item['发票号码']!=null && item['发票号码']!='' && typeof item['发票号码']!='undefined'){
+               invoiceNums+= item['发票号码']+',';
+           }
+            if(item['发票代码']!=null && item['发票代码']!='' && typeof item['发票代码']!='undefined'){
+               invoiceCodes+= item['发票代码']+',';
+           }
+        });
+      
+      }
+      if(billNums!=''){
+        this.formCondition.waybillNum =billNums.substring(0,billNums.length-1);
+        this.formCondition.invoiceCode =invoiceCodes.substring(0,invoiceCodes.length-1);
+        this.formCondition.invoiceNum =invoiceNums.substring(0,invoiceNums.length-1);
+      }
+     
+      
+    })
+  },
+  file2Xce (file) {
+    return new Promise(function (resolve, reject) {
+      const reader = new FileReader()
+      reader.onload = function (e) {
+        const data = e.target.result
+        this.wb = XLSX.read(data, {
+          type: 'binary'
+        })
+        const result = []
+        console.log((this.wb.Sheets.Sheet1)['!ref'])
+        var are = (this.wb.Sheets.Sheet1)['!ref'];
+        var areRe = are.replace('A1','A2');
+        (this.wb.Sheets.Sheet1)['!ref'] = areRe;
+        this.wb.SheetNames.forEach((sheetName) => {
+          result.push({
+            sheetName: sheetName,
+            sheet: XLSX.utils.sheet_to_json(this.wb.Sheets[sheetName])
+          })
+        })
+        resolve(result)
+      }
+      // reader.readAsBinaryString(file.raw)
+      reader.readAsBinaryString(file) // 传统input方法
+    })
+  },
            // 下载模板
           DownloadTemplate() {
             var url = hostUrl+"noCar/templateDownload?fileName=4"

+ 69 - 21
src/views/selfCar/invoice.vue

@@ -4,25 +4,13 @@
         <el-row>
           <el-col :span="24">
             <div class="top">
-              <div class="top" >
-               <span style="margin-top: 10px;margin-bottom: 10px;">导入文件:</span>
-
-              <el-upload
-                class="upload-demo"
-                ref="upload"
-                style="margin-bottom: 10px"
-                action="http://invoice.back.jkcredit.com/dishonestuser/upload"
-                :on-preview="handlePreview"
-                :on-remove="handleRemove"
-                :on-change="handleSuccess"
-                :auto-upload="false">
-                <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-                <el-button style="margin-left: 10px;" size="small" type="success" @click="batchUpload" v-loading.fullscreen.lock="fullscreenLoading">批量查询</el-button>
-                <el-button style="margin-left: 555px;" @click="DownloadTemplate">查询模板下载</el-button>
-
-              </el-upload>
+              <div class="demo-input-suffix" style="margin-left: 10px;">
+              <el-upload  :action="url" :http-request="importExcel" list-type="text" :show-file-list="false" >
+                         <el-button  type="primary">导入参数</el-button>
+                         <el-button style="margin-left: 555px;" @click="DownloadTemplate">查询模板下载</el-button>
+             </el-upload>
               </div>
-             <div class="demo-input-suffix">
+             <div class="demo-input-suffix" style="margin-top: 5px">
                 <el-input  placeholder="公司名称" class="input-demo" v-model="formCondition.companyName"></el-input>
                 <el-input  placeholder="etc卡号" class="input-demo" v-model="formCondition.cardId"></el-input>
                 <el-input  placeholder="税号" class="input-demo" v-model="formCondition.buyerTaxpayerCode"></el-input>
@@ -201,7 +189,8 @@ import XLSX from "xlsx";
         data(){
           return{
             formCondition:{
-
+              cardId:'',
+              tradeId:''
             },
             formUserList: {
             "file": ""
@@ -214,7 +203,7 @@ import XLSX from "xlsx";
           }
         },
         created() {
-          this.heightt = tableHeight-100;
+          this.heightt = tableHeight-50;
           this.loadData();
         },
         filters: {
@@ -242,7 +231,66 @@ import XLSX from "xlsx";
               this.total = response.data.data.total;
             }
           },
-
+importExcel (content) {
+    const file = content.file
+    // let file = file.files[0] // 使用传统的input方法需要加上这一步
+    const types = file.name.split('.')[1]
+    const fileType = ['xlsx', 'xlc', 'xlm', 'xls', 'xlt', 'xlw', 'csv'].some(item => item === types)
+    if (!fileType) {
+      this.$message('格式错误!请重新选择')
+      return
+    }
+    this.file2Xce(file).then(tabJson => {
+      var tradeIds = '';
+      var etcIds = '';
+      if (tabJson && tabJson.length > 0) {
+        this.xlsxJson = tabJson
+        this.fileList = this.xlsxJson[0].sheet
+        let n = '匹配的字段'
+        this.fileList.forEach((item, index, arr) => {
+           if(item['etc卡号']!=null && item['etc卡号']!='' && typeof item['etc卡号']!='undefined'){
+               etcIds+= item['etc卡号']+',';
+           }
+           if(item['交易id']!=null && item['交易id']!='' && typeof item['交易id']!='undefined'){
+               tradeIds+= item['交易id']+',';
+           } 
+        });
+      
+      }
+      if(etcIds!=''){
+        this.formCondition.cardId =etcIds.substring(0,etcIds.length-1);
+      }
+      if(tradeIds!=null){
+        this.formCondition.tradeId = tradeIds.substring(0,tradeIds.length-1) ;
+      }
+      
+    })
+  },
+  file2Xce (file) {
+    return new Promise(function (resolve, reject) {
+      const reader = new FileReader()
+      reader.onload = function (e) {
+        const data = e.target.result
+        this.wb = XLSX.read(data, {
+          type: 'binary'
+        })
+        const result = []
+        console.log((this.wb.Sheets.Sheet1)['!ref'])
+        var are = (this.wb.Sheets.Sheet1)['!ref'];
+        var areRe = are.replace('A1','A2');
+        (this.wb.Sheets.Sheet1)['!ref'] = areRe;
+        this.wb.SheetNames.forEach((sheetName) => {
+          result.push({
+            sheetName: sheetName,
+            sheet: XLSX.utils.sheet_to_json(this.wb.Sheets[sheetName])
+          })
+        })
+        resolve(result)
+      }
+      // reader.readAsBinaryString(file.raw)
+      reader.readAsBinaryString(file) // 传统input方法
+    })
+  },
              // 下载模板
           DownloadTemplate() {
             var url = hostUrl+"noCar/templateDownload?fileName=7"

+ 73 - 23
src/views/selfCar/selfCarTrade.vue

@@ -1,24 +1,13 @@
 <template>
-    <div class="billWay_container">
+    <div class="billWay_container"> 
       <div class="title">
         <el-row>
           <el-col :span="24">
             <div class="top">
-               <div class="top" >
-               <span style="margin-top: 10px;margin-bottom: 10px;">导入文件:</span>
-
-              <el-upload
-                class="upload-demo"
-                ref="upload"
-                style="margin-bottom: 10px"
-                action="http://invoice.back.jkcredit.com/dishonestuser/upload"
-                :on-preview="handlePreview"
-                :on-remove="handleRemove"
-                :on-change="handleSuccess"
-                :auto-upload="false">
-                <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-                <el-button style="margin-left: 10px;" size="small" type="success" @click="batchUpload" v-loading.fullscreen.lock="fullscreenLoading">批量查询</el-button>
-                <el-select style="margin-left: 30px;" v-model="formCondition.status" placeholder="交易状态">
+              <div class="demo-input-suffix" style="margin-left: 10px;">
+                  <el-upload  :action="url" :http-request="importExcel" list-type="text" :show-file-list="false" >
+                            <el-button  type="primary">导入参数</el-button>
+                             <el-select style="margin-left: 110px;" v-model="formCondition.status" placeholder="交易状态">
                       <el-option
                         v-for="item in tradeStatus"
                         :key="item.value"
@@ -26,13 +15,12 @@
                         :value="item.value">
                       </el-option>
                 </el-select>
-                <el-button style="margin-left: 230px;" @click="DownloadTemplate">查询模板下载</el-button>
-                  <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
-
-              </el-upload>
-              
+                <el-button style="margin-left: 10px;" @click="DownloadTemplate">查询模板下载</el-button>
+                  <el-button type="primary"  @click="exportExcel">导出报表</el-button>
+                </el-upload>
+               
               </div>
-               <div class="demo-input-suffix">
+               <div class="demo-input-suffix" style="margin-top: 5px;">
                <el-input  placeholder="公司名称" class="input-demo" v-model="formCondition.companyName"></el-input>
                 <el-input  placeholder="etc卡号" class="input-demo" v-model="formCondition.cardId"></el-input>
                 <el-input  placeholder="税号" class="input-demo" v-model="formCondition.companyReferencenum"></el-input>
@@ -143,6 +131,8 @@ import XLSX from "xlsx";
             multipleSelection:[],
             formCondition:{
                status:'',
+                cardId:'',
+              tradeId:''
             },
             formUserList: {
             "file": ""
@@ -156,7 +146,7 @@ import XLSX from "xlsx";
           }
         },
         created() {
-          this.heightt = tableHeight-100;
+          this.heightt = tableHeight-90;
           this.loadData();
         },
         filters: {
@@ -195,6 +185,66 @@ import XLSX from "xlsx";
               this.total = response.data.data.total;
             }
           },
+          importExcel (content) {
+    const file = content.file
+    // let file = file.files[0] // 使用传统的input方法需要加上这一步
+    const types = file.name.split('.')[1]
+    const fileType = ['xlsx', 'xlc', 'xlm', 'xls', 'xlt', 'xlw', 'csv'].some(item => item === types)
+    if (!fileType) {
+      this.$message('格式错误!请重新选择')
+      return
+    }
+    this.file2Xce(file).then(tabJson => {
+      var tradeIds = '';
+      var etcIds = '';
+      if (tabJson && tabJson.length > 0) {
+        this.xlsxJson = tabJson
+        this.fileList = this.xlsxJson[0].sheet
+        let n = '匹配的字段'
+        this.fileList.forEach((item, index, arr) => {
+           if(item['etc卡号']!=null && item['etc卡号']!='' && typeof item['etc卡号']!='undefined'){
+               etcIds+= item['etc卡号']+',';
+           }
+           if(item['交易id']!=null && item['交易id']!='' && typeof item['交易id']!='undefined'){
+               tradeIds+= item['交易id']+',';
+           } 
+        });
+      
+      }
+      if(etcIds!=''){
+        this.formCondition.cardId =etcIds.substring(0,etcIds.length-1);
+      }
+      if(tradeIds!=null){
+        this.formCondition.tradeId = tradeIds.substring(0,tradeIds.length-1)  ;
+      }
+      
+    })
+  },
+  file2Xce (file) {
+    return new Promise(function (resolve, reject) {
+      const reader = new FileReader()
+      reader.onload = function (e) {
+        const data = e.target.result
+        this.wb = XLSX.read(data, {
+          type: 'binary'
+        })
+        const result = []
+        console.log((this.wb.Sheets.Sheet1)['!ref'])
+        var are = (this.wb.Sheets.Sheet1)['!ref'];
+        var areRe = are.replace('A1','A2');
+        (this.wb.Sheets.Sheet1)['!ref'] = areRe;
+        this.wb.SheetNames.forEach((sheetName) => {
+          result.push({
+            sheetName: sheetName,
+            sheet: XLSX.utils.sheet_to_json(this.wb.Sheets[sheetName])
+          })
+        })
+        resolve(result)
+      }
+      // reader.readAsBinaryString(file.raw)
+      reader.readAsBinaryString(file) // 传统input方法
+    })
+  },
            handleSelectionChange(value){
                        this.multipleSelection = value;
                        console.log(this.multipleSelection);