sales-reached.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="home-container">
  3. <el-card class="home-container__card">
  4. <div class="title">
  5. <span>
  6. 今日业务总量
  7. </span>
  8. <span>
  9. <i
  10. class="el-icon-refresh-right"
  11. style="cursor: pointer;font-size:20px"
  12. @click="refresh"
  13. ></i>
  14. </span>
  15. </div>
  16. <div class="content" v-loading="loading">
  17. <div style="width: 100%;height: 300px;display: flex;justify-content: space-around;flex-wrap: wrap">
  18. <div id="totalContainer" style="width: 26%;height: 210px;"></div>
  19. <div id="totalBulkCargo" style="width: 26%;height: 210px;"></div>
  20. <div id="specialTotal" style="width: 26%;height: 210px;"></div>
  21. <!--<div id="totalContainerTwo" style="width: 26%;height: 210px;"></div>-->
  22. <!-- <div id="totalBulkCargoTwo" style="width: 26%;height: 210px;"></div>-->
  23. <!-- <div id="specialTotalTwo" style="width: 26%;height: 210px;"></div>-->
  24. </div>
  25. </div>
  26. </el-card>
  27. </div>
  28. </template>
  29. <script>
  30. import {bizCount, frequency} from "@/api/wel";
  31. export default {
  32. name: "basicContainer",
  33. data() {
  34. return {
  35. loading: false,
  36. tradeType: null,
  37. entrustTimer: null,
  38. tableData: []
  39. };
  40. },
  41. created() {
  42. this.getSysType();
  43. },
  44. mounted() {
  45. // 延迟获取数据
  46. frequency().then(res=>{
  47. let this_ = this
  48. this_.entrustTimer = setInterval(function () {
  49. if (JSON.parse(localStorage.getItem("saber-token")).content) {
  50. this_.getSysType();
  51. }
  52. }, Number(res.data.data[0].dictKey)*1000)
  53. })
  54. },
  55. beforeDestroy() {
  56. clearInterval(this.entrustTimer); //关闭
  57. },
  58. methods: {
  59. //点击获取图表数据
  60. handleMousedown(params){
  61. this.$emit('handleMousedown',params.data)
  62. },
  63. //箱分布图表
  64. rankingTwo(id, name, data) {
  65. // 基于准备好的dom,初始化echarts实例,所以只能在mounted中调用
  66. let myChart = this.$echarts.init(document.getElementById(id));
  67. // 绘制图表
  68. myChart.setOption(
  69. {
  70. title: {
  71. text: name,
  72. left: 'center'
  73. },
  74. tooltip: {
  75. trigger: 'item'
  76. },
  77. legend: {
  78. top: 'bottom'
  79. },
  80. series: [
  81. {
  82. type: 'pie',
  83. radius: '50%',
  84. data: data,
  85. emphasis: {
  86. itemStyle: {
  87. shadowBlur: 10,
  88. shadowOffsetX: 0,
  89. shadowColor: 'rgba(0, 0, 0, 0.5)'
  90. }
  91. }
  92. }
  93. ]
  94. }
  95. );
  96. myChart.on("click", this.handleMousedown);
  97. },
  98. init() {
  99. this.getSysType();
  100. },
  101. // 渲染echarts图
  102. getSysType() {
  103. this.loading = true
  104. // 集装箱的数据
  105. bizCount({mold:1}).then(res=>{
  106. this.rankingTwo('totalContainer', '集装箱:'+res.data.data.flow.all, res.data.data.flow.list)
  107. // this.rankingTwo('totalContainerTwo', '集装箱总量:'+res.data.data.dept.all, res.data.data.dept.list)
  108. })
  109. // 散货的echarts的数据
  110. bizCount({mold:2}).then(res=>{
  111. this.rankingTwo('totalBulkCargo', '散货:'+res.data.data.flow.all, res.data.data.flow.list)
  112. // this.rankingTwo('totalBulkCargoTwo', '散货总量:'+res.data.data.dept.all, res.data.data.dept.list)
  113. })
  114. // 特种运输的echarts的数据
  115. bizCount({mold:3}).then(res=>{
  116. this.rankingTwo('specialTotal', '特种运输:'+res.data.data.flow.all,res.data.data.flow.list)
  117. // this.rankingTwo('specialTotalTwo', '特种车辆总量:'+res.data.data.dept.all,res.data.data.dept.list)
  118. })
  119. this.loading = false
  120. },
  121. //刷新按钮
  122. refresh() {
  123. this.init();
  124. },
  125. }
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. .home-container {
  130. padding: 0px 5px 5px 5px;
  131. box-sizing: border-box;
  132. height: 100%;
  133. ::v-deep .el-card__body {
  134. padding: 10px 15px;
  135. font-size: 14px;
  136. }
  137. &__card {
  138. width: 100%;
  139. height: 100%;
  140. }
  141. .title {
  142. display: flex;
  143. justify-content: space-between;
  144. }
  145. }
  146. .content {
  147. display: flex;
  148. &_item {
  149. margin-top: 20px;
  150. .divider {
  151. display: block;
  152. height: 0px;
  153. width: 12vw;
  154. border-top: 1px dashed #dcdfe6;
  155. }
  156. &_num {
  157. font-size: 18px;
  158. font-weight: 600;
  159. }
  160. &_text {
  161. color: #909399;
  162. }
  163. }
  164. }
  165. </style>