123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- import { copy } from "@/utils/utils"
- import { Badge, Button, Space, Typography } from "antd"
- import { ColumnsType } from "antd/es/table"
- import { tableDfixed } from "@/utils/tableDfixed"
- const { Text } = Typography;
- export function TableConfig(handle: (data: any, type: string) => void): ColumnsType<any> {
- let arr: ColumnsType<any> = [
- {
- title: '企微名称',
- dataIndex: 'corpName',
- key: 'corpName',
- width: 150,
- ellipsis: true,
- fixed: 'left'
- },
- {
- title: 'corpId',
- dataIndex: 'corpId',
- key: 'corpId',
- align: 'center',
- width: 150,
- ellipsis: true,
- fixed: 'left',
- render: (a: any) => {
- return <a onClick={() => copy(a)}>{a}</a>
- }
- },
- {
- title: '企微ID',
- dataIndex: 'originCorpId',
- key: 'originCorpId',
- align: 'center',
- width: 125,
- ellipsis: true,
- render(value) {
- return value || '--'
- },
- },
- {
- title: '用户规模',
- dataIndex: 'corpUserMax',
- key: 'corpUserMax',
- align: 'center',
- width: 100,
- render(value) {
- return value && value === 0 ? value : '--'
- },
- },
- {
- title: '授权方企业类型',
- dataIndex: 'corpType',
- key: 'corpType',
- align: 'center',
- width: 60,
- render: (a: string) => {
- return <span>{{ verified: '认证号', unverified: '注册号' }[a] || '--'}</span>
- }
- },
- {
- title: '认证到期时间',
- dataIndex: 'verifiedEndTime',
- key: 'verifiedEndTime',
- align: 'center',
- width: 120,
- render(value) {
- return value || '--'
- },
- },
- {
- title: '授权状态',
- dataIndex: 'authStatus',
- key: 'authStatus',
- align: 'center',
- width: 80,
- render: (a: any) => {
- return <span>{a === 1 ? <Badge status="success" text='成功授权' /> : <Badge status="error" text='取消授权' />}</span>
- }
- },
- {
- title: '配置状态',
- dataIndex: 'configStatus',
- key: 'configStatus',
- align: 'center',
- width: 80,
- render: (a: any) => {
- return <span>{({ 'SUCCESS': <Badge status="success" text='配置成功' />, 'ING': <Badge status="default" text='未配置' /> } as any)[a] || <Badge status="error" text='配置失败' />}</span>
- }
- },
- {
- title: '回调地址',
- dataIndex: 'externalUserCallbackUrl',
- key: 'externalUserCallbackUrl',
- width: 150,
- ellipsis: true,
- render: (a: any) => {
- return <a onClick={() => copy(a)}>{a || '--'}</a>
- }
- },
- {
- title: 'Token',
- dataIndex: 'externalUserToken',
- key: 'externalUserToken',
- width: 150,
- ellipsis: true,
- render: (a: any) => {
- return <a onClick={() => copy(a)}>{a || '--'}</a>
- }
- },
- {
- title: 'AESKey',
- dataIndex: 'externalUserAesKey',
- key: 'externalUserAesKey',
- width: 150,
- ellipsis: true,
- render: (a: any) => {
- return <a onClick={() => copy(a)}>{a || '--'}</a>
- }
- },
- {
- title: '授权时间',
- dataIndex: 'createTime',
- key: 'createTime',
- align: 'center',
- width: 130,
- ellipsis: true,
- },
- {
- title: '备注',
- dataIndex: 'remark',
- key: 'remark',
- width: 200,
- ellipsis: true,
- render(value) {
- return value || '--'
- },
- },
- {
- title: '操作',
- dataIndex: 'cz',
- key: 'cz',
- align: 'center',
- width: 100,
- fixed: 'right',
- render: (a, b) => {
- return <Space wrap size={'small'}>
- <a onClick={() => handle(b, 'sx')}>修改</a>
- <a onClick={() => handle(b, 'txl')}>企微通讯录</a>
- </Space>
- }
- },
- ]
- return tableDfixed(arr)
- }
- export function TableMailConfig(handle?: (data: any, type: string) => void, setAccountOpen?: (d: any) => void, setChangeLog?: (d: any) => void): ColumnsType<any> {
- let arr: ColumnsType<any> = [
- {
- title: '企微号ID',
- dataIndex: 'corpUserId',
- key: 'corpUserId',
- align: 'center',
- width: 80,
- ellipsis: true,
- fixed: 'left'
- },
- {
- title: '企微号',
- dataIndex: 'name',
- key: 'name',
- align: 'center',
- width: 90,
- ellipsis: true,
- },
- {
- title: '公众号',
- dataIndex: 'mpAccountInfo.name',
- key: 'mpAccountInfo.name',
- align: 'center',
- width: 90,
- ellipsis: true,
- render: (a: any, b: any) => {
- return b?.mpAccountInfo?.name || '--'
- }
- },
- {
- title: '书城',
- dataIndex: 'mpAccountInfo.platformName',
- key: 'mpAccountInfo.platformName',
- align: 'center',
- width: 90,
- ellipsis: true,
- render: (a: any, b: any) => {
- return b?.mpAccountInfo?.platformName || '--'
- }
- },
- {
- title: '运营',
- dataIndex: 'operUserId',
- key: 'operUserId',
- align: 'center',
- width: 90,
- ellipsis: true,
- render: (a: any, b: any) => {
- return b?.operUser?.nickName || '--'
- }
- },
- {
- title: '投手',
- dataIndex: 'putUserId',
- key: 'putUserId',
- align: 'center',
- width: 90,
- ellipsis: true,
- render: (a: any, b: any) => {
- return b?.putUser?.nickName || '--'
- }
- },
- {
- title: '运营助手',
- dataIndex: 'userList',
- key: 'userList',
- align: 'center',
- width: 90,
- ellipsis: true,
- render: (a: any[], b: any) => {
- return <Text ellipsis={{ tooltip: true }}>{a?.map(item => item?.nickname)?.toString() || '--'}</Text>
- }
- },
- {
- title: '状态',
- dataIndex: 'status',
- key: 'status',
- align: 'center',
- width: 80,
- render: (a: number) => {
- return <span>{a === 1 ? '已激活' : a === 2 ? '已禁用' : a === 4 ?
- '未激活' : a === 5 ? '退出企业' : '--'}</span>
- }
- },
- {
- title: '创建时间',
- dataIndex: 'createTime',
- key: 'createTime',
- align: 'center',
- ellipsis: true,
- width: 120
- },
- {
- title: '操作',
- dataIndex: 'cz',
- key: 'cz',
- align: 'center',
- width: 200,
- fixed: 'right',
- render: (a, b) => {
- return <Space wrap size={'small'}>
- <Button size='small' type="link" style={{ padding: 0 }} onClick={() => handle?.([b], '')}>指派</Button>
- <Button size='small' type="link" style={{ padding: 0 }} onClick={() => handle?.([b], 'zs')}>运营助手指派</Button>
- <Button size='small' type="link" style={{ padding: 0 }} onClick={() => setAccountOpen?.(b)}>指派公众号</Button>
- <Button size='small' type="link" style={{ padding: 0 }} onClick={() => setChangeLog?.(b)}>变更记录</Button>
- </Space>
- }
- },
- ]
- return tableDfixed(arr)
- }
- export function TableChangeLogConfig(): ColumnsType<any> {
- let arr: ColumnsType<any> = [
- {
- title: 'ID',
- dataIndex: 'id',
- key: 'id',
- align: 'center',
- width: 30,
- ellipsis: true,
- },
- {
- title: '变更时间',
- dataIndex: 'createTime',
- key: 'createTime',
- align: 'center',
- width: 120,
- ellipsis: true,
- },
- {
- title: '变更后公众号',
- dataIndex: 'mpAccount.name',
- key: 'mpAccount.name',
- align: 'center',
- width: 80,
- ellipsis: true,
- render: (a: any, b: any) => {
- return b?.mpAccount?.name || '--'
- }
- },
- {
- title: '变更后书城',
- dataIndex: 'mpAccount.platformName',
- key: 'mpAccount.platformName',
- align: 'center',
- width: 80,
- ellipsis: true,
- render: (a: any, b: any) => {
- return b?.mpAccount?.platformName || '--'
- }
- },
- ]
- return arr
- }
|