Prechádzať zdrojové kódy

基本薪资-列表排序

jingbb 1 rok pred
rodič
commit
d400a3f738

+ 14 - 45
src/views/oa/salary_management/personnelSalary/BasicSalary.vue

@@ -90,6 +90,10 @@
           DateTime:[],
           selectedRowKeys:[],
           selectedRows:[],
+          isorter: {
+            column: 'updateTime',
+            order: 'desc'
+          },
           // 表头
           columns: [
             {
@@ -110,17 +114,7 @@
               title: '部门',
               align:"center",
               dataIndex: 'sysOrgCode',
-              sorter:(a,b)=> {
-                  let temp1="";
-                  let temp2="";
-                  if(a.sysOrgCode!=null){
-                    temp1=a.sysOrgCode;
-                  }
-                  if(b.sysOrgCode!=null){
-                    temp2=b.sysOrgCode;
-                  }
-                  return temp1.localeCompare(temp2);
-              },
+              sorter:true
             },
             {
               title: '姓名',
@@ -131,17 +125,7 @@
               title: '组织',
               align:"center",
               dataIndex: 'orgName',
-              sorter:(a,b)=> {
-                  let temp1="";
-                  let temp2="";
-                  if(a.orgName!=null){
-                    temp1=a.orgName;
-                  }
-                  if(b.orgName!=null){
-                    temp2=b.orgName;
-                  }
-                  return temp1.localeCompare(temp2);
-              },
+              sorter:true
             },
             {
               title: '工资卡号',
@@ -154,33 +138,13 @@
               dataIndex: 'beforeAdjustment',
               scopedSlots: { customRender: 'basicSalary' } ,
               customCell: this.handleBasicSalary,
-              sorter:(a,b)=> {
-                  let temp1="";
-                  let temp2="";
-                  if(a.beforeAdjustment!=null){
-                    temp1=a.beforeAdjustment;
-                  }
-                  if(b.beforeAdjustment!=null){
-                    temp2=b.beforeAdjustment;
-                  }
-                  return temp1.localeCompare(temp2);
-              },
+              sorter:true
             },
             {
               title: '最后变更时间',
               align:"center",
               dataIndex: 'updateTime',
-              sorter:(a,b)=> {
-                  let temp1="";
-                  let temp2="";
-                  if(a.updateTime!=null){
-                    temp1=a.updateTime;
-                  }
-                  if(b.updateTime!=null){
-                    temp2=b.updateTime;
-                  }
-                  return temp1.localeCompare(temp2);
-              },
+              sorter:true
             },
           ],
           queryParam:{},
@@ -198,7 +162,8 @@
       },
       methods: {
         getTableList(){
-          getAction('/salary/salaryChangeRecord/querySalaryList',this.queryParam).then(res=>{
+          var param = Object.assign({}, this.queryParam, this.isorter)
+          getAction('/salary/salaryChangeRecord/querySalaryList',param).then(res=>{
             if(res.success){
                 this.dataSource =res.result.records
                 this.ipagination = {
@@ -234,6 +199,10 @@
             this.selectedRows = selectionRows;
         },
         handleTableChange(pagination, filters, sorter) {
+          if (Object.keys(sorter).length > 0) {
+            this.isorter.column = sorter.field;
+            this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc';
+          }
             this.queryParam.pageNo = pagination.current
             this.queryParam.pageSize = pagination.pageSize
             this.getTableList()