Просмотр исходного кода

提交添加联系人接入接口

outaozhen 5 лет назад
Родитель
Сommit
290e3c461b
3 измененных файлов с 16 добавлено и 4 удалено
  1. 1 1
      src/pages/Customer/Company/index.jsx
  2. 6 3
      src/pages/Customer/Contact/index.jsx
  3. 9 0
      src/services/contact.js

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

@@ -8,7 +8,7 @@ const Company = () => {
     <Card bordered={false}>
     <Card bordered={false}>
       <Form>
       <Form>
         <Form.Item label="姓名">
         <Form.Item label="姓名">
-          <EditableFormItem dataIndex="name" record="哈哈哈哈哈哈">
+          <EditableFormItem dataIndex="name" record="">
             哈哈哈哈哈哈
             哈哈哈哈哈哈
           </EditableFormItem>
           </EditableFormItem>
         </Form.Item>
         </Form.Item>

+ 6 - 3
src/pages/Customer/Contact/index.jsx

@@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react'
 import SvgIcon from '@/components/SvgIcon'
 import SvgIcon from '@/components/SvgIcon'
 import useAutoTable from '@/hooks/useAutoTable'
 import useAutoTable from '@/hooks/useAutoTable'
 import consts from '@/consts'
 import consts from '@/consts'
-import { queryContact } from '@/services/contact'
+import { queryContact,apiAddClient } from '@/services/contact'
 import styles from './index.less'
 import styles from './index.less'
 import LazyCascader from '@/components/LazyCascader'
 import LazyCascader from '@/components/LazyCascader'
 
 
@@ -33,7 +33,10 @@ const Contact = props => {
 
 
   const handleAddClient = async (values) => {
   const handleAddClient = async (values) => {
     setAddClient({ ...addClient, loading: true })
     setAddClient({ ...addClient, loading: true })
-    // const xx =
+    const { code = -1 } = await apiAddClient(values)
+    if (code === consts.RET_CODE.SUCCESS) {
+      setState({ ...state, data:values })
+    }
     // 请求完了
     // 请求完了
     setAddClient({ ...addClient, loading: false, visible: false })
     setAddClient({ ...addClient, loading: false, visible: false })
     await initData()
     await initData()
@@ -360,7 +363,7 @@ const Contact = props => {
             },
             },
             actions: [
             actions: [
               <LazyCascader onSelect={handleOnselect} key="LazyCascader" />,
               <LazyCascader onSelect={handleOnselect} key="LazyCascader" />,
-              <Button key="button" type="primary" onClick={() => setVisible(true)}>
+              <Button key="button" type="primary" onClick={() => setAddClient({ ...addClient, visible: true })}>
                 <SvgIcon type="icon-plus" />
                 <SvgIcon type="icon-plus" />
                 联系人
                 联系人
               </Button>
               </Button>

+ 9 - 0
src/services/contact.js

@@ -31,3 +31,12 @@ export async function apiUpdateContract(payload) {
   const data = await request.post('/api/client/update', { data: { ...payload } })
   const data = await request.post('/api/client/update', { data: { ...payload } })
   return data
   return data
 }
 }
+
+/**
+ * 新增联系人
+ * @param {*} payload 载荷
+ */
+export async function apiAddClient(payload) {
+  const data = await request.post('/api/client/add',{ data:{ ...payload } })
+  return data
+}