table排序

<el-table v-loading="fourthloading" :data="tableData4" style="width: 100%" height="390"
    @sort-change="sortChange" ref="fourthtable"> //@sort-change
    <el-table-column prop="title" label="项目名" />
    <el-table-column prop="money" label="签约金额" sortable="true" width="86" />
    <el-table-column prop="grossMargin" label="毛利" sortable="true" />
    <el-table-column prop="grossMarginRate" label="毛利率" sortable="true" />
    <el-table-column prop="advance_amount" label="垫资金额" sortable="true" width="86" />
</el-table>
 
        sortChange(column) {
            this.tableData = []
            if (column) {
                var sort
                console.log(column, 'columncolumncolumn')
                if (column.order === 'ascending') { // 这里双重判断:该字段为升序时向后端传递升序参数,反之降序
                    sort = `${column.prop},asc`
                } else if (column.order === 'descending') {
                    sort = `${column.prop},desc`
                }
                // this.fourthloading = true
                this.sort_param = sort
                // noticeboard_project_list_amounts({ limit: 500, 'sort_param': sort, title: this.input4 }).then((res) => {
                //     this.tableData4 = res.data.list
                //     this.fourthloading = false
                // })
            }
        },

 

posted @ 2023-08-14 18:14  LALAYU  阅读(20)  评论(0编辑  收藏  举报