材料站增加默认查询时间

This commit is contained in:
bb_pan 2025-08-15 17:31:51 +08:00
parent 3cc97a37aa
commit 3702be5f60
5 changed files with 70 additions and 3 deletions

View File

@ -296,10 +296,20 @@ export default {
}
},
created() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
this.getList()
this.initSelectData()
},
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) {
if (node.children && !node.children.length) {
@ -372,7 +382,10 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.time = []
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
// this.resetForm("queryForm");
this.queryParams.teamId = ''
this.projectId = null

View File

@ -164,9 +164,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}`
},
//
async getList() {
this.loading = true
@ -237,6 +247,10 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.timeRange = [this.format(start), this.format(end)]
this.resetForm('queryForm')
this.handleQuery()
},

View File

@ -315,9 +315,19 @@ export default {
}
},
created() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [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}`
},
getList() {
this.loading = true
const params = {
@ -346,7 +356,10 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.time = []
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
this.resetForm('queryForm')
this.queryParams.keyWord = ''
this.handleQuery()

View File

@ -165,9 +165,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}`
},
//
async getList() {
this.loading = true
@ -236,6 +246,10 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.timeRange = [this.format(start), this.format(end)]
this.resetForm('queryForm')
this.handleQuery()
},

View File

@ -303,9 +303,19 @@ export default {
}
},
created() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [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}`
},
getList() {
this.loading = true
const params = {
@ -335,7 +345,10 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.time = []
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
this.resetForm('queryForm')
this.queryParams.keyWord = ''
this.handleQuery()