Selaa lähdekoodia

客户列表 修改

魏熙美 5 vuotta sitten
vanhempi
commit
5b8e01c6dc
1 muutettua tiedostoa jossa 36 lisäystä ja 3 poistoa
  1. 36
    3
      src/pages/customer/customerlist/index.jsx

+ 36
- 3
src/pages/customer/customerlist/index.jsx Näytä tiedosto

@@ -28,6 +28,8 @@ function body(props) {
28 28
 
29 29
   // eslint-disable-next-line react-hooks/rules-of-hooks
30 30
   const [dataSource, setDataSource] = useState({ records: [] })
31
+  // eslint-disable-next-line react-hooks/rules-of-hooks
32
+  // const [columns, setColumns] = useState(privateColumns)
31 33
 
32 34
   // 默认私客
33 35
   // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -107,6 +109,7 @@ function body(props) {
107 109
 
108 110
     const { value } = e.target
109 111
     setCustomerType(value)
112
+    //setColumns(value === 'private' ? privateColumns : publicColumns)
110 113
     getList({ pageNumber: 1, pageSize: 10, customerType: value })
111 114
   }
112 115
 
@@ -168,7 +171,34 @@ function body(props) {
168 171
     link.click()
169 172
   }
170 173
 
171
-  const columns = [
174
+  const publicColumns = [
175
+    {
176
+      title: '头像',
177
+      dataIndex: 'picture',
178
+      key: 'picture',
179
+      align: 'center',
180
+      width: '15%',
181
+      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
182
+    },
183
+    {
184
+      title: '姓名',
185
+      dataIndex: 'name',
186
+      key: 'name',
187
+      align: 'center',
188
+      width: '10%',
189
+      // eslint-disable-next-line no-nested-ternary
190
+      render: (_, record) => <><span>{customerType === 'private' ? record.name : record.nickname}</span></>,
191
+    },
192
+    {
193
+      title: '电话',
194
+      dataIndex: 'phone',
195
+      key: 'phone',
196
+      align: 'center',
197
+      width: '15%',
198
+    },
199
+  ]
200
+
201
+  const privateColumns = [
172 202
     {
173 203
       title: '头像',
174 204
       dataIndex: 'picture',
@@ -324,8 +354,11 @@ function body(props) {
324 354
           </Radio.Group>
325 355
         </AuthButton>
326 356
       </div>
327
-      <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" />
328
-
357
+      {customerType === 'private' ? 
358
+        <Table dataSource={dataSource.records} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
359
+        <Table dataSource={dataSource.records} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
360
+      }
361
+      
329 362
       {/* 调整归属 */}
330 363
       <Attribution visibleData={gVisibleData} />
331 364