ElementUI,table页面实现两个页面的切换

vue定义的data数据,methods数据,全部都在这个里面了

过滤出不同类型的数组,然后在不同的table页面和表枚进行展示。

// 公告栏
getAnnouceData(){
  pageAnnouceListApi().then((res) => {
    if (res.resultCode == 0) {
      this.announceList = res.data;
      // console.log(this.announceList,"announcelist--------------------");
      this.announceList1 =  this.announceList.filter(function (type) {
        return type.annType == "系统通知";
      });
      this.page1.totalPage1 = this.announceList1.length;

      this.announceList2 =  this.announceList.filter(function (type) {
        return type.annType == "其他";
      });

      this.page2.totalPage2 = this.announceList2.length;
    }
  }).catch((err) => {
    this.$store.dispatch("loading/CHANGE_LOADING", false);
  });
},

// 每页数
sizeChangeHandle1(val) {
  this.page1.pageSize1 = val;
  this.page1.pageIndex1 = 1;
  this.getAnnouceData();
},
// 当前页
currentChangeHandle1(val) {
  this.page1.pageIndex1 = val;
  this.getAnnouceData();
},

// 每页数
sizeChangeHandle2(val) {
  this.page2.pageSize2 = val;
  this.page2.pageIndex2 = 1;
  this.getAnnouceData();
},
// 当前页
currentChangeHandle2(val) {
  this.page2.pageIndex2 = val;
  this.getAnnouceData();
},


//  前往末页
toLastPage1() {
  let max = Math.ceil(this.tablePage.totalResult / this.tablePage.pageSize1);
  this.handleCurrentChange(max);
},

toLastPage2() {
  let max = Math.ceil(this.tablePage.totalResult / this.tablePage.pageSize2);
  this.handleCurrentChange(max);
},
// -----------











   page1: {
        pageIndex1: 1,
        pageSize1: 10,
        totalPage1: 0,
      },
      page2: {
        pageIndex2: 1,
        pageSize2: 10,
        totalPage2: 0,
      },
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
        <!-- 弹框:意外原因 -->
      <el-dialog
        v-dialogDrag
        title="公告栏"
        :visible.sync="annDialog"
        width="40%"
        class="dialogBox">
        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
          <el-tab-pane label="系统通知" name="first">
            <el-table
              :data="announceList1"
              tooltip-effect="dark"
              style="width: 100%"
            >
              <el-table-column  label="公告内容" show-overflow-tooltip>
                <template slot-scope="scope">
                  <span>  <strong style="color: deepskyblue"> {{scope.row.annContent}} </strong> - {{'('+scope.row.startTime +')' || "--"}} </span>
                </template>

              </el-table-column>


            </el-table>
            <el-row>
              <el-col :span="24">
                <div class="pagination">
                  <!-- 分页 -->
                  <el-pagination background @size-change="sizeChangeHandle1" @current-change="currentChangeHandle1"
                                 :current-page="page1.pageIndex1" :page-sizes="[10, 20, 50, 100]" :page-size="page1.pageSize1"
                                 :total="page1.totalPage1" layout="total, sizes, prev, pager, next, jumper">
                  </el-pagination>
                </div>
              </el-col>
            </el-row>
          </el-tab-pane>

          <el-tab-pane label="其他" name="second">
            <el-table
              :data="announceList2"
              tooltip-effect="dark"
              style="width: 100%"
            >
              <el-table-column  label="公告内容" show-overflow-tooltip>
                <template slot-scope="scope">
                  <span>  <strong style="color: deepskyblue"> {{scope.row.annContent}} </strong>
                    <span v-if="scope.row.startTime != null"> {{'-'+'('+scope.row.startTime +')' || "--"}} </span>
                    </span>
                </template>

              </el-table-column>


            </el-table>
            <el-row>
              <el-col :span="24">
                <div class="pagination">
                  <!-- 分页 -->
                  <el-pagination background @size-change="sizeChangeHandle2" @current-change="currentChangeHandle2"
                                 :current-page="page2.pageIndex2" :page-sizes="[10, 20, 50, 100]" :page-size="page2.pageSize2"
                                 :total="page2.totalPage2" layout="total, sizes, prev, pager, next, jumper">
                  </el-pagination>
                </div>
              </el-col>
            </el-row>
          </el-tab-pane>
        </el-tabs>





      </el-dialog>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

有时间指导毕业设计

觉得写的好的话可以给我打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值