|
@@ -3,7 +3,7 @@ import React, { useState, useEffect, useRef } from 'react'
|
|
|
import styles from './index.less'
|
|
import styles from './index.less'
|
|
|
import { SearchOutlined } from '@ant-design/icons'
|
|
import { SearchOutlined } from '@ant-design/icons'
|
|
|
import { useDebounceFn } from 'ahooks'
|
|
import { useDebounceFn } from 'ahooks'
|
|
|
-import { useDispatch } from 'umi'
|
|
|
|
|
|
|
+import { useDispatch, useAccess } from 'umi'
|
|
|
import AddCompany from '@/pages/Customer/Company/components/AddCompany'
|
|
import AddCompany from '@/pages/Customer/Company/components/AddCompany'
|
|
|
import { createCustomer, queryCustomers } from '@/services/customer'
|
|
import { createCustomer, queryCustomers } from '@/services/customer'
|
|
|
import consts from '@/basic/consts'
|
|
import consts from '@/basic/consts'
|
|
@@ -12,6 +12,7 @@ import { apiChangeCustomer } from '@/services/customer'
|
|
|
import CustomModal from '@/components/Modal/src/components/CustomModal'
|
|
import CustomModal from '@/components/Modal/src/components/CustomModal'
|
|
|
|
|
|
|
|
const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
|
|
|
+ const hasAddPerm = useAccess()?.validatePermByType('company_add')
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
const scrollRef = useRef()
|
|
const scrollRef = useRef()
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
@@ -108,12 +109,14 @@ const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
|
placeholder="输入单位名称搜索"
|
|
placeholder="输入单位名称搜索"
|
|
|
onChange={handleInputChange}
|
|
onChange={handleInputChange}
|
|
|
/>
|
|
/>
|
|
|
- }>
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
<div
|
|
<div
|
|
|
className={styles.modalContent}
|
|
className={styles.modalContent}
|
|
|
ref={scrollRef}
|
|
ref={scrollRef}
|
|
|
onScroll={handleListScroll}
|
|
onScroll={handleListScroll}
|
|
|
- style={{ paddingBottom: 0 }}>
|
|
|
|
|
|
|
+ style={{ paddingBottom: 0 }}
|
|
|
|
|
+ >
|
|
|
<Spin spinning={state.laoding}>
|
|
<Spin spinning={state.laoding}>
|
|
|
{state.customer.map(item => (
|
|
{state.customer.map(item => (
|
|
|
<div key={item.id} className={styles.card}>
|
|
<div key={item.id} className={styles.card}>
|
|
@@ -129,9 +132,11 @@ const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
|
</Spin>
|
|
</Spin>
|
|
|
{state.noMore && <div className="text-center text-gray-400 my-4">已到底部</div>}
|
|
{state.noMore && <div className="text-center text-gray-400 my-4">已到底部</div>}
|
|
|
</div>
|
|
</div>
|
|
|
- <div className={styles.modalFooter}>
|
|
|
|
|
- <AddCompany onConfirm={addConfirm} dataId={dataId} dataType={preUrl} />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ {hasAddPerm && (
|
|
|
|
|
+ <div className={styles.modalFooter}>
|
|
|
|
|
+ <AddCompany onConfirm={addConfirm} dataId={dataId} dataType={preUrl} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
</CustomModal>
|
|
</CustomModal>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|