tableConfig.tsx 9.2 KB

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