viewLengend.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /**
  2. *@author:Guoxiaohuan
  3. *@date:2020.05.29
  4. *@info:图例展示状态
  5. */
  6. <template>
  7. <div class='view'>
  8. <div v-if='systemName=="土建系统"'>
  9. <el-table
  10. v-loading='loading'
  11. ref='dataTable'
  12. :data='viewTable'
  13. tooltip-effect='dark'
  14. style='width:100%;'
  15. :header-cell-style='{background:"rgba(2,91,170,0.1)",fontFamily:"PingFangSC-Medium,PingFang SC;",color:"rgba(0,0,0,0.85);",fontSize:"12px"}'
  16. >
  17. <el-table-column prop label='说明'>
  18. <template slot-scope='{row}'>
  19. <span>{{'--'}}</span>
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop label='图例' width='60'>
  23. <template slot-scope='{row}'>
  24. <div v-if='row.Url' class='Url-img'>
  25. <img :src='`/serve/topology-wanda/Picture/query/${row.Url}`' alt />
  26. </div>
  27. <div v-else>{{'--'}}</div>
  28. </template>
  29. </el-table-column>
  30. </el-table>
  31. </div>
  32. <div v-else>
  33. <el-table
  34. v-loading='loading'
  35. ref='dataTable'
  36. :data='viewTable'
  37. tooltip-effect='dark'
  38. style='width:100%;'
  39. @selection-change='handleSelectionChange'
  40. :header-cell-style='{background:"rgba(2,91,170,0.1)",fontFamily:"PingFangSC-Medium,PingFang SC;",color:"rgba(0,0,0,0.85);",fontSize:"12px"}'
  41. >
  42. <el-table-column type='selection' width='45'></el-table-column>
  43. <el-table-column prop='Name' :show-overflow-tooltip='true' label='项目' width='100'>
  44. <template slot-scope='{row}'>{{row.Name||'--'}}</template>
  45. </el-table-column>
  46. <el-table-column prop='Num' label='数量'>
  47. <template slot-scope='{row}'>
  48. <span v-if='row.Num || row.Num==0'>{{row.Num}}</span>
  49. <span v-else>--</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop='Unit' label='单位' width='70'>
  53. <template slot-scope='{row}'>{{row.Unit||'--'}}</template>
  54. </el-table-column>
  55. <el-table-column prop='Url' label='图例' width='55'>
  56. <template slot-scope='{row}'>
  57. <div v-if='row.Url' class='Url-img'>
  58. <img :src='`/serve/topology-wanda/Picture/query/${row.Url}`' alt />
  59. </div>
  60. <div v-else>{{'--'}}</div>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <div class='swich'>
  65. <el-switch v-model='swich' @change='handleSwich(swich)'></el-switch>
  66. <span>隐藏数量为0的项目</span>
  67. </div>
  68. <div class='remark' v-if='remarksText'>
  69. <span class='remark-title'>注:</span>
  70. <div v-html='remarksText' class='remark-text'></div>
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. import bus from "@/utils/bus.js"
  77. export default {
  78. props: ['viewTable', 'loading', 'remarksText', 'systemName'],
  79. data() {
  80. return {
  81. swich: true,
  82. multipleSelection: []
  83. }
  84. },
  85. methods: {
  86. handleSelectionChange(val) {
  87. this.multipleSelection = val
  88. const tempArr = val.map(t => {
  89. return t.GraphElementId
  90. })
  91. bus.$emit('changeShow', tempArr)
  92. },
  93. handleSwich(val) {
  94. this.$emit('changeSwitch', val)
  95. },
  96. setSelected() {
  97. this.viewTable.forEach(t => {
  98. this.$refs.dataTable.toggleRowSelection(t, true)
  99. })
  100. }
  101. },
  102. mounted() {}
  103. }
  104. </script>
  105. <style lang="less" scoped>
  106. .view {
  107. .swich {
  108. display: flex;
  109. justify-content: flex-end;
  110. align-items: center;
  111. margin-top: 8px;
  112. margin-right: 4px;
  113. margin-bottom: 12px;
  114. span {
  115. margin-left: 8px;
  116. }
  117. }
  118. .remark {
  119. font-size: 12px;
  120. font-family: MicrosoftYaHeiSemibold;
  121. color: rgba(31, 35, 41, 1);
  122. line-height: 16px;
  123. display: flex;
  124. .remark-title {
  125. font-weight: bold;
  126. }
  127. .remark-text {
  128. white-space: normal;
  129. word-break: break-all;
  130. p {
  131. padding: 0;
  132. }
  133. }
  134. }
  135. .Url-img {
  136. width: 20px;
  137. height: 22px;
  138. line-height: 20px;
  139. img {
  140. width: 100%;
  141. height: 100%;
  142. }
  143. }
  144. }
  145. </style>