<template>
|
<div>
|
<div style="padding: 10px 10px 0px 10px;">
|
<el-form :inline="true" :model="searchForm">
|
<el-form-item label="停车场">
|
<el-select v-model="searchForm.parkId" clearable>
|
<el-option v-for="item in table1" :key="item.id" :label="item.name" :value="item.id" ></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="选择时间">
|
<div class="date-box">
|
<el-date-picker type="daterange" value-format="yyyy-MM-dd" format="yyyy-MM-dd"
|
v-model="searchForm.date" placeholder="">
|
</el-date-picker>
|
</div>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" size="small" @click="onSearch" icon="el-icon-search">查询</el-button>
|
<el-button type="primary" size="small" @click="onSearch2" icon="el-icon-search">查询</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
|
<el-table :data="table2" border style="width:55%;border:1px solid #bcbec2;" show-summary>
|
<el-table-column type="index" width="50" label="序号" align="center"> </el-table-column>
|
<el-table-column prop="parkName" label="停车场" align="center" ></el-table-column>
|
<el-table-column prop="orderNum" label="有效订单数" align="center" ></el-table-column>
|
<el-table-column prop="orderMoney" label="订单总金额(元)" align="center" ></el-table-column>
|
</el-table>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: "index",
|
data: function () {
|
return {
|
flag:false,
|
flag2:false,
|
searchForm: {
|
parkId: '',
|
startTime:'',
|
endTime:'',
|
date:[],
|
},
|
formData: {
|
parkName:'',
|
orderNum:'',
|
orderMoney:''
|
},
|
urlPath:this.$systemconfig.basePath + '/orderrecord/',
|
table1:[],
|
table2:[],
|
}
|
},
|
mounted() {
|
this.defaultDate();
|
this.$byutil.postData(this, this.$systemconfig.basePath+'/park/findAll', this.formData, res => {
|
this.table1 = res.data;
|
})
|
},
|
methods: {
|
loadData() {
|
if (this.searchForm.date) {
|
this.searchForm.startTime = this.searchForm.date[0];
|
this.searchForm.endTime = this.searchForm.date[1];
|
} else {
|
this.searchForm.startTime = null;
|
this.searchForm.endTime = null;
|
}
|
this.$byutil.postData(this, this.urlPath+'findCountPage', this.searchForm,res => {
|
this.table2 = res.data;
|
});
|
},
|
onSearch() {
|
this.loadData();
|
},
|
onSearch2() {
|
this.$byutil.postData(this, this.urlPath+'getById/1000', null,res => {
|
console.log(res.data)
|
});
|
},
|
//设置默认日期
|
defaultDate(){
|
//获取新的时间
|
let date = new Date()
|
//获取当前时间的年份转为字符串
|
let year = date.getFullYear().toString()
|
//获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
|
let month = date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1).toString():(date.getMonth()+1).toString()
|
//获取天,判断是否小于10,如果是在字符串前面拼接'0'
|
let da = date.getDate() < 10 ? '0'+date.getDate().toString():date.getDate().toString()
|
//字符串拼接,开始时间,结束时间
|
let end = year + '-' + month + '-' + da //当天'2019-04-12'
|
let beg = year + '-' + month + '-' + da //当月第一天'2019-04-01'
|
this.searchForm.date = [beg,end] //将值设置给插件绑定的数据
|
this.loadData();
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|