增加时间默认值

This commit is contained in:
bb_pan 2025-07-09 17:06:52 +08:00
parent f6c384e163
commit 2ca86860de
6 changed files with 71 additions and 7 deletions

View File

@ -324,10 +324,19 @@ export default {
}; };
}, },
created() { created() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
this.getList(); this.getList();
}, },
methods: { 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}`
},
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.sendTemp = []; this.sendTemp = [];
@ -370,7 +379,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.time = []; const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.keyWord = ""; this.queryParams.keyWord = "";
this.handleQuery(); this.handleQuery();

View File

@ -476,7 +476,7 @@ export default {
const res = await getProjectInfoApi({ unitId: null, isApp: true }) const res = await getProjectInfoApi({ unitId: null, isApp: true })
console.log('🚀 ~ projectInfoList ~ res:', res) console.log('🚀 ~ projectInfoList ~ res:', res)
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
this.projectIds = res.data.map(item => item.proId) this.projectIds = res.data.map(item => item.projectId)
} else { } else {
this.projectIds = [] this.projectIds = []
} }

View File

@ -311,10 +311,20 @@ export default {
} }
}, },
created() { created() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
this.getList(); this.getList();
this.initSelectData() this.initSelectData()
}, },
methods: { 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}`
},
/** 转换菜单数据结构 */ /** 转换菜单数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
@ -385,7 +395,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.time = [] const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
// this.resetForm("queryForm"); // this.resetForm("queryForm");
this.unitId=null; this.unitId=null;
this.projectId=null; this.projectId=null;

View File

@ -658,9 +658,19 @@ export default {
if (this.$route.query.code) { if (this.$route.query.code) {
this.queryParams.keyWord = this.$route.query.code this.queryParams.keyWord = this.$route.query.code
} }
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
this.getList() this.getList()
}, },
methods: { 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}`
},
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.maCodeList = [] this.maCodeList = []
@ -709,7 +719,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.time = [] const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
// this.resetForm('queryForm') // this.resetForm('queryForm')
this.queryParams.taskStatus = '' this.queryParams.taskStatus = ''
this.queryParams.keyWord = '' this.queryParams.keyWord = ''

View File

@ -361,12 +361,22 @@ export default {
if(this.$route.query.code){ if(this.$route.query.code){
this.queryParams.keyWord=this.$route.query.code this.queryParams.keyWord=this.$route.query.code
} }
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
this.getList(); this.getList();
// this.initSelectData() // this.initSelectData()
// this.InitIGetInfo() // this.InitIGetInfo()
}, },
components: { vueEasyPrint }, components: { vueEasyPrint },
methods: { 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}`
},
// //
InitIGetInfo() { InitIGetInfo() {
getInfo().then((res) => { getInfo().then((res) => {
@ -399,7 +409,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.time = [] const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
// this.resetForm("queryForm"); // this.resetForm("queryForm");
this.$refs.queryForm.resetFields() this.$refs.queryForm.resetFields()
this.handleQuery() this.handleQuery()

View File

@ -316,9 +316,19 @@ export default {
}; };
}, },
created() { created() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
this.getList(); this.getList();
}, },
methods: { 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}`
},
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.passTemp = []; this.passTemp = [];
@ -366,7 +376,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.time = []; const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 2)
this.queryParams.time = [this.format(start), this.format(end)]
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.keyword = ""; this.queryParams.keyword = "";
this.handleQuery(); this.handleQuery();