data.config.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import type { VbenFormProps, VxeGridProps } from '#/adapter';
  2. import { RoleApi } from '#/api';
  3. import { formatterStatus } from '#/api/model';
  4. export const searchFormOptions: VbenFormProps = {
  5. schema: [
  6. {
  7. component: 'Input',
  8. fieldName: 'code',
  9. label: '编号',
  10. },
  11. {
  12. component: 'Input',
  13. fieldName: 'name',
  14. label: '名称',
  15. },
  16. ],
  17. };
  18. export const gridOptions: VxeGridProps<RoleApi.RecordItem> = {
  19. toolbarConfig: {
  20. refresh: true,
  21. print: false,
  22. export: false,
  23. zoom: true,
  24. custom: true,
  25. },
  26. columns: [
  27. { title: '序号', type: 'seq', width: 50 },
  28. {
  29. align: 'left',
  30. field: 'code',
  31. title: '编号',
  32. width: 150,
  33. },
  34. { align: 'left', field: 'name', title: '名称', width: 200 },
  35. { align: 'left', field: 'sort', title: '排序', width: 70 },
  36. { align: 'left', field: 'remark', title: '备注' },
  37. {
  38. field: 'status',
  39. title: '状态',
  40. width: 60,
  41. formatter: formatterStatus,
  42. },
  43. {
  44. field: 'action',
  45. fixed: 'right',
  46. slots: { default: 'action' },
  47. title: '操作',
  48. width: 170,
  49. },
  50. ],
  51. height: 'auto',
  52. keepSource: true,
  53. proxyConfig: {
  54. ajax: {
  55. query: async ({ page }, formValues) => {
  56. return await RoleApi.getPage({
  57. pageIndex: page.currentPage,
  58. pageSize: page.pageSize,
  59. ...formValues,
  60. });
  61. },
  62. },
  63. },
  64. };
  65. export const formOptions: VbenFormProps = {
  66. commonConfig: {
  67. componentProps: {
  68. class: 'w-full',
  69. },
  70. },
  71. schema: [
  72. {
  73. component: 'Input',
  74. componentProps: {
  75. placeholder: '请输入编号',
  76. },
  77. fieldName: 'code',
  78. label: '编号',
  79. rules: 'required',
  80. },
  81. {
  82. component: 'Input',
  83. componentProps: {
  84. placeholder: '请输入名称',
  85. },
  86. fieldName: 'name',
  87. label: '名称',
  88. rules: 'required',
  89. },
  90. {
  91. component: 'InputNumber',
  92. componentProps: {
  93. placeholder: '请输入排序',
  94. },
  95. fieldName: 'sort',
  96. label: '排序',
  97. rules: 'required',
  98. },
  99. {
  100. component: 'Textarea',
  101. componentProps: {
  102. placeholder: '请输入',
  103. },
  104. fieldName: 'remark',
  105. label: '备注',
  106. },
  107. ],
  108. wrapperClass: 'grid-cols-1',
  109. };