Browse Source

添加条件

wolyshaw 4 năm trước cách đây
mục cha
commit
193961598b

+ 30 - 3
src/components/filter-search/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="filter-search" v-if="$route.query[this.searchKey]">
+  <div class="filter-search" v-if="show">
     <img src="./icon.svg"/>
     <span>{{desced}}</span>
     <i class="el-icon-circle-close" @click="close"/>
@@ -7,6 +7,7 @@
 </template>
 <script>
 import { errorType } from '@/views/main/constant'
+import cleanDeep from 'clean-deep'
 export default {
   name: 'filter-search',
   props: {
@@ -17,21 +18,47 @@ export default {
     searchKey: {
       type: String,
       default: 'search'
-    }
+    },
+    keys: {
+      type: Array,
+      default: () => []
+    },
+    moreKeys: {
+      type: Array,
+      default: () => []
+    },
   },
   computed: {
     desced() {
       const { name } = errorType[this.$route.query.filter_type] || {}
       return name ? `仅显示: ${name}` : this.desc
-    }
+    },
+    hasSearch() {
+      return this.$route.query[this.searchKey]
+    },
+    hasForm() {
+      const keys = {}
+      for (const item of this.keys) {
+        keys[item] = this.$route.query[item]
+      }
+      return !!Object.keys(cleanDeep(keys)).length
+    },
+    show() {
+      return this.hasSearch || this.hasForm
+    },
   },
   methods: {
     close() {
+      const keys = {}
+      for (const item of [...this.keys, ...this.moreKeys]) {
+        keys[item] = undefined
+      }
       this.$router.replace({
         query: {
           ...this.$route.query,
           [this.searchKey]: undefined,
           filter_type: undefined,
+          ...keys
         }
       })
       this.$emit('reload')

+ 1 - 1
src/views/main/abnormal/index.vue

@@ -43,7 +43,7 @@
       v-else
       v-for="(item, index) in activeList"
       :key="index"
-      :disabled="item[0].result && !item[0].result.length && !item[0].always" type="text"
+      :disabled="(item[0].result && !item[0].result.length) || (!item[0].always && !item[0].num)" type="text"
     >
       <title-item
         :type="item[0].isError ? 'error' : 'warning'"

+ 36 - 13
src/views/main/constant.js

@@ -33,8 +33,12 @@ export const errorType = {
   MUSIC_PATROL_ITEM: {
     name: '乐团巡查事项异常',
     isError: false,
-    url: '/business/musicInspection',
-    resultKey: 'ids',
+    url: '/main/main',
+    always: true,
+    query: {
+      tabrouter: 'teamSchedule',
+      searchType: 'MUSIC_PATROL_ITEM',
+    },
   },
   HIGH_CLASS_STUDENT_LESS_THAN_THREE: {
     name: '基础技能班学员数量异常',
@@ -61,7 +65,7 @@ export const errorType = {
     resultKey: 'search',
   },
   COURSE_TRUANT_STUDENT_NUM: {
-    name: '学员考异常旷课',
+    name: '学员考异常旷课',
     isError: true,
     url: '/operateManager/stuRecodeManager',
     always: true,
@@ -87,14 +91,26 @@ export const errorType = {
   TEACHER_EXCEPTION_ATTENDANCE: {
     name: '老师考勤异常',
     isError: true,
+    always: true,
     url: '/operateManager/recodeList',
-    resultKey: 'teacherAttendanceId',
+    query: {
+      attendanceStatus: 'ERR_ATTENDANCE',
+      visitFlag: 0,
+      start: '2020-12-01',
+      end: dayjs().format('YYYY-MM-DD'),
+    },
   },
   TEACHER_NOT_A_CLASS: {
-    name: '未签到签退',
+    name: '老师未签到签退',
     isError: true,
+    always: true,
     url: '/operateManager/recodeList',
-    resultKey: 'teacherAttendanceId',
+    query: {
+      attendanceStatus: 'NO_ATTENDANCE',
+      visitFlag: 0,
+      start: '2020-12-01',
+      end: dayjs().format('YYYY-MM-DD'),
+    },
   },
   TEACHER_LEAVE: {
     name: '老师请假',
@@ -117,26 +133,33 @@ export const errorType = {
   INSPECTION_ITEM: {
     name: '乐团巡查任务未计划',
     isError: true,
+    always: true,
     url: '/main/main',
     resultKey: 'ids',
     query: {
-      tabrouter: 'teamSchedule'
-    }
+      tabrouter: 'teamSchedule',
+      searchType: 'INSPECTION_ITEM',
+    },
   },
   INSPECTION_ITEM_PLAN: {
     name: '乐团巡查任务未提交',
     isError: true,
-    url: '/business/musicInspection',
-    resultKey: 'ids',
+    url: '/main/main',
+    always: true,
+    query: {
+      tabrouter: 'teamSchedule',
+      searchType: 'INSPECTION_ITEM_PLAN',
+    },
   },
   STUDENT_VISIT: {
     name: '回访任务未完成',
     isError: true,
     url: '/main/main',
-    resultKey: 'ids',
+    always: true,
     query: {
-      tabrouter: 'teamSchedule'
-    }
+      tabrouter: 'teamSchedule',
+      searchType: 'STUDENT_VISIT',
+    },
   },
 }
 

+ 4 - 2
src/views/main/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="m-container">
     <h2>
-      <div class="squrt"></div>控制台 <filter-search v-if="$route.query.tabrouter === 'teamSchedule'" searchKey="ids" @reload="reloadItem"/>
+      <div class="squrt"></div>控制台 <filter-search v-if="$route.query.tabrouter === 'teamSchedule'" :keys="['searchType']" @reload="reloadItem"/>
     </h2>
     <div class="m-core">
       <tab-router @change="changeKey">
@@ -89,7 +89,9 @@ export default {
       })
     },
     reloadItem() {
-      this.$refs.teamSchedule.getList()
+      if (this.$refs.teamSchedule) {
+        this.$refs.teamSchedule.getList()
+      }
     }
   }
 }

+ 8 - 4
src/views/recodeManager/recodeList.vue

@@ -3,7 +3,7 @@
   <div class="m-container">
     <h2>
       <div class="squrt"></div>
-      老师考勤列表 <filter-search @reload="reloadSearch" searchKey="teacherAttendanceId"/>
+      老师考勤列表 <filter-search @reload="reloadSearch" :keys="['attendanceStatus', 'visitFlag']" :moreKeys="['start', 'end']"/>
     </h2>
     <div class="m-core">
       <save-form
@@ -349,7 +349,7 @@ export default {
     },
     teacherAttendanceId() {
       return this.$route.query.teacherAttendanceId
-    }
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
@@ -366,8 +366,11 @@ export default {
     //     this.organList = res.data;
     //   }
     // });
+    const { query } = this.$route
     this.$store.dispatch("setBranchs");
-    if (!this.teacherAttendanceId) {
+    if (query.start || query.end) {
+      this.courseTime = [query.start, query.end]
+    } else {
       this.courseTime = [nowTime, nowTime]
     }
     this.init();
@@ -383,7 +386,8 @@ export default {
       let obj = {
         page: this.rules.page,
         rows: this.rules.limit,
-        teacherAttendanceId: this.teacherAttendanceId,
+        attendanceStatus: this.$route.query.attendanceStatus,
+        visitFlag: this.$route.query.visitFlag,
       };
       Object.assign(obj, this.searchForm);
       if (this.courseTime && this.courseTime.length > 0) {

+ 0 - 5
src/views/teamDetail/components/studentList.vue

@@ -247,11 +247,6 @@
             <div>{{ scope.row.paymentStatus | studentPays }}</div>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="是否欠费">
-          <template slot-scope="scope">
-            <div>{{ scope.row.oweFlag | yesOrNo }}</div>
-          </template>
-        </el-table-column>
         <el-table-column align="center" label="是否激活">
           <template slot-scope="scope">
             <div>{{ scope.row.isActive ? "是" : "否" }}</div>