index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /** // author:zhangb // time:2022-10-19 // desc:可视化组件图标部分拆解 */
  2. <template>
  3. <div class="dashboard">
  4. <!-- 顶部卡片汇总 -->
  5. <div class="top_card_border">
  6. <card-box
  7. :startCor="'#fe8e82'"
  8. :endCor="'#ff6fb7'"
  9. @click="router.push('/trackManager/waybillManager')"
  10. :boxWidth="'19%'"
  11. :numValue="waybillData.length"
  12. :mainTitle="'运单数量'"
  13. :numUnit="'条'"
  14. ></card-box>
  15. <card-box
  16. :boxWidth="'19%'"
  17. @click="router.push('/trackManager/deviceAbnormality')"
  18. :numValue="exceptionWaybillStatistics.device"
  19. :mainTitle="'设备异常'"
  20. :numUnit="'条'"
  21. ></card-box>
  22. <card-box
  23. :startCor="'#f382ee'"
  24. :endCor="'#7d7cfe'"
  25. :boxWidth="'19%'"
  26. @click="router.push('/trackManager/loadDeviation')"
  27. :numValue="exceptionWaybillStatistics.loading"
  28. :mainTitle="'装货地异常'"
  29. :numUnit="'条'"
  30. ></card-box>
  31. <card-box
  32. :startCor="'#40ecb0'"
  33. :endCor="'#0eb4e8'"
  34. @click="router.push('/trackManager/abnormalWaybill')"
  35. :boxWidth="'19%'"
  36. :numValue="exceptionWaybillStatistics.unload"
  37. :mainTitle="'卸货地异常'"
  38. :numUnit="'条'"
  39. ></card-box>
  40. <card-box
  41. :startCor="'#fe8e82'"
  42. :endCor="'#ff6fb7'"
  43. :boxWidth="'19%'"
  44. :numValue="exceptionRate"
  45. :mainTitle="'运单运输异常率'"
  46. :numUnit="'%'"
  47. ></card-box>
  48. </div>
  49. <div class="mid_content">
  50. <!-- 核心可视化地图内容 -->
  51. <div class="map_style">
  52. <map-chart :heightStyle="'height:800px;'"></map-chart>
  53. </div>
  54. <div class="right_step">
  55. <div class="title">运单数据排行榜</div>
  56. <el-table :data="tableData" border stripe style="width: 100%">
  57. <el-table-column label="供应商" prop="supplierName" width=""></el-table-column>
  58. <el-table-column label="运单数" prop="waybillCount" width=""></el-table-column>
  59. </el-table>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script setup>
  65. import { tms } from '@/request/api'
  66. import cardBox from './components/cardBox.vue'
  67. import { ref, reactive, onMounted } from 'vue'
  68. import { useRouter } from 'vue-router'
  69. import mapChart from './components/mapChart.vue'
  70. const router = useRouter()
  71. // 异常运单统计
  72. const exceptionWaybillStatistics = ref({
  73. device: 0,
  74. loading: 0,
  75. unload: 0,
  76. }) // 异常运单统计
  77. const getData = async () => {
  78. const response = await tms.queryExceptionWaybillStatistics()
  79. if (response.code === 101) {
  80. exceptionWaybillStatistics.value.device = response.data.find(item => item.type === 'DEVICE').count
  81. exceptionWaybillStatistics.value.loading = response.data.find(item => item.type === 'LOADING').count
  82. exceptionWaybillStatistics.value.unload = response.data.find(item => item.type === 'UNLOAD').count
  83. }
  84. }
  85. const waybillData = ref([]) // 运单数据
  86. // 获取运单发货地运力地图数据
  87. const getWaybillData = async () => {
  88. const res = await tms.queryAllWaybill()
  89. if (res.code === 101) {
  90. waybillData.value = res.data
  91. }
  92. }
  93. const tableData = ref([]) // 运单数据排行
  94. // 查看供应商数据排行
  95. const getSupplierData = async () => {
  96. const res = await tms.querySupplierRanking()
  97. if (res.code === 101) {
  98. console.log(res.data, '数据排行')
  99. tableData.value = res.data
  100. }
  101. }
  102. const exceptionRate = ref(0) // 运单号
  103. // 订单运输异常率
  104. const getExceptionRate = async () => {
  105. const res = await tms.queryExceptionRate()
  106. if (res.code === 101) {
  107. console.log(res.data, '订单运输异常率')
  108. exceptionRate.value = res.data.exceptionWaybillCount / res.data.totalWaybillCount * 100
  109. }
  110. }
  111. onMounted(() => {
  112. getData()
  113. getWaybillData()
  114. getSupplierData()
  115. getExceptionRate()
  116. })
  117. </script>
  118. <style lang="scss" scoped>
  119. .dashboard {
  120. padding: 1em;
  121. width: 100%;
  122. .top_card_border {
  123. width: 100%;
  124. display: flex;
  125. justify-content: space-between;
  126. }
  127. .mid_content {
  128. display: flex;
  129. width: 100%;
  130. justify-content: space-evenly;
  131. .let_step {
  132. // border: 1px solid #000;
  133. display: flex;
  134. justify-content: space-between;
  135. width: 55%;
  136. height: calc(35vh);
  137. flex-wrap: wrap;
  138. }
  139. .right_step {
  140. text-align: center;
  141. width: 25%;
  142. padding-top: 30px;
  143. padding-left: 10px;
  144. .title {
  145. font-size: 20px;
  146. font-weight: 600;
  147. color: #000;
  148. margin-bottom: 20px;
  149. }
  150. }
  151. }
  152. .map_style {
  153. width: 75%;
  154. border: 1px solid #309ef3;
  155. margin-top: 30px;
  156. // height: calc(100vh * 0.7);
  157. }
  158. }
  159. </style>