change.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div>
  3. <m-card title="元数据新旧差异" class="pb-3">
  4. <m-table
  5. class="candidate-table"
  6. :headers="headers"
  7. :items="items"
  8. :loading="false"
  9. :is-tools="false"
  10. :disable-sort="true"
  11. :show-select="false"
  12. :can-delete="false"
  13. :show-page="false"
  14. :items-per-page="-1"
  15. :no-radius="true"
  16. >
  17. </m-table>
  18. </m-card>
  19. <m-card title="影响关系图谱" bodyStyle="flex: 1" style="height: 800px;" class="d-flex flex-column mt-3">
  20. <Graph :graphData="info.impact_graph"></Graph>
  21. </m-card>
  22. </div>
  23. </template>
  24. <script>
  25. import MCard from '@/components/MCard'
  26. import MTable from '@/components/List/table.vue'
  27. import Graph from './graph.vue'
  28. export default {
  29. name: 'changeComponent',
  30. components: {
  31. MCard,
  32. MTable,
  33. Graph
  34. },
  35. props: {
  36. info: {
  37. type: Object,
  38. default: () => ({})
  39. }
  40. },
  41. data () {
  42. return {
  43. selectedCandidateMetaId: null
  44. }
  45. },
  46. computed: {
  47. newMetaSnapshot () {
  48. if (!this.info || !this.info.new_meta) {
  49. return {}
  50. }
  51. return this.info.new_meta
  52. },
  53. headers () {
  54. return [
  55. { text: '', align: 'start', value: 'title' },
  56. { text: '元数据(新)', align: 'start', value: 'new' },
  57. { text: '元数据(旧)', align: 'start', value: 'old' }
  58. ]
  59. },
  60. items () {
  61. if (!this.info || !this.info.new_meta || !this.info.old_meta) {
  62. return []
  63. }
  64. return [
  65. {
  66. title: '中文名',
  67. new: this.info.new_meta.name_zh || '-',
  68. old: this.info.old_meta.snapshot.name_zh || '-'
  69. },
  70. {
  71. title: '英文名',
  72. new: this.info.new_meta.name_en || '-',
  73. old: this.info.old_meta.snapshot.name_en || '-'
  74. },
  75. {
  76. title: '数据类型',
  77. new: this.info.new_meta.data_type || '-',
  78. old: this.info.old_meta.snapshot.data_type || '-'
  79. },
  80. {
  81. title: '数据标签',
  82. new: this.info.new_meta.tag_ids?.join(', ') || '-',
  83. old: this.info.old_meta.snapshot.tag_ids?.join(', ') || '-'
  84. }
  85. ]
  86. }
  87. },
  88. methods: {
  89. handleSelect (candidateMetaId) {
  90. this.selectedCandidateMetaId = candidateMetaId
  91. this.$emit('selectCandidateMeta', candidateMetaId)
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .snapshot-card {
  98. background: #f5f3f3;
  99. border-radius: 6px;
  100. padding: 16px 20px;
  101. box-shadow: 0 0 0 1px #eee;
  102. }
  103. .snapshot-title {
  104. font-weight: 700;
  105. margin-bottom: 16px;
  106. // font-size: 14px;
  107. color: #333;
  108. }
  109. .snapshot-wrapper {
  110. display: flex;
  111. align-items: flex-start;
  112. }
  113. .snapshot-labels,
  114. .snapshot-values {
  115. list-style: none;
  116. padding: 0;
  117. margin: 0;
  118. font-size: 15px;
  119. line-height: 1.6;
  120. }
  121. .snapshot-labels {
  122. // flex: 0 0 90px;
  123. text-align: right;
  124. margin-right: 12px;
  125. color: #403b3b;
  126. // font-weight: 700;
  127. }
  128. .snapshot-values {
  129. flex: 1;
  130. word-break: break-all;
  131. }
  132. .snapshot-labels li,
  133. .snapshot-values li {
  134. margin: 6px 0;
  135. }
  136. .candidate-table thead th {
  137. background-color: #f5f5f5;
  138. font-weight: 600;
  139. font-size: 13px;
  140. }
  141. .candidate-table tbody tr:hover {
  142. background-color: #f9f9f9;
  143. }
  144. .candidate-table td {
  145. font-size: 13px;
  146. }
  147. </style>