columns.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import {
  2. // getAccountTableColumn,
  3. getTimeTableColumn,
  4. getStatusTableColumn,
  5. getTimeDurationColumn,
  6. // getNameDescriptionTableColumn,
  7. } from '@/utils/common/tableColumn'
  8. export default {
  9. created () {
  10. this.columns = [
  11. // getNameDescriptionTableColumn({
  12. // onManager: this.onManager,
  13. // hideField: true,
  14. // title: this.$t('cloudenv.task_type'),
  15. // edit: false,
  16. // showDesc: false,
  17. // slotCallback: row => {
  18. // const name = this.$te(`bill.task_type.${row.task_type}`) ? this.$t(`bill.task_type.${row.task_type}`) : row.task_type || '-'
  19. // return (
  20. // <side-page-trigger onTrigger={() => this.handleOpenSidepage({ name, ...row })}>{name}</side-page-trigger>
  21. // )
  22. // },
  23. // }),
  24. {
  25. title: this.$t('cloudenv.task_id'),
  26. field: 'id',
  27. minWidth: 80,
  28. showOverflow: 'ellipsis',
  29. },
  30. {
  31. field: 'task_type',
  32. title: this.$t('cloudenv.task_type'),
  33. slots: {
  34. default: ({ row }) => {
  35. const name = this.$te(`cloudenv.task_type.${row.task_type}`) ? this.$t(`cloudenv.task_type.${row.task_type}`) : row.task_type || '-'
  36. return [
  37. <side-page-trigger onTrigger={() => this.handleOpenSidepage({ name, ...row })}>{name}</side-page-trigger>,
  38. ]
  39. },
  40. },
  41. formatter: ({ row }) => {
  42. const name = this.$te(`cloudenv.task_type.${row.task_type}`) ? this.$t(`cloudenv.task_type.${row.task_type}`) : row.task_type || '-'
  43. return name
  44. },
  45. },
  46. getStatusTableColumn({ statusModule: 'billtasks' }),
  47. // getAccountTableColumn(),
  48. {
  49. field: 'mode',
  50. title: this.$t('cloudenv.bill_task.task_mode'),
  51. formatter: ({ row }) => {
  52. return this.$te(`cloudenv.bill_task.task_mode.${row.mode}`) ? this.$t(`cloudenv.bill_task.task_mode.${row.mode}`) : '-'
  53. },
  54. },
  55. {
  56. field: 'month',
  57. title: this.$t('cloudenv.month'),
  58. formatter: ({ row }) => {
  59. if (!row.month) return '-'
  60. return this.$moment(row.month + '').format('YYYY-MM')
  61. },
  62. },
  63. getTimeTableColumn({ field: 'started_at', title: this.$t('cloudenv.text_461') }),
  64. getTimeTableColumn({ field: 'ended_at', title: this.$t('cloudenv.text_462') }),
  65. getTimeDurationColumn({
  66. field: 'time_duration',
  67. title: this.$t('cloudenv.time_duration'),
  68. start_field: 'started_at',
  69. end_field: 'ended_at',
  70. }),
  71. ]
  72. },
  73. }