Przeglądaj źródła

Merge branch 'master' of http://192.168.1.41:3000/outaozhen/cldV2react

outaozhen 5 lat temu
rodzic
commit
574a898acc

+ 52 - 0
src/basic/css/common.scss

@@ -14,6 +14,32 @@
 }
 
 .zh-bg-red {
+
+  // 弹窗左右结构
+.sheet-box {
+  overflow: hidden;
+  .sheet-box-left {
+    height: calc(100vh - 25px);
+    overflow-y: auto;
+    .sheet-left-panel {
+      overflow-x: hidden;
+    }
+
+  }
+}
+.sheet-right-panel {
+  height: 280px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+.sheet-btns {
+  height: 54px;
+}
+.sheet-panel-record {
+  // height: 340px;
+  overflow-x: hidden;
+}
+
   background-color: $zh-red;
 }
 
@@ -423,3 +449,29 @@
 ::-webkit-scrollbar-thumb:hover{
   background: #636363;
 }
+
+
+// 弹窗左右结构
+.sheet-box {
+  overflow: hidden;
+  .sheet-box-left {
+    height: calc(100vh - 25px);
+    overflow-y: auto;
+    .sheet-left-panel {
+      overflow-x: hidden;
+    }
+
+  }
+}
+.sheet-right-panel {
+  height: 280px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+.sheet-btns {
+  height: 54px;
+}
+.sheet-panel-record {
+  // height: 340px;
+  overflow-x: hidden;
+}

+ 0 - 24
src/components/PopContent/index.scss

@@ -1,24 +0,0 @@
-// 弹窗左右结构
-.sheet-box {
-  overflow: hidden;
-  .sheet-box-left {
-    height: calc(100vh - 25px);
-    overflow-y: auto;
-    .sheet-left-panel {
-      overflow-x: hidden;
-    }
-
-  }
-}
-.sheet-right-panel {
-  height: 280px;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
-.sheet-btns {
-  height: 54px;
-}
-.sheet-panel-record {
-  // height: 340px;
-  overflow-x: hidden;
-}

+ 0 - 114
src/pages/Customer/Company/AddCompany/index.jsx

@@ -1,114 +0,0 @@
-import React from 'react'
-import { Form, Input, Modal, Row, Col, Select } from 'antd'
-import LazyCascader from '@/components/LazyCascader'
-import { useForm } from 'antd/lib/form/Form'
-
-const index =  props => {
-  const [form] = useForm()
-  const { visible, onCancel, onConfirm, loading } = props
-  const { Option } = Select
-  const layout = {
-    labelCol: { flex: "100px" }
-  }
-  return (
-    <div>
-      <Modal
-        title="添加客户"
-        width={800}
-        onCancel={onCancel}
-        visible={visible}
-        confirmLoading={loading}
-        onOk={() => {
-          form.validateFields().then(values => {
-            form.resetFields()
-            onConfirm(values)
-          })
-        }}
-        >
-        <Form {...layout} form={form} name="basic">
-          <Row>
-            <Col span={24}>
-              <Form.Item
-                label="公司全称"
-                name="companyName"
-                rules={[{ required: true, message: '公司全称' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="公司地区" name="" rules={[{ message: '公司地区' }]}>
-                <LazyCascader key="LazyCascader" />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="公司性质" name="gender" rules={[{ message: '公司性质' }]}>
-                <Select>
-                  <Option key="设计" value="设计">设计</Option>
-                  <Option key="咨询" value="咨询">咨询</Option>
-                </Select>
-              </Form.Item>
-            </Col>
-            <Col span={24}>
-              <Form.Item
-                label="公司地址"
-                name="address"
-                rules={[{ message: '公司地址' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item
-                label="公司传真"
-                name="fax"
-                rules={[{ message: '公司传真' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item
-                label="网址"
-                name="webservice"
-                rules={[{ message: '网址' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={24}>
-              <Form.Item
-                label="乘车路线"
-                name="ride"
-                rules={[{ message: '乘车路线' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={24}>
-              <Form.Item
-                label="地标建筑"
-                name="landmarks"
-                rules={[{ message: '地标建筑' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={24}>
-              <Form.Item
-                label="参考住宿"
-                name="stay"
-                rules={[{ message: '参考住宿' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={24}>
-              <Form.Item
-                label="备注"
-                name="remarks"
-                rules={[{ message: '备注' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-          </Row>
-        </Form>
-      </Modal>
-    </div>
-  )
-}
-
-export default index

+ 77 - 0
src/pages/Customer/Company/components/AddCompany/index.jsx

@@ -0,0 +1,77 @@
+import React, { useEffect } from 'react'
+import { Form, Row, Col, Button } from 'antd'
+import LazyCascader from '@/components/LazyCascader'
+import { ModalForm, ProFormSelect, ProFormText } from '@ant-design/pro-form'
+import { connect } from 'dva'
+import SvgIcon, { IconPark } from '@/components/SvgIcon'
+
+const AddCompany = props => {
+  const { natures, onConfirm, dispatch } = props
+  const layout = {
+    layout: 'horizontal',
+    labelCol: { flex: '100px' }
+  }
+  useEffect(() => {
+    const getNatures = () => {
+      dispatch({
+        type: 'customer/fetch'
+      })
+    }
+    !natures.length && getNatures()
+  }, [])
+  return (
+    <ModalForm
+      title="添加客户"
+      {...layout}
+      trigger={
+        <Button key="button" type="primary">
+          <IconPark type="plus" theme="filled" />
+          <span>客户</span>
+        </Button>
+      }
+      onFinish={async values => {
+        await onConfirm(values)
+        return true
+      }}>
+      <ProFormText
+        name="companyName"
+        label="公司全称"
+        rules={[{ required: true, message: '请输入公司全称' }]}
+      />
+      <Row>
+        <Col span={10}>
+          <Form.Item
+            label="公司地区"
+            name="district"
+            rules={[{ required: true, message: '请选择公司地区' }]}>
+            <LazyCascader />
+          </Form.Item>
+        </Col>
+        <Col span={14}>
+          <ProFormSelect label="公司性质" name="natureIds" options={natures} mode="multiple" />
+        </Col>
+      </Row>
+      <ProFormText
+        name="address"
+        label="公司地址"
+        rules={[{ required: true, message: '请填写公司地址' }]}
+      />
+      <Row>
+        <Col span={12}>
+          <ProFormText name="fax" label="公司传真" />
+        </Col>
+        <Col span={12}>
+          <ProFormText name="webservice" label="网址" />
+        </Col>
+      </Row>
+      <ProFormText name="ride" label="乘车路线" />
+      <ProFormText name="landmarks" label="地标建筑" />
+      <ProFormText name="stay" label="参考住宿" />
+      <ProFormText name="remarks" label="备注" />
+    </ModalForm>
+  )
+}
+
+export default connect(({ customer }) => ({
+  natures: customer.natures
+}))(AddCompany)

src/components/PopContent/Companys/CompanyForm.jsx → src/pages/Customer/Company/components/CompanyDetail/CompanyForm.jsx


src/components/PopContent/Companys/CompanyLowerList.jsx → src/pages/Customer/Company/components/CompanyDetail/CompanyLowerList.jsx


src/components/PopContent/Companys/CompanyTabList.jsx → src/pages/Customer/Company/components/CompanyDetail/CompanyTabList.jsx


+ 3 - 4
src/components/PopContent/Companys/index.jsx

@@ -1,12 +1,11 @@
 import React, { useState, useEffect } from 'react'
-import '../index.scss'
 import { Drawer, Row, Col } from 'antd'
 import useAutoTable from '@/hooks/useAutoTable'
 import consts from '@/consts'
 import { apiCompanyDetail } from '@/services/company'
-import CompanyForm from '@/components/PopContent/Companys/CompanyForm'
-import CompanyLowerList from '@/components/PopContent/Companys/CompanyLowerList'
-import CompanyTabList from '@/components/PopContent/Companys/CompanyTabList'
+import CompanyForm from '@/pages/Customer/Company/components/CompanyDetail/CompanyForm'
+import CompanyLowerList from '@/pages/Customer/Company/components/CompanyDetail/CompanyLowerList'
+import CompanyTabList from '@/pages/Customer/Company/components/CompanyDetail/CompanyTabList'
 import { connect } from 'dva'
 
 const Index = props => {

+ 8 - 28
src/pages/Customer/Company/index.jsx

@@ -1,14 +1,14 @@
 import React, { useState, useEffect } from 'react'
 import ProTable from '@ant-design/pro-table'
 import useAutoTable from '@/hooks/useAutoTable'
-import SvgIcon from '@/components/SvgIcon'
-import { Button, message } from 'antd'
+import { message } from 'antd'
 import consts from '@/consts'
 import { queryCompany, apiAddCompany } from '@/services/company'
 import LazyCascader from '@/components/LazyCascader'
-import Companys from '@/components/PopContent/Companys'
-import AddCompany from '@/pages/Customer/Company/AddCompany'
+import Companys from '@/pages/Customer/Company/components/CompanyDetail'
+import AddCompany from '@/pages/Customer/Company/components/AddCompany'
 import { useModal } from '@/components/Modal'
+import { formatValues } from '@/components/LazyCascader'
 
 const Company = props => {
   const { toggleDrawer, setDrawerProps } = useModal()
@@ -39,7 +39,8 @@ const Company = props => {
   }
   const handleAddCompany = async values => {
     setAddCompany({ ...addCompany, loading: true })
-    const { code = -1 } = await apiAddCompany(values)
+    const params = formatValues(values)
+    const { code = -1 } = await apiAddCompany(params)
     if (code === consts.RET_CODE.SUCCESS) {
       message.success('新增成功')
       setState({ ...state, data: values })
@@ -50,7 +51,6 @@ const Company = props => {
   }
 
   useEffect(() => {
-    // props.getlist();
     initData()
   }, [])
   const handleSearch = value => {
@@ -75,13 +75,6 @@ const Company = props => {
     toggleDrawer()
   }
 
-  // 隐藏drawer
-  // const hideDrawer = () => {
-  //   setState({ ...state, visible: false, id: '' })
-  // }
-  // const onCreate = values => {
-  //   console.log(values)
-  // }
   const columns = [
     {
       title: '客户名称',
@@ -202,14 +195,8 @@ const Company = props => {
             onSearch: handleSearch
           },
           actions: [
-            <LazyCascader onChange={onDistrictChange} key="LazyCascader" />,
-            <Button
-              key="button"
-              type="primary"
-              onClick={() => setAddCompany({ ...addCompany, visible: true })}>
-              <SvgIcon type="icon-plus" />
-              客户
-            </Button>
+            <LazyCascader onChange={onDistrictChange} key="lazyCascader" />,
+            <AddCompany onConfirm={handleAddCompany} key="addCompanyBtn" />
           ]
         }}
         scroll={{ x, y }}
@@ -223,13 +210,6 @@ const Company = props => {
           onChange: (page, size) => initData({ page, size })
         }}
       />
-      <AddCompany
-        onConfirm={handleAddCompany}
-        loading={addCompany.loading}
-        visible={addCompany.visible}
-        onCancel={() => setAddCompany({ ...addCompany, visible: false })}
-      />
-      {/* <Companys onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} /> */}
     </div>
   )
 }

+ 64 - 126
src/pages/Customer/Contact/components/AddContact/index.jsx

@@ -1,137 +1,75 @@
-import React, { useEffect } from 'react'
-import { Form, Input, Modal, Row, Col, Select } from 'antd'
+import React from 'react'
+import { Form, Row, Col, Button } from 'antd'
 import LazyCascader, { validCascaderRule } from '@/components/LazyCascader'
-import { useForm } from 'antd/lib/form/Form'
-import { formatValues } from '@/components/LazyCascader'
+import { ModalForm, ProFormSelect, ProFormText } from '@ant-design/pro-form'
+import { IconPark } from '@/components/SvgIcon'
 
 const Addcontact = props => {
-  const [form] = useForm()
-  const { visible, onCancel, onConfirm, loading } = props
-  const { Option } = Select
+  const { onConfirm } = props
   const layout = {
+    layout: 'horizontal',
     labelCol: { flex: '100px' }
   }
-  function handleChange(value) {
-    console.log(`selected ${value}`)
-  }
 
-  useEffect(() => {
-    if (visible) {
-      form.resetFields()
-    }
-  }, [])
   return (
-    <div>
-      <Modal
-        title="添加联系人"
-        width={800}
-        onCancel={onCancel}
-        visible={visible}
-        confirmLoading={loading}
-        onOk={() => {
-          form.validateFields().then(values => {
-            const params = formatValues(values)
-            onConfirm(params)
-          })
-        }}>
-        <Form {...layout} form={form} name="basic">
-          <Row>
-            <Col span={24}>
-              <Form.Item
-                label="姓名"
-                name="clientName"
-                rules={[{ required: true, message: '请输入姓名' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            {/* <Col span={12} /> */}
-            <Col span={12}>
-              <Form.Item
-                label="联系人地区"
-                name="district"
-                rules={[
-                  { required: true, message: '请选择地区' },
-                  { validator: validCascaderRule }
-                ]}>
-                <LazyCascader />
-              </Form.Item>
-            </Col>
-            <Col span={12} />
-            <Col span={12}>
-              <Form.Item
-                label="性别"
-                name="gender"
-                rules={[{ required: true, message: '请选择性别' }]}>
-                <Select onChange={handleChange}>
-                  <Option key="男" value="男">
-                    男
-                  </Option>
-                  <Option key="女" value="女">
-                    女
-                  </Option>
-                </Select>
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="昵称" name="niceName">
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item
-                label="手机"
-                name="telephone"
-                rules={[{ required: true, message: '请输入手机号码' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="QQ" name="qq" rules={[{ required: true, message: '请输入QQ号码' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item
-                label="电话"
-                name="phone"
-                rules={[{ required: true, message: '请输入电话/座机号' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="邮箱" name="email" rules={[{ required: true, message: '邮箱' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="联系人地址" name="address" rules={[{ message: '联系人地址' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="联系人乘车" name="ride" rules={[{ message: '联系人乘车' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="联系人地标" name="landmarks" rules={[{ message: '联系人地标' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item label="联系人住宿" name="stay" rules={[{ message: '联系人住宿' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-            <Col span={24}>
-              <Form.Item label="备注" name="mark" rules={[{ message: '备注' }]}>
-                <Input />
-              </Form.Item>
-            </Col>
-          </Row>
-        </Form>
-      </Modal>
-    </div>
+    <ModalForm
+      {...layout}
+      title="添加联系人"
+      trigger={
+        <Button key="button" type="primary">
+          <IconPark type="plus" />
+          联系人
+        </Button>
+      }
+      onFinish={async values => {
+        await onConfirm(values)
+        return true
+      }}>
+      <ProFormText
+        name="clientName"
+        label="姓名"
+        rules={[{ required: true, message: '请输入姓名' }]}
+      />
+      <Form.Item
+        label="联系人地区"
+        name="district"
+        rules={[{ required: true, message: '请选择地区' }, { validator: validCascaderRule }]}>
+        <LazyCascader />
+      </Form.Item>
+      <Row>
+        <Col span={12}>
+          <ProFormSelect
+            name="gender"
+            label="性别"
+            rules={[{ required: true, message: '请选择性别' }]}
+            options={[
+              { label: '男', value: '男' },
+              { label: '女', value: '女' }
+            ]}
+          />
+          <ProFormText
+            label="手机"
+            name="telephone"
+            rules={[{ required: true, message: '请输入手机号码' }]}
+          />
+          <ProFormText
+            label="电话"
+            name="phone"
+            rules={[{ required: true, message: '请输入电话/座机号' }]}
+          />
+          <ProFormText label="联系人地址" name="address" />
+          <ProFormText label="联系人地标" name="landmarks" />
+        </Col>
+        <Col span={12}>
+          <ProFormText label="昵称" name="niceName" />
+          <ProFormText label="QQ" name="qq" />
+          <ProFormText label="邮箱" name="email" />
+          <ProFormText label="联系人乘车" name="ride" />
+          <ProFormText label="联系人住宿" name="stay" />
+        </Col>
+      </Row>
+      <ProFormText label="备注" name="remakrs" />
+    </ModalForm>
   )
 }
 

src/components/Modal/src/components/addCustomerModal/index.jsx → src/pages/Customer/Contact/components/AddCustomerModal/index.jsx


+ 1 - 1
src/pages/Customer/Contact/components/ChangeCompany/index.jsx

@@ -3,7 +3,7 @@ import { IconPark } from '@/components/SvgIcon'
 import { Card, Tooltip } from 'antd'
 import React from 'react'
 import styles from './index.less'
-import SearchModal from '@/components/Modal/src/components/customerModal'
+import SearchModal from '@/pages/Customer/Contact/components/CustomerModal'
 import { apiDelCustomer } from '@/services/contact'
 import { useDispatch } from 'dva'
 import consts from '@/consts'

src/components/PopContent/Contacts/AddRecord.jsx → src/pages/Customer/Contact/components/ContactDetail/AddRecord.jsx


src/components/PopContent/Contacts/ContanctForm.jsx → src/pages/Customer/Contact/components/ContactDetail/ContanctForm.jsx


src/components/PopContent/Contacts/ContanctLowerList.jsx → src/pages/Customer/Contact/components/ContactDetail/ContanctLowerList.jsx


src/components/PopContent/Contacts/ContanctTabList.jsx → src/pages/Customer/Contact/components/ContactDetail/ContanctTabList.jsx


+ 22 - 23
src/components/PopContent/Contacts/index.jsx

@@ -1,9 +1,8 @@
-import { Row, Col } from 'antd'
+import { Row, Col, Spin } from 'antd'
 import React, { useState, useEffect } from 'react'
-import '../index.scss'
-import ContanctForm from '@/components/PopContent/Contacts/ContanctForm.jsx'
-import ContanctTabList from '@/components/PopContent/Contacts/ContanctTabList.jsx'
-import ContanctLowerList from '@/components/PopContent/Contacts/ContanctLowerList.jsx'
+import ContanctForm from '@/pages/Customer/Contact/components/ContactDetail/ContanctForm.jsx'
+import ContanctTabList from '@/pages/Customer/Contact/components/ContactDetail/ContanctTabList.jsx'
+import ContanctLowerList from '@/pages/Customer/Contact/components/ContactDetail/ContanctLowerList.jsx'
 import { apiContactDetail } from '@/services/contact'
 import consts from '@/consts'
 import { connect } from 'dva'
@@ -12,12 +11,14 @@ const PopContent = props => {
   const { dispatch, shouldUpdate, visible, id = '' } = props
 
   const [state, setState] = useState({
+    loading: false,
     client: {},
     log: [],
     serviceLog: []
   })
 
   const initData = async () => {
+    setState({ ...state, loading: true })
     const {
       data: { client = {}, log = [], serviceLog = [] },
       code = -1
@@ -29,7 +30,7 @@ const PopContent = props => {
           payload: 'contact'
         })
       }
-      setState({ ...state, client, log, serviceLog })
+      setState({ ...state, client, log, serviceLog, loading: false })
     }
   }
   useEffect(() => {
@@ -41,23 +42,21 @@ const PopContent = props => {
     visible && initData()
   }, [])
   return (
-    <div className="sheet-box">
-      <Row>
-        <Col span={12} className="sheet-box-left">
-          <div className="sheet-left-panel zh-pd-right-15">
-            <ContanctForm client={state.client} />
-          </div>
-        </Col>
-        <Col span={12}>
-          <ContanctTabList />
-          <ContanctLowerList
-            log={state.log}
-            clientId={state.client.id}
-            servicelist={state.serviceLog}
-          />
-        </Col>
-      </Row>
-    </div>
+    <Spin spinning={state.loading}>
+      <div className="sheet-box">
+        <Row>
+          <Col span={12} className="sheet-box-left">
+            <div className="sheet-left-panel zh-pd-right-15">
+              <ContanctForm client={state.client} />
+            </div>
+          </Col>
+          <Col span={12}>
+            <ContanctTabList />
+            <ContanctLowerList log={state.log} servicelist={state.serviceLog} />
+          </Col>
+        </Row>
+      </div>
+    </Spin>
   )
 }
 

+ 1 - 1
src/components/Modal/src/components/customerModal/index.jsx

@@ -4,7 +4,7 @@ import styles from './index.less'
 import { SearchOutlined, CloseOutlined } from '@ant-design/icons'
 import { useDebounceFn, useThrottleFn } from 'ahooks'
 import { useDispatch } from 'dva'
-import AddCustomerModal from '../addCustomerModal'
+import AddCustomerModal from '../AddCustomerModal'
 import { createCustomer, queryCustomers } from '@/services/customer'
 import consts from '@/basic/consts'
 import { formatValues } from '@/components/LazyCascader'

src/components/Modal/src/components/customerModal/index.less → src/pages/Customer/Contact/components/CustomerModal/index.less


+ 22 - 31
src/pages/Customer/Contact/index.jsx

@@ -1,11 +1,10 @@
-import Contacts from '@/components/PopContent/Contacts'
+import Contacts from '@/pages/Customer/Contact/components/ContactDetail'
 import Addcontact from '@/pages/Customer/Contact/components/AddContact'
 import ProTable from '@ant-design/pro-table'
 // import { PageHeaderWrapper } from '@ant-design/pro-layout';
-import { Button, message, Tag } from 'antd'
+import { message, Tag } from 'antd'
 import { connect } from 'dva'
 import React, { useEffect, useState } from 'react'
-import SvgIcon from '@/components/SvgIcon'
 import useAutoTable from '@/hooks/useAutoTable'
 import consts from '@/consts'
 import { queryContact, apiAddClient } from '@/services/contact'
@@ -13,6 +12,7 @@ import styles from './index.less'
 import LazyCascader from '@/components/LazyCascader'
 import { useDebounceFn } from 'ahooks'
 import { useModal } from '@/components/Modal'
+import { formatValues } from '@/components/LazyCascader'
 
 const Contact = props => {
   const { toggleDrawer, setDrawerProps } = useModal()
@@ -28,39 +28,33 @@ const Contact = props => {
     servicelog: [],
     total: 0,
     id: '',
-    visible: false
-  })
-  const [addClient, setAddClient] = useState({
-    visible: false,
-    loading: false
+    tail: { department: 0, email: 0, telephone: 0 }
   })
+
   const initData = async payload => {
     const {
       code = -1,
-      data: { client = [], log = [], serviceLog = [], total = 0 } = {
+      data: { client = [], log = [], serviceLog = [], total = 0, tail } = {
         client: [],
         log: [],
         serviceLog: [],
-        total: 0
+        total: 0,
+        tail: { department: 0, email: 0, telephone: 0 }
       }
     } = await queryContact(payload)
     if (code === consts.RET_CODE.SUCCESS) {
-      setState({ ...state, data: client, journal: log, servicelist: serviceLog, total })
-      if (addClient.visible) {
-        setAddClient({ ...addClient, loading: false, visible: false })
-      }
+      setState({ ...state, data: client, journal: log, servicelist: serviceLog, total, tail })
     }
   }
 
   const handleAddClient = async values => {
-    setAddClient({ ...addClient, loading: true })
-    const { code = -1 } = await apiAddClient(values)
+    const payload = formatValues(values)
+    const { code = -1 } = await apiAddClient(payload)
     if (code === consts.RET_CODE.SUCCESS) {
       await initData()
       return message.success('新增成功')
     }
     // 请求完了
-    setAddClient({ ...addClient, loading: false })
   }
 
   // 展示drawer
@@ -369,6 +363,15 @@ const Contact = props => {
           // size="middle"
           columns={columns}
           dataSource={state.data}
+          summary={() => (
+            <ProTable.Summary.Row>
+              <ProTable.Summary.Cell>统计: 总数</ProTable.Summary.Cell>
+              <ProTable.Summary.Cell />
+              <ProTable.Summary.Cell>未填写: {state.tail.department}</ProTable.Summary.Cell>
+              <ProTable.Summary.Cell>未填写: {state.tail.telephone}</ProTable.Summary.Cell>
+              <ProTable.Summary.Cell>未填写: {state.tail.email}</ProTable.Summary.Cell>
+            </ProTable.Summary.Row>
+          )}
           pagination={{
             pageSize: consts.PAGE_SIZE,
             total: state.total,
@@ -382,14 +385,8 @@ const Contact = props => {
               onChange: handleSearchInputChange
             },
             actions: [
-              <LazyCascader onChange={onDistrictChange} key="LazyCascader" />,
-              <Button
-                key="button"
-                type="primary"
-                onClick={() => setAddClient({ ...addClient, visible: true })}>
-                <SvgIcon type="icon-plus" />
-                联系人
-              </Button>
+              <LazyCascader onChange={onDistrictChange} key="lazyCascader" />,
+              <Addcontact onConfirm={handleAddClient} key="addContactBtn" />
             ]
           }}
           scroll={{ x, y }}
@@ -404,12 +401,6 @@ const Contact = props => {
           // ]}
         />
       </div>
-      <Addcontact
-        onConfirm={handleAddClient}
-        loading={addClient.loading}
-        visible={addClient.visible}
-        onCancel={() => setAddClient({ ...addClient, visible: false })}
-      />
     </>
   )
 }

+ 1 - 1
src/pages/Customer/Test/index.jsx

@@ -3,7 +3,7 @@ import { Button, Card, Cascader, Dropdown, Input, Menu, Select } from 'antd'
 import EditableForm from '@/components/EditableForm'
 import { useModal } from '@/components/Modal'
 import { connect } from 'dva'
-import SearchModal from '@/components/Modal/src/components/customerModal'
+import SearchModal from '@/pages/Customer/Contact/components/CustomerModal'
 import ChangeCompanyInput from '../Contact/components/ChangeCompany'
 
 const { Option } = Select

+ 3 - 5
src/services/company.js

@@ -25,11 +25,9 @@ export async function apiCompanyDetail(id) {
 
 /**
  * 新增客户
- * @param {string} id 联系人记录id
+ * @param {string} data
  */
-export async function apiAddCompany(id) {
-  const params = { id }
-  const data = await request('/api/customer/add', { params })
+export async function apiAddCompany(payload) {
+  const data = await request.post('/api/customer/add', { data: payload })
   return data
 }
-