middleCard.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div id="middle-card">
  3. <div :class="$style.chart_box">
  4. <div :class="$style.item">
  5. <!-- <div :class="$style.title">
  6. <span>检测受理类型</span>
  7. </div> -->
  8. <div id="accept" style="width: 100%; height: 100%"></div>
  9. </div>
  10. <dv-decoration-2 :reverse="true" style="width:5px;height:100%;" />
  11. <div :class="$style.item">
  12. <!-- <div :class="$style.title">
  13. <span>检测任务情况</span>
  14. </div> -->
  15. <div id="task" style="min-width: 300px; height: 100%"></div>
  16. </div>
  17. <dv-decoration-2 :reverse="true" :dur="10" style="width:5px;height:100%;" />
  18. <div :class="$style.item">
  19. <dv-scroll-board
  20. v-if="tableData.data && tableData.data.length"
  21. :config="tableData"
  22. style="width: 100%; height: 100%"
  23. />
  24. <div v-else :class="$style.no_data">当前月份暂无已完成的检测项目数据</div>
  25. </div>
  26. </div>
  27. <dv-decoration-10 :dur="15"/>
  28. </div>
  29. </template>
  30. <script>
  31. import echarts from 'echarts'
  32. import { acceptOption, taskOption } from '../data'
  33. export default {
  34. name: 'topBar',
  35. props: {
  36. info: {
  37. type: Object,
  38. default: {}
  39. },
  40. list: {
  41. type: Object,
  42. default: {}
  43. }
  44. },
  45. components: {},
  46. watch: {
  47. info: {
  48. handler() {
  49. this.init()
  50. },
  51. deep: true
  52. },
  53. list: {
  54. handler(value) {
  55. console.log(value)
  56. if ((!this.tableData.data || (value.data.length !== this.tableData.data.length))) {
  57. if (this.tableData.data) {
  58. console.log(value.data.length, this.tableData.data.length)
  59. }
  60. this.tableData = JSON.parse(JSON.stringify(value))
  61. }
  62. },
  63. immediate: true,
  64. deep: true
  65. }
  66. },
  67. data() {
  68. return {
  69. tableData: {}
  70. }
  71. },
  72. created() {
  73. // this.init()
  74. },
  75. mounted() {
  76. this.init()
  77. },
  78. methods: {
  79. init() {
  80. const accept = echarts.init(document.getElementById('accept'))
  81. const task = echarts.init(document.getElementById('task'))
  82. // 设置图表数据
  83. acceptOption.series[0].data = this.info.acceptData
  84. acceptOption.legend.data = this.info.config.option
  85. acceptOption.color = this.info.config.colorList
  86. taskOption.series[0].data = this.info.completionRate
  87. // taskOption.series[0].data = this.info.taskData
  88. // this.tableData = JSON.parse(JSON.stringify(this.tableData))
  89. //渲染
  90. accept.setOption(acceptOption)
  91. task.setOption(taskOption)
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" module>
  97. .chart_box {
  98. position: relative;
  99. display: flex;
  100. justify-content: space-between;
  101. width: 100%;
  102. height: 100%;
  103. .item {
  104. width: 24%;
  105. height: 100%;
  106. background-color: rgba(6, 30, 93, 0.5);
  107. &:first-child, &:last-child {
  108. width: 36%;
  109. }
  110. .no_data {
  111. font-size: 20px;
  112. text-align: center;
  113. margin-top: 20px;
  114. }
  115. :global {
  116. .header {
  117. background-color: #08153e !important;
  118. }
  119. }
  120. }
  121. }
  122. :global {
  123. #middle-card {
  124. width: 96%;
  125. height: calc((100% - 240px) / 2);
  126. padding: 0 2%;
  127. margin: 15px 0 30px;
  128. .dv-decoration-10 {
  129. width: 100%;
  130. margin: 12px 0;
  131. height: 5px;
  132. }
  133. }
  134. }
  135. </style>