zoukankan      html  css  js  c++  java
  • element UI table组件后端排序

     <el-table
            :data="tableData"
            max-height="700"
            fit
            show-overflow-tooltip="true"
            @sort-change='sortthiscolumn'
            height="500"
            :header-cell-style="{background:'#FAFAFA'}"
            :cell-style="styleObj"
            style=" 100%"
            :default-sort = "{prop: 'date', order: 'descending'}"
          >
            <el-table-column  prop="id" label="接口编号" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="name" label="接口名称" align="center"></el-table-column>
            <el-table-column prop="healthy" label="接口健康状态" align="center">
              <template slot-scope="scope">
                 <div><span :class="ifnormal(scope.row.healthy)">●</span>&ensp;{{scope.row.healthy == false ? "异常" : "正常"}}</div>
              </template>
            </el-table-column>
            <el-table-column prop="city" label="最后调用时间" align="center" sortable='custom'></el-table-column>
            <el-table-column prop="callTimes" label="调用次数" align="center" sortable='custom'></el-table-column>
             <el-table-column prop="errorCount"  label="报错次数" align="center" sortable='custom'></el-table-column>
            <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                <el-button @click="handleClick(scope.row)" type="text" size="small">调用详情</el-button>
              </template>
            </el-table-column>  
          </el-table>
    <script>
    import share from "@/api/share"
    export default {
      data() {
        return {
         
         
          
          
        };
      },
      methods: { 
        sortthiscolumn (column) {    //自定义排序      column参数为一个对象包含需要排序的属性和排序方法
           if(column.prop == "callTimes" && column.order == "ascending"){
               this.useorder = "ASC"
               this.page.currentPage = 1;
                this.getRunConfig(this.page.pagesize,this.page.currentPage,this.configState,this.input,this.timeorder,this.useorder,this.errororder);
         }else if(column.prop == "callTimes" && column.order == "descending"){
               this.useorder = "DESC"
                this.page.currentPage = 1;
                this.getRunConfig(this.page.pagesize,this.page.currentPage,this.configState,this.input,this.timeorder,this.useorder,this.errororder);
         }else if(column.prop == "errorCount" && column.order == "ascending"){
                this.errororder = "ASC"
                this.page.currentPage = 1;
                 this.getRunConfig(this.page.pagesize,this.page.currentPage,this.configState,this.input,this.timeorder,this.useorder,this.errororder);
         }else if(column.prop == "errorCount" && column.order == "descending"){
                this.errororder = "DESC"
                this.page.currentPage = 1;
                 this.getRunConfig(this.page.pagesize,this.page.currentPage,this.configState,this.input,this.timeorder,this.useorder,this.errororder);
         }else{
           return;
         }
        },
       
      }
    };
    </script>
    

      

  • 相关阅读:
    新人优惠的风险
    Linux服务器记录并查询历史操作记录
    斜率比截距重要
    专访李果:初生牛犊不怕虎的移动创业者
    iPhone开发视频教程 ObjectiveC部分 (51课时)
    珍藏40个android应用源码分享
    iPhone开发教程 UI基础课程(58课时)
    ios源码分享之动画类
    史上最全的ios源码汇总。欢迎收藏
    Android开发教程汇总
  • 原文地址:https://www.cnblogs.com/tomofagain/p/11213144.html
Copyright © 2011-2022 走看看