user.data.ts 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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. show: false,
  152. },
  153. // {
  154. // label: '角色',
  155. // field: 'selectedroles',
  156. // component: 'ApiSelect',
  157. // componentProps: {
  158. // mode: 'multiple',
  159. // api: getAllRolesList,
  160. // labelField: 'roleName',
  161. // valueField: 'id',
  162. // },
  163. // },
  164. {
  165. label: '所属部门',
  166. field: 'selecteddeparts',
  167. component: 'JSelectDept',
  168. required: true,
  169. componentProps: ({ formActionType, formModel }) => {
  170. return {
  171. sync: false,
  172. checkStrictly: true,
  173. defaultExpandLevel: 2,
  174. onSelect: (options, values) => {
  175. const { updateSchema } = formActionType;
  176. //所属部门修改后更新负责部门下拉框数据
  177. updateSchema([
  178. {
  179. field: 'departIds',
  180. componentProps: { options },
  181. },
  182. ]);
  183. //所属部门修改后更新负责部门数据
  184. formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
  185. },
  186. };
  187. },
  188. },
  189. ];
  190. export const formPasswordSchema: FormSchema[] = [
  191. {
  192. label: '用户账号',
  193. field: 'username',
  194. component: 'Input',
  195. componentProps: { readOnly: true },
  196. },
  197. {
  198. label: '登录密码',
  199. field: 'password',
  200. component: 'StrengthMeter',
  201. componentProps: {
  202. placeholder: '请输入登录密码',
  203. },
  204. rules: [
  205. {
  206. required: true,
  207. message: '请输入登录密码',
  208. },
  209. ],
  210. },
  211. {
  212. label: '确认密码',
  213. field: 'confirmPassword',
  214. component: 'InputPassword',
  215. dynamicRules: ({ values }) => rules.confirmPassword(values, true),
  216. },
  217. ];
  218. export const formAgentSchema: FormSchema[] = [
  219. {
  220. label: '',
  221. field: 'id',
  222. component: 'Input',
  223. show: false,
  224. },
  225. {
  226. field: 'userName',
  227. label: '用户名',
  228. component: 'Input',
  229. componentProps: {
  230. readOnly: true,
  231. allowClear: false,
  232. },
  233. },
  234. {
  235. field: 'agentUserName',
  236. label: '代理人用户名',
  237. required: true,
  238. component: 'JSelectUser',
  239. componentProps: {
  240. rowKey: 'username',
  241. labelKey: 'realname',
  242. maxSelectCount: 10,
  243. },
  244. },
  245. {
  246. field: 'startTime',
  247. label: '代理开始时间',
  248. component: 'DatePicker',
  249. required: true,
  250. componentProps: {
  251. showTime: true,
  252. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  253. placeholder: '请选择代理开始时间',
  254. },
  255. },
  256. {
  257. field: 'endTime',
  258. label: '代理结束时间',
  259. component: 'DatePicker',
  260. required: true,
  261. componentProps: {
  262. showTime: true,
  263. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  264. placeholder: '请选择代理结束时间',
  265. },
  266. },
  267. {
  268. field: 'status',
  269. label: '状态',
  270. component: 'JDictSelectTag',
  271. defaultValue: '1',
  272. componentProps: {
  273. dictCode: 'valid_status',
  274. type: 'radioButton',
  275. },
  276. },
  277. ];