|
@@ -1,7 +1,6 @@
|
|
|
import ContactDetail from '@/pages/Customer/Client/components/ClientDetail'
|
|
import ContactDetail from '@/pages/Customer/Client/components/ClientDetail'
|
|
|
import CompanyDetail from '@/pages/Customer/Company/components/CompanyDetail'
|
|
import CompanyDetail from '@/pages/Customer/Company/components/CompanyDetail'
|
|
|
import AddClient from '@/pages/Customer/Client/components/AddClient'
|
|
import AddClient from '@/pages/Customer/Client/components/AddClient'
|
|
|
-import ProTable from '@ant-design/pro-table'
|
|
|
|
|
import { Input, Button, message, Tooltip } from 'antd'
|
|
import { Input, Button, message, Tooltip } from 'antd'
|
|
|
import { connect, useModel } from 'umi'
|
|
import { connect, useModel } from 'umi'
|
|
|
import React, { useEffect, useState, useRef, useMemo } from 'react'
|
|
import React, { useEffect, useState, useRef, useMemo } from 'react'
|
|
@@ -16,13 +15,12 @@ import {
|
|
|
LabelModeType
|
|
LabelModeType
|
|
|
} from '../Company/components/PersonLabel/const'
|
|
} from '../Company/components/PersonLabel/const'
|
|
|
import { Add, Down, Check } from '@icon-park/react'
|
|
import { Add, Down, Check } from '@icon-park/react'
|
|
|
-import { useTableScroll } from '@/hooks/useAutoTable'
|
|
|
|
|
import { apiAddClient, queryClient } from '@/services/customer'
|
|
import { apiAddClient, queryClient } from '@/services/customer'
|
|
|
import { apiBatchLink } from '@/services/customer'
|
|
import { apiBatchLink } from '@/services/customer'
|
|
|
import styles from './index.less'
|
|
import styles from './index.less'
|
|
|
import { refactorSortField } from '@/utils/utils'
|
|
import { refactorSortField } from '@/utils/utils'
|
|
|
-import PermSelect from '../Company/components/PermSelect'
|
|
|
|
|
import { PermDataTypeEunm } from '../Company/components/PermSelect'
|
|
import { PermDataTypeEunm } from '../Company/components/PermSelect'
|
|
|
|
|
+import BasicTable from '@/components/Table'
|
|
|
|
|
|
|
|
const Client = props => {
|
|
const Client = props => {
|
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
@@ -85,25 +83,19 @@ const Client = props => {
|
|
|
setTagState({ ...tagState, [type]: ids })
|
|
setTagState({ ...tagState, [type]: ids })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const [selectKeys, setSelectKeys] = useState([])
|
|
|
|
|
- const hanleRowSelectChange = selectedRowKeys => {
|
|
|
|
|
- setSelectKeys(selectedRowKeys)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
- params: { dataPermission: 'oneself', staffIds: null },
|
|
|
|
|
- id: '',
|
|
|
|
|
|
|
+ params: {},
|
|
|
orderIds: []
|
|
orderIds: []
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 重置到默认值,包括表单
|
|
// 重置到默认值,包括表单
|
|
|
const initData = () => {
|
|
const initData = () => {
|
|
|
- tRef.current.reset()
|
|
|
|
|
|
|
+ tRef.current?.reset()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 刷新
|
|
// 刷新
|
|
|
const refreshData = () => {
|
|
const refreshData = () => {
|
|
|
- tRef.current.reload()
|
|
|
|
|
|
|
+ tRef.current?.reload()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleAddClient = async values => {
|
|
const handleAddClient = async values => {
|
|
@@ -374,7 +366,7 @@ const Client = props => {
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
- const [columnsStateMap, setColumnsStateMap] = useState({
|
|
|
|
|
|
|
+ const columnsStateMap = {
|
|
|
phone: {
|
|
phone: {
|
|
|
show: false
|
|
show: false
|
|
|
},
|
|
},
|
|
@@ -411,9 +403,7 @@ const Client = props => {
|
|
|
staffName: {
|
|
staffName: {
|
|
|
show: false
|
|
show: false
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- const { getScrollRef, redoHeight } = useTableScroll(columns, selectKeys)
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 默认刷新一次列表请求数据
|
|
// 默认刷新一次列表请求数据
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -475,15 +465,6 @@ const Client = props => {
|
|
|
requestSuccess && refreshData()
|
|
requestSuccess && refreshData()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 处理权限Select下拉组件OnChange事件
|
|
|
|
|
- const handlePermChange = ({ staffIds = [], dataPermission }) => {
|
|
|
|
|
- if (staffIds?.length) {
|
|
|
|
|
- setState({ ...state, params: { ...state.params, staffIds, dataPermission: null } })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- setState({ ...state, params: { ...state.params, staffIds: null, dataPermission } })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
const renderTableAlert = ({ selectedRowKeys }) => {
|
|
const renderTableAlert = ({ selectedRowKeys }) => {
|
|
|
return (
|
|
return (
|
|
|
<div className="flex flex-row">
|
|
<div className="flex flex-row">
|
|
@@ -546,8 +527,9 @@ const Client = props => {
|
|
|
}
|
|
}
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.contactContent}>
|
|
<div className={styles.contactContent}>
|
|
|
- <ProTable
|
|
|
|
|
- bordered
|
|
|
|
|
|
|
+ <BasicTable
|
|
|
|
|
+ mainMenuType="customer"
|
|
|
|
|
+ columnStateType="CLIENT"
|
|
|
params={state.params}
|
|
params={state.params}
|
|
|
actionRef={tRef}
|
|
actionRef={tRef}
|
|
|
rowKey={record => record.id}
|
|
rowKey={record => record.id}
|
|
@@ -567,7 +549,6 @@ const Client = props => {
|
|
|
}}
|
|
}}
|
|
|
tableAlertRender={renderTableAlert}
|
|
tableAlertRender={renderTableAlert}
|
|
|
rowSelection={{
|
|
rowSelection={{
|
|
|
- onChange: hanleRowSelectChange,
|
|
|
|
|
type: 'checkbox',
|
|
type: 'checkbox',
|
|
|
columnWidth: 25
|
|
columnWidth: 25
|
|
|
}}
|
|
}}
|
|
@@ -604,15 +585,7 @@ const Client = props => {
|
|
|
/>
|
|
/>
|
|
|
]
|
|
]
|
|
|
}}
|
|
}}
|
|
|
- headerTitle={
|
|
|
|
|
- <PermSelect onConfirm={handlePermChange} dataType={PermDataTypeEunm.CUSTOMER} />
|
|
|
|
|
- }
|
|
|
|
|
- onLoadingChange={loadingStatus => {
|
|
|
|
|
- loadingStatus && redoHeight()
|
|
|
|
|
- }}
|
|
|
|
|
- scroll={getScrollRef}
|
|
|
|
|
columnsStateMap={columnsStateMap}
|
|
columnsStateMap={columnsStateMap}
|
|
|
- onColumnsStateChange={map => setColumnsStateMap(map)}
|
|
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|