|
|
@@ -15,6 +15,7 @@ import { TagTypeEnum, TagDataTypeEnum, LabelModeType } from './components/Person
|
|
|
import { Add, Down, Check } from '@icon-park/react'
|
|
|
import { apiBatchLink } from '@/services/customer'
|
|
|
import styles from './index.less'
|
|
|
+import { refactorSortField } from '@/utils/utils'
|
|
|
|
|
|
const Company = props => {
|
|
|
const {
|
|
|
@@ -43,12 +44,12 @@ const Company = props => {
|
|
|
const personOptions = []
|
|
|
const teamOptions = []
|
|
|
personTags.forEach(item => {
|
|
|
- personOptions.push({ label: item.name, value: item.id })
|
|
|
+ // personOptions.push({ label: item.name, value: item.id })
|
|
|
personTagMap[item.id] = {
|
|
|
text: (
|
|
|
<>
|
|
|
<span
|
|
|
- className="inline-block w-12px h-12px rounded-1\/2 mr-3px"
|
|
|
+ className="inline-block w-12px h-12px rounded-1/2 mr-3px"
|
|
|
style={{ backgroundColor: personTagColorMap[item.id] }}
|
|
|
/>
|
|
|
<span>{item.name}</span>
|
|
|
@@ -57,7 +58,7 @@ const Company = props => {
|
|
|
}
|
|
|
})
|
|
|
teamTags.forEach(item => {
|
|
|
- teamOptions.push({ label: item.name, value: item.id })
|
|
|
+ // teamOptions.push({ label: item.name, value: item.id })
|
|
|
teamTagMap[item.id] = {
|
|
|
text: (
|
|
|
<>
|
|
|
@@ -80,10 +81,6 @@ const Company = props => {
|
|
|
visible: false,
|
|
|
orderIds: []
|
|
|
})
|
|
|
- const [addCompany, setAddCompany] = useState({
|
|
|
- visible: false,
|
|
|
- loading: false
|
|
|
- })
|
|
|
|
|
|
// 重置到默认值,包括表单
|
|
|
const initData = () => {
|
|
|
@@ -96,15 +93,12 @@ const Company = props => {
|
|
|
}
|
|
|
|
|
|
const handleAddCompany = async values => {
|
|
|
- setAddCompany({ ...addCompany, loading: true })
|
|
|
const params = formatValues(values)
|
|
|
const { code = -1 } = await apiAddCompany(params)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
message.success('新增成功')
|
|
|
+ initData()
|
|
|
}
|
|
|
- // 请求完了
|
|
|
- setAddCompany({ ...addCompany, loading: false, visible: false })
|
|
|
- initData()
|
|
|
}
|
|
|
|
|
|
useEffect(() => {
|
|
|
@@ -183,13 +177,14 @@ const Company = props => {
|
|
|
dataIndex: 'tagIds',
|
|
|
width: 100,
|
|
|
filters: true,
|
|
|
+ search: false,
|
|
|
valueEnum: tag.personTagMap,
|
|
|
- valueType: 'select',
|
|
|
- fieldProps: {
|
|
|
- mode: 'multiple',
|
|
|
- options: tag.personOptions,
|
|
|
- showArrow: true
|
|
|
- },
|
|
|
+ // valueType: 'select',
|
|
|
+ // fieldProps: {
|
|
|
+ // mode: 'multiple',
|
|
|
+ // options: tag.personOptions,
|
|
|
+ // showArrow: true
|
|
|
+ // },
|
|
|
render: (_, record) => (
|
|
|
<div className="items-center flex-wrap">
|
|
|
{record.tagIds.map(item => (
|
|
|
@@ -217,14 +212,15 @@ const Company = props => {
|
|
|
dataIndex: 'tagCooperationIds',
|
|
|
key: 'tagCooperationIds',
|
|
|
width: 80,
|
|
|
+ search: false,
|
|
|
filters: true,
|
|
|
valueEnum: tag.teamTagMap,
|
|
|
- valueType: 'select',
|
|
|
- fieldProps: {
|
|
|
- mode: 'multiple',
|
|
|
- options: tag.teamOptions,
|
|
|
- showArrow: true
|
|
|
- },
|
|
|
+ // valueType: 'select',
|
|
|
+ // fieldProps: {
|
|
|
+ // mode: 'multiple',
|
|
|
+ // options: tag.teamOptions,
|
|
|
+ // showArrow: true
|
|
|
+ // },
|
|
|
render: (_, record) => (
|
|
|
<div className="flex items-center flex-wrap">
|
|
|
{record.tagCooperationIds.map(item => (
|
|
|
@@ -438,8 +434,9 @@ const Company = props => {
|
|
|
actionRef={tRef}
|
|
|
params={state.params}
|
|
|
request={async (params, sort, filter) => {
|
|
|
+ const srotOrder = refactorSortField(sort)
|
|
|
const { code = -1, data: { customer = [], total = 0 } = { customer: [], total: 0 } } =
|
|
|
- await queryCompany({ ...params, ...sort, ...filter })
|
|
|
+ await queryCompany({ ...params, ...srotOrder, ...filter })
|
|
|
setState({ ...state, orderIds: customer.map(item => item.id) })
|
|
|
return {
|
|
|
data: customer,
|