data_origin.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div class="saga-fill">
  3. <div class="mess-view">
  4. <div class="saga-title">{{renderData.Name}}</div>
  5. <div class="point-type">通讯协议:{{renderData.ProtocolType}}</div>
  6. <div class="point-des">
  7. <p class="p">{{renderData.Description}}</p>
  8. </div>
  9. </div>
  10. <div class="doughnut-view">
  11. <doughnut v-if="renderData.Sum" type="type" width="200" height="200" :sum="renderData.Sum" :name="renderData.Name" :renderData="echartsData" :id="id"></doughnut>
  12. <div v-else class="center">
  13. <i class="icon-wushuju iconfont"></i>
  14. 暂无数据
  15. </div>
  16. </div>
  17. <slot></slot>
  18. </div>
  19. </template>
  20. <script>
  21. import doughnut from "@/components/echarts/doughnut"
  22. export default {
  23. name: "dataOrgin",
  24. components: {
  25. doughnut
  26. },
  27. props: {
  28. id: {
  29. type: String,
  30. default: function createRandomId() {
  31. return (Math.random() * 10000000).toString(16).substr(0, 4) + '-' + (new Date()).getTime() + '-' + Math.random().toString().substr(2, 5);
  32. }
  33. },
  34. renderData: {
  35. type: Object,
  36. default: function() {
  37. return {}
  38. }
  39. }
  40. },
  41. data() {
  42. return {
  43. echartsData: []
  44. }
  45. },
  46. created() {
  47. console.log(this.renderData)
  48. this.changeData()
  49. },
  50. mounted() {},
  51. methods: {
  52. changeData() {
  53. this.echartsData = [
  54. {
  55. name: "已关联:" + this.renderData.Related ,
  56. value: this.renderData.Related
  57. },
  58. {
  59. name: "未关联:" + this.renderData.Notrelated,
  60. value: this.renderData.Notrelated
  61. },
  62. {
  63. name: "未使用:" + this.renderData.Notused,
  64. value: this.renderData.Notused
  65. },
  66. ]
  67. }
  68. },
  69. watch: {
  70. renderData: {
  71. deep: true,
  72. handler: function() {
  73. this.changeData()
  74. }
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .mess-view {
  81. height: 90px;
  82. box-sizing: border-box;
  83. border-bottom: 1px solid #ddd;
  84. overflow: hidden;
  85. padding: 10px 20px 10px 15px;
  86. .saga-title {
  87. font-size: 14px;
  88. color: #333;
  89. font-weight: 600;
  90. line-height: 14px;
  91. }
  92. .point-type{
  93. font-size: 12px;
  94. height: 17px;
  95. line-height: 17px;
  96. margin-top: 5px;
  97. margin-bottom: 10px;
  98. color: #999;
  99. }
  100. .point-des{
  101. font-size: 12px;
  102. height: 17px;
  103. line-height: 17px;
  104. p{
  105. overflow: hidden;
  106. text-overflow:ellipsis;
  107. white-space: nowrap;
  108. color: #999;
  109. }
  110. }
  111. }
  112. .saga-fill {
  113. .doughnut-view {
  114. height: 165px;
  115. width: 100%;
  116. padding: 0 5px;
  117. box-sizing: border-box;
  118. }
  119. }
  120. </style>