|
@@ -1,7 +1,7 @@
|
|
|
import ContactDetail from '@/pages/customer/Contact/components/ContactDetail'
|
|
import ContactDetail from '@/pages/customer/Contact/components/ContactDetail'
|
|
|
import Addcontact from '@/pages/customer/Contact/components/AddContact'
|
|
import Addcontact from '@/pages/customer/Contact/components/AddContact'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
-import { Button, Card, message } from 'antd'
|
|
|
|
|
|
|
+import { Button, Card, message, Tag, Tooltip } from 'antd'
|
|
|
import { connect } from 'dva'
|
|
import { connect } from 'dva'
|
|
|
import React, { useEffect, useState, useRef, useMemo } from 'react'
|
|
import React, { useEffect, useState, useRef, useMemo } from 'react'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
@@ -20,7 +20,6 @@ import { apiBatchLink } from '@/services/customer'
|
|
|
const Contact = props => {
|
|
const Contact = props => {
|
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
|
const { personTagColorMap, teamTagColorMap, personTags, teamTags, dispatch } = props
|
|
const { personTagColorMap, teamTagColorMap, personTags, teamTags, dispatch } = props
|
|
|
- // console.log(personTags, personTagColorMap)
|
|
|
|
|
|
|
|
|
|
const tRef = useRef()
|
|
const tRef = useRef()
|
|
|
const [tagState, setTagState] = useState({
|
|
const [tagState, setTagState] = useState({
|
|
@@ -31,7 +30,10 @@ const Contact = props => {
|
|
|
const tag = useMemo(() => {
|
|
const tag = useMemo(() => {
|
|
|
const personTagMap = {}
|
|
const personTagMap = {}
|
|
|
const teamTagMap = {}
|
|
const teamTagMap = {}
|
|
|
|
|
+ const personOptions = []
|
|
|
|
|
+ const teamOptions = []
|
|
|
personTags.forEach(item => {
|
|
personTags.forEach(item => {
|
|
|
|
|
+ personOptions.push({ label: item.name, value: item.id })
|
|
|
personTagMap[item.id] = {
|
|
personTagMap[item.id] = {
|
|
|
text: (
|
|
text: (
|
|
|
<>
|
|
<>
|
|
@@ -44,7 +46,9 @@ const Contact = props => {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
teamTags.forEach(item => {
|
|
teamTags.forEach(item => {
|
|
|
|
|
+ teamOptions.push({ label: item.name, value: item.id })
|
|
|
teamTagMap[item.id] = {
|
|
teamTagMap[item.id] = {
|
|
|
text: (
|
|
text: (
|
|
|
<>
|
|
<>
|
|
@@ -58,7 +62,7 @@ const Contact = props => {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return { personTagMap, teamTagMap }
|
|
|
|
|
|
|
+ return { personTagMap, teamTagMap, personOptions, teamOptions }
|
|
|
}, [personTags, teamTags, personTagColorMap, teamTagColorMap])
|
|
}, [personTags, teamTags, personTagColorMap, teamTagColorMap])
|
|
|
|
|
|
|
|
const toolbarOptionsChange = (type, ids) => {
|
|
const toolbarOptionsChange = (type, ids) => {
|
|
@@ -200,14 +204,21 @@ const Contact = props => {
|
|
|
dataIndex: 'tagIds',
|
|
dataIndex: 'tagIds',
|
|
|
key: 'tagIds',
|
|
key: 'tagIds',
|
|
|
width: 60,
|
|
width: 60,
|
|
|
|
|
+ valueType: 'select',
|
|
|
|
|
+ fieldProps: {
|
|
|
|
|
+ mode: 'multiple',
|
|
|
|
|
+ options: tag.personOptions,
|
|
|
|
|
+ showArrow: true
|
|
|
|
|
+ },
|
|
|
render: (_, record) => (
|
|
render: (_, record) => (
|
|
|
<div className="zh-align-center zh-flex-wrap">
|
|
<div className="zh-align-center zh-flex-wrap">
|
|
|
{record.tagIds.map(item => (
|
|
{record.tagIds.map(item => (
|
|
|
- <span
|
|
|
|
|
- key={record.id + item}
|
|
|
|
|
- className="zh-circle-icon zh-mg-right-3"
|
|
|
|
|
- style={{ backgroundColor: personTagColorMap[item] }}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <Tooltip title={personTags.find(i => i.id === item)?.name} key={record.id + item}>
|
|
|
|
|
+ <span
|
|
|
|
|
+ className="zh-circle-icon zh-mg-right-3"
|
|
|
|
|
+ style={{ backgroundColor: personTagColorMap[item] }}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Tooltip>
|
|
|
))}
|
|
))}
|
|
|
<PersonLabel
|
|
<PersonLabel
|
|
|
dataId={record.id}
|
|
dataId={record.id}
|
|
@@ -219,25 +230,32 @@ const Contact = props => {
|
|
|
<IconPark type="add" theme="filled" size="20" fill="#868e96" className="zh-pointer" />
|
|
<IconPark type="add" theme="filled" size="20" fill="#868e96" className="zh-pointer" />
|
|
|
</PersonLabel>
|
|
</PersonLabel>
|
|
|
</div>
|
|
</div>
|
|
|
- ),
|
|
|
|
|
- filters: true,
|
|
|
|
|
|
|
+ )
|
|
|
|
|
+ // filters: true
|
|
|
// onFilter: true,
|
|
// onFilter: true,
|
|
|
- // valueType: 'option',
|
|
|
|
|
- valueEnum: tag.personTagMap
|
|
|
|
|
|
|
+ // valueEnum: tag.personTagMap
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '协作标签',
|
|
title: '协作标签',
|
|
|
dataIndex: 'tagCooperationIds',
|
|
dataIndex: 'tagCooperationIds',
|
|
|
key: 'tagCooperationIds',
|
|
key: 'tagCooperationIds',
|
|
|
width: 60,
|
|
width: 60,
|
|
|
|
|
+ valueType: 'select',
|
|
|
|
|
+ fieldProps: {
|
|
|
|
|
+ mode: 'multiple',
|
|
|
|
|
+ options: tag.teamOptions,
|
|
|
|
|
+ showArrow: true
|
|
|
|
|
+ },
|
|
|
render: (_, record) => (
|
|
render: (_, record) => (
|
|
|
<div className="zh-align-center zh-flex-wrap">
|
|
<div className="zh-align-center zh-flex-wrap">
|
|
|
{record.tagCooperationIds.map(item => (
|
|
{record.tagCooperationIds.map(item => (
|
|
|
- <span
|
|
|
|
|
- key={record.id + item}
|
|
|
|
|
- className="zh-square-icon zh-mg-right-3"
|
|
|
|
|
- style={{ backgroundColor: teamTagColorMap[item] }}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <Tooltip title={teamTags.find(i => i.id === item)?.name} key={record.id + item}>
|
|
|
|
|
+ <span
|
|
|
|
|
+ key={record.id + item}
|
|
|
|
|
+ className="zh-square-icon zh-mg-right-3"
|
|
|
|
|
+ style={{ backgroundColor: teamTagColorMap[item] }}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Tooltip>
|
|
|
))}
|
|
))}
|
|
|
<PersonLabel
|
|
<PersonLabel
|
|
|
dataId={record.id}
|
|
dataId={record.id}
|
|
@@ -249,10 +267,10 @@ const Contact = props => {
|
|
|
<IconPark type="add" theme="filled" size="20" fill="#868e96" className="zh-pointer" />
|
|
<IconPark type="add" theme="filled" size="20" fill="#868e96" className="zh-pointer" />
|
|
|
</PersonLabel>
|
|
</PersonLabel>
|
|
|
</div>
|
|
</div>
|
|
|
- ),
|
|
|
|
|
- filters: true,
|
|
|
|
|
|
|
+ )
|
|
|
|
|
+ // filters: true,
|
|
|
// valueType: 'select',
|
|
// valueType: 'select',
|
|
|
- valueEnum: tag.teamTagMap
|
|
|
|
|
|
|
+ // valueEnum: tag.teamTagMap
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '地址',
|
|
title: '地址',
|
|
@@ -522,8 +540,8 @@ const Contact = props => {
|
|
|
onChange: hanleRowSelectChange,
|
|
onChange: hanleRowSelectChange,
|
|
|
type: 'checkbox'
|
|
type: 'checkbox'
|
|
|
}}
|
|
}}
|
|
|
- search={false}
|
|
|
|
|
- // search={{ filterType: 'light' }}
|
|
|
|
|
|
|
+ // search={false}
|
|
|
|
|
+ search={{ filterType: 'light' }}
|
|
|
toolbar={{
|
|
toolbar={{
|
|
|
search: {
|
|
search: {
|
|
|
allowClear: true,
|
|
allowClear: true,
|