zhengnaiwen_citu 2 mesiacov pred
rodič
commit
61b285b320

+ 72 - 8
src/views/modelSystem/modelTrain/modelTrainStatus.vue

@@ -17,7 +17,7 @@
             v-for="(status, index) in statusItems"
           >
             <v-stepper-step
-              :key="status.key"
+              :key="status.key + index"
               :step="index + 1"
               :complete="status.value === 'completed'"
               :rules="[() => status.value !== 'failed']"
@@ -33,7 +33,7 @@
                 </v-btn>
               </div>
               <div class="text-center mt-3">
-                <v-btn :loading="status.loading" @click="handleRun(status, true)">
+                <v-btn :loading="status.loading" @click="handleTest(status)">
                   <v-icon left>mdi-play</v-icon>
                   测试执行
                 </v-btn>
@@ -45,19 +45,25 @@
         </v-stepper-header>
       </v-stepper>
     </div>
+    <m-dialog title="确认执行" :visible.sync="showConfirm" :widthType="2" @submit="handleSubmit">
+      <MForm :items="formItems" v-model="formValues" v-loading="loadingTest"></MForm>
+    </m-dialog>
   </m-dialog>
 </template>
 
 <script>
 import MDialog from '@/components/Dialog'
+import MForm from '@/components/MForm'
 import { getDataTasksStatus, executeDataTasks } from '@/api/dataChart'
 export default {
   name: 'modelTrainStatus',
   components: {
-    MDialog
+    MDialog,
+    MForm
   },
   data () {
     return {
+      showConfirm: false,
       statusList: {
         preparing: 'primary',
         completed: 'success',
@@ -67,7 +73,46 @@ export default {
       show: false,
       loading: false,
       statusItems: [],
-      id: null
+      id: null,
+      loadingTest: false,
+      formItems: [
+        {
+          label: '备份vector表数据到CSV文件',
+          type: 'ifRadio',
+          key: 'backup_vector_tables',
+          width: 180,
+          items: [
+            { label: '是', value: true },
+            { label: '否', value: false }
+          ]
+        },
+        {
+          label: '清空vector表数据',
+          type: 'ifRadio',
+          key: 'truncate_vector_tables',
+          width: 180,
+          items: [
+            { label: '是', value: true },
+            { label: '否', value: false }
+          ]
+        },
+        {
+          label: '跳过训练文件处理',
+          type: 'ifRadio',
+          key: 'skip_training',
+          width: 180,
+          items: [
+            { label: '是', value: true },
+            { label: '否', value: false }
+          ]
+        }
+      ],
+      formValues: {
+        backup_vector_tables: false,
+        truncate_vector_tables: false,
+        skip_training: false
+      },
+      itemData: null
     }
   },
   methods: {
@@ -93,18 +138,37 @@ export default {
         this.loading = false
       }
     },
-    async handleRun (item, test = false) {
+    handleTest (item) {
+      this.itemData = item
+      this.formValues = {
+        backup_vector_tables: false,
+        truncate_vector_tables: false,
+        skip_training: false
+      }
+      this.showConfirm = true
+    },
+    async handleSubmit () {
+      this.loadingTest = true
+      const check = await this.handleRun(this.itemData, this.formValues)
+      this.loadingTest = false
+      if (check) {
+        this.showConfirm = false
+      }
+    },
+    async handleRun (item, data = {
+      backup_vector_tables: false,
+      truncate_vector_tables: false
+    }) {
       item.loading = true
       try {
         await executeDataTasks(this.id, {
           execution_mode: 'step',
           step_name: item.key,
-          backup_vector_tables: true,
-          truncate_vector_tables: true,
-          skip_training: test
+          ...data
         })
         this.$snackbar.success('任务已启动')
         this.getStatus()
+        return true
       } catch (error) {
         this.$snackbar.error(error)
       } finally {