|
|
@@ -1,14 +1,15 @@
|
|
|
import BasicTable from '@/components/Table'
|
|
|
import { apiRoadAddCompany, queryRoadcompanyList } from '@/services/product'
|
|
|
-import { Button, Input, message } from 'antd'
|
|
|
+import { Button, Input, message, Tag } from 'antd'
|
|
|
import React, { useState, useRef, useEffect } from 'react'
|
|
|
-import { generateSortField } from '@/utils/utils'
|
|
|
+import { dayjsFormat, generateSortField } from '@/utils/utils'
|
|
|
import consts from '@/consts'
|
|
|
-import { connect, useAccess } from 'umi'
|
|
|
+import { connect, useAccess, useDispatch } from 'umi'
|
|
|
import { useModal } from '@/components/ModalStore'
|
|
|
|
|
|
-const Enterprise = ({ shouldUpdate }) => {
|
|
|
+const Enterprise = ({ compilationv2, shouldUpdate }) => {
|
|
|
const hasAddPerm = useAccess()?.validatePermByType('enterprise_add') || false
|
|
|
+ const dispatch = useDispatch()
|
|
|
const dispatchModal = useModal()
|
|
|
const [state, setState] = useState({
|
|
|
params: {
|
|
|
@@ -26,6 +27,14 @@ const Enterprise = ({ shouldUpdate }) => {
|
|
|
return code === consts.RET_CODE.SUCCESS
|
|
|
}
|
|
|
useEffect(() => {
|
|
|
+ if (!compilationv2?.length) {
|
|
|
+ dispatch({
|
|
|
+ type: 'personal/fetchCompilationv2',
|
|
|
+ payload: {
|
|
|
+ projectType: 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
if (shouldUpdate) {
|
|
|
tRef.current.reload()
|
|
|
}
|
|
|
@@ -51,51 +60,71 @@ const Enterprise = ({ shouldUpdate }) => {
|
|
|
},
|
|
|
{
|
|
|
title: '企业管理员',
|
|
|
- dataIndex: 'managerName',
|
|
|
- key: 'managerName',
|
|
|
- width: 110
|
|
|
- },
|
|
|
- {
|
|
|
- title: '电话号码',
|
|
|
- dataIndex: 'managerPhone',
|
|
|
- key: 'managerPhone',
|
|
|
- width: 110
|
|
|
+ dataIndex: 'role',
|
|
|
+ key: 'role',
|
|
|
+ width: 110,
|
|
|
+ renderText: (_, record) =>
|
|
|
+ record.members.map(item => {
|
|
|
+ return (
|
|
|
+ <span key={item.userID}>{record.members?.find(item => item.role === 'admin')?.memberName}</span>
|
|
|
+ )
|
|
|
+ })
|
|
|
},
|
|
|
+ // {
|
|
|
+ // title: '电话号码',
|
|
|
+ // dataIndex: 'managerPhone',
|
|
|
+ // key: 'managerPhone',
|
|
|
+ // width: 110
|
|
|
+ // },
|
|
|
{
|
|
|
title: '授权数量',
|
|
|
- dataIndex: 'numLicenses',
|
|
|
- key: 'numLicenses',
|
|
|
+ dataIndex: 'licenceNum',
|
|
|
+ key: 'licenceNum',
|
|
|
width: 110
|
|
|
},
|
|
|
{
|
|
|
title: 'CLD客户',
|
|
|
- dataIndex: 'client_name',
|
|
|
- key: 'client_name',
|
|
|
- width: 110
|
|
|
+ dataIndex: 'clientName',
|
|
|
+ key: 'clientName',
|
|
|
+ width: 110,
|
|
|
+ renderText: (_, record) => record.cld?.clientName
|
|
|
},
|
|
|
{
|
|
|
title: 'CLD单位',
|
|
|
- dataIndex: 'customer_name',
|
|
|
- key: 'customer_name',
|
|
|
- width: 110
|
|
|
+ dataIndex: 'customerName',
|
|
|
+ key: 'customerName',
|
|
|
+ width: 110,
|
|
|
+ renderText: (_, record) => record.cld?.customerName
|
|
|
},
|
|
|
{
|
|
|
title: '最近使用',
|
|
|
- dataIndex: 'latestUsed',
|
|
|
- key: 'latestUsed',
|
|
|
- width: 110
|
|
|
+ dataIndex: 'usedCptList',
|
|
|
+ key: 'usedCptList',
|
|
|
+ width: 110,
|
|
|
+ renderText: (_, record) => (
|
|
|
+ <div className="children:m-2px">
|
|
|
+ {record.usedCptList.map(item => {
|
|
|
+ return (
|
|
|
+ <Tag color="purple" key={item.compilationID}>
|
|
|
+ {compilationv2?.find(i => i.ID === item.compilationID)?.name}
|
|
|
+ </Tag>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
},
|
|
|
{
|
|
|
title: '注册时间',
|
|
|
- dataIndex: 'registerTime',
|
|
|
- key: 'registerTime',
|
|
|
- width: 110
|
|
|
+ dataIndex: 'createTime',
|
|
|
+ key: 'createTime',
|
|
|
+ width: 110,
|
|
|
+ renderText: text => dayjsFormat(text, 'YYYY-MM-DD HH:mm')
|
|
|
}
|
|
|
]
|
|
|
return (
|
|
|
<div>
|
|
|
<BasicTable
|
|
|
- rowKey={record => record.client_id}
|
|
|
+ rowKey={record => record.ID}
|
|
|
actionRef={tRef}
|
|
|
columns={columns}
|
|
|
params={state.params}
|
|
|
@@ -113,11 +142,7 @@ const Enterprise = ({ shouldUpdate }) => {
|
|
|
}}
|
|
|
toolbar={{
|
|
|
search: (
|
|
|
- <Input.Search
|
|
|
- style={{ width: '250px' }}
|
|
|
- allowClear={true}
|
|
|
- placeholder="请输入手机、QQ进行搜索"
|
|
|
- />
|
|
|
+ <Input.Search style={{ width: '250px' }} allowClear={true} placeholder="请输入手机、QQ进行搜索" />
|
|
|
),
|
|
|
actions: [
|
|
|
<Button
|
|
|
@@ -148,6 +173,7 @@ const Enterprise = ({ shouldUpdate }) => {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-export default connect(({ refresh }) => ({
|
|
|
+export default connect(({ personal, refresh }) => ({
|
|
|
+ compilationv2: personal.compilationv2,
|
|
|
shouldUpdate: refresh.enterprise
|
|
|
}))(Enterprise)
|