MSY 3 years ago
parent
commit
0c4d01916a
1 changed files with 52 additions and 0 deletions
  1. 52 0
      src/views/noCar/billway.vue

+ 52 - 0
src/views/noCar/billway.vue

@@ -3,6 +3,21 @@
       <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"
+                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>
             <div class="top">
               <div class="demo-input-suffix">
                <el-input  placeholder="客户名称" class="input-demo" v-model="noCarWayBill.companyName"></el-input>
@@ -16,6 +31,7 @@
                  <el-date-picker v-model="noCarWayBill.startBegin"  type="date" placeholder="开始指令上传时间始"></el-date-picker> -->
                 <!-- <el-date-picker v-model="noCarWayBill.endBegin" type="date" placeholder="结束指令上传时间始"></el-date-picker>
                 <el-date-picker v-model="noCarWayBill.endEnd" type="date" placeholder="结束指令上传时间止"></el-date-picker> -->
+                <el-button style="margin-right: 1%;" @click="DownloadTemplate">查询模板下载</el-button>
                <el-button type="success" style="margin-left: 1%;" @click="loadData">查询</el-button>
                <el-button type="success" style="margin-left: 1%;" @click="updateStatus">更新状态</el-button>
                <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
@@ -149,6 +165,9 @@ import XLSX from "xlsx";
           return{
             noCarWayBill:{
             },
+             formUserList: {
+            "file": ""
+            },
              optionone: [{
               value: 0,
               label: '实时运单'
@@ -189,6 +208,22 @@ import XLSX from "xlsx";
               this.total = response.data.data.total;
             }
           },
+           // 下载模板
+          DownloadTemplate() {
+            var url = hostUrl+"noCar/templateDownload?fileName=5"
+            window.location.href= url;
+
+          },
+            handleRemove(file, fileList) {
+            console.log(file, fileList);
+          },
+
+          handlePreview(file) {
+            console.log(file);
+          },
+          handleSuccess (a) {
+            this.formUserList.file = a.raw;
+          },
          async updateStatus(){
             const response = await this.$http.post(`noCar/updateStatus`);
                   if(response.data.code === 0) {
@@ -215,6 +250,23 @@ import XLSX from "xlsx";
               this.loadData();
             // console.log(`当前页: ${val}`);
           },
+    // 批量上传模板信息
+    async batchUpload() {
+      this.fullscreenLoading = true;
+      const formData = new FormData();
+      formData.append('file', this.formUserList.file);
+      const response = await this.$http.post(`noCar/batchImportNocarBillWay`,formData);
+      var {data: { code, msg, data }} = response;
+      debugger
+      if(code === 0 && msg === '1') {
+         this.fullscreenLoading = false;
+         this.billWayTable = response.data.data;
+         this.total = response.data.data.length;
+      }else {
+        this.fullscreenLoading = false;
+        this.$message.error('数据存在错误,请检查文件中数据');
+      }
+    },
          async  exportExcel() {
               let curr = this.current;
               let pagesize1 = this.pagesize;