BillSync.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. show-sync
  6. :export-data-options="exportDataOptions"
  7. :placeholder="this.$t('common.text00014')" />
  8. </template>
  9. <script>
  10. import {
  11. getTimeRangeFilter,
  12. } from '@/utils/common/tableFilter'
  13. import {
  14. getStatusTableColumn,
  15. } from '@/utils/common/tableColumn'
  16. import WindowsMixin from '@/mixins/windows'
  17. import ListMixin from '@/mixins/list'
  18. export default {
  19. name: 'BillSyncForCloudaccountSidepage',
  20. mixins: [WindowsMixin, ListMixin],
  21. props: {
  22. id: String,
  23. resId: String,
  24. data: Object,
  25. getParams: [Function, Object],
  26. },
  27. data () {
  28. return {
  29. columns: [
  30. {
  31. field: 'type',
  32. title: this.$t('cloudenv.text_425'),
  33. minWidth: 100,
  34. slots: {
  35. default: ({ row }) => {
  36. return this.$t('cloudenv.bill_sync')
  37. },
  38. },
  39. },
  40. getStatusTableColumn({ statusModule: 'scheduledtaskBillSync', minWidth: 90 }),
  41. {
  42. field: 'created_at',
  43. title: this.$t('cloudenv.text_461'),
  44. minWidth: 200,
  45. showOverflow: 'title',
  46. formatter: ({ row }) => {
  47. return row.created_at ? this.$moment(row.created_at).format('YYYY-MM-DD HH:mm:ss') : '-'
  48. },
  49. },
  50. {
  51. field: 'updated_at',
  52. title: this.$t('cloudenv.text_462'),
  53. minWidth: 200,
  54. showOverflow: 'title',
  55. formatter: ({ row }) => {
  56. return row.updated_at ? this.$moment(row.updated_at).format('YYYY-MM-DD HH:mm:ss') : '-'
  57. },
  58. },
  59. ],
  60. list: this.$list.createList(this, {
  61. id: this.id,
  62. apiVersion: 'v1',
  63. resource: 'progresses',
  64. getParams: this.getParam,
  65. filterOptions: {
  66. created_at: getTimeRangeFilter({ label: this.$t('cloudenv.text_461'), field: 'created_at' }),
  67. updated_at: getTimeRangeFilter({ label: this.$t('cloudenv.text_462'), field: 'updated_at' }),
  68. },
  69. }),
  70. exportDataOptions: {
  71. items: [
  72. { label: this.$t('cloudenv.text_425'), key: 'type' },
  73. { label: this.$t('cloudenv.text_98'), key: 'status' },
  74. { label: this.$t('cloudenv.text_461'), key: 'created_at' },
  75. { label: this.$t('cloudenv.text_462'), key: 'updated_at' },
  76. ],
  77. },
  78. }
  79. },
  80. created () {
  81. this.list.fetchData()
  82. },
  83. methods: {
  84. refresh () {
  85. this.list.fetchData()
  86. },
  87. getParam () {
  88. const ret = {
  89. details: true,
  90. type: 'pull',
  91. account_id: this.resId,
  92. }
  93. return ret
  94. },
  95. },
  96. }
  97. </script>