tableConfig.tsx 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. import { ProColumns } from "@ant-design/pro-components";
  2. import { useModel } from "@umijs/max";
  3. import { Badge, Button, Image, Space, Tag } from "antd";
  4. import PopUp from "./popUp";
  5. export const columns = (sync: (id: any) => void): ProColumns<any>[] => {
  6. const { getEnum } = useModel("global")
  7. return [
  8. {
  9. title: "企微名称",
  10. dataIndex: 'corpName',
  11. key: "corpName",
  12. align: "center",
  13. width:100,
  14. ellipsis:true,
  15. fixed: 'left'
  16. },
  17. {
  18. title: "企微ID",
  19. dataIndex: 'corpId',
  20. key: "corpId",
  21. hideInSearch: true,
  22. width:100,
  23. ellipsis:true,
  24. align: "center",
  25. },
  26. {
  27. title: "授权方企业类型",
  28. dataIndex: 'corpType',
  29. key: "corpType",
  30. hideInSearch: true,
  31. align: "center",
  32. width:100,
  33. ellipsis:true,
  34. valueEnum: getEnum("CORPTYPE", "map")
  35. },
  36. {
  37. title: "授权方企业用户规模",
  38. dataIndex: 'corpUserMax',
  39. key: "corpUserMax",
  40. hideInSearch: true,
  41. width:100,
  42. ellipsis:true,
  43. align: "center",
  44. },
  45. {
  46. title: "授权方企业的主体名称",
  47. dataIndex: 'corpFullName',
  48. key: "corpFullName",
  49. hideInSearch: true,
  50. width:100,
  51. ellipsis:true,
  52. align: "center",
  53. },
  54. {
  55. title: "认证到期时间",
  56. dataIndex: 'verifiedEndTime',
  57. key: "verifiedEndTime",
  58. hideInSearch: true,
  59. width:100,
  60. ellipsis:true,
  61. align: "center",
  62. },
  63. {
  64. title: "企业类型",
  65. dataIndex: 'subjectType',
  66. key: "subjectType",
  67. hideInSearch: true,
  68. align: "center",
  69. width:100,
  70. ellipsis:true,
  71. valueEnum: getEnum("SUBJECTTYPE", "map")
  72. },
  73. {
  74. title: "企业规模",
  75. dataIndex: 'corpScale',
  76. key: "corpScale",
  77. hideInSearch: true,
  78. width:100,
  79. ellipsis:true,
  80. align: "center",
  81. },
  82. {
  83. title: "所属行业",
  84. dataIndex: 'corpIndustry',
  85. key: "corpIndustry",
  86. hideInSearch: true,
  87. width:100,
  88. ellipsis:true,
  89. align: "center",
  90. },
  91. {
  92. title: "所属子行业",
  93. dataIndex: 'corpSubIndustry',
  94. key: "corpSubIndustry",
  95. hideInSearch: true,
  96. width:100,
  97. ellipsis:true,
  98. align: "center",
  99. },
  100. {
  101. title: "授权方应用id",
  102. dataIndex: 'agentId',
  103. key: "agentId",
  104. hideInSearch: true,
  105. width:100,
  106. ellipsis:true,
  107. align: "center",
  108. },
  109. {
  110. title: "所属分销商账号id",
  111. dataIndex: 'authDistributorAccountId',
  112. key: "authDistributorAccountId",
  113. hideInSearch: true,
  114. width:100,
  115. ellipsis:true,
  116. align: "center",
  117. },
  118. {
  119. title: "授权状态",
  120. dataIndex: 'authStatus',
  121. key: "authStatus",
  122. align: "center",
  123. width:100,
  124. ellipsis:true,
  125. valueEnum(row) {
  126. return { "1": { text: <Badge status="success" text="授权成功" /> }, "-1": { text: <Badge status="error" text="取消授权" /> } }
  127. },
  128. },
  129. {
  130. title: "授权时间",
  131. dataIndex: 'createTime',
  132. key: "createTime",
  133. hideInSearch: true,
  134. align: "center",
  135. width:100,
  136. ellipsis:true,
  137. },
  138. {
  139. title: "关注二维码",
  140. tooltip: "授权企业在微信插件(原企业号)的二维码,可用于关注微信插件",
  141. dataIndex: 'corpWxQrcode',
  142. key: "corpWxQrcode",
  143. hideInSearch: true,
  144. align: "center",
  145. ellipsis:true,
  146. width: 120,
  147. render: (_, row) => {
  148. return <Image src={row?.corpWxQrcode} style={{ width: 20 }} />
  149. }
  150. },
  151. {
  152. title: "操作",
  153. dataIndex: 'option',
  154. valueType: 'option',
  155. align: "center",
  156. width: 90,
  157. render: (_, record) => {
  158. return <Space>
  159. <Button onClick={() => { sync(record?.corpId) }} type="link" size="small">同步</Button>
  160. <PopUp corpId={record?.corpId} corpName={record?.corpName} />
  161. </Space>
  162. },
  163. },
  164. ];
  165. }
  166. export function PopUpColumns(): ProColumns<any>[] {
  167. const { getEnum } = useModel("global")
  168. return [
  169. {
  170. title: "企微客服id",
  171. dataIndex: 'corpUserId',
  172. key: "corpUserId",
  173. hideInSearch: true,
  174. align: "center",
  175. },
  176. {
  177. title: "企微客服名称",
  178. dataIndex: 'name',
  179. key: "name",
  180. align: "center",
  181. },
  182. {
  183. title: "性别",
  184. dataIndex: 'gender',
  185. key: "gender",
  186. align: "center",
  187. hideInSearch: true,
  188. valueEnum(row) {
  189. return { 0: { text: <Tag >未知</Tag> }, 1: { text: <Tag color="green">男</Tag> }, 2: { text: <Tag color="red">女</Tag> } }
  190. },
  191. },
  192. {
  193. title: "分销商账号",
  194. dataIndex: 'distributorAccountName',
  195. key: "distributorAccountName",
  196. hideInSearch: true,
  197. align: "center",
  198. },
  199. {
  200. title: "状态",
  201. dataIndex: 'status',
  202. key: "status",
  203. hideInSearch: true,
  204. align: "center",
  205. valueEnum:()=>{
  206. let obj = getEnum("CORPSTATE", "obj")
  207. let colors = ["success","error","default","warning"]
  208. Object.keys(obj).forEach((key:any,index)=>{
  209. obj[key] = {
  210. text:<Tag color={colors[index]}>{obj[key].text}</Tag>
  211. }
  212. })
  213. return obj
  214. }
  215. },
  216. ]
  217. }