浏览代码

feat(组件): 排序公共

tangning 2 年之前
父节点
当前提交
040d946970

+ 3 - 2
src/settings/componentSetting.ts

@@ -17,6 +17,7 @@ export default {
       // Total number of tables returned by the interface field name
       totalField: 'totalCount',
     },
+
     // Number of pages that can be selected
     pageSizeOptions: ['10', '20', '50', '80', '100'],
     // Default display quantity on one page
@@ -29,9 +30,9 @@ export default {
       if (field && order) {
         return {
           // The sort field passed to the backend you
-          field,
+          sidx: field,
           // Sorting method passed to the background asc/desc
-          order,
+          order: order.replace('end', ''), //用于适配后端的排序字段
         };
       } else {
         return {};

+ 0 - 4
src/views/feedback/list.vue

@@ -130,10 +130,6 @@
         // rowKey: 'userId',
         pagination: { pageSize: 20 },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
         fetchSetting: {
           pageField: 'page',
           sizeField: 'limit',

+ 0 - 4
src/views/order/list.vue

@@ -302,10 +302,6 @@
           totalField: 'totalCount',
         },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function renderOrderTypeLabel(type: number): string {

+ 0 - 4
src/views/product/list.vue

@@ -111,10 +111,6 @@
           listField: 'list',
           totalField: 'totalCount',
         },
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function handleEdit(record: Recordable) {

+ 0 - 4
src/views/rightsEnterprises/camera.vue

@@ -220,10 +220,6 @@
           });
         },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function renderStatus(type: number): string {

+ 0 - 4
src/views/rightsEnterprises/cameraList.vue

@@ -195,10 +195,6 @@
           };
         },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function renderRoleType(type: number): string {

+ 0 - 4
src/views/rightsEnterprises/enterprises.vue

@@ -162,10 +162,6 @@
           };
         },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function renderRoleType(type: number): string {

+ 0 - 4
src/views/rightsEnterprises/list.vue

@@ -236,10 +236,6 @@
           return T;
         },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function renderStatus(type: number): string {

+ 0 - 4
src/views/rightsEnterprises/staff.vue

@@ -204,10 +204,6 @@
           return T;
         },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function renderStatus(type: number): string {

+ 0 - 9
src/views/scenes/live.vue

@@ -279,15 +279,6 @@
           listField: 'list',
           totalField: 'totalCount',
         },
-        sortFn: (sortInfo) => {
-          console.log('sortInfo', sortInfo);
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
-        // defSort: {
-        //   field: 'order',
-        //   order: 'asc',
-        // },
       });
 
       function handleBindAnchor(record: Recordable) {

+ 0 - 5
src/views/scenes/room.vue

@@ -291,11 +291,6 @@
           listField: 'list',
           totalField: 'totalCount',
         },
-        sortFn: (sortInfo) => {
-          console.log('sortInfo', sortInfo);
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
       });
 
       function handleBindAnchor(record: Recordable) {

+ 0 - 4
src/views/staff/list.vue

@@ -245,10 +245,6 @@
           return T;
         },
         bordered: true,
-        sortFn: (sortInfo) => {
-          let order = sortInfo.order && sortInfo.order.replace('end', '');
-          return { ...sortInfo, sidx: sortInfo.field, order: order };
-        },
         searchInfo: searchInfo,
         handleSearchInfoFn(data) {
           searchInfo = Object.assign(searchInfo, data);