ExternalProjects.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{ title }}</div>
  4. <div slot="body">
  5. <dialog-table v-if="columns && columns.length" :data="externalprojects" :columns="columns" />
  6. </div>
  7. <div slot="footer">
  8. <a-button type="primary" @click="cancelDialog" :loading="loading">{{ $t("dialog.ok") }}</a-button>
  9. <!-- <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button> -->
  10. </div>
  11. </base-dialog>
  12. </template>
  13. <script>
  14. import DialogMixin from '@/mixins/dialog'
  15. import WindowsMixin from '@/mixins/windows'
  16. import {
  17. getProjectTableColumn,
  18. getAccountTableColumn,
  19. getBrandTableColumn,
  20. } from '@/utils/common/tableColumn'
  21. export default {
  22. name: 'ExternalProjectsDialog',
  23. mixins: [DialogMixin, WindowsMixin],
  24. data () {
  25. return {
  26. loading: false,
  27. externalprojects: [],
  28. title: this.$t('system.text_402'),
  29. }
  30. },
  31. computed: {
  32. columns () {
  33. return [
  34. {
  35. field: 'name',
  36. title: this.$t('system.text_402'),
  37. minWidth: 120,
  38. slots: {
  39. default: ({ row }, h) => {
  40. return row.name
  41. },
  42. },
  43. },
  44. getBrandTableColumn(),
  45. getAccountTableColumn(),
  46. getProjectTableColumn({ title: this.$t('table.title.local_project') }),
  47. ]
  48. },
  49. },
  50. created () {
  51. this.manager = new this.$Manager('externalprojects')
  52. this.fetchExternalProjects()
  53. },
  54. methods: {
  55. fetchExternalProjects () {
  56. const params = {
  57. scope: this.$store.getters.scope,
  58. tenant: this.params.data.id,
  59. }
  60. this.manager.list({ params })
  61. .then((res) => {
  62. this.externalprojects = res.data.data
  63. })
  64. .catch((error) => {
  65. this.externalprojects = []
  66. throw error
  67. })
  68. },
  69. },
  70. }
  71. </script>