com-sta-data.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!-- 第一行统计数据 -->
  2. <template>
  3. <div>
  4. <div style="padding: 10px;">
  5. <el-date-picker v-model="date" type="daterange" range-separator="至" start-placeholder="开始日期"
  6. end-placeholder="结束日期" @change="getCarStatics">
  7. </el-date-picker>
  8. </div>
  9. <el-row :gutter="14">
  10. <el-col :lg="4" :sm="8" :xs="24">
  11. <div class="sa-wnk">
  12. <img src="../../static/icon/icon-total.png">
  13. <div class="sa-wnk-tv">
  14. <p class="sa-wnk-title">入场车辆</p>
  15. <p class="sa-wnk-value">{{ car.todayInCar }}</p>
  16. </div>
  17. </div>
  18. </el-col>
  19. <el-col :lg="5" :sm="8" :xs="24">
  20. <div class="sa-wnk">
  21. <img src="../../static/icon/icon-car-leave.png">
  22. <div class="sa-wnk-tv">
  23. <p class="sa-wnk-title">离场车辆</p>
  24. <p class="sa-wnk-value">{{ car.outCar }}</p>
  25. </div>
  26. </div>
  27. </el-col>
  28. <el-col :lg="5" :sm="8" :xs="24">
  29. <div class="sa-wnk">
  30. <img src="../../static/icon/icon-car-in.png">
  31. <div class="sa-wnk-tv">
  32. <p class="sa-wnk-title">当前未出车辆</p>
  33. <p class="sa-wnk-value">{{ car.inCar }}</p>
  34. </div>
  35. </div>
  36. </el-col>
  37. <el-col :lg="5" :sm="8" :xs="24">
  38. <div class="sa-wnk">
  39. <img src="../../static/icon/icon-car-weight.png">
  40. <div class="sa-wnk-tv">
  41. <p class="sa-wnk-title">当前未出重车</p>
  42. <p class="sa-wnk-value">{{ car.weightCar }}</p>
  43. </div>
  44. </div>
  45. </el-col>
  46. <el-col :lg="5" :sm="8" :xs="24">
  47. <div class="sa-wnk">
  48. <img src="../../static/icon/icon-car-empty.png">
  49. <div class="sa-wnk-tv">
  50. <p class="sa-wnk-title">当前未出空车</p>
  51. <p class="sa-wnk-value">{{ car.emptyCar }}</p>
  52. </div>
  53. </div>
  54. </el-col>
  55. </el-row>
  56. </div>
  57. </template>
  58. <script>
  59. module.exports = {
  60. data() {
  61. return {
  62. date: [new Date(), new Date()],
  63. // 统计数据
  64. car: {
  65. todayInCar: 0,
  66. inCar: 0,
  67. outCar: 0,
  68. weightCar: 0,
  69. emptyCar: 0
  70. },
  71. timmer: null
  72. }
  73. },
  74. methods: {
  75. getCarStatics() {
  76. let days=this.date;
  77. let p={};
  78. if (days.length == 2) {
  79. p.startDay = sa.forDate(days[0]);
  80. p.endDay = sa.forDate(days[1]);
  81. }
  82. sa.ajaxNoLoading('/TbBusinessCar/staticsCar',p, function(resp) {
  83. this.car = resp.data;
  84. }.bind(this))
  85. },
  86. checkTimeout() {
  87. sa.ajaxNoLoading('/AccAdmin/checkTimeout', function(resp) {
  88. if (resp.code == 405) {
  89. window.open('../../login.html');
  90. }
  91. }.bind(this))
  92. },
  93. },
  94. created() {
  95. this.getCarStatics();
  96. this.timmer = setInterval(() => {
  97. this.getCarStatics();
  98. this.checkTimeout();
  99. }, 20000)
  100. },
  101. beforeDestroy() {
  102. if (this.timmer != null) {
  103. clearInterval(this.timmer);
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped>
  109. /* 第一行 */
  110. .sa-wnk {
  111. background-color: #f0f0f0;
  112. border: 1px #ddd solid;
  113. margin-bottom: 14px;
  114. min-height: 100px;
  115. cursor: pointer;
  116. transition: all 0.3s;
  117. overflow: hidden;
  118. }
  119. .sa-wnk:hover {
  120. box-shadow: 0 0 20px #999;
  121. }
  122. .sa-wnk img {
  123. float: left;
  124. line-height: 100px;
  125. margin: 25px 0px 0 20px;
  126. width: 50px;
  127. height: 50px;
  128. vertical-align: middle;
  129. }
  130. .sa-wnk .sa-wnk-tv {
  131. float: left;
  132. margin-left: 10px;
  133. max-width: calc(100% - 100px);
  134. }
  135. .sa-wnk-title {
  136. margin-top: 25px;
  137. font-size: 16px;
  138. }
  139. .sa-wnk-value {
  140. margin-top: 4px;
  141. font-size: 24px;
  142. padding-bottom: 20px;
  143. }
  144. </style>