Commit 8dcd7f649e8c6f920c5a83ec71f6a8882d1aeb89
1 parent
848073f1
api 接口封装 news
Showing
3 changed files
with
48 additions
and
73 deletions
src/api/api.js
... | ... | @@ -6,8 +6,14 @@ export const memberAddress = p => post('urban/intelligence/appuser/queryUserPers |
6 | 6 | //....收费员 |
7 | 7 | export const tollmanAddress = p => post('urban/intelligence/employee/queryEmployeeStaByOrgIds',p) |
8 | 8 | |
9 | -//....设备 | |
9 | +//....收入 | |
10 | 10 | export const incomeAddress = p => post('urban/intelligence/income/queryIncomeStaByOrgIds',p) |
11 | 11 | |
12 | +//....泊位 | |
13 | +export const berthAddress = p => post('urban/intelligence/berth/queryBerthStatisticByOrgIds',p) | |
14 | + | |
12 | 15 | //....设备 |
13 | 16 | export const deviceAddress = p => post('urban/intelligence/device/queryDeviceStatistic',p) |
17 | + | |
18 | +//....消息 | |
19 | +export const msgAddress = p => post('urban/intelligence/orderPark/queryLastOrderPark',p) | ... | ... |
src/components/berth/index.vue
... | ... | @@ -24,56 +24,50 @@ |
24 | 24 | <script> |
25 | 25 | import common from '../../api/common'; |
26 | 26 | import echarts from 'echarts' |
27 | + import { berthAddress } from '../../api/api' | |
27 | 28 | export default { |
28 | 29 | name: "berth", |
29 | 30 | data() { |
30 | 31 | return { |
31 | 32 | demo:'',//示例 |
32 | 33 | berthTotal:"",//泊位总数 |
33 | - free:12345,//空余 | |
34 | - have:23456,//占有 | |
35 | - //color: this.$store.state.color, | |
34 | + free:'',//空余 | |
35 | + have:'',//占有 | |
36 | 36 | pieChart: {}, |
37 | 37 | name: '饼图', |
38 | 38 | pieChartOption:{ |
39 | 39 | seriesData:[ |
40 | - {name:"占有",value:6000}, | |
41 | - {name:"空余",value:4000} | |
40 | + {name:"占有",value:''}, | |
41 | + {name:"空余",value:''} | |
42 | 42 | ] |
43 | 43 | } |
44 | 44 | } |
45 | 45 | }, |
46 | 46 | mounted() { |
47 | - this.axios.post('urban/intelligence/berth/queryBerthStatisticByOrgIds',{ | |
48 | - orgIds: this.GLOBAL.paramsvariables | |
49 | - }).then((response)=>{ | |
50 | - let data = response.data.data | |
51 | - console.log(data) | |
52 | - this.berthTotal = common.formatNumToStr(data.allBerthNum) | |
53 | - this.free = data.freeBerthNum | |
54 | - this.have = data.isOccupyBertnNum | |
55 | - | |
56 | - this.pieChartOption.seriesData[0].value = data.isOccupyBertnNum | |
57 | - this.pieChartOption.seriesData[1].value = data.freeBerthNum | |
58 | - let pieChartOption = this.pieChartOption | |
59 | - //占有率 | |
60 | - this.pieChart=this.createPie(pieChartOption); | |
61 | - window.addEventListener('resize', function() { | |
62 | - this.pieChart.resize() | |
63 | - }.bind(this)); | |
64 | - }).catch((response)=>{ | |
65 | - console.log(response); | |
66 | - }) | |
67 | - //this.createLine(); | |
68 | - //总收入 | |
69 | - | |
47 | + this.onLoad() | |
70 | 48 | }, |
71 | 49 | methods: { |
72 | - /* | |
73 | - * 格式化总泊位 | |
74 | - * */ | |
75 | - formatNumToStr:function(){ | |
76 | - return common.formatNumToStr(this.$options.data().demo); | |
50 | + onLoad() { | |
51 | + berthAddress({ | |
52 | + orgIds: this.GLOBAL.paramsvariables | |
53 | + }).then((response)=>{ | |
54 | + let data = response.data.data | |
55 | + console.log(data) | |
56 | + this.berthTotal = common.formatNumToStr(data.allBerthNum) | |
57 | + this.free = data.freeBerthNum | |
58 | + this.have = data.isOccupyBertnNum | |
59 | + | |
60 | + this.pieChartOption.seriesData[0].value = data.isOccupyBertnNum | |
61 | + this.pieChartOption.seriesData[1].value = data.freeBerthNum | |
62 | + let pieChartOption = this.pieChartOption | |
63 | + //占有率 | |
64 | + this.pieChart=this.createPie(pieChartOption); | |
65 | + window.addEventListener('resize', function() { | |
66 | + this.pieChart.resize() | |
67 | + }.bind(this)); | |
68 | + }).catch((response)=>{ | |
69 | + console.log(response); | |
70 | + }) | |
77 | 71 | }, |
78 | 72 | /* |
79 | 73 | * 泊位占比 | ... | ... |
src/components/orderMessage/index.vue
... | ... | @@ -3,34 +3,7 @@ |
3 | 3 | <div class="theme-card"> |
4 | 4 | <div class="title"><span>订单消息</span></div> |
5 | 5 | <div class="content"> |
6 | - <!--<table class="orderMessageTb">--> | |
7 | - <!--<tr>--> | |
8 | - <!--<td>--> | |
9 | - <!--<table class="tbHead">--> | |
10 | - <!--<tr><td><div class="orderImgCom orderNum"></div></td><td>订单编号</td></tr>--> | |
11 | - <!--</table>--> | |
12 | - <!--</td>--> | |
13 | - <!--<td>--> | |
14 | - <!--<table class="tbHead">--> | |
15 | - <!--<tr><td><div class="orderImgCom orderPark"></div></td><td>停车场</td></tr>--> | |
16 | - <!--</table>--> | |
17 | - <!--</td>--> | |
18 | - <!--<td>--> | |
19 | - <!--<table class="tbHead">--> | |
20 | - <!--<tr><td><div class="orderImgCom orderMoney"></div></td><td>收费金额</td></tr>--> | |
21 | - <!--</table>--> | |
22 | - <!--</td>--> | |
23 | - <!--</tr>--> | |
24 | - <!--<tr>--> | |
25 | - <!--<td colspan="3">--> | |
26 | - <!--<div class="orderListBox" id="orderListBox">--> | |
27 | - <!--<marquee class="marqueeStyle" direction="up" behavior="scroll" scrollamount="2" onMouseOut="this.start()" onMouseOver="this.stop()" scrolldelay="0" loop="-1" >--> | |
28 | - <!--<div class="orderListBox" v-html="orderList"></div>--> | |
29 | - <!--</marquee>--> | |
30 | - <!--</div>--> | |
31 | - <!--</td>--> | |
32 | - <!--</tr>--> | |
33 | - <!--</table>--> | |
6 | + | |
34 | 7 | <ul class="news-wrap"> |
35 | 8 | <li class="orderNum">订单编号</li> |
36 | 9 | <li class="orderPark">停车场</li> |
... | ... | @@ -51,7 +24,7 @@ |
51 | 24 | </template> |
52 | 25 | |
53 | 26 | <script> |
54 | - import common from '../../api/common' | |
27 | + import { msgAddress } from '../../api/api' | |
55 | 28 | export default { |
56 | 29 | name: "orderMessage", |
57 | 30 | data() { |
... | ... | @@ -64,18 +37,20 @@ |
64 | 37 | } |
65 | 38 | }, |
66 | 39 | created() { |
67 | - this.axios.post('urban/intelligence/orderPark/queryLastOrderPark',{ | |
68 | - orgIds: this.GLOBAL.paramsvariables | |
69 | - }).then((response)=>{ | |
70 | - let data = response.data.data | |
71 | - this.list = data; | |
72 | - setInterval(this.scroll, 2000) | |
73 | - }).catch((response)=>{ | |
74 | - console.log(response); | |
75 | - }) | |
76 | - | |
40 | + this.onLoad() | |
77 | 41 | }, |
78 | 42 | methods: { |
43 | + onLoad() { | |
44 | + msgAddress({ | |
45 | + orgIds: this.GLOBAL.paramsvariables | |
46 | + }).then((response)=>{ | |
47 | + let data = response.data.data | |
48 | + this.list = data; | |
49 | + setInterval(this.scroll, 2000) | |
50 | + }).catch((response)=>{ | |
51 | + console.log(response); | |
52 | + }) | |
53 | + }, | |
79 | 54 | scroll() { |
80 | 55 | this.animate = !this.animate; |
81 | 56 | var that = this; // 在异步函数中会出现this的偏移问题,此处一定要先保存好this的指向 | ... | ... |