Kaynağa Gözat

elective - long time api - lock page

hare8999@163.com 2 yıl önce
ebeveyn
işleme
7ef6963af2

+ 6 - 2
src/views/elective/generation/components/elective-generation-commands.vue

@@ -44,7 +44,7 @@ export default {
   mixins: [transferMixin],
   name: 'elective-generation-commands',
   components: { ElectiveGenerationPushSetting },
-  inject: ['refreshData'],
+  inject: ['refreshData', 'lockPage', 'unlockPage'],
   props: ['chartBinding', 'disabled'],
   computed: {
     generation() {
@@ -138,9 +138,13 @@ export default {
     },
     async terminateAndJumpDispatch() {
       await this.$confirm('确认进入选科分班?该操作将锁定所有选科录取状态,且不可逆')
+      this.lockPage()
       terminateGeneration().then(res => {
         this.jumpDispatch()
-      }).finally(() => this.notifyRootRefresh())
+      }).finally(() => {
+        this.unlockPage()
+        this.notifyRootRefresh()
+      })
     },
     jumpDispatch() {
       const path = '/new-gaokao/selectCourse/elective/dispatch/index'

+ 3 - 1
src/views/elective/generation/index.vue

@@ -95,7 +95,9 @@ export default {
   },
   provide() {
     return {
-      refreshData: this.refreshData
+      refreshData: this.refreshData,
+      lockPage: () => this.loading = true,
+      unlockPage: () => this.loading = false
     }
   },
   mounted() {

+ 5 - 10
src/views/elective/publish/components/round-settings.vue

@@ -22,7 +22,7 @@
     </div>
     <el-drawer v-if="stepsVisible" :visible.sync="stepsVisible" :title="modifyTitle" :append-to-body="true" size="70%">
       <round-setting-steps :settingModel="settingModel" :default-active-step="activeStep" :year-options="yearOptions"
-                           @do-post="handleSubmit"></round-setting-steps>
+                           @do-post="handleSubmit" v-loading="loading"></round-setting-steps>
     </el-drawer>
   </div>
 </template>
@@ -32,14 +32,7 @@ import * as ext from '@/utils'
 import selectTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin'
 import RoundModelConvert from './round-model-convert'
 import MxCondition from '@/components/MxCondition/mx-condition'
-import {
-  addRound,
-  deleteRound,
-  getScoreImportConfig,
-  roundList,
-  saveScoreImportConfig,
-  updateRound
-} from '@/api/webApi/selection'
+import { deleteRound, getScoreImportConfig, roundList, saveScoreImportConfig } from '@/api/webApi/selection'
 import RoundSettingSteps from '@/views/elective/publish/components/steps/round-setting-steps'
 
 export default {
@@ -48,6 +41,7 @@ export default {
   components: { RoundSettingSteps, MxCondition },
   data() {
     return {
+      loading: false,
       // drawer
       stepsVisible: false,
       activeStep: 0,
@@ -162,13 +156,14 @@ export default {
       })
     },
     handleSubmit(commit) {
+      this.loading = true
       const round = this.toApiModel(commit)
       // 提交
       saveScoreImportConfig(round).then(res => {
         this.stepsVisible = false
         this.msgSuccess('保存成功')
         this.handleQuery()
-      })
+      }).finally(() => this.loading = false)
     }
   }
 }