Commit da45106e authored by 罗林杰's avatar 罗林杰

修改点击量时间搜索

parent f726d4cc
...@@ -86,7 +86,7 @@ export function getPeopleNumber(query) { ...@@ -86,7 +86,7 @@ export function getPeopleNumber(query) {
return request({ return request({
url: '/memInfo/getPeopleNumber', url: '/memInfo/getPeopleNumber',
method: 'get', method: 'get',
params: { firstDay: query.firstDay, lastDay: query.lastDay } params: query
}) })
} }
......
...@@ -374,7 +374,15 @@ export default { ...@@ -374,7 +374,15 @@ export default {
getPeopleNumber() { getPeopleNumber() {
// 获取当前日期 // 获取当前日期
const date = new Date() const date = new Date()
// 算出当前日期是的月份 // 格式化日期为 yyyy-mm-dd
function formatDate(d) {
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0') // 月份从0开始,需加1
const day = String(d.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
// 将日期格式化为 yyyy-mm-dd
const nowDayRange = [formatDate(date), formatDate(date)]
const month = date.getMonth() + 1 const month = date.getMonth() + 1
// 根据月份,获取第一天和最后一天日期 // 根据月份,获取第一天和最后一天日期
const firstDay = new Date(date.getFullYear(), month - 1, 1) const firstDay = new Date(date.getFullYear(), month - 1, 1)
...@@ -382,7 +390,8 @@ export default { ...@@ -382,7 +390,8 @@ export default {
const queryParams = { const queryParams = {
firstDay: firstDay, firstDay: firstDay,
lastDay: lastDay, lastDay: lastDay,
nowDay: date beginTime: nowDayRange[0],
endTime: nowDayRange[1]
} }
getPeopleNumber(queryParams).then(res => { getPeopleNumber(queryParams).then(res => {
this.peopleNumber = res.data this.peopleNumber = res.data
...@@ -581,8 +590,8 @@ export default { ...@@ -581,8 +590,8 @@ export default {
getVisitorData() { getVisitorData() {
// 假设 this.visitCount 是一个包含多个 {title, applicationCount} 对象的数组 // 假设 this.visitCount 是一个包含多个 {title, applicationCount} 对象的数组
const visitCount = this.visitCount.map(item => ({ const visitCount = this.visitCount.map(item => ({
name: item.title, name: item.nickName,
value: item.applicationCount value: item.memTraffic
})) }))
// 初始化图表 // 初始化图表
......
...@@ -154,8 +154,6 @@ export default { ...@@ -154,8 +154,6 @@ export default {
}, },
getNowDayRange() { getNowDayRange() {
const date = new Date() const date = new Date()
// 克隆一个新的日期对象以避免修改原始日期
const lastDate = new Date(date.getTime() - 3600 * 1000 * 24)
// 格式化日期为 yyyy-mm-dd // 格式化日期为 yyyy-mm-dd
function formatDate(d) { function formatDate(d) {
const year = d.getFullYear() const year = d.getFullYear()
...@@ -164,9 +162,8 @@ export default { ...@@ -164,9 +162,8 @@ export default {
return `${year}-${month}-${day}` return `${year}-${month}-${day}`
} }
// 将日期格式化为 yyyy-mm-dd // 将日期格式化为 yyyy-mm-dd
this.nowDayRange = [formatDate(lastDate), formatDate(date)] this.nowDayRange = [formatDate(date), formatDate(date)]
this.dateRange = this.nowDayRange this.dateRange = this.nowDayRange
console.log('11111111111', this.nowDayRange)
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment