parking_operate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <div class="body-wrapper">
  3. <el-form class="form-wrapper" :inline="true" :model="formInline1">
  4. <!-- <el-form-item label="行政区">-->
  5. <!-- <el-select clearable v-model="formInline1.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 label="街道">-->
  10. <!-- <el-input v-model="formInline1.streetName" placeholder="请输入"></el-input>-->
  11. <!-- </el-form-item>-->
  12. <el-form-item label="停车场">
  13. <el-select clearable filterable v-model="formInline1.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="formInline1.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 style="display: flex; justify-content: space-between;">
  35. <div style="width: 50%; height: 300px">
  36. <div align="center" style="color: white">停车饱和度</div>
  37. <linechart
  38. :autoStop="false"
  39. :top="30"
  40. :bottom="30"
  41. :left="40"
  42. :legendTop="0"
  43. yAxisName="(个)"
  44. :dataset="bardata"
  45. :tooltipFormat="lineTooltipFormat6"
  46. :encode="[
  47. {x: 'mouth', y: 'lastYearAmount', seriesName: '占用' ,bool:'true'}]"
  48. id="tcbhd"
  49. />
  50. </div>
  51. <div style="width: 50%; height: 300px">
  52. <div align="center" style="color: white">停车场周转率分析</div>
  53. <linechart
  54. :autoStop="false"
  55. :top="30"
  56. :bottom="30"
  57. :left="40"
  58. :legendTop="0"
  59. yAxisName="(%)"
  60. :dataset="linedata1"
  61. :tooltipFormat="lineTooltipFormat1"
  62. :encode="[
  63. { x: 'month', y: 'lastAmount', seriesName: '停车场周转率',bool:'true' },
  64. ]"
  65. id="sxcyfzqk1"
  66. />
  67. </div>
  68. </div>
  69. <div style="display: flex; justify-content: space-between;margin-top: 5%">
  70. <div style="width: 50%; height: 300px;padding-left: 25px">
  71. <div align="center" style="color: white">车辆进出场趋势</div>
  72. <linechart
  73. :autoStop="false"
  74. :top="30"
  75. :bottom="30"
  76. :left="40"
  77. :legendTop="0"
  78. yAxisName="(%)"
  79. :dataset="linedata2"
  80. :tooltipFormat="lineTooltipFormat2"
  81. :encode="[
  82. { x: 'month', y: 'lastYearAmount', seriesName: '进流率',bool:'true' },
  83. { x: 'month', y: 'thisYearAmount', seriesName: '出流率',bool:'true' },
  84. ]"
  85. id="sxcyfzqk2"
  86. />
  87. </div>
  88. <div style="width: 50%; height: 300px; position: relative;">
  89. <div style="position: absolute; left: 0; color: white">车辆类型进场占比</div>
  90. <piechart
  91. class="model-pie-body"
  92. id="chart1"
  93. :roseType="false"
  94. :radiusArr="['30%', '50%']"
  95. :colorArr="modelPieColor"
  96. :labelFormat="['{name|{b} {d}%}', '{hr|}']"
  97. :dataset="modelData.list"
  98. :encode="{ itemName: 'name', value: 'value' }"
  99. />
  100. </div>
  101. </div>
  102. <div style="display: flex; justify-content: space-between;margin-top: 5%">
  103. <div style="width: 50%; height: 450px;">
  104. <div align="center" style="color: white">停车场营收分析</div>
  105. <linechart
  106. :autoStop="false"
  107. :top="30"
  108. :bottom="200"
  109. :left="40"
  110. :legendTop="0"
  111. yAxisName="(元)"
  112. :dataset="linedata"
  113. :xlabelFormat="xlabelFormat"
  114. :tooltipFormat="lineTooltipFormat"
  115. :encode="[
  116. { x: 'month', y: 'lastAmount', seriesName: '泊位收入',bool:'true' }
  117. ]"
  118. id="sxcyfzqk"
  119. />
  120. </div>
  121. <div style="width: 50%; height: 450px;">
  122. <div align="center" style="color: white">停车场营收对比分析</div>
  123. <linechart
  124. :autoStop="false"
  125. :top="30"
  126. :bottom="200"
  127. :left="40"
  128. :legendTop="0"
  129. yAxisName="(元)"
  130. :dataset="linedata3"
  131. :xlabelFormat="xlabelFormat"
  132. :tooltipFormat="lineTooltipFormat3"
  133. :encode="[
  134. { x: 'month', y: 'lastYearAmount', seriesName: '今日',bool:'true' },
  135. { x: 'month', y: 'thisYearAmount', seriesName: '昨日',bool:'true' },
  136. ]"
  137. id="sxcyfzqk3"
  138. />
  139. </div>
  140. </div>
  141. </div>
  142. </template>
  143. <script>
  144. import piechart from "@/components/pieChart";
  145. import linechart from "@/components/lineChart";
  146. import barchart from "@/components/barChart";
  147. import vtable from "@/components/vtableNew";
  148. import api from "@/api/article_z";
  149. import options from '@/util/options'
  150. export default {
  151. components: {
  152. piechart,
  153. linechart,
  154. barchart,
  155. vtable
  156. },
  157. data() {
  158. return {
  159. districtOptions: options.districtOptions,
  160. carOptions: [],
  161. formInline1: {
  162. parkId: '',
  163. time: [],
  164. regionCode: '',
  165. streetName: ''
  166. },
  167. modelPieColor: ["#4382f6", "#9078f8", "#79a7db", "#FF9800"],
  168. modelData: {
  169. list: []
  170. },
  171. linedata: [],
  172. linedata1: [],
  173. linedata2: [],
  174. linedata3: [],
  175. bardata: [],
  176. }
  177. },
  178. mounted() {
  179. this.getParkDic()
  180. this.queryAll()
  181. },
  182. watch: {
  183. },
  184. methods: {
  185. xlabelFormat(name) {
  186. var str = name.split("");
  187. return str.join("\n");
  188. },
  189. getParkDic() {
  190. api.parkDic().then(res => {
  191. this.carOptions = res.data || [];
  192. })
  193. },
  194. queryAll() {
  195. let params = {...this.formInline1}
  196. if (
  197. this.formInline1.time && this.formInline1.time.length === 2 &&
  198. this.formInline1.time[1] !== ""
  199. ) {
  200. this.formInline1.time[0] = this.formInline1.time[0].substring(0, 10) + " 00:00:00";
  201. this.formInline1.time[1] = this.formInline1.time[1].substring(0, 10) + " 23:59:59";
  202. params.begin= this.formInline1.time[0]
  203. params.end = this.formInline1.time[1]
  204. }
  205. delete params.time
  206. this.getBardataData(params)
  207. this.getLinedata1Data(params)
  208. this.getLinedataData(params)
  209. this.getModelDataData(params)
  210. this.getLinedata2Data(params)
  211. this.getLinedata3Data(params)
  212. },
  213. //初始化
  214. getBardataData(params){
  215. api.queryParkingOperate_Tcbhd(params).then(res=>{
  216. this.bardata=res.data;
  217. })
  218. },
  219. getLinedata1Data(params){
  220. api.queryParkingOperate_Tczzlfx(params).then(res=>{
  221. this.linedata1=res.data;
  222. })
  223. },
  224. getLinedataData(params){
  225. api.queryParkingOperate_Tccysfx(params).then(res=>{
  226. this.linedata=res.data;
  227. })
  228. },
  229. getModelDataData(params){
  230. api.queryParkingOperate_Tscljczb(params).then(res=>{
  231. this.modelData.list=res.data;
  232. })
  233. },
  234. getLinedata2Data(params){
  235. api.queryParkingOperate_Cljccqs(params).then(res=>{
  236. this.linedata2=res.data;
  237. })
  238. },
  239. getLinedata3Data(params){
  240. api.queryParkingOperate_Tccysdbfx(params).then(res=>{
  241. this.linedata3=res.data;
  242. })
  243. },
  244. lineTooltipFormat1(params) {
  245. const data = params[0].data;
  246. return `<div class="line-tooltip">
  247. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  248. params[0].data.lastAmount || "--"
  249. }(%)</div>`;
  250. },
  251. lineTooltipFormat(params) {
  252. const data = params[0].data;
  253. return `<div class="line-tooltip">
  254. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  255. params[0].data.lastAmount || "--"
  256. }(元)</div>`;
  257. },
  258. lineTooltipFormat6(params) {
  259. const data = params[0].data
  260. let zb = '--'
  261. console.log(params[0].data, '999999')
  262. if (Number(params[0].data.thisYearAmount) > 0) {
  263. zb = (Number(params[0].data.lastYearAmount)/Number(params[0].data.thisYearAmount) * 100 ).toFixed(2)
  264. }
  265. return `<div class="line-tooltip">
  266. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  267. params[0].data.lastYearAmount
  268. }个<div style="color: ${params[0].color}">饱和度: ${
  269. zb
  270. }%</div>`;
  271. },
  272. lineTooltipFormat2(params) {
  273. const data = params[0].data;
  274. return `<div class="line-tooltip">
  275. <div style="color: ${params[1].color}">${params[1].seriesName}: ${
  276. params[0].data.thisYearAmount || "--"
  277. }(%)</div>
  278. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  279. params[0].data.lastYearAmount || "--"
  280. }(%)</div>
  281. </div>`;
  282. },
  283. lineTooltipFormat3(params) {
  284. const data = params[0].data;
  285. return `<div class="line-tooltip">
  286. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  287. params[0].data.lastYearAmount || "0"
  288. }(元)</div>
  289. <div style="color: ${params[1].color}">${params[1].seriesName}: ${
  290. params[0].data.thisYearAmount || "0"
  291. }(元)</div>
  292. </div>`;
  293. },
  294. xLabelFormat(name) {
  295. const nameArr = []
  296. for(let i=0; i<name.length; i+=7) {
  297. nameArr.push(name.substring(i, i+7))
  298. }
  299. return nameArr.join('\n');
  300. },
  301. tooltipFormat(params) {
  302. const type = params[0].seriesType;
  303. const data = params[0].data;
  304. // ${params[0].name || "--"}月:
  305. return `<div class="line-tooltip">
  306. <div>${params[0].seriesName}: ${
  307. params[0].data.hs || "--"}个</div>
  308. <div>${params[1].seriesName}: ${
  309. params[0].data.cs || "--"}个</div>
  310. </div>`;
  311. },
  312. }
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. .form-wrapper {
  317. margin-bottom: 20px;
  318. }
  319. /deep/ .el-input__inner {
  320. background: #2d3744;
  321. border: none;
  322. border-radius: 0;
  323. }
  324. /deep/ .el-select {
  325. /* 下面设置右侧按钮居中 */
  326. .el-input__suffix {
  327. top: 0px;
  328. display: flex;
  329. justify-content: center;
  330. align-items: center;
  331. flex-wrap: nowrap;
  332. flex-direction: row;
  333. align-content: flex-start;
  334. }
  335. /* 输入框加上上下边是 32px + 2px =34px */
  336. .el-input__icon {
  337. line-height: 0px;
  338. }
  339. }
  340. /deep/ .form-wrapper .el-button {
  341. background: linear-gradient(90deg, #0158d9, #3c97e4);
  342. width: 100px;
  343. height: 30px;
  344. }
  345. .body-wrapper {
  346. .button-block{
  347. text-align: right;
  348. margin-bottom: 20px;
  349. }
  350. .search-card{
  351. font-size: 24px;
  352. font-weight: bold;
  353. color: #3498db;
  354. margin-bottom: 20px;
  355. .input-wrapper{
  356. width: 36%;
  357. }
  358. }
  359. }
  360. .audit-dialog{
  361. .mg-bt{
  362. margin-bottom: 24px;
  363. }
  364. .label{
  365. text-align: right;
  366. }
  367. }
  368. .charts_all {
  369. display: flex;
  370. justify-content: space-around;
  371. width: 100%;
  372. height: 400px;
  373. }
  374. .charts {
  375. width: 30%;
  376. height: 300px;
  377. }
  378. .btn_save {
  379. background-color: #3498db;
  380. color: #ffffff;
  381. padding: 10px 20px;
  382. cursor: pointer;
  383. border: none;
  384. border-radius: 4px;
  385. font-size: 16px;
  386. height: 30px;
  387. }
  388. .sel {
  389. height: 200px;
  390. margin-right: 10px;
  391. }
  392. .input-search {
  393. width: 100%;
  394. padding: 10px;
  395. margin-bottom: 20px;
  396. box-sizing: border-box;
  397. background-color: #2a2a2a;
  398. border: 1px solid #333;
  399. color: #ffffff;
  400. }
  401. .audit-dialog {
  402. .mg-bt {
  403. margin-bottom: 24px;
  404. }
  405. .label {
  406. text-align: right;
  407. }
  408. .form-div {
  409. /deep/ .el-input__inner {
  410. height: 35px;
  411. width: 100%;
  412. border: 1px solid #a6a5a5;
  413. color: #fff;
  414. background: #2d3744;
  415. }
  416. /deep/ .el-input__icon {
  417. //line-height: 35px;
  418. }
  419. }
  420. }
  421. </style>