|
@@ -96,8 +96,9 @@ export default defineComponent({
|
|
|
state.showWeekly = true
|
|
|
}
|
|
|
}
|
|
|
- const initDaily = async () => {
|
|
|
- await that.$api.getDailyReportList({
|
|
|
+ const initDaily = () => {
|
|
|
+ state.loading = true
|
|
|
+ that.$api.getDailyReportList({
|
|
|
pageNum: 1,
|
|
|
pageSize: 11,
|
|
|
}).then((res: any) => {
|
|
@@ -106,11 +107,14 @@ export default defineComponent({
|
|
|
} else {
|
|
|
ElMessage.error(res.message)
|
|
|
}
|
|
|
+ state.loading = false
|
|
|
}).catch(() => {
|
|
|
+ state.loading = false
|
|
|
})
|
|
|
}
|
|
|
- const initWeekly = async () => {
|
|
|
- await that.$api.getWeekReportList({
|
|
|
+ const initWeekly = () => {
|
|
|
+ state.loading = true
|
|
|
+ that.$api.getWeekReportList({
|
|
|
pageNum: 1,
|
|
|
pageSize: 11,
|
|
|
}).then((res: any) => {
|
|
@@ -119,17 +123,26 @@ export default defineComponent({
|
|
|
} else {
|
|
|
ElMessage.error(res.message)
|
|
|
}
|
|
|
+ state.loading = false
|
|
|
}).catch(() => {
|
|
|
+ state.loading = false
|
|
|
})
|
|
|
}
|
|
|
+ watch(() => state.sourceType, (n) => {
|
|
|
+ if (n === '1') {
|
|
|
+ initDaily()
|
|
|
+ } else {
|
|
|
+ initWeekly()
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ immediate: true
|
|
|
+ })
|
|
|
onActivated(() => {
|
|
|
- state.loading = true
|
|
|
- Promise.all([
|
|
|
- initDaily(),
|
|
|
+ if (state.sourceType === '1') {
|
|
|
+ initDaily()
|
|
|
+ } else {
|
|
|
initWeekly()
|
|
|
- ]).then(() => {
|
|
|
- state.loading = false
|
|
|
- })
|
|
|
+ }
|
|
|
})
|
|
|
return {
|
|
|
...toRefs(state),
|