Explorar el Código

02/14 修改搜索优化

1
Xiao_Mo hace 4 años
padre
commit
0fdb4c7515

+ 17 - 23
src/views/businessManager/orderManager/backMoney.vue

@@ -9,6 +9,7 @@
       <save-form
         :inline="true"
         class="searchForm"
+        ref='searchForm'
         :model="searchForm"
         @submit="search"
         @reset="onReSet"
@@ -29,13 +30,12 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="orderDate">
           <el-date-picker
             style="width: 410px"
             v-model.trim="searchForm.orderDate"
             type="daterange"
             value-format="yyyy-MM-dd"
-            @change="searchOrderDate"
             range-separator="至"
             start-placeholder="申请开始日期"
             end-placeholder="申请结束日期"
@@ -239,7 +239,14 @@ export default {
     // })
     this.$store.dispatch("setBranchs");
     if (this.searchForm?.orderDate?.length < 1) {
-      var now = new Date();
+     this.getNow()
+    }
+
+    this.getList();
+  },
+  methods: {
+    getNow(){
+       var now = new Date();
       var startDate = new Date(
         Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
       )
@@ -253,11 +260,7 @@ export default {
       this.searchForm.orderDate = [];
       this.searchForm.orderDate.push(startDate);
       this.searchForm.orderDate.push(endDate);
-    }
-
-    this.getList();
-  },
-  methods: {
+    },
     search() {
       this.pageInfo.page = 1;
       this.getList();
@@ -289,16 +292,7 @@ export default {
         rows: this.pageInfo.limit,
         ...getTimes(orderDate, ["startTime", "endTime"]),
       };
-      // let params = this.searchForm;
-      // params.rows = this.pageInfo.limit;
-      // params.page = this.pageInfo.page;
-      // if (this.orderDate?.length > 0) {
-      //   params.startTime = this.orderDate[0];
-      //   params.endTime = this.orderDate[1];
-      // } else {
-      //   params.startTime = null;
-      //   params.endTime = null;
-      // }
+      console.log(params)
       studentRefundsQueryPage(params).then((res) => {
         let result = res.data;
         if (res.code == 200) {
@@ -308,6 +302,7 @@ export default {
       });
     },
     searchOrderDate(value) {
+      console.log(value)
       if (value) {
         this.searchForm.startTime = value[0] + " 00:00:00";
         this.searchForm.endTime = value[1] + " 23:59:59";
@@ -317,11 +312,10 @@ export default {
       }
     },
     onReSet() {
-      this.orderDate = null;
-      this.searchForm = {
-        startTime: null,
-        endTime: null,
-      };
+      this.$refs["searchForm"].resetFields();
+      // console.log(this.searchForm)
+      // this.getNow()
+      this.search()
     },
     onFormClose(formName) {
       // 关闭弹窗重置验证

+ 21 - 26
src/views/recodeManager/recodeList.vue

@@ -13,7 +13,7 @@
         ref="searchForm"
         :model="searchForm"
       >
-        <el-form-item>
+        <el-form-item prop="search">
           <el-input
             v-model.trim="searchForm.search"
             clearable
@@ -37,7 +37,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="courseScheduleType">
           <el-select
             v-model.trim="searchForm.courseScheduleType"
             clearable
@@ -51,7 +51,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="jobNature">
           <el-select
             v-model.trim="searchForm.jobNature"
             filterable
@@ -66,7 +66,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="signInStatus">
           <el-select
             v-model.trim="searchForm.signInStatus"
             clearable
@@ -77,7 +77,7 @@
             <el-option :value="3" label="未签到"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="signOutStatus">
           <el-select
             v-model.trim="searchForm.signOutStatus"
             clearable
@@ -88,9 +88,9 @@
             <el-option :value="3" label="未签退"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="courseTime">
           <el-date-picker
-            v-model.trim="courseTime"
+            v-model.trim="searchForm.courseTime"
             style="width: 410px"
             type="daterange"
             value-format="yyyy-MM-dd"
@@ -304,6 +304,7 @@ import { jobNature, courseType } from "@/utils/searchArray";
 import { repealComplaints } from './api'
 import appeal from './modals/appeal'
 import hand from './modals/hand'
+import {  getTimes } from "@/utils";
 let nowTime = new Date();
 nowTime =
   nowTime.getFullYear() +
@@ -321,12 +322,13 @@ export default {
         signInStatus: null,
         signOutStatus: null,
         jobNature: null,
+         courseTime: [],
       },
       detail: null,
       appealVisible: false,
       handVisible: false,
       jobNature: jobNature, // 工作类型
-      courseTime: [],
+     
       courseType,
       // teacherList: [],
       tableList: [],
@@ -344,7 +346,7 @@ export default {
     isEmptyQuery() {
       return !Object.keys(cleanDeep({
         ...this.searchForm,
-        courseTime: this.courseTime,
+        // courseTime: this.courseTime,
       })).length && !this.teacherAttendanceId
     },
     teacherAttendanceId() {
@@ -353,8 +355,9 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    if(this.courseTime.length >0)
-     this.courseTime = [nowTime, nowTime]
+
+    if(this.searchForm.courseTime.length <=0)
+     this.searchForm.courseTime = [nowTime, nowTime]
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
@@ -375,7 +378,7 @@ export default {
       this.searchForm.organId = query.organId
     }
     if (query.start || query.end) {
-      this.courseTime = [query.start, query.end]
+      this.searchForm.courseTime = [query.start, query.end]
     } else {
      
     }
@@ -386,18 +389,15 @@ export default {
       this.getList();
     },
     getSearchValues() {
+         const { courseTime, ...rest } = this.searchForm;
       let obj = {
+        ...rest,
         page: this.rules.page,
         rows: this.rules.limit,
         attendanceStatus: this.$route.query.attendanceStatus,
         visitFlag: this.$route.query.visitFlag,
+        ...getTimes(courseTime,['courseStartDate','courseEndDate'])
       };
-      Object.assign(obj, this.searchForm);
-      if (this.courseTime && this.courseTime.length > 0) {
-        obj.courseStartDate = this.courseTime[0];
-        obj.courseEndDate = this.courseTime[1];
-      }
-
       return obj
     },
     reloadSearch() {
@@ -424,15 +424,10 @@ export default {
       this.getList();
     },
     onReSet() {
-      this.searchForm = {
-        search: null,
-        organIdList: null,
-        signInStatus: null,
-        signOutStatus: null,
-        jobNature: null,
-      };
-      this.courseTime = [nowTime, nowTime];
+
+     
       this.$refs["searchForm"].resetFields();
+       this.searchForm.courseTime = [nowTime, nowTime];
       this.search();
     },
     hand(row) {