Browse Source

处理员工管理搜索功能BUG

wangcz 7 years ago
parent
commit
0fcfadf7db
2 changed files with 15 additions and 20 deletions
  1. 14 19
      components/mobile/staffManagement/StaffList.vue
  2. 1 1
      store/staff.js

+ 14 - 19
components/mobile/staffManagement/StaffList.vue

@@ -8,7 +8,7 @@
     <!--列表-->
     <div class="mobile-fix-content mobile-centerfix-content" id="mobile-staff-center">
       <!--列表-->
-      <div v-if="activeTab == 0">
+      <div v-if="activeTab === 0">
         <div class="staff-head">
           <span class="inline-block" :class="{'active': switchType === 'info'}" @click="setSwitchType('info')">员工信息</span>
           <span v-show="isAdmin" class="inline-block" :class="{'active': switchType === 'Audit'}" @click="setSwitchType('Audit')">审核绑定</span>
@@ -73,7 +73,7 @@
         </div>
       </div>
       <!--编辑角色-->
-      <div v-if="activeTab == 1">
+      <div v-if="activeTab === 1">
         <div v-for="(role, index) in rolesList">
           <div class="staff-role">
             <div class="staff-header"><span :class="'active_0' + role.color"><b></b>{{role.desc}}</span></div>
@@ -173,31 +173,23 @@
       'staffData': {
         handler: function (val) {
           if (this.isChange) {
-            this.staffDataList = val.content
+            this.staffDataList = []
             this.isChange = false
-          } else {
-            this.staffDataList = [...this.staffDataList, ...val.content]
           }
+          this.staffDataList = [...this.staffDataList, ...val.content]
         },
         immediate: true
       },
       'auditBind': {
         handler: function (val) {
           if (this.hasChange) {
-            this.AuditList = val.content
+            this.AuditList = []
             this.hasChange = false
-          } else {
-            this.AuditList = [...this.AuditList, ...val.content]
           }
+          this.AuditList = [...this.AuditList, ...val.content]
         }
       }
     },
-    mounted () {
-      // 获取角色
-      this.$nextTick(() => {
-        this.getRoles()
-      })
-    },
     computed: {
       staffData () {
         return this.$store.state.staff.infoList.info.data
@@ -227,6 +219,8 @@
         this.timeoutCount++
       },
       setSwitchType (type) {
+        this.staffSearch = ''
+        this.auditSearch = ''
         this.switchType = type
         this.page = 1
         if ( type === 'info') {
@@ -248,6 +242,7 @@
       staffRecord () {
         this.role = '全部角色'
         this.showRole = false
+        this.isChange = true
         this.$store.dispatch('staff/loadStaffList', {count: this.count, page: this.page, enuu: this.user.data.enterprise.uu, keyword: this.staffSearch})
       },
       // 员工列表删除员工
@@ -290,7 +285,8 @@
             keyword: this.staffSearch,
             roleId: type.id
           }
-          this.$store.commit('infoList/REQUEST_INFO_LIST')
+          this.isChange = true
+          this.$store.commit('staff/infoList/REQUEST_INFO_LIST')
           this.$http.get('/basic/user/enterprise/keywordinfo', {params})
             .then(response => {
               this.$store.commit('staff/infoList/GET_INFO_LIST_SUCCESS', response.data ? response.data : {})
@@ -298,7 +294,6 @@
               this.$store.commit('staff/infoList/GET_INFO_LIST_FAILURE', err)
             })
         } else {
-          this.role = '全部角色'
           this.staffRecord()
         }
       },
@@ -353,10 +348,10 @@
       },
       // 申请绑定搜索
       auditRecord () {
-        console.log(this.user.data.enterprise.uu)
+        this.hasChange = true
         this.$store.dispatch('staff/loadBindAudit', {count: this.count, page: this.page, speaceUU: this.user.data.enterprise.uu, status: 311, keyword: this.auditSearch})
       },
-      // 申请绑定下拉更多
+      // 绑定下拉
       onPullUpAudit () {
         this.page++
         this.auditRecord()
@@ -364,7 +359,7 @@
       // 申请绑定操作事件 (同意和拒绝)
       agreeEvent (type, flag) {
         this.$http.get(`/basic/enterprise/auditApply?id=${type.id}&status=${Number(flag)}&userUU=${type.userUU}`)
-        this.auditSearch = null
+        this.auditSearch = ''
         this.page = 1
         this.auditRecord()
       }

+ 1 - 1
store/staff.js

@@ -16,7 +16,7 @@ export const actions = {
     commit('infoList/REQUEST_BIND_AUDIT')
     return axios.get(`/api/userspace/apply/info/mall`, {params})
       .then(res => {
-        commit('infoList/GET_BIND_AUDIT_SUCCESS', res.data.content)
+        commit('infoList/GET_BIND_AUDIT_SUCCESS', res.data.content || {})
       }, err => {
         commit('infoList/GET_BIND_AUDIT_FAILURE', err)
       })