post.data.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. const { t } = useI18n() // 国际化
  3. // 表单校验
  4. export const rules = reactive({
  5. name: [required],
  6. code: [required],
  7. sort: [required]
  8. })
  9. // 增删改查 CrudSchema 配置
  10. const crudSchemas = reactive<VxeCrudSchema>({
  11. primaryKey: 'id',
  12. primaryType: 'id',
  13. primaryTitle: '岗位编号',
  14. action: true,
  15. columns: [
  16. {
  17. title: '岗位名称',
  18. field: 'name',
  19. isSearch: true
  20. },
  21. {
  22. title: '岗位编码',
  23. field: 'code',
  24. isSearch: true
  25. },
  26. {
  27. title: '岗位顺序',
  28. field: 'sort',
  29. form: {
  30. component: 'InputNumber'
  31. }
  32. },
  33. {
  34. title: t('common.status'),
  35. field: 'status',
  36. dictType: DICT_TYPE.COMMON_STATUS,
  37. dictClass: 'number',
  38. isSearch: true
  39. },
  40. {
  41. title: '备注',
  42. field: 'remark',
  43. isTable: false
  44. },
  45. {
  46. title: t('common.createTime'),
  47. field: 'createTime',
  48. formatter: 'formatDate',
  49. isForm: false,
  50. table: {
  51. width: 180
  52. }
  53. }
  54. ]
  55. })
  56. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)