tableConfig.tsx 8.0 KB

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