|
|
@@ -13,7 +13,7 @@ import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
|
|
|
import { PermDataTypeEunm } from '@/pages/Customer/Company/components/PermSelect'
|
|
|
import { BUSINESS_GROUP_KEY } from '@/utils/cache/cacheEnum'
|
|
|
|
|
|
-const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
|
|
|
+const Business = ({ dispatch, groupList, shouldUpdate, loading, refreshGroupList }) => {
|
|
|
const [defaultPermAuthCache, defaultStaffIds] = getPermAuthCache(PermDataTypeEunm.CUSTOMER)
|
|
|
const tRef = useRef(null)
|
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
|
@@ -29,7 +29,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
|
|
|
})
|
|
|
|
|
|
const funnelData = useMemo(() => {
|
|
|
- if (!groupList) return null
|
|
|
+ if (!groupList?.length) return null
|
|
|
return groupList
|
|
|
.find(item => item.value === state.params.businessGroupId)
|
|
|
?.items?.filter(item => !item.endProcess)
|
|
|
@@ -57,7 +57,13 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
|
|
|
if (!groupList) {
|
|
|
initGroupList(state.groupParams)
|
|
|
}
|
|
|
- }, [])
|
|
|
+ if (refreshGroupList) {
|
|
|
+ initGroupList()
|
|
|
+ dispatch({
|
|
|
+ type: 'business/toggleRefreshGroupStatus'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }, [refreshGroupList])
|
|
|
useEffect(() => {
|
|
|
if (shouldUpdate) {
|
|
|
tRef.current.reload()
|
|
|
@@ -166,7 +172,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
|
|
|
<div className="p-4 border-b-1 border-solid border-black border-opacity-10 bg-[#f7f9fa] flex justify-around items-center">
|
|
|
<div className="w-1/2 text-md">商机漏斗</div>
|
|
|
<div className="w-1/2">
|
|
|
- {groupList && (
|
|
|
+ {groupList?.length ? (
|
|
|
<Select
|
|
|
placeholder="请选择商机组"
|
|
|
size="small"
|
|
|
@@ -176,11 +182,13 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
|
|
|
defaultValue={defaultGroupId}
|
|
|
onChange={handleBussinessChange}
|
|
|
/>
|
|
|
- )}
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className="p-4 bg-white " style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
|
|
|
- <div className="max-h-1/3">{funnelData && <Funnel data={funnelData} {...conifg} />}</div>
|
|
|
+ <div className="max-h-1/3">
|
|
|
+ {funnelData?.length ? <Funnel data={funnelData} {...conifg} /> : null}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className="w-17/20">
|
|
|
@@ -245,6 +253,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
|
|
|
|
|
|
export default connect(({ business, refresh, loading }) => ({
|
|
|
groupList: business.groupList,
|
|
|
+ refreshGroupList: business.refreshGroupList,
|
|
|
loading: loading.models.business,
|
|
|
shouldUpdate: refresh.business
|
|
|
}))(Business)
|