diff --git a/src/views/safetyManagement/equipmentInspectionTask/index.vue b/src/views/safetyManagement/equipmentInspectionTask/index.vue index b8759842..f91faae7 100644 --- a/src/views/safetyManagement/equipmentInspectionTask/index.vue +++ b/src/views/safetyManagement/equipmentInspectionTask/index.vue @@ -16,6 +16,7 @@ @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" + @sort-change="sortChange" > @@ -240,6 +241,20 @@ export default { this.query = { taskStatus: '1' }; this.onLoad(this.page); }, + // 排序 + sortChange({ prop, order }) { + if (!prop) { + // 如果取消排序,清空排序参数 + this.query.orderByField = undefined; + this.query.isAsc = undefined; + } else { + const orderByField = prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase(); + this.query.orderByField = orderByField; + this.query.isAsc = order === 'ascending' ? true : false; + } + // // 重新加载数据 + this.onLoad(this.page, this.query); + }, // 加载页面数据 onLoad(page, params = {}) { this.loading = true;