feat:增加健康统计图表功能
This commit is contained in:
@@ -3,6 +3,7 @@ import type { IHandleApi } from 'vue3-common/types'
|
||||
import { queryHealthApi, updateHealthApi } from '@/apis/health.ts'
|
||||
import { IHealth, IHealthQuery } from '@/types/health'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getCurrentMonth, formatDate, getStartEndDate } from 'vue3-common/utils/dateUtil'
|
||||
|
||||
export const useHealthStore = defineStore('health', {
|
||||
state: () => ({
|
||||
@@ -11,6 +12,7 @@ export const useHealthStore = defineStore('health', {
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
} as IHealthQuery,
|
||||
queryMonth: getCurrentMonth(),
|
||||
healthApiType: 'ADD' as IHandleApi,
|
||||
currentHealth: {
|
||||
sportProject: '',
|
||||
@@ -20,7 +22,8 @@ export const useHealthStore = defineStore('health', {
|
||||
} as IHealth,
|
||||
selectDate: '',
|
||||
isScrollEnd: false,
|
||||
isRefresh: false
|
||||
isRefresh: false,
|
||||
isLoading: false
|
||||
}),
|
||||
actions: {
|
||||
async queryHealthRecordList() {
|
||||
@@ -41,8 +44,12 @@ export const useHealthStore = defineStore('health', {
|
||||
}
|
||||
},
|
||||
async refreshInfo() {
|
||||
this.isLoading = true
|
||||
const result = getStartEndDate(formatDate(this.queryMonth), 'month')
|
||||
this.queryInfo = { startDate: result[0], endDate: result[1] }
|
||||
await this.queryHealthRecordList()
|
||||
this.isRefresh = !this.isRefresh
|
||||
this.isLoading = false
|
||||
},
|
||||
getEmptyHealth(date: string): IHealth {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user