data.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. import { listDictModel } from '/@/api/common';
  2. import { DescItem } from '/@/components/Description';
  3. import { BasicColumn, FormSchema } from '/@/components/Table';
  4. import { validateStr } from '/@/utils/validate';
  5. export const columns: BasicColumn[] = [
  6. {
  7. title: '策略编码',
  8. dataIndex: 'code',
  9. },
  10. {
  11. title: '策略名称',
  12. dataIndex: 'name',
  13. },
  14. {
  15. title: '编号前缀',
  16. dataIndex: 'prefix',
  17. },
  18. {
  19. title: '生成模式',
  20. dataIndex: 'type',
  21. },
  22. {
  23. title: '流水号长度',
  24. dataIndex: 'limitLen',
  25. },
  26. {
  27. title: '填充字符',
  28. dataIndex: 'fillChar',
  29. },
  30. ];
  31. // 表单列定义
  32. export const searchFormSchema: FormSchema[] = [
  33. {
  34. label: '策略编码',
  35. field: 'code',
  36. component: 'Input',
  37. componentProps: {
  38. placeholder: '请输入策略编码',
  39. },
  40. },
  41. {
  42. label: '策略名称',
  43. field: 'name',
  44. component: 'Input',
  45. componentProps: {
  46. placeholder: '请输入策略名称',
  47. },
  48. },
  49. ];
  50. // 表单新增编辑
  51. export const dataFormSchema: FormSchema[] = [
  52. {
  53. label: '策略编码',
  54. field: 'code',
  55. required: true,
  56. component: 'Input',
  57. componentProps: {
  58. placeholder: '请输入策略编码',
  59. },
  60. dynamicRules: () => {
  61. return [
  62. {
  63. required: true,
  64. validator: async (_, value) => {
  65. if (!value) {
  66. return Promise.reject('字典项编码不能为空');
  67. }
  68. if (validateStr(value)) {
  69. return Promise.reject('字典项编码为字母或数字组成');
  70. }
  71. return Promise.resolve();
  72. },
  73. },
  74. ];
  75. },
  76. },
  77. {
  78. label: '策略名称',
  79. field: 'name',
  80. required: true,
  81. component: 'Input',
  82. componentProps: {
  83. placeholder: '请输入策略名称',
  84. },
  85. },
  86. {
  87. label: '流水号(递增)',
  88. field: 'nextNum',
  89. required: true,
  90. component: 'Input',
  91. componentProps: {
  92. placeholder: '请输入流水号(递增)',
  93. },
  94. },
  95. {
  96. label: '流水号长度',
  97. field: 'limitLen',
  98. required: true,
  99. component: 'Input',
  100. componentProps: {
  101. placeholder: '请输入流水号长度',
  102. },
  103. },
  104. {
  105. label: '填充字符',
  106. field: 'fillChar',
  107. required: true,
  108. component: 'Input',
  109. componentProps: {
  110. placeholder: '请输入填充字符',
  111. },
  112. },
  113. {
  114. label: '编号前缀',
  115. field: 'prefix',
  116. component: 'Input',
  117. componentProps: {
  118. placeholder: '请输入编号前缀',
  119. },
  120. },
  121. {
  122. label: '生成模式',
  123. field: 'type',
  124. component: 'ApiSelect',
  125. required: true,
  126. componentProps: {
  127. api: listDictModel,
  128. params: {
  129. dictCode: 'sys_numbering_type',
  130. },
  131. },
  132. },
  133. {
  134. label: '备注',
  135. field: 'remark',
  136. component: 'InputTextArea',
  137. componentProps: {
  138. placeholder: '请输入备注',
  139. },
  140. },
  141. ];
  142. // 表单详情查看
  143. export const viewSchema: DescItem[] = [
  144. {
  145. label: '策略编码',
  146. field: 'code',
  147. },
  148. {
  149. label: '策略名称',
  150. field: 'name',
  151. },
  152. {
  153. label: '编号前缀',
  154. field: 'prefix',
  155. },
  156. {
  157. label: '生成模式',
  158. field: 'type',
  159. },
  160. {
  161. label: '流水号(递增)',
  162. field: 'nextNum',
  163. },
  164. {
  165. label: '流水号长度',
  166. field: 'limitLen',
  167. },
  168. {
  169. label: '填充字符',
  170. field: 'fillChar',
  171. },
  172. {
  173. label: '备注',
  174. field: 'remark',
  175. },
  176. {
  177. label: '下一个编号',
  178. field: 'nextFormatNum',
  179. },
  180. ];