middleCard.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. },
  41. components: {},
  42. watch: {
  43. info: {
  44. handler() {
  45. this.init()
  46. },
  47. deep: true
  48. }
  49. },
  50. data() {
  51. return {
  52. tableData: {}
  53. }
  54. },
  55. created() {
  56. // this.init()
  57. },
  58. mounted() {
  59. this.init()
  60. },
  61. methods: {
  62. init() {
  63. const accept = echarts.init(document.getElementById('accept'))
  64. const task = echarts.init(document.getElementById('task'))
  65. // 设置图表数据
  66. acceptOption.series[0].data = this.info.acceptData
  67. taskOption.series[0].data = this.info.taskData
  68. this.tableData = JSON.parse(JSON.stringify(this.info.tableData))
  69. //渲染
  70. accept.setOption(acceptOption)
  71. task.setOption(taskOption)
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" module>
  77. .chart_box {
  78. position: relative;
  79. display: flex;
  80. justify-content: space-between;
  81. width: 100%;
  82. height: 100%;
  83. .item {
  84. width: 20%;
  85. height: 100%;
  86. background-color: rgba(6, 30, 93, 0.5);
  87. &:first-child, &:last-child {
  88. width: 38%;
  89. }
  90. .no_data {
  91. font-size: 20px;
  92. text-align: center;
  93. margin-top: 20px;
  94. }
  95. }
  96. }
  97. :global {
  98. #middle-card {
  99. width: 96%;
  100. height: calc((100% - 240px) / 2);
  101. padding: 0 2%;
  102. margin: 15px 0 30px;
  103. .dv-decoration-10 {
  104. width: 100%;
  105. margin: 12px 0;
  106. height: 5px;
  107. }
  108. }
  109. }
  110. </style>