tableConfig.tsx 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import { ProColumns } from '@ant-design/pro-components';
  2. import { Tag, Button, Popconfirm, Space, Switch, Tooltip } from 'antd';
  3. import Users from './user'
  4. import { InfoCircleOutlined } from '@ant-design/icons';
  5. export const columns = (
  6. edit: (b: boolean, v: any) => void,
  7. del: (id: any) => void,
  8. stateUpdata: (id: any, ck: boolean) => void,
  9. mimiAssign: (b: any) => void,
  10. ): ProColumns<any>[] => {
  11. return [
  12. {
  13. title: 'ID',
  14. dataIndex: 'id',
  15. key: 'id',
  16. align: 'center',
  17. width: 70,
  18. ellipsis: true,
  19. hideInSearch: true,
  20. },
  21. {
  22. title: '小程序appId',
  23. dataIndex: 'wechatAppId',
  24. key: 'wechatAppId',
  25. align: 'center',
  26. width: 70,
  27. ellipsis: true,
  28. },
  29. // {
  30. // title: '小程序秘钥',
  31. // dataIndex: 'appSecret',
  32. // key: 'appSecret',
  33. // align: 'center',
  34. // width: 80,
  35. // ellipsis: true,
  36. // hideInSearch: true,
  37. // },
  38. {
  39. title: '小程序名称',
  40. dataIndex: 'appName',
  41. key: 'appName',
  42. width: 80,
  43. ellipsis: true,
  44. align: 'center',
  45. },
  46. {
  47. title: '小程序页面模板',
  48. dataIndex: 'templateName',
  49. key: 'templateName',
  50. width: 80,
  51. ellipsis: true,
  52. align: 'center',
  53. },
  54. {
  55. title: '小程序首页链接',
  56. dataIndex: 'homePage',
  57. key: 'homePage',
  58. width: 80,
  59. ellipsis: true,
  60. align: 'center',
  61. hideInSearch: true,
  62. },
  63. {
  64. title: '小程序版本号',
  65. dataIndex: 'appVersion',
  66. key: 'appVersion',
  67. width: 80,
  68. ellipsis: true,
  69. align: 'center',
  70. hideInSearch: true,
  71. },
  72. {
  73. title: 'ios支付版本号',
  74. width: 80,
  75. ellipsis: true,
  76. align: 'center',
  77. tooltip: "ios的特殊性,此版本号与IOS支付模块关联,小程序版本号<=此版本号IOS才会出现支付功能,(微信)小程序发布线上后必须设置",
  78. dataIndex: 'iosPayment',
  79. hideInSearch: true,
  80. render: (_, d) => {
  81. return d.iosPayment ? <Tag color={d.iosPayment === d.appVersion ? "processing" : "error"} bordered={false}> {d.iosPayment} </Tag> : <Tag color="error" bordered={false}>IOS无法支付</Tag>
  82. }
  83. },
  84. {
  85. title: '备注',
  86. dataIndex: 'remark',
  87. key: 'remark',
  88. width: 80,
  89. align: 'center',
  90. ellipsis: true,
  91. hideInSearch: true,
  92. },
  93. {
  94. title: '状态',
  95. dataIndex: 'enabled',
  96. key: 'enabled',
  97. width: 80,
  98. align: 'center',
  99. ellipsis: true,
  100. hideInSearch: true,
  101. render: (a: any, b: any) => {
  102. return (
  103. <Switch
  104. checkedChildren="正常"
  105. unCheckedChildren="停用"
  106. checked={b?.enabled}
  107. onChange={(ck) => {
  108. stateUpdata(b.id, ck);
  109. }}
  110. />
  111. );
  112. },
  113. },
  114. {
  115. title: '已指派(分销商)',
  116. dataIndex: 'distributorInfo',
  117. width: 80,
  118. align: 'center',
  119. ellipsis: true,
  120. hideInSearch: true,
  121. render: (a, b: any) => {
  122. return <a>{b?.distributorInfo?.companyName}</a>;
  123. },
  124. },
  125. {
  126. title: '商户',
  127. dataIndex: 'mchName',
  128. width: 80,
  129. align: 'center',
  130. ellipsis: true,
  131. hideInSearch: true,
  132. render: (a, b: any) => {
  133. return <a>{b?.mchInfo?.mchName}</a>;
  134. },
  135. },
  136. {
  137. title: '操作',
  138. dataIndex: 'cz',
  139. key: 'cz',
  140. width: 160,
  141. align: 'center',
  142. hideInSearch: true,
  143. render: (a: any, b: any) => {
  144. return (
  145. <Space size={[0, 0]}>
  146. <Button
  147. onClick={() => {
  148. edit(true, b);
  149. }}
  150. size="small"
  151. type="link"
  152. >
  153. 编辑
  154. </Button>
  155. <Popconfirm
  156. title={
  157. <div>
  158. 确定要删除<span style={{ color: 'red' }}>{b.appName}</span>小程序?
  159. </div>
  160. }
  161. onConfirm={() => {
  162. del(b.id);
  163. }}
  164. >
  165. <Button size="small" danger type="link">
  166. 删除
  167. </Button>
  168. </Popconfirm>
  169. <Button
  170. onClick={() => {
  171. mimiAssign(b);
  172. }}
  173. size="small"
  174. type="link"
  175. >
  176. 指派
  177. </Button>
  178. <Users data={b} />
  179. </Space>
  180. );
  181. },
  182. },
  183. ];
  184. };