Browse Source

添加类型仙子

wolyshaw 4 năm trước cách đây
mục cha
commit
2caecdcb5e
3 tập tin đã thay đổi với 48 bổ sung9 xóa
  1. 8 1
      src/store/modules/app.js
  2. 39 7
      src/views/main/abnormal/index.vue
  3. 1 1
      src/views/main/index.vue

+ 8 - 1
src/store/modules/app.js

@@ -12,6 +12,9 @@ const state = {
   status: {
     indexErrData: false,
     remindMatterData: false,
+    musicPatrol: false,
+    studentInfo: false,
+    teacherInfo: false,
   },
 }
 
@@ -36,7 +39,11 @@ const mutations = {
   },
   COMMIT_DOT_STATUS: (state, status) => {
     toggleDot(status)
-    state.status = status
+    const { musicPatrol, studentInfo, teacherInfo } = status
+    state.status = {
+      ...status,
+      remindMatterData: musicPatrol || studentInfo || teacherInfo
+    }
   }
 }
 

+ 39 - 7
src/views/main/abnormal/index.vue

@@ -18,15 +18,15 @@
     </save-form>
     <div class="tags">
       <el-badge
-        :hidden="item.num === 0"
+        :hidden="!keyNames[item].num"
         is-dot
-        v-for="(item, index) in tags"
+        v-for="(item, index) in permissionTags"
         :key="index"
       >
         <el-tag
-          :effect="activeKey === item.type ? 'dark' : 'plain'"
-          @click="changeTag(item.type)"
-        >{{item.name}}</el-tag>
+          :effect="activeKey === item ? 'dark' : 'plain'"
+          @click="changeTag(item)"
+        >{{keyNames[item].name}}</el-tag>
       </el-badge>
     </div>
     <empty desc="暂无需要处理异常" v-if="!activeList.length"/>
@@ -82,6 +82,7 @@
 import { getIndexError } from '@/views/main/api'
 import { createNotification } from '@/helpers/notification'
 import { errorType } from '@/views/main/constant'
+import { permission } from '@/utils/directivePage'
 import title from './title'
 const initSearch = {
   organId: null
@@ -96,17 +97,42 @@ export default {
         ...initSearch
       },
       listByType: {},
+      infoByType: {},
       list: [],
     }
   },
   computed: {
+    keyNames() {
+      const { status } = this.$store.state.app
+      return {
+        MUSIC_PATROL: {
+          name: '乐团巡查',
+          num: status.musicPatrol || false,
+        },
+        STUDENT_INFO: {
+          name: '学员处理',
+          num: status.studentInfo || false,
+        },
+        TEACHER_INFO: {
+          name: '日常行政',
+          num: status.teacherInfo || false,
+        },
+      }
+    },
+    permissionTags() {
+      const url = 'getIndexErrData?errorType='
+      const permissions = ['MUSIC_PATROL', 'STUDENT_INFO', 'TEACHER_INFO']
+      return permissions.filter(item => {
+        return this.permission(url + item)
+      })
+    },
     activeKey() {
       let key = ''
       const { tag } = this.$route.query
       if (tag) {
         key = tag
-      } else if (this.tags[0]) {
-        key = this.tags[0].type
+      } else if (this.permissionTags[0]) {
+        key = this.permissionTags[0]
       }
       return key
     },
@@ -124,6 +150,7 @@ export default {
     this.$store.dispatch('setBranchs')
   },
   methods: {
+    permission,
     changeTag(type) {
       this.$router.replace({
         query: {
@@ -131,6 +158,7 @@ export default {
           tag: type
         }
       })
+      this.FetchList()
     },
     formatData(data) {
       const list = {}
@@ -152,13 +180,17 @@ export default {
     async FetchList() {
       try {
         const res = await getIndexError({
+          errorType: this.activeKey,
           ...this.search,
         })
         this.list = res.data.data
         const data = {}
+        const info = {}
         for (const item of this.list) {
+          info[item.errorType] = item
           data[item.errorType] = this.formatData(item?.result || [])
         }
+        this.infoByType = info
         this.listByType = data
       } catch (error) {}
     },

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

@@ -8,7 +8,7 @@
         <el-tab-pane v-if="permission('newIndex')" lazy label="基本信息" name="baseinfo">
           <baseinfo v-if="activeKey === 'baseinfo'"/>
         </el-tab-pane>
-        <el-tab-pane v-if="permission('getIndexErrData')" lazy name="abnormal">
+        <el-tab-pane v-if="permission('/getIndexErrData')" lazy name="abnormal">
           <el-badge slot="label" class="badge" is-dot :hidden="!status.indexErrData">异常处理</el-badge>
           <abnormal v-if="activeKey === 'abnormal'"/>
         </el-tab-pane>