lanjianrong 5 년 전
부모
커밋
2e85bf4207
1개의 변경된 파일39개의 추가작업 그리고 32개의 파일을 삭제
  1. 39 32
      src/pages/Customer/Contact/index.jsx

+ 39 - 32
src/pages/Customer/Contact/index.jsx

@@ -21,11 +21,11 @@ const Contact = props => {
     total: 0
   })
 
-  const initData = async (page = 1, size = consts.PAGE_SIZE) => {
+  const initData = async payload => {
     const {
       code = -1,
       data: { client = [], total = 0 }
-    } = await queryContact({ page, size })
+    } = await queryContact(payload)
     if (code === consts.RET_CODE.SUCCESS) {
       setState({ ...state, data: client, total })
     }
@@ -303,12 +303,14 @@ const Contact = props => {
     }
     options()
   }, [])
-  const {
-    districtName
-  } = props
-  const districtlist = [ ...districtName.data ]
+  const { districtName } = props
+  const districtlist = [...districtName.data]
   console.log(districtlist)
 
+  const handleSearch = value => {
+    console.log(111)
+    initData({ search: value })
+  }
   return (
     // <PageHeaderWrapper></PageHeaderWrapper>
     <div>
@@ -316,32 +318,37 @@ const Contact = props => {
         <Cascader onChange={onChange} />
       </div>
       <div className={styles.tableContent}>
-      <ProTable
-        // className={styles.tableContent}
-        rowKey={record => record.id}
-        size="middle"
-        columns={columns}
-        dataSource={state.data}
-        pagination={{
-          pageSize: consts.PAGE_SIZE,
-          total: state.total,
-          onChange: (page, size) => initData(page, size)
-        }}
-        search={false}
-        options={{
-          search: true
-        }}
-        scroll={{ x, y }}
-        columnsStateMap={columnsStateMap}
-        onColumnsStateChange={map => setColumnsStateMap(map)}
-        headerTitle="联系人"
-        toolBarRender={() => [
-          <Button key="button" type="primary">
-            <SvgIcon type="icon-plus" />
-            联系人
-          </Button>
-        ]}
-      />
+        <ProTable
+          // className={styles.tableContent}
+          rowKey={record => record.id}
+          size="middle"
+          columns={columns}
+          dataSource={state.data}
+          pagination={{
+            pageSize: consts.PAGE_SIZE,
+            total: state.total,
+            onChange: (page, size) => initData({ page, size })
+          }}
+          search={false}
+          // options={{
+          //   onSearch: handleSearch
+          // }}
+          toolbar={{
+            search: {
+              onSearch: handleSearch
+            }
+          }}
+          scroll={{ x, y }}
+          columnsStateMap={columnsStateMap}
+          onColumnsStateChange={map => setColumnsStateMap(map)}
+          headerTitle="联系人"
+          toolBarRender={() => [
+            <Button key="button" type="primary">
+              <SvgIcon type="icon-plus" />
+              联系人
+            </Button>
+          ]}
+        />
       </div>
       <Contacts onClose={hideDrawer} visible={visible} onCreate={onCreate} />
     </div>