change.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div style="height: calc(100% - 48px);">
  3. <v-tabs v-model="activeIndex" background-color="#f7f8fa">
  4. <v-tab>元数据新旧差异</v-tab>
  5. <v-tab>影响关系图谱</v-tab>
  6. </v-tabs>
  7. <v-tabs-items v-model="activeIndex" style="flex: 1">
  8. <v-tab-item>
  9. <common-component :info="info" class="mt-3" @notesChange="handleNotesChange" />
  10. <m-table
  11. :headers="headers"
  12. :items="items"
  13. :loading="false"
  14. :is-tools="false"
  15. :disable-sort="true"
  16. :show-select="false"
  17. :can-delete="false"
  18. :show-page="false"
  19. :items-per-page="-1"
  20. :no-radius="true"
  21. >
  22. </m-table>
  23. </v-tab-item>
  24. <v-tab-item>
  25. <m-card style="height: calc(100% - 12px);" no-title class="d-flex flex-column mt-3" bodyStyle="flex: 1">
  26. <Graph :graphData="info.impact_graph"></Graph>
  27. </m-card>
  28. </v-tab-item>
  29. </v-tabs-items>
  30. </div>
  31. </template>
  32. <script>
  33. import MCard from '@/components/MCard'
  34. import MTable from '@/components/List/table.vue'
  35. import Graph from './graph.vue'
  36. import CommonComponent from './common.vue'
  37. export default {
  38. name: 'changeComponent',
  39. components: {
  40. MCard,
  41. MTable,
  42. Graph,
  43. CommonComponent
  44. },
  45. props: {
  46. info: {
  47. type: Object,
  48. default: () => ({})
  49. }
  50. },
  51. data () {
  52. return {
  53. activeIndex: 0
  54. }
  55. },
  56. computed: {
  57. headers () {
  58. return [
  59. { text: '', align: 'start', value: 'title' },
  60. { text: '元数据(新)', align: 'start', value: 'new' },
  61. { text: '元数据(旧)', align: 'start', value: 'old' }
  62. ]
  63. },
  64. items () {
  65. if (!this.info || !this.info.new_meta || !this.info.old_meta) {
  66. return []
  67. }
  68. const newMeta = this.info.new_meta || {}
  69. const oldMeta = this.info.old_meta.snapshot || {}
  70. const newTagIds = newMeta.tag_ids && newMeta.tag_ids.length ? newMeta.tag_ids.map(tag => tag.name_zh).join(', ') : '-'
  71. const oldTagIds = oldMeta.tag_ids && oldMeta.tag_ids.length ? oldMeta.tag_ids.map(tag => tag.name_zh).join(', ') : '-'
  72. return [
  73. {
  74. title: '中文名',
  75. new: newMeta?.name_zh || '-',
  76. old: oldMeta?.name_zh || '-'
  77. },
  78. {
  79. title: '英文名',
  80. new: newMeta?.name_en || '-',
  81. old: oldMeta?.name_en || '-'
  82. },
  83. {
  84. title: '数据类型',
  85. new: newMeta?.data_type || '-',
  86. old: oldMeta?.data_type || '-'
  87. },
  88. {
  89. title: '数据标签',
  90. new: newTagIds,
  91. old: oldTagIds
  92. }
  93. ]
  94. }
  95. },
  96. methods: {
  97. handleNotesChange (notes) {
  98. this.$emit('notesChange', notes)
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. ::v-deep .v-window {
  105. height: 100%;
  106. }
  107. ::v-deep .v-window__container, .v-window-item {
  108. height: 100%;
  109. }
  110. </style>