Przeglądaj źródła

feat: 增加搜索商机名称+单位名称

outaozhen 5 lat temu
rodzic
commit
73632421f9
1 zmienionych plików z 25 dodań i 6 usunięć
  1. 25 6
      src/pages/Customer/Business/index.jsx

+ 25 - 6
src/pages/Customer/Business/index.jsx

@@ -1,14 +1,16 @@
 import React, { useState, useEffect, useRef } from 'react'
-import { connect } from 'umi'
+import { connect, useModel } from 'umi'
 import { getBusinessList } from '@/services/customer'
 import consts from '@/consts'
-import { Select } from 'antd'
+import { Select, Tooltip, Input } from 'antd'
 import AddBusiness from './components/AddBusiness'
 import Detail from './components/BusinessDetail'
 import { useModal } from '@/components/Modal'
 import CompanyDetail from '../Company/components/CompanyDetail'
 import { Funnel } from '@ant-design/charts'
 import BasicTable from '@/components/Table'
+import { getPermAuthCache } from '@/utils/auth'
+import { PermDataTypeEunm } from '@/pages/Customer/Company/components/PermSelect'
 
 const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
   const tRef = useRef(null)
@@ -18,6 +20,10 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
     params: { businessGroupId: null, dataPermission: 'oneself', staffIds: null },
     funnelData: []
   })
+  const { initialState: { permData } = { permData: {} } } = useModel('@@initialState')
+  const handleSearch = value => {
+    setState({ ...state, params: { ...state.params, search: value } })
+  }
 
   useEffect(() => {
     if (!groupList) {
@@ -70,8 +76,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
       render: (text, record) => (
         <span
           onClick={() => showDrawer(record.id)}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
-        >
+          className="text-primary cursor-pointer hover:text-[#967bbd]">
           {text}
         </span>
       )
@@ -84,8 +89,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
         return record.customerId !== consts.ENCRYPTION_ZERO ? (
           <span
             onClick={() => showDrawer(record.customerId, true)}
-            className="text-primary cursor-pointer hover:text-[#967bbd]"
-          >
+            className="text-primary cursor-pointer hover:text-[#967bbd]">
             {text}
           </span>
         ) : (
@@ -131,6 +135,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
     conversionTag: false
   }
 
+  const [defaultPermAuthCache] = getPermAuthCache(PermDataTypeEunm.CUSTOMER)
   return (
     <div className="h-full w-full flex flex-row justify-between">
       <div className="h-full w-3/20 rounded-4px shadow-card">
@@ -187,6 +192,20 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
               }}
               search={false}
               toolbar={{
+                search: (
+                  <Tooltip placement="bottom" title="输入商机名称、单位名称">
+                    <Input.Search
+                      style={{ width: '300px' }}
+                      allowClear={true}
+                      placeholder={`在${
+                        permData[PermDataTypeEunm.CUSTOMER]?.find(
+                          item => item.value === defaultPermAuthCache
+                        )?.label
+                      }下搜索`}
+                      onSearch={handleSearch}
+                    />
+                  </Tooltip>
+                ),
                 actions: [
                   <AddBusiness
                     key="add"