tableConfig.tsx 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import { FundStatusEnum } from "@/services/launchAdq/enum"
  2. import { EditOutlined, FileSearchOutlined, SettingOutlined, SwapOutlined, UploadOutlined, UserSwitchOutlined } from "@ant-design/icons"
  3. import { Badge, Button, Popconfirm, Space, Tooltip } from "antd"
  4. import React from "react"
  5. import DivideIntoGroups from "./divideIntoGroups"
  6. import './index.less'
  7. export function columnsMp(edit: (params: any) => void, setOpenServer: (data: any) => void, del: (groupId: number, accountId: number) => void, checkAccount: (value: any[]) => void, changeRecord: (accountId: number, id: number) => void, putUserHandle: (data: any) => void, activeKey: string, userId: string | undefined, groupId?: number, getAdAccountList?: any): any {
  8. return [
  9. {
  10. title: 'ID',
  11. dataIndex: 'id',
  12. key: 'id',
  13. align: 'center',
  14. width: 55,
  15. fixed: 'left'
  16. },
  17. {
  18. title: '广告主ID',
  19. dataIndex: 'accountId',
  20. key: 'accountId',
  21. align: 'center',
  22. width: 80,
  23. fixed: 'left'
  24. },
  25. {
  26. title: '类型',
  27. dataIndex: 'sourceType',
  28. key: 'sourceType',
  29. align: 'center',
  30. width: 60,
  31. render: (a: any, b: any) => {
  32. return <span>{a == 0 ? '微信' : 'QQ'}</span>
  33. }
  34. },
  35. {
  36. title: '投手',
  37. dataIndex: 'putUserInfo',
  38. key: 'putUserInfo',
  39. width: 70,
  40. align: 'center',
  41. ellipsis: true,
  42. render: (a: any, b: any) => {
  43. return <span>{a?.nickname || '-1'}</span>
  44. }
  45. },
  46. {
  47. title: '投放助理',
  48. dataIndex: 'accountUsers',
  49. key: 'accountUsers',
  50. width: 70,
  51. align: 'center',
  52. ellipsis: true,
  53. render: (a: any[], b: any) => {
  54. return a && a?.length > 0 ? a.map((item: { putUserName: string, putUseId: number }) => item.putUserName).toString() : '-1'
  55. }
  56. },
  57. {
  58. title: '投放信息',
  59. dataIndex: 'putResourceName',
  60. key: 'putResourceName',
  61. width: 110,
  62. align: 'center',
  63. ellipsis: true,
  64. },
  65. {
  66. title: '腾讯备注',
  67. dataIndex: 'memo',
  68. key: 'memo',
  69. align: 'center',
  70. width: 100,
  71. ellipsis: true,
  72. },
  73. {
  74. title: '本地备注',
  75. dataIndex: 'remark',
  76. key: 'remark',
  77. align: 'center',
  78. width: 100,
  79. ellipsis: true,
  80. },
  81. // {
  82. // title: '公众号信息',
  83. // dataIndex: 'wechatAccountName',
  84. // key: 'wechatAccountName',
  85. // width: 150,
  86. // align: 'center',
  87. // render: (a: any, b: any) => {
  88. // return <div className="verticalCenter">
  89. // <div><strong>{a}</strong></div>
  90. // <div style={{ color: "rgb(136, 136, 136)", fontSize: 13 }}>{b?.wechatAccountId}</div>
  91. // </div>
  92. // }
  93. // },
  94. {
  95. title: '企业名称',
  96. dataIndex: 'corporationName',
  97. key: 'corporationName',
  98. width: 150,
  99. align: 'center',
  100. ellipsis: true
  101. },
  102. {
  103. title: '服务商',
  104. dataIndex: 'serviceProviderName',
  105. key: 'serviceProviderName',
  106. width: 150,
  107. align: 'center',
  108. ellipsis: true
  109. },
  110. // {
  111. // title: '服务商ID列表',
  112. // dataIndex: 'agencyIdList',
  113. // key: 'agencyIdList',
  114. // width: 130,
  115. // align: 'center',
  116. // render: (a: any) => {
  117. // return <Tooltip title={a}>
  118. // <div className="name-wrapper">
  119. // <p>{ a }</p>
  120. // </div>
  121. // </Tooltip>
  122. // }
  123. // },
  124. {
  125. title: '行业ID',
  126. dataIndex: 'systemIndustryId',
  127. key: 'systemIndustryId',
  128. width: 105,
  129. align: 'center',
  130. render: (a: any) => {
  131. return <Tooltip title={a}>
  132. <div className="name-wrapper">{a}</div>
  133. </Tooltip>
  134. }
  135. },
  136. {
  137. title: '是否有效',
  138. dataIndex: 'enabled',
  139. key: 'enabled',
  140. align: 'center',
  141. width: 60,
  142. render: (a: any, b: any) => {
  143. return <Badge status={a ? "processing" : "error"} text={a ? '是' : '否'} />
  144. }
  145. },
  146. {
  147. title: '授权时间',
  148. dataIndex: 'createTime',
  149. key: 'createTime',
  150. align: 'center',
  151. width: 150
  152. },
  153. {
  154. title: '日限额(分)',
  155. dataIndex: 'dailyBudget',
  156. key: 'dailyBudget',
  157. align: 'center',
  158. width: 80
  159. },
  160. {
  161. title: '资金状态',
  162. dataIndex: 'fundStatus',
  163. key: 'fundStatus',
  164. align: 'center',
  165. width: 80,
  166. render: (a: string | number) => {
  167. return FundStatusEnum[a]
  168. }
  169. },
  170. {
  171. title: '操作',
  172. dataIndex: 'cz',
  173. key: 'cz',
  174. align: 'center',
  175. width: 200,
  176. fixed: 'right',
  177. render: (a: any, b: any) => {
  178. return <Space>
  179. <Tooltip title="配置服务商">
  180. <Button size="small" style={{ color: "#00bcd4" }} onClick={() => setOpenServer([b])} icon={<SettingOutlined />}></Button>
  181. </Tooltip>
  182. <Tooltip title="备注">
  183. <Button size="small" style={{ color: '#52c41a' }} onClick={() => edit(b)} icon={<EditOutlined />}></Button>
  184. </Tooltip>
  185. <Tooltip title="切号">
  186. <Button size="small" style={{ color: '#ea5506' }} onClick={() => checkAccount([b])} icon={<SwapOutlined />}></Button>
  187. </Tooltip>
  188. <Tooltip title="变更记录">
  189. <Button size="small" style={{ color: '#4d5aaf' }} onClick={() => changeRecord(b?.accountId, b?.id)} icon={<FileSearchOutlined />}></Button>
  190. </Tooltip>
  191. {activeKey === '1' && <>
  192. {userId == b?.putUserInfo?.userId?.toString() && <Tooltip title="指派投放助理">
  193. <Button size="small" style={{ color: '#0eb83a' }} onClick={() => putUserHandle([b])} icon={<UserSwitchOutlined />}></Button>
  194. </Tooltip>}
  195. {!groupId && <DivideIntoGroups groupIds={b?.groupIds} getAdAccountList={getAdAccountList} accountId={b?.accountId} />}
  196. </>}
  197. {groupId && <Popconfirm
  198. title={`是否把${b?.accountId}移出该分组?`}
  199. onConfirm={() => { del(groupId, b?.accountId) }}
  200. okText="是"
  201. cancelText="否"
  202. >
  203. <Tooltip title="移出分组">
  204. <Button size="small" style={{ color: 'red' }}><UploadOutlined /></Button>
  205. </Tooltip>
  206. </Popconfirm>}
  207. </Space>
  208. }
  209. },
  210. ]
  211. }