张延森 2 years ago
parent
commit
6aee6f3eb8

+ 2
- 1
src/components/QueryTable/index.jsx View File

6
   const tableRef = useRef()
6
   const tableRef = useRef()
7
   const searchRef = useRef()
7
   const searchRef = useRef()
8
   const [searchData, setSearchData] = useState({})
8
   const [searchData, setSearchData] = useState({})
9
-  const {api, searchFields, params, onPageChange,searchProps, ...leftProps} = props
9
+  const {api, searchFields, searchPre, params, onPageChange,searchProps, ...leftProps} = props
10
   const handleSearch = (data) => setSearchData(data)
10
   const handleSearch = (data) => setSearchData(data)
11
 
11
 
12
   useImperativeHandle(ref, () => ({
12
   useImperativeHandle(ref, () => ({
23
     <>
23
     <>
24
       <Search
24
       <Search
25
         ref={searchRef}
25
         ref={searchRef}
26
+        preBtn={searchPre}
26
         fields={searchFields}
27
         fields={searchFields}
27
         onSearch={handleSearch}
28
         onSearch={handleSearch}
28
         onReset={handleSearch}
29
         onReset={handleSearch}

+ 6
- 1
src/components/Search/SearchForm.jsx View File

4
 import { defaultLayout, getFormDataFrom } from './utils'
4
 import { defaultLayout, getFormDataFrom } from './utils'
5
 
5
 
6
 export default (props) => {
6
 export default (props) => {
7
-  const { fields = [], extraParams = {}, onSearch, onReset } = props
7
+  const { fields = [], extraParams = {}, preBtn, onSearch, onReset } = props
8
   const initValue = useRef(getFormDataFrom(fields))
8
   const initValue = useRef(getFormDataFrom(fields))
9
   const [formData, setFormData] = useState(initValue.current)
9
   const [formData, setFormData] = useState(initValue.current)
10
 
10
 
32
 
32
 
33
   return (
33
   return (
34
     <Form layout="inline">
34
     <Form layout="inline">
35
+      {
36
+        preBtn && (
37
+          <Form.Item>{preBtn}</Form.Item>
38
+        )
39
+      }
35
       {
40
       {
36
         fields.map((field) => (
41
         fields.map((field) => (
37
           <SearchItem
42
           <SearchItem

+ 2
- 2
src/pages/broker/announcement/util.js View File

7
   {
7
   {
8
     title: '成为经纪人',
8
     title: '成为经纪人',
9
     page: '/subpackages/pages/broker/toBeBroker/index',
9
     page: '/subpackages/pages/broker/toBeBroker/index',
10
-    queryStr: 'recommendAgent={personId}'
10
+    queryStr: ''
11
   },
11
   },
12
   {
12
   {
13
-    title: '报备客户',
13
+    title: '推荐客户',
14
     page: '/pages/mine/addCustomer/index',
14
     page: '/pages/mine/addCustomer/index',
15
     queryStr: ''
15
     queryStr: ''
16
   },
16
   },

+ 3
- 12
src/pages/broker/customer/index.jsx View File

1
 import React, { useMemo, useRef, useState } from 'react'
1
 import React, { useMemo, useRef, useState } from 'react'
2
-import { Button, notification, Spin, Badge, Select } from 'antd'
3
-import { router } from 'umi'
2
+import { Button} from 'antd'
4
 import moment from 'moment'
3
 import moment from 'moment'
4
+import router from 'umi/router';
5
 import QueryTable from '@/components/QueryTable'
5
 import QueryTable from '@/components/QueryTable'
6
 import { fetch, apis } from '@/utils/request';
6
 import { fetch, apis } from '@/utils/request';
7
-import { useEffect } from 'react'
8
 
7
 
9
 const searchFields = [
8
 const searchFields = [
10
   {
9
   {
24
   const { recommendPerson } = history.location.query
23
   const { recommendPerson } = history.location.query
25
 
24
 
26
   const ref = useRef()
25
   const ref = useRef()
27
-  const [notQuery, setNotQuery] = useState(true);
28
 
26
 
29
   const tableColumns = [
27
   const tableColumns = [
30
     {
28
     {
102
     },
100
     },
103
   ]
101
   ]
104
 
102
 
105
-  useEffect(() => {
106
-    setNotQuery(!recommendPerson);
107
-
108
-    if (!recommendPerson) {
109
-      notification.warning({ message: "请设置经纪人" })
110
-    }
111
-  }, [recommendPerson])
112
-
113
   return (
103
   return (
114
     <QueryTable
104
     <QueryTable
115
       ref={ref}
105
       ref={ref}
116
       rowKey="channelCustomerId"
106
       rowKey="channelCustomerId"
117
       api={apis.broker.getCustomerList}
107
       api={apis.broker.getCustomerList}
108
+      searchPre={<Button type="link" icon="arrow-left" onClick={() => router.goBack()}>返回</Button>}
118
       searchFields={searchFields}
109
       searchFields={searchFields}
119
       columns={tableColumns}
110
       columns={tableColumns}
120
       params={{ recommendPerson }}
111
       params={{ recommendPerson }}