post.data.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  4. import { DICT_TYPE } from '@/utils/dict'
  5. import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. name: [required],
  10. code: [required],
  11. sort: [required]
  12. })
  13. // CrudSchema
  14. const crudSchemas = reactive<VxeCrudSchema[]>([
  15. {
  16. title: t('common.index'),
  17. field: 'id',
  18. type: 'seq',
  19. form: {
  20. show: false
  21. },
  22. detail: {
  23. show: false
  24. }
  25. },
  26. {
  27. title: '岗位名称',
  28. field: 'name',
  29. search: {
  30. show: true
  31. }
  32. },
  33. {
  34. title: '岗位编码',
  35. field: 'code',
  36. search: {
  37. show: true
  38. }
  39. },
  40. {
  41. title: '岗位顺序',
  42. field: 'sort'
  43. },
  44. {
  45. title: t('common.status'),
  46. field: 'status',
  47. dictType: DICT_TYPE.COMMON_STATUS,
  48. table: {
  49. slots: {
  50. default: 'status_default'
  51. }
  52. },
  53. search: {
  54. show: true
  55. }
  56. },
  57. {
  58. title: '备注',
  59. field: 'remark',
  60. table: {
  61. show: false
  62. }
  63. },
  64. {
  65. title: t('common.createTime'),
  66. field: 'createTime',
  67. formatter: 'formatDate',
  68. form: {
  69. show: false
  70. }
  71. },
  72. {
  73. title: t('table.action'),
  74. field: 'action',
  75. table: {
  76. width: '240px',
  77. slots: {
  78. default: 'action_default'
  79. }
  80. },
  81. form: {
  82. show: false
  83. },
  84. detail: {
  85. show: false
  86. }
  87. }
  88. ])
  89. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)