给单据列表中的时间段增加默认值,默认3个月

This commit is contained in:
jishenghua
2024-04-25 21:30:55 +08:00
parent 7cbf15174a
commit 1a53fe1117
3 changed files with 44 additions and 5 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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);