tableConfig.tsx 5.0 KB

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