Skip to content

Commit

Permalink
feat: 优化初始化请求
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoooooo committed Jun 4, 2024
1 parent 018e692 commit 77eb033
Showing 1 changed file with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
</el-popover>
</template>


<script>
import { getSurveyHistory } from '@/management/api/survey'
import moment from 'moment'
Expand Down Expand Up @@ -65,18 +64,17 @@ export default {
}
},
watch: {
surveyId: {
immediate: true,
visible: {
async handler(newVal) {
if (newVal) {
if (this.visible && newVal) {
this.fetchHis()
}
}
},
currentTab: {
immediate: true,
async handler(newVal) {
if (newVal) {
if (this.visible && newVal) {
this.fetchHis()
}
}
Expand All @@ -89,26 +87,32 @@ export default {
fetchHis() {
this.paneLoading = true
switch (this.currentTab) {
case 'daily':
getSurveyHistory({
surveyId: this.surveyId,
historyType: 'dailyHis'
}).then((dailyHis) => {
this.dailyHis = dailyHis.data || []
})
break;
.then((dailyHis) => {
this.dailyHis = dailyHis.data || []
})
.finally(() => {
this.paneLoading = false
})
break
case 'publish':
getSurveyHistory({
surveyId: this.surveyId,
historyType: 'publishHis'
}).then((publishHis) => {
this.publishHis = publishHis.data || []
})
break;
.then((publishHis) => {
this.publishHis = publishHis.data || []
})
.finally(() => {
this.paneLoading = false
})
break
}
this.paneLoading = false
}
}
}
Expand Down

0 comments on commit 77eb033

Please sign in to comment.