材料站增加默认查询时间

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() { 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.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) {
@ -372,7 +382,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { 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.resetForm("queryForm");
this.queryParams.teamId = '' this.queryParams.teamId = ''
this.projectId = null this.projectId = null

View File

@ -164,9 +164,19 @@ export default {
} }
}, },
created() { 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() 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}`
},
// //
async getList() { async getList() {
this.loading = true this.loading = true
@ -237,6 +247,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { 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.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },

View File

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

View File

@ -165,9 +165,19 @@ export default {
} }
}, },
created() { 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() 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}`
},
// //
async getList() { async getList() {
this.loading = true this.loading = true
@ -236,6 +246,10 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { 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.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },

View File

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