metadata.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div class="pa-3">
  3. <m-card title="元数据成员">
  4. <div class="pa-3">
  5. <m-table
  6. :headers="headers"
  7. :items="items"
  8. :elevation="0"
  9. :is-tools="false"
  10. :show-select="false"
  11. :loading="loading"
  12. :page-info="pageInfo"
  13. :total="total"
  14. @pageHandleChange="pageHandleChange"
  15. ></m-table>
  16. </div>
  17. </m-card>
  18. </div>
  19. </template>
  20. <script>
  21. import MCard from '@/components/MCard'
  22. import MTable from '@/components/List/table'
  23. import { api } from '@/api/dataGovernance'
  24. export default {
  25. name: 'data-book-resource-metadata',
  26. components: {
  27. MCard,
  28. MTable
  29. },
  30. data () {
  31. return {
  32. loading: false,
  33. headers: [
  34. { text: '名称', value: 'name' },
  35. { text: '英文名称', value: 'en_name' },
  36. { text: '类型', value: 'data_type' },
  37. { text: '创建时间', value: 'create_time' }
  38. ],
  39. items: [],
  40. total: 0,
  41. pageInfo: {
  42. current: 1,
  43. size: 10
  44. }
  45. }
  46. },
  47. created () {
  48. this.init()
  49. },
  50. methods: {
  51. async init () {
  52. const id = this.$route.params.id
  53. if (!id) {
  54. return
  55. }
  56. this.loading = true
  57. try {
  58. const { data } = await api.getMetaDataById({ id: +id, ...this.pageInfo })
  59. this.items = data.records
  60. this.total = data.total
  61. } catch (error) {
  62. this.$snackbar.error(error)
  63. } finally {
  64. this.loading = false
  65. }
  66. },
  67. pageHandleChange (index) {
  68. this.pageInfo.current = index
  69. this.init()
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. </style>