Detail.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <detail
  3. :data="data"
  4. :on-manager="onManager"
  5. :base-info="baseInfo" />
  6. </template>
  7. <script>
  8. import { STRATEGY_CN } from '@Cloudenv/constants/sched'
  9. import { getEnabledTableColumn, getCopyWithContentTableColumn } from '@/utils/common/tableColumn'
  10. export default {
  11. name: 'SchedpolicyDetail',
  12. props: {
  13. data: {
  14. type: Object,
  15. required: true,
  16. },
  17. onManager: {
  18. type: Function,
  19. required: true,
  20. },
  21. },
  22. data () {
  23. return {
  24. baseInfo: [
  25. getEnabledTableColumn(),
  26. {
  27. field: 'resource_type',
  28. title: this.$t('cloudenv.text_384'),
  29. },
  30. getCopyWithContentTableColumn({
  31. field: 'schedtag',
  32. title: this.$t('cloudenv.text_385'),
  33. hideField: true,
  34. slotCallback: row => {
  35. if (!row.schedtag) return '-'
  36. return [<side-page-trigger onTrigger={ () => this.handleOpenSchedtagDetail(row.schedtag_id) }>{ row.schedtag }</side-page-trigger>]
  37. },
  38. }),
  39. {
  40. field: 'strategy',
  41. title: this.$t('cloudenv.text_413'),
  42. formatter: ({ row }) => STRATEGY_CN[row.strategy] || this.$t('cloudenv.text_4'),
  43. },
  44. {
  45. field: 'condition',
  46. title: this.$t('cloudenv.text_22'),
  47. minWidth: 70,
  48. showOverflow: 'title',
  49. slots: {
  50. default: ({ row }, h) => {
  51. return [
  52. <div class='text-truncate' title={ row.condition }>
  53. { row.condition }
  54. </div>,
  55. ]
  56. },
  57. },
  58. },
  59. ],
  60. }
  61. },
  62. methods: {
  63. handleOpenSchedtagDetail (id) {
  64. this.$emit('init-side-page-tab', 'schedtag-detail')
  65. this.$emit('side-page-trigger-handle', this, 'SchedtagSidePage', {
  66. id,
  67. resource: 'schedtags',
  68. apiVersion: 'v2',
  69. }, {
  70. cancel: () => {
  71. this.$emit('single-refresh', this.data.id)
  72. },
  73. })
  74. },
  75. },
  76. }
  77. </script>