parkingLotAnalysis.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <!-- 停车场分析 -->
  2. <template>
  3. <view class="section">
  4. <!-- 营收趋势分析 -->
  5. <view class="section-part">
  6. <view class="section-part-title">
  7. <text>|</text>营收趋势分析
  8. </view>
  9. <view class="section-part-content">
  10. <ColumnChart
  11. v-if="revenueTrendsData.series[0].data.length"
  12. :chartData="revenueTrendsData"
  13. :title="title"
  14. :opts="opts1"
  15. />
  16. <view class="empty" v-else>
  17. <u-empty></u-empty>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="section-part">
  22. <view class="section-part-title">
  23. <text>|</text>车流量统计
  24. </view>
  25. <view class="section-part-content">
  26. <ColumnChart
  27. v-if="trafficFlowData.series[0].data.length"
  28. :chartData="trafficFlowData"
  29. :title="title"
  30. :opts="opts2"
  31. />
  32. <view class="empty" v-else>
  33. <u-empty></u-empty>
  34. </view>
  35. </view>
  36. </view>
  37. <u-loading-page :loading="loading" loading-text="loading..."></u-loading-page>
  38. </view>
  39. </template>
  40. <script>
  41. import ColumnChart from '@/components/columnChart.vue';
  42. export default {
  43. components: {
  44. ColumnChart
  45. },
  46. props: {
  47. title: {
  48. type: String,
  49. default: ''
  50. }
  51. },
  52. data() {
  53. return {
  54. loading: false,
  55. opts1: {
  56. enableScroll: true,
  57. xAxis: {
  58. rotateLabel: true,
  59. scrollShow: true,
  60. itemCount: 8
  61. },
  62. yAxis: {
  63. showTitle: true,
  64. splitNumber: 5,
  65. data: [
  66. {
  67. title: '收益(元)',
  68. titleOffsetY: -3
  69. }
  70. ]
  71. },
  72. legend: {
  73. show: false
  74. },
  75. dataLabel: false,
  76. padding: [20, 0, 10, 0],
  77. extra: {
  78. column: {
  79. width: 20
  80. }
  81. }
  82. },
  83. opts2: {
  84. enableScroll: true,
  85. xAxis: {
  86. rotateLabel: true,
  87. scrollShow: true,
  88. itemCount: 8
  89. },
  90. yAxis: {
  91. showTitle: true,
  92. splitNumber: 5,
  93. data: [
  94. {
  95. title: '车辆(辆)',
  96. titleOffsetY: 0,
  97. titleOffsetX: 10
  98. }
  99. ]
  100. },
  101. legend: {
  102. show: false
  103. },
  104. dataLabel: false,
  105. padding: [10, 0, 10, 0],
  106. extra: {
  107. column: {
  108. width: 20
  109. }
  110. }
  111. },
  112. revenueTrendsData: {
  113. categories: [],
  114. series: [
  115. {
  116. name: '',
  117. data: []
  118. }
  119. ]
  120. },
  121. trafficFlowData: {
  122. categories: [],
  123. series: [
  124. {
  125. name: '',
  126. data: []
  127. }
  128. ]
  129. }
  130. };
  131. },
  132. methods: {
  133. getData({ reportType, queryDate }) {
  134. this.reportType = reportType;
  135. this.queryDate = queryDate;
  136. this.getRevenueTrendsData();
  137. this.getRoadTrafficFlowData();
  138. },
  139. getRevenueTrendsData() {
  140. this.loading = true;
  141. uni.$u.api.operationalAnalysisApi
  142. .getParkingLotRevenueAmountApi({
  143. reportType: this.reportType,
  144. queryDate: this.queryDate
  145. })
  146. .then((res) => {
  147. if (res.code === 200) {
  148. if (res.data.itemList && res.data.itemList.length) {
  149. this.revenueTrendsData.categories = res.data.itemList.map(
  150. (item) => {
  151. return item.roadName;
  152. }
  153. );
  154. this.revenueTrendsData.series[0].data = res.data.itemList.map(
  155. (item) => {
  156. return item.amt;
  157. }
  158. );
  159. } else {
  160. this.revenueTrendsData.categories = [];
  161. this.revenueTrendsData.series[0].data = [];
  162. }
  163. }
  164. this.loading = false;
  165. });
  166. },
  167. getRoadTrafficFlowData() {
  168. this.loading = true;
  169. uni.$u.api.operationalAnalysisApi
  170. .getParkingLotTrafficVolumeApi({
  171. reportType: this.reportType,
  172. queryDate: this.queryDate
  173. })
  174. .then((res) => {
  175. if (res.code === 200) {
  176. if (res.data.itemList && res.data.itemList.length) {
  177. this.trafficFlowData.categories = res.data.itemList.map(
  178. (item) => {
  179. return item.roadName;
  180. }
  181. );
  182. this.trafficFlowData.series[0].data = res.data.itemList.map(
  183. (item) => {
  184. return item.vehicleCount;
  185. }
  186. );
  187. } else {
  188. this.trafficFlowData.categories = [];
  189. this.trafficFlowData.series[0].data = [];
  190. }
  191. }
  192. this.loading = false;
  193. });
  194. }
  195. }
  196. };
  197. </script>
  198. <style lang="scss" scoped>
  199. .section {
  200. &-part {
  201. background-color: #fff;
  202. border-radius: 5px;
  203. margin-bottom: 10px;
  204. &-title {
  205. padding: 15px;
  206. text {
  207. color: #f00;
  208. margin-right: 5px;
  209. }
  210. }
  211. }
  212. .empty {
  213. padding: 15px;
  214. }
  215. }
  216. </style>