access_data_analysis.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="body-wrapper">
  3. <el-form class="form-wrapper" :inline="true" :model="formInline">
  4. <el-form-item label="所在区">
  5. <el-select v-model="formInline.region" placeholder="请选择所在区">
  6. <el-option
  7. v-for="item in options"
  8. :key="item.value"
  9. :label="item.label"
  10. :value="item.value">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="停车场名称">
  15. <el-input v-model="formInline.interfaceName" placeholder="请输入停车场名称"></el-input>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type="primary" @click="onSubmit">查询</el-button>
  19. </el-form-item>
  20. </el-form>
  21. <div style="display: flex; justify-content: space-between;">
  22. <div style="width: 50%; height: 300px">
  23. <barchart
  24. class="side-chart"
  25. :autoStop="false"
  26. :colorArr="['#ffd201', '#00eacb', '#01b4ff', '#5d78ff']"
  27. legendIcon="react"
  28. :bottom="30"
  29. :xlabelFormat="xLabelFormat"
  30. :top="60"
  31. yAxisName="(个)"
  32. :tooltip="tooltipFormat"
  33. :dataset="bardata"
  34. :encode="[
  35. {x: 'month', y: 'hs', seriesName: '接入数量'},
  36. {x: 'month', y: 'cs', seriesName: '异常数量'}]"
  37. :labelSize="15"
  38. id="fxdqhszzt"
  39. />
  40. </div>
  41. <div style="width: 50%; height: 300px">
  42. <!-- <div align="center" style="color: white">漯河市财政局停车场</div>-->
  43. <piechart
  44. class="model-pie-body"
  45. id="chart1"
  46. :roseType="false"
  47. :radiusArr="['30%', '70%']"
  48. :colorArr="modelPieColor"
  49. :labelFormat="['{name|{b}}', '{sub|{@value}次 {d}%}', '{hr|}']"
  50. :dataset="modelData.list"
  51. :encode="{ itemName: 'name', value: 'value' }"
  52. />
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import piechart from "@/components/pieChart";
  59. import barchart from "@/components/barChart";
  60. import api from "@/api/article_liao";
  61. export default {
  62. components: {
  63. piechart,
  64. barchart
  65. },
  66. data() {
  67. return {
  68. formInline: {
  69. interfaceName: '',
  70. region: ''
  71. },
  72. options: [{
  73. value: '源汇区',
  74. label: '源汇区'
  75. }, {
  76. value: '郾城区',
  77. label: '郾城区'
  78. }, {
  79. value: '召陵区',
  80. label: '召陵区'
  81. }, {
  82. value: '临颍县',
  83. label: '临颍县'
  84. }, {
  85. value: '舞阳县',
  86. label: '舞阳县'
  87. }],
  88. value: '',
  89. modelPieColor: ["#4382f6", "#9078f8", "#79a7db", "#FF9800", "#9C27B0"],
  90. modelPieColor1: ["#4382f6", "#9078f8", "#6aa1e1", "#FF9800", "#9C27B0"],
  91. modelData: {
  92. list: []
  93. },
  94. bardata: [],
  95. }
  96. },
  97. mounted() {
  98. this.dashAccessDataAnalysisStat1()
  99. this.dashAccessDataAnalysisStat2()
  100. },
  101. watch: {},
  102. methods: {
  103. tooltipFormat(params) {
  104. const type = params[0].seriesType;
  105. const data = params[0].data;
  106. // ${params[0].name || "--"}月:
  107. return `<div class="line-tooltip">
  108. <div>${params[0].seriesName}: ${
  109. params[0].data.hs || "--"}个</div>
  110. <div>${params[1].seriesName}: ${
  111. params[0].data.cs || "--"}个</div>
  112. </div>`;
  113. },
  114. xLabelFormat(name) {
  115. const nameArr = []
  116. for (let i = 0; i < name.length; i += 7) {
  117. nameArr.push(name.substring(i, i + 7))
  118. }
  119. return nameArr.join('\n');
  120. },
  121. dashAccessDataAnalysisStat1(){
  122. api.dashAccessDataAnalysisStat1().then(res =>{
  123. this.bardata = res.data
  124. })
  125. },
  126. dashAccessDataAnalysisStat2(){
  127. api.dashAccessDataAnalysisStat2().then(res =>{
  128. this.modelData.list = res.data
  129. })
  130. },
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .form-wrapper {
  136. margin-bottom: 20px;
  137. }
  138. /deep/ .el-input__inner {
  139. background: #2d3744;
  140. border: none;
  141. border-radius: 0;
  142. }
  143. /deep/ .el-select {
  144. height: 40px;
  145. .el-input__inner {
  146. height: 40px;
  147. }
  148. .el-input__prefix, .el-input__suffix {
  149. height: 40px;
  150. }
  151. /* 下面设置右侧按钮居中 */
  152. .el-input__suffix {
  153. top: 0px;
  154. display: flex;
  155. justify-content: center;
  156. align-items: center;
  157. flex-wrap: nowrap;
  158. flex-direction: row;
  159. align-content: flex-start;
  160. }
  161. /* 输入框加上上下边是 32px + 2px =34px */
  162. .el-input__icon {
  163. line-height: 0px;
  164. }
  165. }
  166. /deep/ .form-wrapper .el-button {
  167. background: linear-gradient(90deg,#0158d9,#3c97e4);
  168. width: 100px;
  169. height: 40px;
  170. }
  171. .body-wrapper {
  172. width: 100%;
  173. height: 100%;
  174. box-sizing: border-box;
  175. background: #0c0c0c;
  176. }
  177. .model-pie-body {
  178. width: 100%;
  179. height: 99%;
  180. }
  181. .form-wrapper {
  182. margin-bottom: 20px;
  183. }
  184. /deep/ .el-input__inner {
  185. background: #2d3744;
  186. border: none;
  187. border-radius: 0;
  188. }
  189. /deep/ .el-select {
  190. height: 40px;
  191. .el-input__inner {
  192. height: 40px;
  193. }
  194. .el-input__prefix, .el-input__suffix {
  195. height: 40px;
  196. }
  197. /* 下面设置右侧按钮居中 */
  198. .el-input__suffix {
  199. top: 0px;
  200. display: flex;
  201. justify-content: center;
  202. align-items: center;
  203. flex-wrap: nowrap;
  204. flex-direction: row;
  205. align-content: flex-start;
  206. }
  207. /* 输入框加上上下边是 32px + 2px =34px */
  208. .el-input__icon {
  209. line-height: 0px;
  210. }
  211. }
  212. /deep/ .form-wrapper .el-button {
  213. background: linear-gradient(90deg,#0158d9,#3c97e4);
  214. width: 100px;
  215. height: 40px;
  216. }
  217. </style>