Kaynağa Gözat

客户添加联系人绑定客户id

outaozhen 5 yıl önce
ebeveyn
işleme
8b7f10e8d0

+ 4 - 8
src/pages/Customer/Company/components/CompanyDetail/CompanyTabList.jsx

@@ -1,21 +1,17 @@
-import React, { useRef } from 'react'
-import { Tabs, Button, message } from 'antd'
+import React from 'react'
+import { Tabs, message } from 'antd'
 // import SvgIcon from '@/components/SvgIcon'
 import AddContact from '@/pages/customer/Contact/components/AddContact'
 import { apiAddClient } from '@/services/contact'
 import { formatValues } from '@/components/LazyCascader'
 import consts from '@/consts'
 
-const CompanyTabList = ({ initData }) => {
+const CompanyTabList = ({ initData, customerId }) => {
   const { TabPane } = Tabs
-  // const tRef = useRef()
-  // const initData = () => {
-  //   tRef.current.reset()
-  // }
   const handleAddClient = async values => {
     // 客户id
 
-    const payload = formatValues(values)
+    const payload = formatValues({ ...values, customerId })
     const { code = -1, msg = '新增失败' } = await apiAddClient(payload)
     if (code === consts.RET_CODE.SUCCESS) {
       message.success(msg)

+ 1 - 1
src/pages/Customer/Company/components/CompanyDetail/index.jsx

@@ -50,7 +50,7 @@ const Index = props => {
             </div>
           </Col>
           <Col span={12} flex={{ flexDirection: 'column' }}>
-            <CompanyTabList initData={initData} />
+            <CompanyTabList initData={initData} customerId={id} />
             <CompanyLowerList log={state.log} />
           </Col>
         </Row>

+ 12 - 19
src/pages/Customer/Contact/index.jsx

@@ -16,10 +16,6 @@ import { useTableScroll } from '@/hooks/useAutoTable'
 import { apiAddClient, queryContact } from '@/services/contact'
 import { LabelModeType } from '../Company/components/PersonLabel'
 import { apiBatchLink } from '@/services/customer'
-import ProForm, {
-  LightFilter,
-  ProFormText
-} from '_@ant-design_pro-form@1.22.1@@ant-design/pro-form'
 
 const Contact = props => {
   const { toggleDrawer, setDrawerProps } = useModal()
@@ -131,7 +127,8 @@ const Contact = props => {
           className="text-primary cursor-pointer hover:text-[#967bbd]">
           {clientName}
         </span>
-      )
+      ),
+      search: false
     },
     {
       title: '客户名称',
@@ -139,7 +136,8 @@ const Contact = props => {
       key: 'companyName',
       width: 150,
       ellipsis: true,
-      render: companyName => <a>{companyName}</a>
+      render: companyName => <a>{companyName}</a>,
+      search: false
     },
     {
       title: '部门',
@@ -165,7 +163,8 @@ const Contact = props => {
       title: 'QQ',
       dataIndex: 'qq',
       key: 'qq',
-      width: 75
+      width: 75,
+      search: false
     },
     {
       title: '邮箱',
@@ -492,12 +491,6 @@ const Contact = props => {
   }
   return (
     <div>
-      {/* <Card>
-        <LightFilter bordered onFinish={async values => console.log(values)}>
-          <ProFormText name="name1" label="联系人" search={{ filterType: 'light' }} />
-          <ProFormText name="name" label="省/市/区" />
-        </LightFilter>
-      </Card> */}
       <ProTable
         bordered
         params={state.params}
@@ -529,13 +522,13 @@ const Contact = props => {
           onChange: hanleRowSelectChange,
           type: 'checkbox'
         }}
-        // search={false}
-        search={{ filterType: 'light' }}
+        search={false}
+        // search={{ filterType: 'light' }}
         toolbar={{
-          // search: {
-          //   allowClear: true,
-          //   onSearch: handleSearch
-          // },
+          search: {
+            allowClear: true,
+            onSearch: handleSearch
+          },
           actions: [
             <LazyCascader onChange={onDistrictChange} changeOnSelect={true} key="lazyCascader" />,
             <Addcontact onConfirm={handleAddClient} key="addContactBtn" />