template.data.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import { BasicColumn, FormSchema } from '/@/components/Table';
  2. import { rules } from '/@/utils/helper/validator';
  3. export const columns: BasicColumn[] = [
  4. {
  5. title: '模板标题',
  6. dataIndex: 'templateName',
  7. width: 80,
  8. },
  9. {
  10. title: '模板编码',
  11. dataIndex: 'templateCode',
  12. width: 100,
  13. },
  14. {
  15. title: '通知模板',
  16. dataIndex: 'templateContent',
  17. width: 150,
  18. },
  19. {
  20. title: '模板类型',
  21. dataIndex: 'templateType',
  22. width: 100,
  23. customRender: function ({ text }) {
  24. if (text == '1') {
  25. return '文本';
  26. }
  27. if (text == '2') {
  28. return '富文本';
  29. }
  30. return text;
  31. },
  32. },
  33. {
  34. title: '是否应用',
  35. dataIndex: 'useStatus',
  36. width: 90,
  37. customRender: function ({ text }) {
  38. if (text == '1') {
  39. return '是';
  40. } else {
  41. return '否';
  42. }
  43. },
  44. },
  45. ];
  46. export const searchFormSchema: FormSchema[] = [
  47. {
  48. label: '模板标题',
  49. field: 'templateName',
  50. component: 'Input',
  51. },
  52. {
  53. label: '模板编码',
  54. field: 'templateCode',
  55. component: 'Input',
  56. },
  57. {
  58. label: '模板类型',
  59. field: 'templateType',
  60. component: 'JDictSelectTag',
  61. componentProps: {
  62. dictCode: 'msgType',
  63. },
  64. },
  65. ];
  66. export const formSchemas: FormSchema[] = [
  67. {
  68. label: 'ID',
  69. field: 'id',
  70. component: 'Input',
  71. show: false,
  72. },
  73. {
  74. label: '模板标题',
  75. field: 'templateName',
  76. component: 'Input',
  77. required: true,
  78. },
  79. {
  80. label: '模板编码',
  81. field: 'templateCode',
  82. component: 'Input',
  83. dynamicRules: ({ model, schema }) => {
  84. return [{ required: true, message: '请输入模板编码!' }, ...rules.duplicateCheckRule('sys_sms_template', 'template_code', model, schema, true)];
  85. },
  86. // 编辑模式下不可修改编码
  87. dynamicDisabled: (params) => !!params.values.id,
  88. },
  89. {
  90. label: '模板类型',
  91. field: 'templateType',
  92. component: 'JDictSelectTag',
  93. componentProps: {
  94. dictCode: 'msgType',
  95. placeholder: '请选择模板类型',
  96. },
  97. required: true,
  98. },
  99. {
  100. label: '是否应用',
  101. field: 'useStatus',
  102. component: 'JSwitch',
  103. componentProps: {
  104. options: ['1', '0'],
  105. },
  106. },
  107. {
  108. label: '模板内容',
  109. field: 'templateContent',
  110. component: 'InputTextArea',
  111. componentProps: {
  112. autoSize: {
  113. minRows: 8,
  114. maxRows: 8,
  115. },
  116. },
  117. ifShow: ({ values }) => {
  118. return !['2', '4'].includes(values.templateType);
  119. },
  120. },
  121. {
  122. label: '模板内容',
  123. field: 'templateContent',
  124. component: 'JEditor',
  125. ifShow: ({ values }) => {
  126. return ['2', '4'].includes(values.templateType);
  127. },
  128. },
  129. ];
  130. export const sendTestFormSchemas: FormSchema[] = [
  131. {
  132. label: '模板编码',
  133. field: 'templateCode',
  134. component: 'Input',
  135. show: false,
  136. },
  137. {
  138. label: '模板标题',
  139. field: 'templateName',
  140. component: 'Input',
  141. componentProps: { disabled: true },
  142. },
  143. {
  144. label: '模板内容',
  145. field: 'templateContent',
  146. component: 'InputTextArea',
  147. componentProps: { disabled: true, rows: 5 },
  148. },
  149. {
  150. label: '测试数据',
  151. field: 'testData',
  152. component: 'InputTextArea',
  153. required: true,
  154. helpMessage: 'JSON数据',
  155. componentProps: {
  156. placeholder: '请输入JSON格式测试数据',
  157. rows: 5,
  158. },
  159. },
  160. {
  161. label: '消息类型',
  162. field: 'msgType',
  163. component: 'JDictSelectTag',
  164. required: true,
  165. componentProps: { dictCode: 'messageType' },
  166. },
  167. {
  168. label: '消息接收方',
  169. field: 'receiver',
  170. component: 'Input',
  171. required: true,
  172. },
  173. ];