From 1a53fe11170612881fe17c402ed350481e57cb9c Mon Sep 17 00:00:00 2001 From: jishenghua <752718920@qq.com> Date: Thu, 25 Apr 2024 21:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E5=8D=95=E6=8D=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=97=B6=E9=97=B4=E6=AE=B5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=EF=BC=8C=E9=BB=98=E8=AE=A43?= =?UTF-8?q?=E4=B8=AA=E6=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jshERP-web/src/utils/util.js | 18 ++++++++++++++++++ .../src/views/bill/mixins/BillListMixin.js | 15 +++++++++++++-- .../financial/mixins/FinancialListMixin.js | 16 +++++++++++++--- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/jshERP-web/src/utils/util.js b/jshERP-web/src/utils/util.js index 85501b3a..391440ae 100644 --- a/jshERP-web/src/utils/util.js +++ b/jshERP-web/src/utils/util.js @@ -548,6 +548,24 @@ export function getBeforeFormatDate(day) { return thirtyDaysAgo.getFullYear() + seperator1 + month + seperator1 + strDate } +/** + * js获取N月前的日期, 格式“yyyy-MM-dd” + */ +export function getPrevMonthFormatDate(monthNum) { + let prevMonth = new Date(); // 当前日期 + prevMonth.setMonth(prevMonth.getMonth() - monthNum); // 设置为前一个月 + let seperator1 = "-"; + let month = prevMonth.getMonth() + 1; + let strDate = prevMonth.getDate(); + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + return prevMonth.getFullYear() + seperator1 + month + seperator1 + strDate +} + /** * JS中根据指定值删除数组中的元素 * @param arrylist diff --git a/jshERP-web/src/views/bill/mixins/BillListMixin.js b/jshERP-web/src/views/bill/mixins/BillListMixin.js index 3d376458..0f747bef 100644 --- a/jshERP-web/src/views/bill/mixins/BillListMixin.js +++ b/jshERP-web/src/views/bill/mixins/BillListMixin.js @@ -3,7 +3,8 @@ import {getAction } from '@/api/manage' import { FormTypes } from '@/utils/JEditableTableUtil' import {findBillDetailByNumber, findBySelectSup, findBySelectCus, findBySelectRetail, getUserList, getAccount, waitBillCount, getCurrentSystemConfig, getPlatformConfigByKey} from '@/api/api' -import { getCheckFlag } from "@/utils/util" +import { getCheckFlag, getFormatDate, getPrevMonthFormatDate } from '@/utils/util' +import moment from 'moment' export const BillListMixin = { data () { @@ -13,6 +14,7 @@ export const BillListMixin = { /* 单据Excel是否开启 */ isShowExcel: false, waitTotal: 0, + dateFormat: 'YYYY-MM-DD', billExcelUrl: '', supList: [], cusList: [], @@ -23,6 +25,11 @@ export const BillListMixin = { settingDataIndex:[], // 实际列 columns:[], + queryParam: { + beginTime: getPrevMonthFormatDate(3), + endTime: getFormatDate(), + createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())] + } } }, computed: { @@ -105,13 +112,17 @@ export const BillListMixin = { searchReset() { this.queryParam = { type: this.queryParam.type, - subType: this.queryParam.subType + subType: this.queryParam.subType, + beginTime: getPrevMonthFormatDate(3), + endTime: getFormatDate(), + createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())] } this.loadData(1); }, onDateChange: function (value, dateString) { this.queryParam.beginTime=dateString[0]; this.queryParam.endTime=dateString[1]; + this.queryParam.createTimeRange = [moment(dateString[0]), moment(dateString[1])] }, onDateOk(value) { console.log(value); diff --git a/jshERP-web/src/views/financial/mixins/FinancialListMixin.js b/jshERP-web/src/views/financial/mixins/FinancialListMixin.js index b3bbc992..ac21577a 100644 --- a/jshERP-web/src/views/financial/mixins/FinancialListMixin.js +++ b/jshERP-web/src/views/financial/mixins/FinancialListMixin.js @@ -1,7 +1,8 @@ import {findFinancialDetailByNumber, findBySelectSup, findBySelectCus, findBySelectOrgan, findBySelectRetail, getUserList, getPersonByType, getAccount, getCurrentSystemConfig, getPlatformConfigByKey} from '@/api/api' -import { getCheckFlag } from "@/utils/util" +import { getCheckFlag, getFormatDate, getPrevMonthFormatDate } from '@/utils/util' import Vue from 'vue' +import moment from 'moment' export const FinancialListMixin = { data () { @@ -18,7 +19,12 @@ export const FinancialListMixin = { retailList: [], userList: [], personList: [], - accountList: [] + accountList: [], + queryParam: { + beginTime: getPrevMonthFormatDate(3), + endTime: getFormatDate(), + createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())] + } } }, computed: { @@ -83,7 +89,10 @@ export const FinancialListMixin = { }, searchReset() { this.queryParam = { - type: this.queryParam.type + type: this.queryParam.type, + beginTime: getPrevMonthFormatDate(3), + endTime: getFormatDate(), + createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())] } this.loadData(1); }, @@ -161,6 +170,7 @@ export const FinancialListMixin = { onDateChange: function (value, dateString) { this.queryParam.beginTime=dateString[0]; this.queryParam.endTime=dateString[1]; + this.queryParam.createTimeRange = [moment(dateString[0]), moment(dateString[1])] }, onDateOk(value) { console.log(value);