user.data.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { getAllRolesList, getAllTenantList } from './user.api';
  4. import { rules } from '/@/utils/helper/validator';
  5. import { render } from '/@/utils/common/renderUtils';
  6. export const columns: BasicColumn[] = [
  7. {
  8. title: '用户账号',
  9. dataIndex: 'username',
  10. width: 80,
  11. },
  12. {
  13. title: '用户姓名',
  14. dataIndex: 'realname',
  15. width: 80,
  16. },
  17. {
  18. title: '令牌',
  19. dataIndex: 'thirdId',
  20. width: 150,
  21. },
  22. {
  23. title: '有效期',
  24. dataIndex: 'birthday',
  25. width: 80,
  26. },
  27. {
  28. title: '状态',
  29. dataIndex: 'status_dictText',
  30. width: 80,
  31. },
  32. ];
  33. export const recycleColumns: BasicColumn[] = [
  34. {
  35. title: '用户账号',
  36. dataIndex: 'username',
  37. width: 100,
  38. },
  39. {
  40. title: '用户姓名',
  41. dataIndex: 'realname',
  42. width: 100,
  43. },
  44. {
  45. title: '头像',
  46. dataIndex: 'avatar',
  47. width: 80,
  48. customRender: render.renderAvatar,
  49. },
  50. {
  51. title: '性别',
  52. dataIndex: 'sex',
  53. width: 80,
  54. sorter: true,
  55. customRender: ({ text }) => {
  56. return render.renderDict(text, 'sex');
  57. },
  58. },
  59. ];
  60. export const searchFormSchema: FormSchema[] = [
  61. {
  62. label: '账号',
  63. field: 'username',
  64. component: 'JInput',
  65. colProps: { span: 6 },
  66. },
  67. {
  68. label: '名字',
  69. field: 'realname',
  70. component: 'JInput',
  71. colProps: { span: 6 },
  72. },
  73. // {
  74. // label: '性别',
  75. // field: 'sex',
  76. // component: 'JDictSelectTag',
  77. // componentProps: {
  78. // dictCode: 'sex',
  79. // placeholder: '请选择性别',
  80. // stringToNumber: true,
  81. // },
  82. // colProps: { span: 6 },
  83. // },
  84. // {
  85. // label: '手机号码',
  86. // field: 'phone',
  87. // component: 'Input',
  88. // colProps: { span: 6 },
  89. // },
  90. // {
  91. // label: '用户状态',
  92. // field: 'status',
  93. // component: 'JDictSelectTag',
  94. // componentProps: {
  95. // dictCode: 'user_status',
  96. // placeholder: '请选择状态',
  97. // stringToNumber: true,
  98. // },
  99. // colProps: { span: 6 },
  100. // },
  101. ];
  102. export const formSchema: FormSchema[] = [
  103. {
  104. label: '',
  105. field: 'id',
  106. component: 'Input',
  107. show: false,
  108. },
  109. {
  110. label: '用户账号',
  111. field: 'username',
  112. component: 'Input',
  113. dynamicDisabled: ({ values }) => {
  114. return !!values.id;
  115. },
  116. dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'username', model, schema, true),
  117. },
  118. {
  119. label: '登录密码',
  120. field: 'password',
  121. component: 'StrengthMeter',
  122. rules: [
  123. {
  124. required: true,
  125. message: '请输入登录密码',
  126. },
  127. ],
  128. },
  129. {
  130. label: '确认密码',
  131. field: 'confirmPassword',
  132. component: 'InputPassword',
  133. dynamicRules: ({ values }) => rules.confirmPassword(values, true),
  134. },
  135. {
  136. label: '用户姓名',
  137. field: 'realname',
  138. required: true,
  139. component: 'Input',
  140. },
  141. {
  142. label: '有效期',
  143. field: 'birthday',
  144. component: 'DatePicker',
  145. },
  146. {
  147. label: '第三方用户',
  148. field: 'thirdType',
  149. component: 'Input',
  150. defaultValue: '_thirdPartyUser',
  151. },
  152. ];
  153. export const formPasswordSchema: FormSchema[] = [
  154. {
  155. label: '用户账号',
  156. field: 'username',
  157. component: 'Input',
  158. componentProps: { readOnly: true },
  159. },
  160. {
  161. label: '登录密码',
  162. field: 'password',
  163. component: 'StrengthMeter',
  164. componentProps: {
  165. placeholder: '请输入登录密码',
  166. },
  167. rules: [
  168. {
  169. required: true,
  170. message: '请输入登录密码',
  171. },
  172. ],
  173. },
  174. {
  175. label: '确认密码',
  176. field: 'confirmPassword',
  177. component: 'InputPassword',
  178. dynamicRules: ({ values }) => rules.confirmPassword(values, true),
  179. },
  180. ];
  181. export const formAgentSchema: FormSchema[] = [
  182. {
  183. label: '',
  184. field: 'id',
  185. component: 'Input',
  186. show: false,
  187. },
  188. {
  189. field: 'userName',
  190. label: '用户名',
  191. component: 'Input',
  192. componentProps: {
  193. readOnly: true,
  194. allowClear: false,
  195. },
  196. },
  197. {
  198. field: 'agentUserName',
  199. label: '代理人用户名',
  200. required: true,
  201. component: 'JSelectUser',
  202. componentProps: {
  203. rowKey: 'username',
  204. labelKey: 'realname',
  205. maxSelectCount: 10,
  206. },
  207. },
  208. {
  209. field: 'startTime',
  210. label: '代理开始时间',
  211. component: 'DatePicker',
  212. required: true,
  213. componentProps: {
  214. showTime: true,
  215. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  216. placeholder: '请选择代理开始时间',
  217. },
  218. },
  219. {
  220. field: 'endTime',
  221. label: '代理结束时间',
  222. component: 'DatePicker',
  223. required: true,
  224. componentProps: {
  225. showTime: true,
  226. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  227. placeholder: '请选择代理结束时间',
  228. },
  229. },
  230. {
  231. field: 'status',
  232. label: '状态',
  233. component: 'JDictSelectTag',
  234. defaultValue: '1',
  235. componentProps: {
  236. dictCode: 'valid_status',
  237. type: 'radioButton',
  238. },
  239. },
  240. ];