outaozhen 5 anni fa
parent
commit
034f830c52

+ 1 - 0
src/components/LazyCascader/index.jsx

@@ -35,6 +35,7 @@ const LazyCascader = props => {
       loadData={loadData}
       fieldNames={{ label: 'name', value: 'id' }}
       changeOnSelect
+      defaultValue={['省', '市', '区']}
     />
   )
 }

+ 5 - 27
src/pages/Customer/Contact/index.jsx

@@ -1,7 +1,7 @@
 import Contacts from '@/components/PopContent/Contacts'
 import ProTable from '@ant-design/pro-table'
 // import { PageHeaderWrapper } from '@ant-design/pro-layout';
-import { Button, Tag, Cascader } from 'antd'
+import { Button, Tag } from 'antd'
 import { connect } from 'dva'
 import React, { useEffect, useState } from 'react'
 import SvgIcon from '@/components/SvgIcon'
@@ -258,7 +258,6 @@ const Contact = props => {
   // const { contactName: { list } } = props // 将contact中的pros.list命名为list
   // const contanctlist = [...list]
   // console.log(props)
-  // console.log(props)
   // console.log(contanctlist)
   const [columnsStateMap, setColumnsStateMap] = useState({
     telephone: {
@@ -286,27 +285,10 @@ const Contact = props => {
       show: false
     }
   })
-  // const initData = (page = 1, size = consts.PAGE_SIZE) => {
-  //   const { dispatch } = props
-  //   dispatch({
-  //     type: 'contact/fetch',
-  //     payload: { page, size }
-  //   }) // 派发出这个action就会调用contact中的fetch函数,然后就会请求数据
-  // }
   useEffect(() => {
     // props.getlist();
     initData()
-    const options = () => {
-      const { dispatch } = props
-      dispatch({
-        type: 'district/fetch'
-      })
-    }
-    options()
   }, [])
-  const { districtName } = props
-  const districtlist = [...districtName.data]
-  console.log(districtlist)
 
   const handleSearch = value => {
     initData({ search: value })
@@ -318,9 +300,6 @@ const Contact = props => {
   return (
     // <PageHeaderWrapper></PageHeaderWrapper>
     <div>
-      <div className="zh-pd-24">
-        <LazyCascader onSelect={handleOnselect} />
-      </div>
       <div className={styles.tableContent}>
         <ProTable
           // className={styles.tableContent}
@@ -334,13 +313,13 @@ const Contact = props => {
             onChange: (page, size) => initData({ page, size })
           }}
           search={false}
-          // options={{
-          //   onSearch: handleSearch
-          // }}
           toolbar={{
             search: {
               onSearch: handleSearch
-            }
+            },
+            actions:[
+              <LazyCascader onSelect={handleOnselect} key="LazyCascader"/>
+            ]
           }}
           scroll={{ x, y }}
           columnsStateMap={columnsStateMap}
@@ -360,7 +339,6 @@ const Contact = props => {
 }
 
 export default connect(({ district, global, loading }) => ({
-  // export default connect(({ contact, global, loading })
   // contactName: contact,
   // data: contact.data,
   // total: contact.total,