Commit 888b6bfc by Mr. Lan

feat: 添加日期选择筛选。

parent bda74861
Showing with 53 additions and 2 deletions
...@@ -31,6 +31,20 @@ ...@@ -31,6 +31,20 @@
</el-col> </el-col>
</el-row> </el-row>
<el-card :bordered="false" :body-style="{padding: '5'}" :style="{ marginBottom: '12px', textAlign: 'center' }">
<el-date-picker
v-model="querys"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
@change="timeScreening"
/>
</el-card>
<el-card :bordered="false" :body-style="{padding: '0'}" :style="{ marginBottom: '12px' }"> <el-card :bordered="false" :body-style="{padding: '0'}" :style="{ marginBottom: '12px' }">
<div class="salesCard"> <div class="salesCard">
<div> <div>
...@@ -90,7 +104,36 @@ export default { ...@@ -90,7 +104,36 @@ export default {
count: {} count: {}
}, },
rankList: [], rankList: [],
submitData: [] submitData: [],
querys: '',
queryList: {},
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
}
} }
}, },
created() { created() {
...@@ -98,9 +141,17 @@ export default { ...@@ -98,9 +141,17 @@ export default {
}, },
methods: { methods: {
getInitData() { getInitData() {
initData().then(response => { initData(this.queryList).then(response => {
this.dashboardValue = response.data this.dashboardValue = response.data
}) })
},
timeScreening() {
console.log(this.querys)
if (this.querys.length > 1) {
this.queryList.start_time = this.querys[0]
this.queryList.end_time = this.querys[1]
this.getInitData()
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment