Commit e3a3aaf5 authored by 王鑫's avatar 王鑫

feat: 节假日模块表格排序

parent 9c395bf2
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
</div> </div>
<a-table <a-table
size="middle" size="middle"
@change="sortChange"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:row-selection="{selectedRowKeys: selectedRowKeys, onChange: updateSelect}" :row-selection="{selectedRowKeys: selectedRowKeys, onChange: updateSelect}"
...@@ -90,12 +91,13 @@ ...@@ -90,12 +91,13 @@
import {getCommonCode} from "@api/system/sysCode"; import {getCommonCode} from "@api/system/sysCode";
import {getPage,synchronousVacation,deleteHoliday,batchDeleteHoliday} from "@api/holidays/holidays"; import {getPage,synchronousVacation,deleteHoliday,batchDeleteHoliday} from "@api/holidays/holidays";
import HolidaysDetail from "@views/holidays/HolidaysDetail"; import HolidaysDetail from "@views/holidays/HolidaysDetail";
import {humpToLine, setOrder} from "@util/util";
const columns = [ const columns = [
{title: '名称', width: 100,dataIndex: 'name'}, {title: '名称', width: 100,dataIndex: 'name'},
{title: '类型', width: 80, dataIndex: 'dayCode',scopedSlots: {customRender: 'dayCode'}}, {title: '类型', width: 80, dataIndex: 'dayCode',scopedSlots: {customRender: 'dayCode'}},
{title: '开始日期', width: 100, dataIndex: 'startDate',scopedSlots: {customRender: 'startDate'}}, {title: '开始日期',sorter: true, width: 100, dataIndex: 'startDate',scopedSlots: {customRender: 'startDate'}},
{title: '结束日期', width: 100, dataIndex: 'endDate',scopedSlots: {customRender: 'startDate'}}, {title: '结束日期', width: 100, dataIndex: 'endDate',scopedSlots: {customRender: 'startDate'}},
{title: '时长', width: 60, dataIndex: 'duration',scopedSlots: {customRender: 'duration'}}, {title: '时长',sorter: true, width: 70, dataIndex: 'duration',scopedSlots: {customRender: 'duration'}},
{title: '详情',dataIndex: 'vacation'}, {title: '详情',dataIndex: 'vacation'},
{title: '操作', key: 'operation', width: 90, scopedSlots: {customRender: 'action'}} {title: '操作', key: 'operation', width: 90, scopedSlots: {customRender: 'action'}}
] ]
...@@ -109,7 +111,9 @@ export default { ...@@ -109,7 +111,9 @@ export default {
query: { query: {
year: 0, year: 0,
page: 1, page: 1,
size: 10 size: 10,
order: "",
sort: "",
}, },
yearList:[], yearList:[],
loading: false, loading: false,
...@@ -165,6 +169,11 @@ export default { ...@@ -165,6 +169,11 @@ export default {
}, },
pageChange(page) { pageChange(page) {
this.query.page = page; this.query.page = page;
},
sortChange(pagination,filters, sorter){
console.log(sorter)
this.query.sort = humpToLine(sorter.field);
this.query.order = setOrder(sorter.order);
this.loadData(); this.loadData();
}, },
sizeChange(current, size) { sizeChange(current, size) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment