diff --git a/src/views/goods/Index.vue b/src/views/goods/Index.vue index a5150b8..af2e48d 100644 --- a/src/views/goods/Index.vue +++ b/src/views/goods/Index.vue @@ -203,7 +203,22 @@ export default { selectedRowKeys: [], // 加载数据方法 必须为 Promise 对象 loadData: (param) => { - return GoodsApi.list({ ...param, ...this.queryParam }).then((response) => { + const data = { ...param, ...this.queryParam } + const orderEnum = { + ascend: 'asc', + descend: 'desc', + } + + if (data.sortField && data.sortOrder && orderEnum[data.sortOrder]) { + data.sort = data.sortField + data.order = orderEnum[data.sortOrder] + delete data.sortField + delete data.sortOrder + } else { + delete data.sortField + delete data.sortOrder + } + return GoodsApi.list(data).then((response) => { return response.data.list }) }