浏览代码

前端代码合并提交

Administrator 3 年之前
父节点
当前提交
8b1f590b02
共有 1 个文件被更改,包括 246 次插入0 次删除
  1. 246 0
      src/views/noCar/mothaccount.vue

+ 246 - 0
src/views/noCar/mothaccount.vue

@@ -0,0 +1,246 @@
+<template>
+    <div class="invoice_container">
+      <div class="title">
+        <el-row>
+          <el-col :span="24">
+            <div class="top">
+              <!-- <el-input  placeholder="客户" class="input-demo" v-model="formCondition.customerName"></el-input> -->
+              <el-input  placeholder="企业名称" class="input-demo" v-model="formCondition.companyName"></el-input>
+              <el-date-picker v-model="formCondition.tradeMonth" type="month" value-format="yyyy-MM" placeholder="选择月份"> </el-date-picker>
+               <el-button type="success" style="margin-left: 1%;" @click="loadData">查询</el-button>
+               <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
+            </div>
+          </el-col>
+        </el-row>
+      </div>
+      <!-- 表格部分 -->
+        <template>
+        <el-table
+        class="table"
+          v-loading="loading"
+          ref="multipleTable"
+          :data="invoiceTable"
+          :height="heightt"
+          border
+          tooltip-effect="dark">
+          <el-table-column
+            prop="companyName"
+            label="企业名称"
+            show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column
+            prop="waybillNum"
+            label="运单编号"
+            show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column
+            prop="tradeId"
+            label="交易id"
+            show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column
+            prop="enStation"
+            label="入口站名"
+            show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column
+            prop="exStation"
+            label="出口站名"
+            show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column
+            prop="exTime"
+            label="交易时间"
+            show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column
+            prop="fee"
+            label="交易金额"
+            show-overflow-tooltip>
+            <template slot-scope="scope">
+               <span>{{scope.row.fee/100| rounding}}</span>
+            </template>
+          </el-table-column>
+        </el-table>
+      </template>
+       <!-- 分页 -->
+      <div class="block">
+        <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="current"
+        :page-sizes="[1000]"
+        :page-size="pagesize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total">
+        </el-pagination>
+      </div>
+    </div>
+</template>
+<script type="text/javascript">
+import FileSaver from "file-saver";
+import XLSX from "xlsx";
+      export default {
+        data(){
+          return{
+             current: 1,
+             pagesize: 1000,
+             total:'',
+            formCondition:{
+            },
+           invoiceTable:[],
+            hightt:'0px',
+          }
+        },
+        created() {
+          this.heightt = tableHeight+100;
+        },
+        filters: {
+            rounding (value) {
+              return value.toFixed(2)
+            }
+        },
+        methods:{
+          // 列表展示
+          async loadData() {
+            this.formCondition['pageNo'] = this.current;
+            const response = await this.$http.post('noCarService/monthAccQuery', this.formCondition);
+            debugger;
+            if (response.data.code === 0) {
+              this.invoiceTable = response.data.data.result;
+              this.total = response.data.data.totalCount;
+            }else{
+              this.$message({
+                              type: 'error',
+                              message: ''+response.data.msg
+                          });
+            }
+          },
+          // 分页方法
+          handleSizeChange(val) {
+            this.pagesize = val;
+            this.loadData();
+            console.log(`每页 ${val} 条`);
+          },
+          handleCurrentChange(val) {
+            this.current = val;
+              this.loadData();
+            // console.log(`当前页: ${val}`);
+          },
+          formartNum(wb){
+            var sheet = wb['Sheets']['Sheet1'];
+            var replaceTemp = [];
+            debugger;
+            for(var i in sheet){
+              if(sheet[i]['v'] == '金额'){
+                replaceTemp.push(i.replace(/[0-9]/g,''));
+                continue;
+              }
+              if(replaceTemp.includes(i.replace(/[0-9]/g,''))){
+                sheet[i]['t']='n';
+              }
+            }
+          },
+       async     exportExcel() {
+       const loading = this.$loading({
+                             lock: true,
+                             text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
+                             spinner: 'el-icon-loading',
+                             background: 'rgba(0, 0, 0, 0.7)'
+                           });
+         let curr = this.current;
+      let pagesize1 = this.pagesize;
+      this.current = 1;
+      this.pagesize = this.total;
+      await this.loadData();
+      // 设置当前日期
+      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.current = curr;
+      this.pagesize = pagesize1;
+      this.loadData();
+      loading.close();
+      return wbout;
+    },
+        }
+      };
+</script>
+<style>
+.invoice_container {
+  border: 1px solid #d9d9d9;
+  border-radius: 10px;
+}
+.invoice_container .title {
+  font-size: 5px;
+  margin-bottom: 20px;
+}
+.invoice_container .top {
+  padding-top: 20px;
+  padding-left: 20px;
+}
+.invoice_container .text {
+  display: inline-block;
+  color: #000;
+  font-size: 16px ;
+  margin-left: 1%;
+}
+.invoice_container .input-demo {
+  display: inline-block;
+  width: 20%;
+  margin-left: 1%;
+}
+.invoice_container .block {
+  font-size: 5px;
+  text-align: center;
+  margin-top: 25px;
+  margin-bottom: 25px;
+}
+.invoice_container .el-dialog {
+  width: 60%;
+}
+.invoice_container .el-dialog__header, .el-dialog__body {
+  padding: 0 20px;
+}
+.invoice_container .tou {
+  font-size: 20px;
+  height: 30px;
+  line-height: 30px;
+  padding-top: 15px;
+}
+.invoice_container .line {
+  margin-top: 15px;
+  margin-bottom: 15px;
+  width: 100%;
+  height: 2px;
+  background-color: #d9d9d9;
+}
+.invoice_container .xinxi {
+  text-align: center;
+  margin: 15px auto;
+  font-size: 18px;
+}
+</style>