소스 검색

修改bug

QuKatie 3 년 전
부모
커밋
1cc0a49b96
4개의 변경된 파일78개의 추가작업 그리고 17개의 파일을 삭제
  1. 1 0
      src/components/part-dialog/configuration/mainList.json
  2. 3 0
      src/components/price-Library/main.vue
  3. 24 0
      src/util/date.js
  4. 50 17
      src/views/wel/components/realtime-data.vue

+ 1 - 0
src/components/part-dialog/configuration/mainList.json

@@ -9,6 +9,7 @@
   "delBtn": false,
   "editBtn": false,
   "showSummary": true,
+  "refreshBtn":false,
   "column": [{
       "label": "类型",
       "prop": "goodTypeName",

+ 3 - 0
src/components/price-Library/main.vue

@@ -178,6 +178,9 @@ export default {
       this.getList(this.page, params);
       done();
     },
+    refreshChange(){
+      this.getList(this.page,this.search);
+    },
     getList(page, params) {
       let data = {
         ...params,

+ 24 - 0
src/util/date.js

@@ -72,6 +72,30 @@ export function defaultDate(type) {
     ];
   }
 }
+/**
+ * 获取当天
+ * [yyyy-MM-dd,yyyy-MM-dd]
+ */
+ export function defaultDate2() {
+  const date = new Date();
+  return [
+    dateFormat(date, "yyyy-MM-dd"),
+    dateFormat(date, "yyyy-MM-dd")
+  ];
+}
+/**
+ * 获取本月第一天和本月最后一天
+ * [yyyy-MM-dd,yyyy-MM-dd]
+ */
+export function defaultDate3() {
+  const date = new Date();
+  const startDate = new Date(date.getFullYear(), date.getMonth(), 1);
+  const endDate = new Date(date.getFullYear(), date.getMonth()+1, 0);
+  return [
+    dateFormat(startDate, "yyyy-MM-dd"),
+    dateFormat(endDate, "yyyy-MM-dd")
+  ];
+}
 // 获得当前日期
 export function getCurrentDate(type = 'dateTime') {
   const date = new Date();

+ 50 - 17
src/views/wel/components/realtime-data.vue

@@ -9,19 +9,36 @@
           <div class="right_but">
             <div
               class="right_but_left"
-              :class="{ right_but_active: isActive }"
+              :class="{ right_but_active: isActive == 1 }"
               @click="inDay"
             >
               本日
             </div>
             <div
               class="right_but_right"
-              :class="{ right_but_active: !isActive }"
+              :class="{ right_but_active: isActive == 2 }"
               @click="inMoon"
             >
               本月
             </div>
           </div>
+          <el-date-picker
+            v-model="realDate"
+            type="daterange"
+            size="mini"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            style="margin-right:10px;width:240px"
+          >
+          </el-date-picker>
+          <el-button
+            type="primary"
+            size="mini"
+            icon="el-icon-search"
+            style="margin-right:10px;"
+            @click="search"
+            circle
+          ></el-button>
           <i
             class="el-icon-refresh-right"
             style="cursor: pointer;font-size:20px;line-height: 15px;"
@@ -150,6 +167,7 @@
 </template>
 
 <script>
+import { defaultDate2, defaultDate3 } from "@/util/date";
 import { realTimeData, shipRealTimeData } from "@/api/wel";
 export default {
   name: "basicContainer",
@@ -158,8 +176,9 @@ export default {
   },
   data() {
     return {
-      isActive: true,
+      isActive: 1,
       loading: false,
+      realDate: [],
       data1: {},
       data2: {},
       tradeType: null
@@ -167,12 +186,17 @@ export default {
   },
   created() {
     this.getSysType();
+    this.realDate = defaultDate2();
   },
   mounted() {
-    this.init();
+    this.getrealTimeData();
+    this.getshipRealTimeData();
   },
   methods: {
     init() {
+      if (this.realDate == null) {
+        return this.$message.error("请选择日期");
+      }
       this.getrealTimeData();
       this.getshipRealTimeData();
     },
@@ -193,13 +217,17 @@ export default {
         this.tradeType = "GN";
       } else if (sysType == 1) {
         this.tradeType = "XX";
-      }else if(sysType == 999){
+      } else if (sysType == 999) {
         this.tradeType = "ADMIN";
       }
     },
     getrealTimeData() {
       this.loading = true;
-      realTimeData({ tradeType: this.tradeType })
+      realTimeData({
+        tradeType: this.tradeType,
+        orderStartDate: this.realDate[0],
+        orderEndDate: this.realDate[1]
+      })
         .then(res => {
           this.data1 = res.data.data;
         })
@@ -209,7 +237,11 @@ export default {
     },
     getshipRealTimeData() {
       this.loading = true;
-      shipRealTimeData({ tradeType: this.tradeType})
+      shipRealTimeData({
+        tradeType: this.tradeType,
+        orderStartDate: this.realDate[0],
+        orderEndDate: this.realDate[1]
+      })
         .then(res => {
           this.data2 = res.data.data;
         })
@@ -218,18 +250,18 @@ export default {
         });
     },
     inDay() {
-      this.isActive = true;
-      this.loading = true;
-      setTimeout(() => {
-        this.loading = false;
-      }, 1000);
+      this.isActive = 1;
+      this.realDate = defaultDate2();
+      this.init();
     },
     inMoon() {
-      this.isActive = false;
-      this.loading = true;
-      setTimeout(() => {
-        this.loading = false;
-      }, 1000);
+      this.isActive = 2;
+      this.realDate = defaultDate3();
+      this.init();
+    },
+    search() {
+      this.isActive = 3;
+      this.init();
     }
   }
 };
@@ -264,6 +296,7 @@ export default {
           width: 40px;
           text-align: center;
           color: #409eff;
+          border-right: 1px solid #409eff;
           cursor: pointer;
         }
         &_right {