done.data.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  4. import { DICT_TYPE } from '@/utils/dict'
  5. const { t } = useI18n() // 国际化
  6. // CrudSchema
  7. const crudSchemas = reactive<CrudSchema[]>([
  8. {
  9. label: t('common.index'),
  10. field: 'id',
  11. type: 'index'
  12. },
  13. {
  14. label: '任务名称',
  15. field: 'name',
  16. search: {
  17. show: true
  18. }
  19. },
  20. {
  21. label: '所属流程',
  22. field: 'processInstance.name'
  23. },
  24. {
  25. label: '流程发起人',
  26. field: 'processInstance.startUserNickname'
  27. },
  28. {
  29. label: '结果',
  30. field: 'result',
  31. dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
  32. dictData: 'number'
  33. },
  34. {
  35. label: '审批意见',
  36. field: 'reason'
  37. },
  38. {
  39. label: t('common.createTime'),
  40. field: 'createTime',
  41. search: {
  42. show: true,
  43. component: 'DatePicker',
  44. componentProps: {
  45. type: 'datetimerange',
  46. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  47. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)],
  48. shortcuts: [
  49. {
  50. text: '近一周',
  51. value: () => {
  52. const end = new Date()
  53. const start = new Date()
  54. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  55. return [start, end]
  56. }
  57. },
  58. {
  59. text: '近一个月',
  60. value: () => {
  61. const end = new Date()
  62. const start = new Date()
  63. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  64. return [start, end]
  65. }
  66. },
  67. {
  68. text: '近三个月',
  69. value: () => {
  70. const end = new Date()
  71. const start = new Date()
  72. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
  73. return [start, end]
  74. }
  75. }
  76. ]
  77. }
  78. }
  79. },
  80. {
  81. label: '审批时间',
  82. field: 'endTime'
  83. },
  84. {
  85. label: '耗时',
  86. field: 'durationInMillis'
  87. },
  88. {
  89. label: t('table.action'),
  90. field: 'action',
  91. width: '100px'
  92. }
  93. ])
  94. export const { allSchemas } = useCrudSchemas(crudSchemas)