Browse Source

处理员工管理搜索功能

wangcz 7 years ago
parent
commit
9e81c61478
2 changed files with 43 additions and 30 deletions
  1. 41 28
      components/mobile/staffManagement/StaffList.vue
  2. 2 2
      pages/mobile/user/staff/index.vue

+ 41 - 28
components/mobile/staffManagement/StaffList.vue

@@ -24,8 +24,8 @@
             </ul>
           </div>
         </div>
-        <div class="list-content" v-if="staffData && staffData.length">
-          <div class="bg" v-for="item in staffData">
+        <div class="list-content" v-if="staffDataList && staffDataList.length">
+          <div class="bg" v-for="item in staffDataList">
             <div class="staff-list">
               <div class="list-item"><span>UU账号:</span><span v-text="item.userUU">100000721</span></div>
               <div class="list-item"><span>姓名:</span><span v-text="item.userName">张洪别</span></div>
@@ -41,6 +41,7 @@
           </div>
         </div>
         <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'" v-else></empty-status>
+        <pull-up :fixId="'mobile-staff-center'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
         <nuxt-link class="staff-add" :to="'/mobile/user/staff/add'"><i class="iconfont icon-add"></i>新增用户</nuxt-link>
       </div>
       <div class="staff-record" v-if="switchType === 'Audit'">
@@ -48,7 +49,7 @@
           <input type="text" placeholder="人员姓名、电话号码、邮箱或UU" v-model="auditSearch" @keyup.13="auditRecord()">
           <span @click="auditRecord()"><i class="iconfont icon-sousuo"></i></span>
         </div>
-        <div class="list-content" id="auditFixContent" v-if="AuditList && AuditList.length">
+        <div class="list-content" v-if="AuditList && AuditList.length">
           <div class="bg" v-for="item in AuditList">
             <div class="staff-list">
               <div class="list-item"><span>用户名:</span><span v-text="item.user.vipName"></span></div>
@@ -63,8 +64,8 @@
           </div>
         </div>
         <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'" v-else></empty-status>
+        <pull-up :fixId="'mobile-staff-center'" :searchMore="fetch" :allPage="allPageAudit" :page="page" @pullUpAction="onPullUpAudit"></pull-up>
       </div>
-      <pull-up :fixId="'auditFixContent'" :searchMore="fetch" :allPage="allPageAudit" :page="page" @pullUpAction="onPullUpAudit"></pull-up>
     </div>
     <!--删除员工-->
     <div class="deleteKuang" v-if="showDelete">
@@ -96,6 +97,7 @@
         auditSearch: '',
         AuditList: [],
         isChange: false,
+        hasChange: false,
         switchType: 'info',
         showDelete: false,
         currentObject: '',
@@ -110,8 +112,10 @@
       EmptyStatus,
       BaseFilter
     },
-    mounted () {
+    created () {
       this.auditRecord()
+    },
+    mounted () {
       // 获取角色
       this.$nextTick(() => {
         this.getRoles()
@@ -135,15 +139,14 @@
           } else {
             this.staffDataList = [...this.staffDataList, ...val.content]
           }
-          console.log(this.staffDataList, '1213')
         },
         immediate: true
       },
       'auditBind': {
         handler: function (val) {
-          if (this.isChange) {
+          if (this.hasChange) {
             this.AuditList = val.content
-            this.isChange = false
+            this.hasChange = false
           } else {
             this.AuditList = [...this.AuditList, ...val.content]
           }
@@ -156,13 +159,14 @@
         return this.$store.state.staff.infoList.info.data
       },
       fetching () {
-        return this.staffData.fetching
+        return this.$store.state.staff.infoList.info.fetching
       },
       allPage () {
         return Math.floor(this.staffData.totalElements / this.staffData.size) + Math.floor(this.staffData.totalElements % this.staffData.size > 0 ? 1 : 0)
       },
       auditBind () {
-        return this.$store.state.staff.infoList.audit.data.content ? this.$store.state.staff.infoList.audit.data.content : {}
+        console.log(this.$store.state.staff.infoList.audit.data, '213')
+        return this.$store.state.staff.infoList.audit.data ? this.$store.state.staff.infoList.audit.data.content : {content: []}
       },
       fetch () {
         return this.$store.state.staff.infoList.audit.fetching
@@ -179,6 +183,15 @@
         this.remindText = str
         this.timeoutCount++
       },
+      setSwitchType (type) {
+        this.switchType = type
+        this.page = 1
+        if ( type === 'info') {
+          this.staffRecord()
+        } else {
+          this.auditRecord()
+        }
+      },
       // 获取角色信息
       getRoles () {
         this.$http.get('/account/role')
@@ -202,20 +215,11 @@
         this.$store.commit('staff/infoList/EDIT_DATA_SUCCESS', item)
         this.$router.push('/mobile/user/staff/edit')
       },
-      setSwitchType (type) {
-        this.switchType = type
-      },
       // 删除员工
       openDelete (item) {
         this.currentObject = item
         this.showDelete = true
       },
-      agreeEvent (type, flag) {
-        this.$http.get(`/basic/enterprise/auditApply?id=${type.id}&status=${Number(flag)}&userUU=${type.userUU}`)
-        this.auditSearch = null
-        this.page = 1
-        this.auditRecord()
-      },
       // 员工搜索
       staffRecord () {
         this.role = '全部角色'
@@ -254,18 +258,10 @@
           this.staffRecord()
         }
       },
-      // 申请绑定搜索
-      auditRecord () {
-        this.isChange = 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()
-      },
       sureDelete () {
         this.$http.delete('/basic/user/' + this.currentObject.userUU)
           .then(response => {
+            console.log(response.data)
             this.showDelete = false
             this.onRemind('用户' + this.currentObject.userUU + '删除成功')
             this.staffData()
@@ -273,6 +269,22 @@
           this.showDelete = false
           this.onRemind(data.response.data)
         })
+      },
+      // 申请绑定搜索
+      auditRecord () {
+        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()
+      },
+      // 申请绑定操作事件 (同意和拒绝)
+      agreeEvent (type, flag) {
+        this.$http.get(`/basic/enterprise/auditApply?id=${type.id}&status=${Number(flag)}&userUU=${type.userUU}`)
+        this.auditSearch = null
+        this.page = 1
+        this.auditRecord()
       }
     }
   }
@@ -356,6 +368,7 @@
       .list-content{
         margin: 0 auto;
         padding: 0 .20rem;
+        margin-bottom:1.2rem;
         div.bg{
           padding: .32rem .24rem 0 .24rem;
           margin-bottom: .25rem;

+ 2 - 2
pages/mobile/user/staff/index.vue

@@ -13,8 +13,8 @@
     },
     fetch ({ store }) {
       return Promise.all([
-        store.dispatch('staff/loadStaffList', {count: 10, page: 1, enuu: store.state.option.user.data.enterprise.uu}),
-        store.dispatch('staff/loadBindAudit', {count: 10, page: 1, speaceUU: store.state.option.user.data.enterprise.uu, status: 311})
+        store.dispatch('staff/loadBindAudit', {count: 10, page: 1, speaceUU: store.state.option.user.data.enterprise.uu, status: 311}),
+        store.dispatch('staff/loadStaffList', {count: 10, page: 1, enuu: store.state.option.user.data.enterprise.uu})
       ])
     }
   }