Browse Source

员工列表下拉选加载更多

huangb 7 years ago
parent
commit
c65836c26e
1 changed files with 25 additions and 19 deletions
  1. 25 19
      components/mobile/staffManagement/StaffList.vue

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

@@ -44,13 +44,13 @@
             </div>
             </div>
           </div>
           </div>
           <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'" v-else></empty-status>
           <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'" v-else></empty-status>
-          <pull-up :fixId="'mobile-staff-center'" :isValid="isValid" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
+          <pull-up :fixId="'mobile-staff-center'" :isValid="activeTab == 0 && switchType === 'info'" :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>
           <nuxt-link class="staff-add" :to="'/mobile/user/staff/add'"><i class="iconfont icon-add"></i>新增用户</nuxt-link>
         </div>
         </div>
         <div class="staff-record" v-if="switchType === 'Audit'">
         <div class="staff-record" v-if="switchType === 'Audit'">
           <div class="search-content">
           <div class="search-content">
-            <input type="text" placeholder="人员姓名、电话号码、邮箱或UU" v-model="auditSearch" @keyup.13="auditRecord()">
-            <span @click="auditRecord()"><i class="iconfont icon-sousuo"></i></span>
+            <input type="text" placeholder="人员姓名、电话号码、邮箱或UU" v-model="auditSearch" @keyup.13="searchAudit()">
+            <span @click="searchAudit()"><i class="iconfont icon-sousuo"></i></span>
           </div>
           </div>
           <div class="list-content" v-if="AuditList && AuditList.length">
           <div class="list-content" v-if="AuditList && AuditList.length">
             <div class="bg" v-for="item in AuditList">
             <div class="bg" v-for="item in AuditList">
@@ -67,7 +67,7 @@
             </div>
             </div>
           </div>
           </div>
           <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'" v-else></empty-status>
           <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>
+          <pull-up :fixId="'mobile-staff-center'" :isValid="switchType === 'Audit'" :searchMore="fetch" :allPage="allPageAudit" :page="page" @pullUpAction="onPullUpAudit"></pull-up>
         </div>
         </div>
       </div>
       </div>
       <!--编辑角色-->
       <!--编辑角色-->
@@ -89,8 +89,6 @@
           <div class="agree handle" @click="sureEdit">确定</div>
           <div class="agree handle" @click="sureEdit">确定</div>
         </div>
         </div>
       </div>
       </div>
-      <pull-up :fixId="'mobile-staff-center'" :isValid="isValid" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
-      <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
     </div>
     </div>
     <!--删除员工弹框-->
     <!--删除员工弹框-->
     <div class="deleteKuang" v-if="showDelete">
     <div class="deleteKuang" v-if="showDelete">
@@ -130,7 +128,6 @@
         checked: false,
         checked: false,
         rolesList: [],
         rolesList: [],
         currentStaff: [],
         currentStaff: [],
-        isValid: true,
         role: '全部角色',
         role: '全部角色',
         showRole: false
         showRole: false
       }
       }
@@ -163,7 +160,9 @@
             this.staffDataList = []
             this.staffDataList = []
             this.isChange = false
             this.isChange = false
           }
           }
-          this.staffDataList = [...this.staffDataList, ...val.content]
+          if (val && val.content) {
+            this.staffDataList = [...this.staffDataList, ...val.content]
+          }
         },
         },
         immediate: true
         immediate: true
       },
       },
@@ -173,22 +172,25 @@
             this.AuditList = []
             this.AuditList = []
             this.hasChange = false
             this.hasChange = false
           }
           }
-          this.AuditList = [...this.AuditList, ...val.content]
-        }
+          if (val && val.content) {
+            this.AuditList = [...this.AuditList, ...val.content]
+          }
+        },
+        immediate: true
       }
       }
     },
     },
     computed: {
     computed: {
       staffData () {
       staffData () {
-        return this.$store.state.staff.infoList.info.data.content ? this.$store.state.staff.infoList.info.data : {content:[]}
+        return this.$store.state.staff.infoList.info.data
       },
       },
       fetching () {
       fetching () {
-        return this.staffData.fetching
+        return this.$store.state.staff.infoList.info.fetching
       },
       },
       allPage () {
       allPage () {
         return Math.floor(this.staffData.totalElements / this.staffData.size) + Math.floor(this.staffData.totalElements % this.staffData.size > 0 ? 1 : 0)
         return Math.floor(this.staffData.totalElements / this.staffData.size) + Math.floor(this.staffData.totalElements % this.staffData.size > 0 ? 1 : 0)
       },
       },
       auditBind () {
       auditBind () {
-        return this.$store.state.staff.infoList.audit.data.content ? this.$store.state.staff.infoList.audit.data : {content:[]}
+        return this.$store.state.staff.infoList.audit.data
       },
       },
       fetch () {
       fetch () {
         return this.$store.state.staff.infoList.audit.fetching
         return this.$store.state.staff.infoList.audit.fetching
@@ -211,8 +213,10 @@
         this.switchType = type
         this.switchType = type
         this.page = 1
         this.page = 1
         if ( type === 'info') {
         if ( type === 'info') {
+          this.isChange = true
           this.staffRecord()
           this.staffRecord()
         } else {
         } else {
+          this.hasChange = true
           this.auditRecord()
           this.auditRecord()
         }
         }
       },
       },
@@ -223,7 +227,6 @@
       onPullUpAction: function () {
       onPullUpAction: function () {
         this.page++
         this.page++
         this.staffList()
         this.staffList()
-        this.isValid = true
       },
       },
       // 员工列表搜索
       // 员工列表搜索
       staffRecord () {
       staffRecord () {
@@ -254,9 +257,9 @@
             this.isChange = true
             this.isChange = true
             this.staffList()
             this.staffList()
           }).catch(data => {
           }).catch(data => {
-          this.showDelete = false
-          this.onRemind(data.response.data)
-        })
+            this.showDelete = false
+            this.onRemind(data.response.data)
+          })
       },
       },
       // 打开选择
       // 打开选择
       showRoleEvent (e) {
       showRoleEvent (e) {
@@ -293,7 +296,6 @@
       },
       },
       // 获取角色
       // 获取角色
       getRoles () {
       getRoles () {
-        this.isValid = false
         this.$http.get('/account/role')
         this.$http.get('/account/role')
           .then(response => {
           .then(response => {
             if (response.data) {
             if (response.data) {
@@ -353,9 +355,13 @@
       },
       },
       // 申请绑定搜索
       // 申请绑定搜索
       auditRecord () {
       auditRecord () {
-        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})
         this.$store.dispatch('staff/loadBindAudit', {count: this.count, page: this.page, speaceUU: this.user.data.enterprise.uu, status: 311, keyword: this.auditSearch})
       },
       },
+      searchAudit () {
+        this.hasChange = true
+        this.page = 1
+        this.auditRecord()
+      },
       // 绑定下拉
       // 绑定下拉
       onPullUpAudit () {
       onPullUpAudit () {
         this.page++
         this.page++