diff --git a/src/views/materialsStation/equipment/totalLeaseRecord/index.vue b/src/views/materialsStation/equipment/totalLeaseRecord/index.vue index 22332b12..589ba5e1 100644 --- a/src/views/materialsStation/equipment/totalLeaseRecord/index.vue +++ b/src/views/materialsStation/equipment/totalLeaseRecord/index.vue @@ -167,9 +167,19 @@ export default { } }, created() { + const end = new Date() + let start = new Date() + start.setMonth(start.getMonth() - 1) + this.queryParams.timeRange = [this.format(start), this.format(end)] this.getList() }, methods: { + format(date) { + const y = date.getFullYear() + const m = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${y}-${m}-${day}` + }, // 查询 handleQuery() { this.queryParams.pageNum = 1 @@ -180,6 +190,10 @@ export default { this.queryParams.pageNum = 1 this.queryParams.pageSize = 10 this.$refs.queryForm.resetFields() + const end = new Date() + let start = new Date() + start.setMonth(start.getMonth() - 1) + this.queryParams.timeRange = [this.format(start), this.format(end)] this.getList() }, // 获取列表 diff --git a/src/views/materialsStation/equipment/totalReturnRecord/index.vue b/src/views/materialsStation/equipment/totalReturnRecord/index.vue index e777bb69..727837a5 100644 --- a/src/views/materialsStation/equipment/totalReturnRecord/index.vue +++ b/src/views/materialsStation/equipment/totalReturnRecord/index.vue @@ -163,9 +163,19 @@ export default { } }, created() { + const end = new Date() + let start = new Date() + start.setMonth(start.getMonth() - 1) + this.queryParams.timeRange = [this.format(start), this.format(end)] this.getList() }, methods: { + format(date) { + const y = date.getFullYear() + const m = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${y}-${m}-${day}` + }, // 查询 handleQuery() { this.queryParams.pageNum = 1 @@ -176,6 +186,10 @@ export default { this.queryParams.pageNum = 1 this.queryParams.pageSize = 10 this.$refs.queryForm.resetFields() + const end = new Date() + let start = new Date() + start.setMonth(start.getMonth() - 1) + this.queryParams.timeRange = [this.format(start), this.format(end)] this.getList() }, // 获取列表