Parcourir la source

完善代理出票合作方资料页面分页

yuanrf il y a 2 jours
Parent
commit
cf457bb14e
1 fichiers modifiés avec 15 ajouts et 7 suppressions
  1. 15 7
      src/components/Resource/AirTicketAgent.vue

+ 15 - 7
src/components/Resource/AirTicketAgent.vue

@@ -4,14 +4,15 @@
             <div class="communal-title">
                 <div>代理出票合作方资料</div>
                 <div class="communal-box">
-                    <el-input @input="Inquireclick()" placeholder="代理方名称" v-model="input" clearable style="width: 350px;">
+                    <el-input @input="Inquireclick()" placeholder="代理方名称" v-model="input" clearable
+                        style="width: 350px;">
                     </el-input>
                     <el-button type="primary" @click="addData" style="margin-left: 10px;">新增</el-button>
                 </div>
             </div>
             <template>
-                <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
-                    style="width: 100%" v-loading="loading" element-loading-text="拼命加载中...">
+                <el-table :data="tableDatas" border style="width: 100%" v-loading="loading"
+                    element-loading-text="拼命加载中...">
                     <el-table-column prop="num" label="序 号" width="55">
                         <template slot-scope="scope">
                             {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
@@ -34,7 +35,7 @@
             <div class="block">
                 <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
                     :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
-                    layout="total, sizes, prev, pager, next" :total="tableDatas.length">
+                    layout="total, sizes, prev, pager, next" :total="total">
                 </el-pagination>
             </div>
         </div>
@@ -76,6 +77,7 @@ export default {
             tableData: [],
             currentPage: 1, // 当前页码
             pageSize: 12,// 每页的数据条数
+            total: 0,
             input: '',
             token: '',
             userId: 0,
@@ -109,10 +111,12 @@ export default {
         handleSizeChange(val) {
             this.currentPage = 1;
             this.pageSize = val;
+            this.QueryAirTicketAgent();
         },
         //当前页改变时触发 跳转其他页
         handleCurrentChange(val) {
             this.currentPage = val;
+            this.QueryAirTicketAgent();
         },
         QueryAirTicketAgent() {
             this.loading = true
@@ -127,7 +131,7 @@ export default {
                 data: {
                     portType: 1,
                     PageIndex: that.currentPage,
-                    PageSize: that.PageSize
+                    PageSize: that.pageSize
                 }
             }).then(function (res) {
                 console.log(res)
@@ -136,12 +140,14 @@ export default {
 
                     that.tableData = res.data.data.pageSource;
                     that.pageSize = res.data.data.pageSize;
-                    that.PageIndex = res.data.data.pageIndex
+                    that.currentPage = res.data.data.pageIndex;
+                    that.total = res.data.data.pageCount;
                     that.tableDatas = that.tableData;
 
-                    if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
+                    if (that.tableDatas.length == 0) {
                         if (that.currentPage > 1) {
                             that.currentPage = that.currentPage - 1;
+                            that.QueryAirTicketAgent();
                         }
                     }
                 }
@@ -156,12 +162,14 @@ export default {
             var newarr = [];
             if (this.input == "") {
                 newarr = this.tableData;
+                this.total = this.tableData.length;
             } else {
                 for (var i = 0; i < this.tableData.length; i++) {
                     if (this.tableData[i].name.indexOf(this.input) != -1) {
                         newarr.push(this.tableData[i]);
                     }
                 }
+                this.total = newarr.length;
             }
             this.tableDatas = newarr;
             this.currentPage = 1;