Rorschach 5 years ago
parent
commit
ac77069243
1 changed files with 5 additions and 6 deletions
  1. 5 6
      src/pages/manage/query.vue

+ 5 - 6
src/pages/manage/query.vue

@@ -184,7 +184,7 @@
     <!-- 查询结果收入表 -->
     <div class="inline-btn">
       <div class="totalSumDiv">全部金额合计:{{totalSum}}</div>
-      <div class="downloadBtn">
+      <div class="downloadBtn" v-if="searchResult.length !== 0">
         <el-button type="primary" @click="onDownload">下载本表</el-button>
       </div>
     </div>
@@ -387,12 +387,13 @@ export default {
     },
     // 下载表格
     onDownload() {
-      this.form.startTime = this.form.startTime ? this.form.startTime.toJSON() : '';
-      this.form.endTime = this.form.endTime ? this.form.endTime.toJSON() : '';
+      console.log(this.form.startTime)
+      console.log(typeof this.form.startTime)
+      this.form.startTime = typeof this.form.startTime === 'object' ? this.form.startTime.toJSON() : this.form.startTime;
+      this.form.endTime = typeof this.form.endTime === 'object' ? this.form.endTime.toJSON() : this.form.endTime;
       console.log(this.form.startTime);
       let url = "http://whiteboardtest.ai160.com/manageBase/manage/export?";
       for (let key in this.form) {
-        console.log(key);
         let str = key + "=" + this.form[key] + "&";
         url += str;
       }
@@ -415,7 +416,6 @@ export default {
           //   break;
           case "amount":
             const amountNum = data.map(item => Number(item["amount"]));
-            console.log(amountNum);
             let amountTemp = amountNum.reduce((prev, cur) => {
               // const sum = prev.toFixed(2) + cur.toFixed(2);
               return (parseFloat(prev) + parseFloat(cur)).toFixed(2);
@@ -469,7 +469,6 @@ export default {
     },
     onSubmit() {
       // this.totalNumber = 0;
-      console.log(this.form.startTime);
       this.searchResult = [];
       if (this.form.type === "INCOME") {
         this.tableType = "INCOME";