ServerList.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <page-list
  3. :columns="columns"
  4. :group-actions="groupActions"
  5. :list="list"
  6. :single-actions="singleActions" />
  7. </template>
  8. <script>
  9. import { getNameDescriptionTableColumn } from '@/utils/common/tableColumn'
  10. import WindowsMixin from '@/mixins/windows'
  11. export default {
  12. name: 'AnsibleTemplateServerList',
  13. mixins: [WindowsMixin],
  14. props: {
  15. getParams: {
  16. type: [Object, Function],
  17. },
  18. data: {
  19. type: Object,
  20. },
  21. resId: {
  22. type: String,
  23. },
  24. },
  25. data () {
  26. return {
  27. list: this.$list.createList(this, {
  28. resource: 'devtool_cronjobs',
  29. getParams: this.getParams,
  30. // steadyStatus: Object.values(expectStatus.redisAccount).flat(),
  31. }),
  32. columns: [
  33. getNameDescriptionTableColumn({
  34. vm: this,
  35. hideField: true,
  36. isNameEdit: false,
  37. showDesc: false,
  38. slotCallback: row => {
  39. return row.name
  40. },
  41. }),
  42. ],
  43. groupActions: [
  44. {
  45. label: this.$t('compute.text_260'),
  46. action: () => {
  47. this.unbind(this.list.selectedItems)
  48. },
  49. meta: (obj) => {
  50. return {
  51. buttonType: 'primary',
  52. validate: !!this.list.selectedItems.length,
  53. // tooltip,
  54. }
  55. },
  56. },
  57. ],
  58. singleActions: [
  59. {
  60. label: this.$t('compute.text_260'),
  61. action: (obj) => {
  62. this.unbind([obj])
  63. },
  64. },
  65. ],
  66. }
  67. },
  68. created () {
  69. this.list.fetchData()
  70. },
  71. methods: {
  72. unbind (data) {
  73. this.createDialog('AnsibleTemplateUnbindServerDialog', {
  74. data,
  75. resId: this.resId,
  76. columns: this.columns,
  77. title: this.$t('compute.perform_delete'),
  78. list: this.list,
  79. })
  80. },
  81. },
  82. }
  83. </script>