data.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import { listDictModel } from '/@/api/common';
  2. import { DescItem } from '/@/components/Description';
  3. import { BasicColumn, FormSchema } from '/@/components/Table';
  4. export const columns: BasicColumn[] = [
  5. {
  6. title: '渠道名称',
  7. dataIndex: 'name',
  8. },
  9. {
  10. title: '短信签名',
  11. dataIndex: 'signature',
  12. },
  13. {
  14. title: '渠道类型',
  15. dataIndex: 'type',
  16. },
  17. {
  18. title: '短信API账号',
  19. dataIndex: 'apiKey',
  20. },
  21. {
  22. title: '发送回调URL',
  23. dataIndex: 'callbackUrl',
  24. },
  25. {
  26. title: '启用',
  27. dataIndex: 'disable',
  28. },
  29. ];
  30. // 表单列定义
  31. export const searchFormSchema: FormSchema[] = [
  32. {
  33. label: '渠道名称',
  34. field: 'name',
  35. component: 'Input',
  36. componentProps: {
  37. placeholder: '请输入渠道名称',
  38. },
  39. },
  40. {
  41. label: '渠道类型',
  42. field: 'type',
  43. component: 'ApiSelect',
  44. componentProps: {
  45. api: listDictModel,
  46. params: {
  47. dictCode: 'sys_sms_channel',
  48. },
  49. },
  50. },
  51. {
  52. label: '是否启用',
  53. field: 'disable',
  54. component: 'ApiSelect',
  55. componentProps: {
  56. api: listDictModel,
  57. params: {
  58. dictCode: 'sys_disable_type',
  59. },
  60. },
  61. },
  62. ];
  63. // 表单新增编辑
  64. export const dataFormSchema: FormSchema[] = [
  65. {
  66. label: '渠道名称',
  67. field: 'name',
  68. required: true,
  69. component: 'Input',
  70. componentProps: {
  71. placeholder: '请输入渠道名称',
  72. },
  73. },
  74. {
  75. label: '短信签名',
  76. field: 'signature',
  77. required: true,
  78. component: 'Input',
  79. componentProps: {
  80. placeholder: '请输入短信签名',
  81. },
  82. },
  83. {
  84. label: '渠道类型',
  85. field: 'type',
  86. component: 'ApiSelect',
  87. componentProps: {
  88. api: listDictModel,
  89. params: {
  90. dictCode: 'sys_sms_channel',
  91. },
  92. },
  93. defaultValue: 'ALIYUN',
  94. },
  95. {
  96. label: '短信API账号',
  97. field: 'apiKey',
  98. required: true,
  99. component: 'Input',
  100. componentProps: {
  101. placeholder: '请输入短信API的账号',
  102. },
  103. },
  104. {
  105. label: '短信API秘钥',
  106. field: 'apiSecret',
  107. required: true,
  108. component: 'Input',
  109. componentProps: {
  110. placeholder: '请输入短信API的秘钥',
  111. },
  112. },
  113. {
  114. label: '发送回调URL',
  115. field: 'callbackUrl',
  116. required: true,
  117. component: 'Input',
  118. componentProps: {
  119. placeholder: '请输入短信发送回调URL',
  120. },
  121. helpMessage: ({ values }) => {
  122. switch (values.type) {
  123. case 'ALIYUN':
  124. return '阿里云回调地址:https://host:ip+/sms/callback/aliyun';
  125. case 'TENCENT':
  126. return '腾讯云回调地址: https://host:ip+/sms/callback/tencent';
  127. }
  128. },
  129. },
  130. {
  131. label: '是否启用',
  132. field: 'disable',
  133. component: 'ApiRadioGroup',
  134. componentProps: {
  135. api: listDictModel,
  136. params: {
  137. dictCode: 'sys_disable_type',
  138. },
  139. },
  140. defaultValue: '0',
  141. },
  142. {
  143. label: '备注',
  144. field: 'remark',
  145. component: 'InputTextArea',
  146. componentProps: {
  147. placeholder: '请输入备注',
  148. },
  149. },
  150. ];
  151. // 表单详情查看
  152. export const viewSchema: DescItem[] = [
  153. {
  154. label: '主键',
  155. field: 'id',
  156. },
  157. {
  158. label: '渠道名称',
  159. field: 'name',
  160. },
  161. {
  162. label: '短信签名',
  163. field: 'signature',
  164. },
  165. {
  166. label: '渠道类型',
  167. field: 'type',
  168. },
  169. {
  170. label: '短信API账号',
  171. field: 'apiKey',
  172. },
  173. {
  174. label: '短信API秘钥',
  175. field: 'apiSecret',
  176. },
  177. {
  178. label: '发送回调URL',
  179. field: 'callbackUrl',
  180. },
  181. {
  182. label: '启用',
  183. field: 'disable',
  184. },
  185. {
  186. label: '备注',
  187. field: 'remark',
  188. },
  189. ];