tableConfig.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. import ProgressTable from "@/components/ProgressTable"
  2. import WidthEllipsis from "@/components/widthEllipsis"
  3. import { Badge, Popconfirm, Space, Statistic } from "antd"
  4. import React from "react"
  5. import SendEmailDetails from "./sendEmailDetails"
  6. import './index.less'
  7. import SendPackDetails from "./sendPackDetails"
  8. // import IsTrue from "./isTrue"
  9. // import InputUpdate from "./inputUpdate"
  10. function columns12(
  11. sendEmail: (data: any[]) => void,
  12. sendPack: (data: any[]) => void,
  13. handleIsTrue: (value: string, data: any, type: string) => void,
  14. handleSave: (data: any) => void,
  15. roleHandle: (data: any[]) => void,
  16. assignHandle: (data: any[]) => void,
  17. changeLog: (data: any[]) => void
  18. ) {
  19. let newArr: { label: string, data: any[] }[] = [
  20. {
  21. label: '角色信息',
  22. data: [
  23. { title: '游戏', dataIndex: 'role_reg_parent_game_name', label: '角色信息', align: 'center', width: 70, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  24. { title: '游戏区服', dataIndex: 'server_name', label: '玩家信息', align: 'center', width: 90, default: 4, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  25. { title: '区服ID', dataIndex: 'server_id', label: '角色信息', align: 'center', width: 70, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  26. { title: '角色名称', dataIndex: 'role_name', label: '角色信息', align: 'center', width: 90, default: 2, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  27. { title: '角色创建时间', dataIndex: 'role_create_time', label: '角色信息', align: 'center', width: 140, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  28. { title: '角色VIP等级', dataIndex: 'vip_level', label: '角色信息', align: 'center', width: 60, default: 3, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  29. { title: '角色等级', dataIndex: 'role_level', label: '角色信息', align: 'center', width: 65, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  30. { title: '角色攻击力', dataIndex: 'combat_num', label: '角色信息', align: 'center', width: 70, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  31. ],
  32. },
  33. {
  34. label: '玩家信息',
  35. data: [
  36. { title: '玩家ID', dataIndex: 'user_id', label: '玩家信息', align: 'center', width: 70 },
  37. { title: '玩家账号', dataIndex: 'username', label: '玩家信息', align: 'center', width: 120, default: 1, render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />) },
  38. { title: '注册渠道', dataIndex: 'agent_name', label: '玩家信息', align: 'center', width: 80, default: 5, render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />) },
  39. { title: '注册渠道ID', dataIndex: 'agent_id', label: '玩家信息', align: 'center', width: 80 },
  40. { title: '注册时间', dataIndex: 'user_create_time', label: '玩家信息', align: 'center', width: 140, default: 6, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  41. { title: '注册游戏', dataIndex: 'user_reg_game_name', label: '玩家信息', align: 'center', width: 70, default: 7, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  42. { title: '玩家操作系统', dataIndex: 'os', label: '玩家信息', align: 'center', width: 70, default: 8 },
  43. // { title: '玩家等级标签', dataIndex: '13', label: '玩家信息', align: 'center', width: 70, default: 14 },
  44. { title: '最近充值游戏', dataIndex: 'user_last_recharge_game_name', label: '玩家信息', align: 'center', width: 70, default: 15, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  45. { title: '最近充值时间', dataIndex: 'user_pay_time', label: '玩家信息', align: 'center', width: 140, default: 16, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  46. { title: '最近活跃时间', dataIndex: 'user_active_time', label: '玩家信息', align: 'center', width: 140, default: 17, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  47. {
  48. title: '注册充值时间差',
  49. dataIndex: 'regPayTimeDiff',
  50. align: 'center',
  51. width: 140,
  52. default: 18,
  53. render: (a: string, b: any) => {
  54. let diff = new Date(b.user_pay_time).getTime() - new Date(b.user_create_time).getTime()
  55. function secondsToDhms(seconds: any) {
  56. const days = Math.floor(seconds / (3600 * 24));
  57. const hours = Math.floor((seconds % (3600 * 24)) / 3600);
  58. const minutes = Math.floor((seconds % 3600) / 60);
  59. const remainingSeconds = seconds % 60;
  60. return `${days ? days + "天" : ''}${hours ? hours + "小时" : ''}${minutes ? minutes + "分" : ''}${remainingSeconds ? remainingSeconds + "秒" : ''}`
  61. }
  62. return diff ? <WidthEllipsis value={secondsToDhms(diff / 1000)} /> : '--'
  63. }
  64. },
  65. {
  66. title: '最近充值时间距今',
  67. dataIndex: 'nowPayTimeDiff',
  68. align: 'center',
  69. width: 130,
  70. default: 19,
  71. render: (a: string, b: any) => {
  72. let diff = new Date().getTime() - new Date(b.user_pay_time).getTime()
  73. function secondsToDhms(seconds: any) {
  74. const days = Math.floor(seconds / (3600 * 24));
  75. const hours = Math.floor((seconds % (3600 * 24)) / 3600);
  76. const minutes = Math.floor((seconds % 3600) / 60);
  77. const remainingSeconds = seconds % 60;
  78. return `${days ? days + "天" : ''}${hours ? hours + "小时" : ''}${minutes ? minutes + "分" : ''}${remainingSeconds ? remainingSeconds.toFixed(0) + "秒" : ''}`
  79. }
  80. return diff ? <span style={Math.floor((diff / 1000) / (3600 * 24)) > 1 ? { color: 'red' } : {}}><WidthEllipsis value={secondsToDhms(diff / 1000)} /></span> : '--'
  81. }
  82. },
  83. ]
  84. },
  85. {
  86. label: '角色充值信息',
  87. data: [
  88. {
  89. title: '当天充值金额', dataIndex: 'today_amount', label: '角色充值信息', align: 'center', width: 70, default: 9, sorter: true,
  90. className: 'progress',
  91. render: (a: number) => {
  92. return <ProgressTable
  93. strokeColor={{
  94. from: '#108ee9',
  95. to: '#87d068',
  96. }}
  97. percent={a ? a / 2000 * 100 : 0}
  98. value={a || 0}
  99. valueStyle={a >= 1000 ? { color: '#000', fontWeight: 500 } : { fontWeight: 500 }}
  100. />
  101. },
  102. },
  103. { title: '首充金额', dataIndex: 'role_first_amount', label: '角色充值信息', align: 'center', width: 70, default: 10, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  104. { title: '最近充值金额', dataIndex: 'role_last_amount', label: '角色充值信息', align: 'center', width: 70, default: 11, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  105. {
  106. title: '累计充值金额', dataIndex: 'amount', label: '角色充值信息', align: 'center', width: 100, default: 12, sorter: true, className: 'progress',
  107. render: (a: number) => {
  108. return <ProgressTable
  109. strokeColor={{
  110. from: '#ff5900',
  111. to: '#ffd380',
  112. }}
  113. percent={a ? a / 10000 * 100 : 0}
  114. value={a || 0}
  115. valueStyle={a >= 5000 ? { color: '#000', fontWeight: 500 } : { fontWeight: 500 }}
  116. />
  117. },
  118. },
  119. { title: '平均单价', dataIndex: 'avg_amount', label: '角色充值信息', align: 'center', width: 70, default: 13, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  120. { title: '累计充值次数', dataIndex: 'amount_count', label: '角色充值信息', align: 'center', width: 70, default: 14, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  121. ],
  122. },
  123. {
  124. label: '客户运营操作',
  125. data: [
  126. {
  127. title: '邮件是否发送', dataIndex: 'is_send_mail', label: '客户运营操作', width: 130, align: 'center',
  128. render: (a: any, b: any) => {
  129. return <Space>
  130. {a ? <Badge className="badge" status="success" text="已发送" /> : <Badge className="badge" status="warning" text="未发送" />}
  131. <a style={{ fontSize: 12 }} onClick={() => sendEmail([b])}>发送</a>
  132. <SendEmailDetails data={b} />
  133. </Space>
  134. },
  135. },
  136. {
  137. title: '最新发送礼包', dataIndex: 'send_gift_id', label: '客户运营操作', align: 'center', width: 138,
  138. render: (a: any, b: any) => {
  139. return <Space>
  140. <div style={{ width: 50, textAlign: 'left' }}><WidthEllipsis value={b?.gift_name} /></div>
  141. <a style={{ fontSize: 12 }} onClick={() => sendPack([b])}>发送</a>
  142. <SendPackDetails data={b} />
  143. </Space>
  144. },
  145. },
  146. {
  147. title: '是否转端', dataIndex: 'is_change_game_type', label: '客户运营操作', align: 'center', width: 60,
  148. render: (a: any, b: any) => {
  149. // return <IsTrue value={a ? '1' : '0'} onChange={(value) => handleIsTrue(value, b, 'isChangeGameType')} />
  150. return a ? '是' : '否'
  151. },
  152. },
  153. {
  154. title: '是否添加企微', dataIndex: 'is_add_corp_wechat', label: '客户运营操作', align: 'center', width: 60,
  155. render: (a: any, b: any) => {
  156. // return <IsTrue value={a ? '1' : '0'} onChange={(value) => handleIsTrue(value, b, 'isAddCorpWechat')} />
  157. return a ? '是' : '否'
  158. },
  159. },
  160. {
  161. title: '企微号', dataIndex: 'add_corp_user_id', label: '客户运营操作', align: 'center', width: 80, className: 'padding0',
  162. render: (a: any, b: any) => {
  163. // return <InputUpdate title={a || ''} dataIndex={'add_corp_user_id'} record={b} handleSave={handleSave} />
  164. return <WidthEllipsis value={a} />
  165. },
  166. },
  167. {
  168. title: '客户微信号', dataIndex: 'user_wechat', label: '客户运营操作', align: 'center', width: 80,
  169. render: (a: any, b: any) => {
  170. // return <InputUpdate title={a || ''} dataIndex={'user_wechat'} record={b} handleSave={handleSave} />
  171. return <WidthEllipsis value={a} />
  172. },
  173. },
  174. {
  175. title: '客户手机号', dataIndex: 'user_phone', label: '客户运营操作', align: 'center', width: 80,
  176. render: (a: any, b: any) => {
  177. // return <InputUpdate title={a || ''} dataIndex={'user_phone'} record={b} handleSave={handleSave} />
  178. return <WidthEllipsis value={a} />
  179. },
  180. },
  181. {
  182. title: '是否退游', dataIndex: 'is_remove_game', label: '客户运营操作', align: 'center', width: 50,
  183. render: (a: any, b: any) => {
  184. // return <IsTrue value={a ? '1' : '0'} onChange={(value) => handleIsTrue(value, b, 'isRemoveGame')} />
  185. return a ? '是' : '否'
  186. },
  187. },
  188. {
  189. title: '是否唤醒', dataIndex: 'is_wake_up', label: '客户运营操作', align: 'center', width: 50,
  190. render: (a: any, b: any) => {
  191. // return <IsTrue value={a ? '1' : '0'} onChange={(value) => handleIsTrue(value, b, 'isWakeUp')} />
  192. return a ? '是' : '否'
  193. },
  194. },
  195. {
  196. title: '备注', dataIndex: 'remark', label: '客户运营操作', align: 'center', width: 80,
  197. render: (a: any, b: any) => {
  198. // return <InputUpdate title={a || ''} dataIndex={'remark'} record={b} handleSave={handleSave} />
  199. return <WidthEllipsis value={a} />
  200. },
  201. },
  202. // {
  203. // title: '角色操作',
  204. // dataIndex: 'rolecz',
  205. // label: '客户运营操作',
  206. // align: 'center',
  207. // width: 80,
  208. // render: (a: any, b: any) => {
  209. // return <a onClick={() => { roleHandle([b]) }}>角色操作</a>
  210. // }
  211. // }
  212. ]
  213. },
  214. {
  215. label: '客户管理操作',
  216. data: [
  217. { title: 'GS', dataIndex: 'gs_name', label: '客户管理操作', align: 'center', width: 80, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  218. { title: '客服', dataIndex: 'customer_service_name', label: '客户管理操作', align: 'center', width: 80, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  219. { title: '运营', dataIndex: 'oper_user_name', label: '客户管理操作', align: 'center', width: 80, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  220. { title: '投手', dataIndex: 'put_user_name', label: '客户管理操作', align: 'center', width: 80, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  221. { title: '创建者', dataIndex: 'create_by', label: '客户管理操作', align: 'center', width: 80, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  222. { title: '更新者', dataIndex: 'update_by', label: '客户管理操作', align: 'center', width: 80, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  223. { title: '创建时间', dataIndex: 'create_time', label: '客户管理操作', align: 'center', width: 140, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  224. { title: '更新时间', dataIndex: 'update_time', label: '客户管理操作', align: 'center', width: 140, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  225. { title: '是否删除', dataIndex: 'is_delete', label: '客户管理操作', align: 'center', width: 70, render: (a: string, b: any) => (<WidthEllipsis value={a ? '删除' : '‘正常'} />) },
  226. // {
  227. // title: '指派',
  228. // dataIndex: 'zp',
  229. // label: '客户管理操作',
  230. // align: 'center',
  231. // width: 110,
  232. // render: (a: any, b: any) => {
  233. // return <Space>
  234. // <a onClick={() => { assignHandle([b]) }}>指派</a>
  235. // <a onClick={() => { changeLog([b]) }}>变更记录</a>
  236. // </Space>
  237. // }
  238. // }
  239. ]
  240. },
  241. {
  242. label: '操作',
  243. data: [
  244. {
  245. title: '操作',
  246. dataIndex: 'cz',
  247. label: '操作',
  248. align: 'center',
  249. width: 180,
  250. default: 20,
  251. render: (a: any, b: any) => {
  252. return <Space>
  253. <a onClick={() => { roleHandle([b]) }}>角色操作</a>
  254. <a onClick={() => { assignHandle([b]) }}>指派</a>
  255. <a onClick={() => { changeLog([b]) }}>变更记录</a>
  256. </Space>
  257. }
  258. }
  259. ]
  260. }
  261. ]
  262. return newArr
  263. }
  264. export const columnsSendEmailLog = (update: (data: any) => void, del: (id: number[]) => void): any[] => {
  265. return [
  266. {
  267. title: '发送时间',
  268. dataIndex: 'sendTime',
  269. key: 'sendTime',
  270. width: 145,
  271. ellipsis: true,
  272. fixed: 'left'
  273. },
  274. {
  275. title: '操作人',
  276. dataIndex: 'createName',
  277. key: 'createName',
  278. width: 60,
  279. ellipsis: true
  280. },
  281. {
  282. title: '更新人',
  283. dataIndex: 'updateName',
  284. key: 'updateName',
  285. width: 60,
  286. ellipsis: true
  287. },
  288. {
  289. title: '创建时间',
  290. dataIndex: 'createTime',
  291. key: 'createTime',
  292. width: 145,
  293. ellipsis: true
  294. },
  295. {
  296. title: '更新时间',
  297. dataIndex: 'updateTime',
  298. key: 'updateTime',
  299. width: 145,
  300. ellipsis: true
  301. },
  302. {
  303. title: '操作',
  304. dataIndex: 'cz',
  305. key: 'cz',
  306. width: 70,
  307. fixed: 'right',
  308. render: (a: any, b: any) => {
  309. return <Space>
  310. <a style={{ fontSize: 12 }} onClick={() => update([b])}>更新</a>
  311. <Popconfirm
  312. title="确定删除?"
  313. onConfirm={() => del([b.id])}
  314. >
  315. <a style={{ color: 'red', fontSize: 12 }}>删除</a>
  316. </Popconfirm>
  317. </Space>
  318. }
  319. },
  320. ]
  321. };
  322. export const columnsSendPackLog = (update: (data: any) => void, del: (id: number[]) => void): any[] => {
  323. return [
  324. {
  325. title: '礼包',
  326. dataIndex: 'giftName',
  327. key: 'giftName',
  328. width: 100,
  329. ellipsis: true,
  330. fixed: 'left'
  331. },
  332. {
  333. title: '发送时间',
  334. dataIndex: 'sendTime',
  335. key: 'sendTime',
  336. width: 145,
  337. ellipsis: true
  338. },
  339. {
  340. title: '操作人',
  341. dataIndex: 'createName',
  342. key: 'createName',
  343. width: 60,
  344. ellipsis: true
  345. },
  346. {
  347. title: '更新人',
  348. dataIndex: 'updateName',
  349. key: 'updateName',
  350. width: 60,
  351. ellipsis: true
  352. },
  353. {
  354. title: '创建时间',
  355. dataIndex: 'createTime',
  356. key: 'createTime',
  357. width: 145,
  358. ellipsis: true
  359. },
  360. {
  361. title: '更新时间',
  362. dataIndex: 'updateTime',
  363. key: 'updateTime',
  364. width: 145,
  365. ellipsis: true
  366. },
  367. {
  368. title: '操作',
  369. dataIndex: 'cz',
  370. key: 'cz',
  371. width: 70,
  372. fixed: 'right',
  373. render: (a: any, b: any) => {
  374. return <Space>
  375. <a style={{ fontSize: 12 }} onClick={() => update([b])}>更新</a>
  376. <Popconfirm
  377. title="确定删除?"
  378. onConfirm={() => del([b.id])}
  379. >
  380. <a style={{ color: 'red', fontSize: 12 }}>删除</a>
  381. </Popconfirm>
  382. </Space>
  383. }
  384. },
  385. ]
  386. };
  387. /**
  388. * 变更记录
  389. * @param update
  390. * @param del
  391. * @returns
  392. */
  393. export const columnsChangeLog = (update: (data: any) => void, del: (id: number[]) => void): any[] => {
  394. return [
  395. {
  396. title: '开始时间',
  397. dataIndex: 'startTime',
  398. key: 'startTime',
  399. width: 145,
  400. ellipsis: true
  401. },
  402. {
  403. title: '结束时间',
  404. dataIndex: 'endTime',
  405. key: 'endTime',
  406. width: 145,
  407. ellipsis: true
  408. },
  409. {
  410. title: '游戏名称',
  411. dataIndex: 'gameName',
  412. key: 'gameName',
  413. width: 100,
  414. ellipsis: true,
  415. fixed: 'left'
  416. },
  417. {
  418. title: '角色名称',
  419. dataIndex: 'roleName',
  420. key: 'roleName',
  421. width: 100,
  422. ellipsis: true,
  423. fixed: 'left'
  424. },
  425. {
  426. title: '区服名称',
  427. dataIndex: 'serverName',
  428. key: 'serverName',
  429. width: 100,
  430. ellipsis: true,
  431. fixed: 'left'
  432. },
  433. {
  434. title: '客服',
  435. dataIndex: 'customerServiceName',
  436. key: 'customerServiceName',
  437. width: 100,
  438. ellipsis: true
  439. },
  440. {
  441. title: '运营',
  442. dataIndex: 'operUserName',
  443. key: 'operUserName',
  444. width: 100,
  445. ellipsis: true
  446. },
  447. {
  448. title: '运营',
  449. dataIndex: 'gsName',
  450. key: 'gsName',
  451. width: 100,
  452. ellipsis: true
  453. },
  454. {
  455. title: '创建人',
  456. dataIndex: 'createName',
  457. key: 'createName',
  458. width: 60,
  459. ellipsis: true
  460. },
  461. {
  462. title: '创建时间',
  463. dataIndex: 'createTime',
  464. key: 'createTime',
  465. width: 145,
  466. ellipsis: true
  467. },
  468. {
  469. title: '更新人',
  470. dataIndex: 'updateName',
  471. key: 'updateName',
  472. width: 60,
  473. ellipsis: true
  474. },
  475. {
  476. title: '更新时间',
  477. dataIndex: 'updateTime',
  478. key: 'updateTime',
  479. width: 145,
  480. ellipsis: true
  481. },
  482. {
  483. title: '备注',
  484. dataIndex: 'remark',
  485. key: 'remark',
  486. width: 200,
  487. ellipsis: true
  488. },
  489. {
  490. title: '操作',
  491. dataIndex: 'cz',
  492. key: 'cz',
  493. width: 70,
  494. fixed: 'right',
  495. render: (a: any, b: any) => {
  496. return <Space>
  497. <a style={{ fontSize: 12 }} onClick={() => update(b)}>修改</a>
  498. <Popconfirm
  499. title="确定删除?"
  500. onConfirm={() => del([b.id])}
  501. >
  502. <a style={{ color: 'red', fontSize: 12 }}>删除</a>
  503. </Popconfirm>
  504. </Space>
  505. }
  506. },
  507. ]
  508. };
  509. export default columns12