Browse Source

员工列表下拉加载更多

huangb 7 years ago
parent
commit
133afb5ed3
1 changed files with 32 additions and 16 deletions
  1. 32 16
      components/mobile/staffManagement/StaffList.vue

+ 32 - 16
components/mobile/staffManagement/StaffList.vue

@@ -31,7 +31,7 @@
           </div>
         </div>
         <div class="list-content">
-          <div class="bg" v-for="item in staffData">
+          <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>
@@ -71,8 +71,7 @@
         </div>
         <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'"></empty-status>
       </div>
-      <!--<seek-list :keyword="remindKeyword" :isSearch="isSearch" :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData"></seek-list>-->
-      <!--<pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>-->
+      <pull-up :fixId="'mobile-staff-center'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
       <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
     </div>
     <!--删除员工-->
@@ -99,6 +98,7 @@
         timeoutCount: 0,
         page: 1,
         count: 10,
+        staffDataList: [],
         auditSearch: '',
         switchType: 'info',
         showDelete: false,
@@ -112,26 +112,41 @@
       BaseFilter
     },
     watch: {
-      // 'buyerAccount': {
-      //   handler: function (val) {
-      //     if (val && val.content) {
-      //       if (this.isChange) {
-      //         this.accountList = []
-      //         this.isChange = false
-      //       }
-      //       this.accountList = [...this.accountList, ...val.content]
-      //     }
-      //   }
+      'staffData': {
+        handler: function (val) {
+          if (this.isChange) {
+            this.staffDataList = val.content
+            this.isChange = false
+          } else {
+            this.staffDataList = [...this.staffDataList, ...val.content]
+          }
+          console.log(this.staffDataList, '1213')
+        },
+        immediate: true
+      }
     },
     computed: {
       staffData () {
-        return this.$store.state.staff.infoList.info.data.content
+        return this.$store.state.staff.infoList.info.data
+      },
+      fetching () {
+        return this.staffData.fetching
+      },
+      allPage () {
+        return Math.floor(this.staffData.totalElements / this.staffData.size) + Math.floor(this.staffData.totalElements % this.staffData.size > 0 ? 1 : 0)
       },
       userInfo () {
         return this.$store.state.option.user.data
       }
     },
     methods: {
+      staffList () {
+        this.$store.dispatch('staff/loadStaffList', {count: this.count, page: this.page, enuu: this.userInfo.enterprise.uu})
+      },
+      onPullUpAction: function () {
+        this.page++
+        this.staffList()
+      },
       goEdit (item) {
         this.$store.commit('staff/infoList/EDIT_DATA_SUCCESS', item)
         this.$router.push('/mobile/user/staff/edit')
@@ -162,7 +177,7 @@
       sureDelete () {
         this.$http.delete('/basic/user/' + this.currentObject.userUU)
           .then(response => {
-            console.log(response)
+            // console.log(response)
             this.showDelete = false
             this.onRemind('用户' + this.currentObject.userUU + '删除成功')
             this.staffData()
@@ -262,7 +277,7 @@
         .staff-list {
           width: 100%;
           .list-item {
-            margin-bottom: .24rem;
+            margin-bottom: .14rem;
             &:last-child{
               padding-bottom: 0;
             }
@@ -280,6 +295,7 @@
             }
             span.role{
               display: inline-block;
+              margin-right: .1rem;
               padding: 0 .05rem;
               height: .25rem;
               line-height: .25rem;