List.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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('aice.llm_image.import_community_image'),
  51. action: () => {
  52. this.$router.push({ name: 'LlmImageImportCommunity' })
  53. },
  54. },
  55. {
  56. label: this.$t('table.action.delete'),
  57. action: () => {
  58. this.createDialog('DeleteResDialog', {
  59. vm: this,
  60. data: this.list.selectedItems,
  61. columns: this.columns,
  62. title: this.$t('table.action.delete'),
  63. name: this.$t('aice.image'),
  64. onManager: this.onManager,
  65. })
  66. },
  67. meta: () => {
  68. const ret = { validate: this.list.selected.length }
  69. if (this.list.selectedItems.some(item => !item.can_delete)) {
  70. ret.validate = false
  71. return ret
  72. }
  73. return ret
  74. },
  75. },
  76. ],
  77. }
  78. },
  79. computed: {
  80. exportDataOptions () {
  81. return {
  82. downloadType: 'local',
  83. title: this.$t('aice.image'),
  84. items: [
  85. { label: 'ID', key: 'id' },
  86. ...this.columns,
  87. ],
  88. }
  89. },
  90. },
  91. created () {
  92. this.initSidePageTab('detail')
  93. this.list.fetchData()
  94. },
  95. methods: {
  96. getParam () {
  97. const ret = {
  98. ...this.getParams,
  99. details: true,
  100. }
  101. return ret
  102. },
  103. handleOpenSidepage (row) {
  104. this.sidePageTriggerHandle(this, 'LlmImageSidePage', {
  105. id: row.id,
  106. resource: 'llm_images',
  107. getParams: this.getParam,
  108. }, {
  109. list: this.list,
  110. })
  111. },
  112. },
  113. }
  114. </script>
  115. <style>
  116. </style>