Browse Source

feat: 客户/联系人 数据列 "电话""手机""QQ""邮箱""地址" 增加排序

outaozhen 5 years ago
parent
commit
fd7190e818
2 changed files with 19 additions and 10 deletions
  1. 12 7
      src/pages/Customer/Client/index.jsx
  2. 7 3
      src/pages/Customer/Company/index.jsx

+ 12 - 7
src/pages/Customer/Client/index.jsx

@@ -188,17 +188,19 @@ const Client = props => {
       width: 75,
       search: false
     },
-    // {
-    //   title: '电话',
-    //   dataIndex: 'phone',
-    //   key: 'phone',
-    //   width: 150
-    // },
+    {
+      title: '电话',
+      dataIndex: 'phone',
+      key: 'phone',
+      width: 65,
+      sorter: (a, b) => a.phone.localeCompare(b.phone)
+    },
     {
       title: '手机',
       dataIndex: 'telephone',
       key: 'telephone',
       width: 75,
+      sorter: (a, b) => a.telephone.localeCompare(b.telephone),
       search: false
     },
     {
@@ -206,6 +208,7 @@ const Client = props => {
       dataIndex: 'qq',
       key: 'qq',
       width: 75,
+      sorter: (a, b) => a.qq.localeCompare(b.qq),
       search: false
     },
     {
@@ -213,6 +216,7 @@ const Client = props => {
       dataIndex: 'email',
       key: 'email',
       width: 75,
+      sorter: (a, b) => a.email.localeCompare(b.email),
       search: false
     },
     {
@@ -316,7 +320,8 @@ const Client = props => {
       dataIndex: 'address',
       key: 'address',
       ellipsis: true,
-      width: 50,
+      width: 150,
+      sorter: (a, b) => a.address.localeCompare(b.address),
       search: false
     },
     {

+ 7 - 3
src/pages/Customer/Company/index.jsx

@@ -174,6 +174,7 @@ const Company = props => {
       dataIndex: 'phone',
       key: 'phone',
       search: false,
+      sorter: (a, b) => a.phone.localeCompare(b.phone),
       width: 80
     },
     {
@@ -267,7 +268,8 @@ const Company = props => {
       dataIndex: 'address',
       key: 'address',
       search: false,
-      width: 80
+      sorter: (a, b) => a.address.localeCompare(b.address),
+      width: 150
     },
     {
       title: '客户传真',
@@ -458,8 +460,10 @@ const Company = props => {
         params={state.params}
         request={async (params, sort, filter) => {
           const srotOrder = refactorSortField(sort)
-          const { code = -1, data: { customer = [], total = 0 } = { customer: [], total: 0 } } =
-            await queryCompany({ ...params, ...srotOrder, ...filter })
+          const {
+            code = -1,
+            data: { customer = [], total = 0 } = { customer: [], total: 0 }
+          } = await queryCompany({ ...params, ...srotOrder, ...filter })
           setState({ ...state, orderIds: customer.map(item => item.id) })
           return {
             data: customer,