List.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. :group-actions="groupActions"
  6. :single-actions="singleActions"
  7. :export-data-options="exportDataOptions" />
  8. </template>
  9. <script>
  10. import WindowsMixin from '@/mixins/windows'
  11. import ListMixin from '@/mixins/list'
  12. import SingleActionsMixin from '../mixins/singleActions'
  13. import ColumnsMixin from '../mixins/columns'
  14. import { filterOptions } from '../utils/filters'
  15. export default {
  16. name: 'PhoneImageList',
  17. mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
  18. props: {
  19. id: String,
  20. getParams: {
  21. type: Object,
  22. default: () => { },
  23. },
  24. },
  25. data () {
  26. return {
  27. list: this.$list.createList(this, {
  28. id: this.id,
  29. resource: 'llm_images',
  30. getParams: this.getParam,
  31. filterOptions,
  32. hiddenColumns: [],
  33. }),
  34. groupActions: [
  35. {
  36. label: this.$t('common.create'),
  37. action: () => {
  38. this.createDialog('DesktopImageCreateDialog', {
  39. onManager: this.onManager,
  40. })
  41. },
  42. meta: () => {
  43. return {
  44. buttonType: 'primary',
  45. validate: true,
  46. }
  47. },
  48. },
  49. {
  50. label: this.$t('table.action.delete'),
  51. action: () => {
  52. this.createDialog('DeleteResDialog', {
  53. vm: this,
  54. data: this.list.selectedItems,
  55. columns: this.columns,
  56. title: this.$t('table.action.delete'),
  57. name: this.$t('aice.image'),
  58. onManager: this.onManager,
  59. })
  60. },
  61. meta: () => {
  62. const ret = { validate: this.list.selected.length }
  63. if (this.list.selectedItems.some(item => !item.can_delete)) {
  64. ret.validate = false
  65. return ret
  66. }
  67. return ret
  68. },
  69. },
  70. ],
  71. }
  72. },
  73. computed: {
  74. exportDataOptions () {
  75. return {
  76. downloadType: 'local',
  77. title: this.$t('aice.image'),
  78. items: [
  79. { label: 'ID', key: 'id' },
  80. ...this.columns,
  81. ],
  82. }
  83. },
  84. },
  85. created () {
  86. this.initSidePageTab('detail')
  87. this.list.fetchData()
  88. },
  89. methods: {
  90. getParam () {
  91. const ret = {
  92. ...this.getParams,
  93. details: true,
  94. }
  95. return ret
  96. },
  97. handleOpenSidepage (row) {
  98. this.sidePageTriggerHandle(this, 'LlmImageSidePage', {
  99. id: row.id,
  100. resource: 'llm_images',
  101. getParams: this.getParam,
  102. }, {
  103. list: this.list,
  104. })
  105. },
  106. },
  107. }
  108. </script>
  109. <style>
  110. </style>