tableConfig.tsx 9.2 KB

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