outaozhen пре 5 година
родитељ
комит
0080f38bec

+ 22 - 5
src/pages/Customer/Company/components/CompanyDetail/CompanyTabList.jsx

@@ -1,9 +1,25 @@
-import React from 'react'
-import { Tabs, Button } from 'antd'
-import SvgIcon from '@/components/SvgIcon'
+import React, { useRef } from 'react'
+import { Tabs, Button, 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 = () => {
   const { TabPane } = Tabs
+  const tRef = useRef()
+  const initData = () => {
+    tRef.current.reset()
+  }
+  const handleAddClient = async values => {
+    const payload = formatValues(values)
+    const { code = -1, msg = '新增失败' } = await apiAddClient(payload)
+    if (code === consts.RET_CODE.SUCCESS) {
+      message.success(msg)
+      initData()
+    }
+  }
   return (
     <div>
       <div className="zh-pd-left-15">
@@ -23,14 +39,15 @@ const CompanyTabList = () => {
         {/* <Button type="primary" ghost>
           <SvgIcon type="icon-link" /> 绑定加密锁
         </Button> */}
-        <Button
+        {/* <Button
           type="primary"
           ghost
           size="small"
           // onClick={() => setAddService({ ...setAddService, visible: true })}
         >
           <SvgIcon type="icon-plus" /> 添加联系人
-        </Button>
+        </Button> */}
+        <Addcontact onConfirm={handleAddClient} key="addContactBtn" />
       </div>
     </div>
   )

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

@@ -171,26 +171,26 @@ const Contact = props => {
       title: '职务',
       dataIndex: 'position',
       key: 'position',
-      width: 25
+      width: 75
     },
     {
       title: '办公室',
       dataIndex: 'office',
       key: 'office',
-      width: 25,
+      width: 75,
       ellipsis: true
     },
     {
       title: '地区',
       dataIndex: 'local',
       key: 'local',
-      width: 25
+      width: 75
     },
     {
       title: '个人标签',
       dataIndex: 'tagIds',
       key: 'tagIds',
-      width: 100,
+      width: 60,
       render: (_, record) => (
         <div className="zh-align-center zh-flex-wrap">
           {record.tagIds.map(item => (
@@ -220,7 +220,7 @@ const Contact = props => {
       title: '协作标签',
       dataIndex: 'tagCooperationIds',
       key: 'tagCooperationIds',
-      width: 100,
+      width: 60,
       render: (_, record) => (
         <div className="zh-align-center zh-flex-wrap">
           {record.tagCooperationIds.map(item => (
@@ -257,7 +257,7 @@ const Contact = props => {
       dataIndex: 'ride',
       key: 'ride',
       ellipsis: true,
-      width: 25
+      width: 50
     },
     {
       title: '地标',

+ 4 - 6
src/pages/Product/Lock/Lockstore/index.jsx

@@ -1,12 +1,12 @@
 import React, { useState, useEffect } from 'react'
 import { Tag } from 'antd'
 import ProTable from '@ant-design/pro-table'
-import useAutoTable from '@/hooks/useAutoTable'
 import consts from '@/consts'
 import { queryLock } from '@/services/lock'
 import LocksDetail from '@/pages/product/lock/Lockstore/components/LocksDetail'
 import { useDebounceFn } from 'ahooks'
 import { useModal } from '@/components/Modal'
+import { useTableScroll } from '@/hooks/useAutoTable'
 
 // 渲染产品标签
 export const ProductLabel = ({ data }) => {
@@ -27,11 +27,8 @@ export const ProductLabel = ({ data }) => {
 }
 
 const Lockstore = () => {
+  const [selectKeys, setSelectKeys] = useState([])
   const { toggleDrawer, setDrawerProps } = useModal()
-  const needSubtractHeight = 48 + 48 + 48 + 64 + 24 + 32 // 需要被裁掉的高度
-  const needSubtractWidth = 48 + 48 + 48 // 需要被裁掉的高度
-
-  const [x, y] = useAutoTable(needSubtractHeight, needSubtractWidth)
   const [state, setState] = useState({
     data: [],
     total: 0,
@@ -132,6 +129,7 @@ const Lockstore = () => {
       width: 150
     }
   ]
+  const { getScrollRef } = useTableScroll(columns, selectKeys)
   return (
     <div>
       <ProTable
@@ -141,7 +139,7 @@ const Lockstore = () => {
         bordered
         columns={columns}
         dataSource={state.data}
-        scroll={{ x, y }}
+        scroll={getScrollRef}
         toolbar={{
           search: {
             allowClear: true,