From 4cfbfd1b425f7b22b876ae6cae95c4fc29ae6bfb Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期五, 23 二月 2024 09:25:33 +0800 Subject: [PATCH] 盘库修改 --- src/views/purchase/dailySaleReport.vue | 104 +++++++++++++++++++++++++-------------------------- 1 files changed, 51 insertions(+), 53 deletions(-) diff --git a/src/views/purchase/dailySaleReport.vue b/src/views/purchase/dailySaleReport.vue index db9656c..2863f99 100644 --- a/src/views/purchase/dailySaleReport.vue +++ b/src/views/purchase/dailySaleReport.vue @@ -1,26 +1,33 @@ <template> <div class="container"> - <div class="filter-container"> + <div class="filter-container" style="padding: 20px"> <el-row> 时间:   - <el-date-picker - v-model="dateRange" - type="datetimerange" - start-placeholder="开始日期" - end-placeholder="结束日期" - :clearable="false" - :default-time="['00:00:00','23:59:59']"> - </el-date-picker> +<!-- <el-date-picker--> +<!-- v-model="dateRange"--> +<!-- type="date"--> +<!-- start-placeholder="开始日期"--> +<!-- end-placeholder="结束日期"--> +<!-- :clearable="false"--> +<!-- :default-time="['00:00:00','23:59:59']">--> +<!-- </el-date-picker>--> + <el-date-picker + v-model="currentDate" + value-format="yyyy-MM-dd" + type="date" + @change="changeDate" + placeholder="选择日期"> + </el-date-picker> + <el-button class="filter-item" style="margin-left: 10px;margin-bottom: 0" type="primary" icon="el-icon-back" + @click="dayForward">前一天</el-button> + <el-button class="filter-item" style="margin-left: 10px;margin-bottom: 0" type="primary" icon="el-icon-right" + @click="dayBackward">后一天</el-button> +<!-- <el-button class="filter-item" style="margin-left: 10px;margin-bottom: 0" type="primary" icon="el-icon-search"--> +<!-- @click="queryHandle"/>--> </el-row> <el-row style="padding-top: 10px"> - <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-back" - @click="dayForward">前一天</el-button> - <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-right" - @click="dayBackward">后一天</el-button> - <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" - @click="queryHandle"/> </el-row> </div> <div class="table_content"> @@ -96,6 +103,7 @@ name: "dailySaleReport", data(){ return{ + currentDate: '', dateRange:[], startDate:'', endDate:'', @@ -110,13 +118,14 @@ } }, - mounted() { - this.queryDateHandle(); + created() { + this.queryDateHandle() + this.getReportList() }, methods:{ - queryHandle(){ - this.getReportList(); - }, + // queryHandle(){ + // this.getReportList(); + // }, getReportList(){ const _this = this; const params = {}; @@ -167,47 +176,36 @@ }, dayForward(){ if (this.dateRange != null){ - const start = this.dateRange[0]; - const end = this.dateRange[1]; - start.setTime(start.getTime() - 3600 * 1000 * 24); - end.setTime(end.getTime() - 3600 * 1000 * 24); - start.setHours(0); - start.setMinutes(0); - start.setSeconds(0); - end.setHours(23); - end.setMinutes(59); - end.setSeconds(59); - this.dateRange = [start,end] + const start = new Date(this.currentDate); + start.setDate(start.getDate() - 1); + this.currentDate = start.toISOString().slice(0, 10) + this.dateRange[0] = start.toISOString().slice(0, 10) + " 00:00:00"; + this.dateRange[1] = start.toISOString().slice(0, 10) + " 23:59:59"; + this.getReportList() } }, dayBackward(){ if (this.dateRange != null){ - const start = this.dateRange[0]; - const end = this.dateRange[1]; - start.setTime(start.getTime() + 3600 * 1000 * 24); - end.setTime(end.getTime() + 3600 * 1000 * 24); - start.setHours(0); - start.setMinutes(0); - start.setSeconds(0); - end.setHours(23); - end.setMinutes(59); - end.setSeconds(59); - this.dateRange = [start,end] + const start = new Date(this.currentDate); + start.setDate(start.getDate() + 1); + this.currentDate = start.toISOString().slice(0, 10) + this.dateRange[0] = start.toISOString().slice(0, 10) + " 00:00:00"; + this.dateRange[1] = start.toISOString().slice(0, 10) + " 23:59:59"; + this.getReportList() } }, queryDateHandle(){ - const end = new Date(); - const start = new Date(); - start.setHours(0); - start.setMinutes(0); - start.setSeconds(0); - end.setHours(23); - end.setMinutes(59); - end.setSeconds(59); - this.dateRange.push(start,end); - this.startDate = start; - this.endDate = end; + const end = new Date(); + this.currentDate = end.toISOString().slice(0, 10) + this.dateRange[0] = end.toISOString().slice(0, 10) + " 00:00:00"; + this.dateRange[1] = end.toISOString().slice(0, 10) + " 23:59:59"; }, + changeDate(){ + console.log(this.currentDate,555) + this.dateRange[0] = this.currentDate + " 00:00:00" + this.dateRange[1] = this.currentDate + " 23:59:59" + this.getReportList() + }, sortChange(param){ this.sort = param.prop; this.order = param.order; -- Gitblit v1.9.2