Browse Source

perf: 成员列表操作后出现的页码错误问题

wangcz 7 years ago
parent
commit
54d3423710
1 changed files with 19 additions and 7 deletions
  1. 19 7
      pages/cloudcenter/enterprise/index.vue

+ 19 - 7
pages/cloudcenter/enterprise/index.vue

@@ -7,7 +7,7 @@
           <div class="table-list">
             <div class="table-top">
               <h3>成员列表</h3>
-              <a class="btn-us-apply" @click="user.userspace.admin.userUU === user.user.userUU ? toggle = !toggle : isToggleDialogVisible = true">申请列表</a>
+              <a class="btn-us-apply" @click="toggleClick(true)">申请列表</a>
             </div>
             <table class="table table-striped" v-if="member.content.length !== 0">
               <thead>
@@ -42,7 +42,7 @@
           <div class="table-list">
             <div class="table-top">
               <h3>申请列表</h3>
-              <a class="btn-us-member" @click="toggle = !toggle">成员列表</a>
+              <a class="btn-us-member" @click="toggleClick(false)">成员列表</a>
             </div>
             <table class="table table-striped" v-if="apple.content.length !== 0">
               <thead>
@@ -77,7 +77,7 @@
             </table>
             <div style="text-align: center; color:#333;height:100px;line-height: 100px;" v-if="apple.content.length === 0">现在没有需要处理的加入申请!</div>
             <page :total="apple.totalElements" :page-size="count"
-                  :current="applyPage" @childEvent="handleApplyChange">
+                  :current="page" @childEvent="handleApplyChange">
             </page>
           </div>
         </div>
@@ -128,7 +128,6 @@
         isToggleDialogVisible: false,
         toggle: true,
         page: 1,
-        applyPage: 1,
         count: 20
       }
     },
@@ -147,6 +146,19 @@
       }
     },
     methods: {
+      toggleClick (type) {
+        if(type) {
+          if(this.user.userspace.admin.userUU === this.user.user.userUU) {
+            this.toggle = !this.toggle
+            this.handleApplyChange(1)
+          } else {
+            this.isToggleDialogVisible = true
+          }
+        } else {
+          this.toggle = !this.toggle
+          this.handleMemberChange(1)
+        }
+      },
       bingEnterpriseClick: function () {
         window.location.href = '/bindEnterPrise/' + this.user.user.userUU
       },
@@ -155,7 +167,7 @@
         this.centerDialogVisible = false
       },
       handleApplyChange: function (page) {
-        this.$store.dispatch('loadApplyList', {page: applyPage, size: this.count})
+        this.$store.dispatch('loadApplyList', {page: page, size: this.count})
       },
       handleMemberChange: function (page) {
         this.$store.dispatch('loadMemberList', {page: page, size: this.count})
@@ -171,7 +183,7 @@
           this.$http.post('/sso/center/agree/apply', param, config)
             .then(res => {
               if (res.data.success) {
-                this.applyPage = 1
+                this.page = 1
                 this.handleApplyChange()
                 this.$message({
                   message: '操作成功',
@@ -186,7 +198,7 @@
           this.$http.post('/sso/center/disagree/apply', param, config)
             .then(res => {
               if (res.data.success) {
-                this.applyPage = 1
+                this.page = 1
                 this.handleApplyChange()
                 this.$message({
                   message: '操作成功',