access_data_analysis.vue 6.5 KB

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