park_bahavior.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 filterable 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. <br>
  34. <div class="charts" style="display: flex">
  35. <div style="width: 50%;height: 320px;">
  36. <h5 style="color: white">停车时长分析</h5>
  37. <piechart
  38. class="model-pie-body"
  39. id="chart1"
  40. :radiusArr="['30%', '50%']"
  41. :roseType = "false"
  42. :colorArr="modelPieColor"
  43. :labelFormat="['{name|{b}}', '{sub|{@value}辆 {d}%}', '{hr|}']"
  44. :dataset="modelData"
  45. :encode="{ itemName: 'name', value: 'value' }"
  46. />
  47. </div>
  48. <div style="width: 50%;height: 320px;">
  49. <h5 style="color: white">停车时段分析</h5>
  50. <linechart
  51. :autoStop="false"
  52. :top="30"
  53. :bottom="30"
  54. :left="60"
  55. :legendTop="0"
  56. yAxisName="辆"
  57. :dataset="linedata"
  58. :tooltipFormat="lineTooltipFormat"
  59. :encode="[
  60. { x: 'month', y: 'lastYearAmount', seriesName: '入场',bool:'true' },
  61. { x: 'month', y: 'thisYearAmount', seriesName: '出场',bool:'true' },
  62. ]"
  63. id="sxcyfzqk"
  64. />
  65. </div>
  66. <br>
  67. </div>
  68. <br>
  69. <div class="charts" style="display: flex">
  70. <div style="width: 50%;height: 300px;">
  71. <h5 style="color: white">临时停车分析</h5>
  72. <piechart
  73. class="model-pie-body"
  74. id="chart3"
  75. :radiusArr="['30%', '70%']"
  76. :roseType = "false"
  77. :colorArr="modelPieColor4"
  78. :labelFormat="['{name|{b}}', '{sub|{@value}辆 {d}%}', '{hr|}']"
  79. :dataset="modelData4"
  80. :encode="{ itemName: 'name', value: 'value' }"
  81. />
  82. </div>
  83. <div style="width: 50%;height: 300px;">
  84. <h5 style="color: white">夜间停车分析</h5>
  85. <piechart
  86. class="model-pie-body"
  87. id="chart4"
  88. :radiusArr="['30%', '70%']"
  89. :roseType = "false"
  90. :colorArr="modelPieColor5"
  91. :labelFormat="['{name|{b}}', '{sub|{@value}辆 {d}%}', '{hr|}']"
  92. :dataset="modelData5"
  93. :encode="{ itemName: 'name', value: 'value' }"
  94. />
  95. </div>
  96. <br>
  97. </div>
  98. </div>
  99. </template>
  100. <script>
  101. import piechart from "@/components/pieChart";
  102. import linechart from "@/components/lineChart";
  103. import api from "@/api/article_liao";
  104. import options from '@/util/options'
  105. const date = new Date;
  106. export default {
  107. components: {
  108. piechart,
  109. linechart
  110. },
  111. data() {
  112. return {
  113. districtOptions: options.districtOptions,
  114. carOptions: [],
  115. linedata: [],
  116. modelPieColor: ["#4382f6","#9078f8","#DAA520","#2E8B57"],
  117. modelData: [],
  118. modelPieColor4: ["#4382f6","#9078f8"],
  119. modelData4: [],
  120. modelPieColor5: ["#4382f6","#9078f8"],
  121. modelData5: [],
  122. formInline: {
  123. regionCode: '',
  124. keyAreas: '',
  125. streetName: '',
  126. time: [date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate()), date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate())],
  127. parkId: '',
  128. }
  129. }
  130. },
  131. mounted() {
  132. this.getParkDic()
  133. this.queryAll()
  134. },
  135. watch: {
  136. },
  137. methods: {
  138. getParkDic() {
  139. api.parkDic().then(res => {
  140. this.carOptions = res.data || [];
  141. })
  142. },
  143. queryAll() {
  144. let params = {...this.formInline}
  145. if (
  146. this.formInline.time && this.formInline.time.length === 2 &&
  147. this.formInline.time[1] !== ""
  148. ) {
  149. this.formInline.time[0] = this.formInline.time[0].substring(0, 10) + " 00:00:00";
  150. this.formInline.time[1] = this.formInline.time[1].substring(0, 10) + " 23:59:59";
  151. params.begin= this.formInline.time[0]
  152. params.end = this.formInline.time[1]
  153. }
  154. delete params.time
  155. this.parkBehaviorDuration(params)
  156. this.parkBehaviorRange(params)
  157. this.parkBehaviorTemporary(params)
  158. this.parkBehaviorNight(params)
  159. },
  160. lineTooltipFormat(params) {
  161. return `<div class="line-tooltip">
  162. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  163. params[0].data.lastYearAmount || "--"
  164. }</div>
  165. <div style="color: ${params[1].color}">${params[1].seriesName}: ${
  166. params[1].data.thisYearAmount || "--"
  167. }</div>
  168. </div>`;
  169. },
  170. parkBehaviorDuration(params) {
  171. api.parkBehaviorDuration(params).then(res =>{
  172. this.modelData = res.data
  173. })
  174. },
  175. parkBehaviorRange(params){
  176. api.parkBehaviorRange(params).then(res =>{
  177. this.linedata = res.data
  178. })
  179. },
  180. parkBehaviorTemporary(params){
  181. api.parkBehaviorTemporary(params).then(res =>{
  182. this.modelData4 = res.data
  183. })
  184. },
  185. parkBehaviorNight(params){
  186. api.parkBehaviorNight(params).then(res =>{
  187. this.modelData5 = res.data
  188. })
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .model-pie-body {
  195. width: 100%;
  196. height: 99%;
  197. }
  198. .form-wrapper {
  199. margin-bottom: 20px;
  200. }
  201. /deep/ .el-input__inner {
  202. background: #2d3744;
  203. border: none;
  204. border-radius: 0;
  205. }
  206. /deep/ .el-select {
  207. /* 下面设置右侧按钮居中 */
  208. .el-input__suffix {
  209. top: 0px;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. flex-wrap: nowrap;
  214. flex-direction: row;
  215. align-content: flex-start;
  216. }
  217. /* 输入框加上上下边是 32px + 2px =34px */
  218. .el-input__icon {
  219. line-height: 0px;
  220. }
  221. }
  222. /deep/ .form-wrapper .el-button {
  223. background: linear-gradient(90deg,#0158d9,#3c97e4);
  224. width: 100px;
  225. height: 30px;
  226. }
  227. .body-wrapper {
  228. .button-block{
  229. text-align: right;
  230. margin-bottom: 20px;
  231. }
  232. .search-card{
  233. margin-bottom: 20px;
  234. text-align: center;
  235. .input-wrapper{
  236. width: 36%;
  237. }
  238. }
  239. }
  240. .audit-dialog{
  241. .mg-bt{
  242. margin-bottom: 24px;
  243. }
  244. .label{
  245. text-align: right;
  246. }
  247. .form-div{
  248. /deep/ .el-input__inner{
  249. height: 35px;
  250. width: 90%;
  251. border: 1px solid #a6a5a5;
  252. color: #fff;
  253. background: #2d3744;
  254. }
  255. }
  256. }
  257. </style>