index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="content">
  3. <view class="charts-box">
  4. <qiun-data-charts type="column" :opts="opts" :chartData="chartData" @getIndex="onTap" />
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import * as api from "@/api/statisticalQuery.js"
  10. export default {
  11. data() {
  12. return {
  13. chartData: {},
  14. opts: {
  15. color: ["#FFC71C", "#19BE6B"],
  16. padding: [15, 15, 0, 5],
  17. enableScroll: false,
  18. legend: {
  19. float: 'left',
  20. position: 'top',
  21. margin: '20'
  22. },
  23. xAxis: {
  24. disableGrid: true
  25. },
  26. yAxis: {
  27. data: [{
  28. min: 0
  29. }]
  30. },
  31. extra: {
  32. column: {
  33. type: "group",
  34. width: 20,
  35. seriesGap: 5,
  36. activeBgColor: "#000000",
  37. activeBgOpacity: 0.08
  38. }
  39. }
  40. }
  41. };
  42. },
  43. onLoad() {
  44. this.getServerData();
  45. },
  46. methods: {
  47. getServerData() {
  48. api.warehouseCapacity().then(res => {
  49. let cityList = []
  50. let emptyCapacity = []
  51. let totalCapacity = []
  52. res.data.map(item => {
  53. if (item.cityName) {
  54. cityList.push(item.cityName)
  55. totalCapacity.push(item.designCapacity)
  56. emptyCapacity.push(item.actualNoneCapacity)
  57. }
  58. })
  59. let option = {
  60. categories: cityList,
  61. series: [{
  62. name: "总仓容",
  63. data: totalCapacity
  64. }, {
  65. name: "有效空仓容",
  66. data: emptyCapacity
  67. }]
  68. }
  69. this.chartData = JSON.parse(JSON.stringify(option));
  70. })
  71. },
  72. onTap() {
  73. uni.navigateTo({
  74. url: '/pages/queryStatistics/storageDistrbution/details'
  75. })
  76. },
  77. }
  78. };
  79. </script>
  80. <style scoped lang="scss">
  81. .content {
  82. padding: 0 30px;
  83. height: calc(100vh - 44px);
  84. .charts-box {
  85. margin: 0 30px;
  86. height: 300px;
  87. padding-top: 100px;
  88. }
  89. }
  90. </style>