Эх сурвалжийг харах

feat: 解决添加模型后,首页没有更新数据问题

WANGKANG 8 сар өмнө
parent
commit
dcb819be59

+ 12 - 4
src/views/demo/toInfrared/index.vue

@@ -128,7 +128,7 @@
 </template>
 
 <script setup lang="tsx" name="ToInfrared">
-import { ref, reactive, onMounted, Ref } from 'vue'
+import { ref, reactive, onMounted, Ref, nextTick } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
 import { ElMessage, ElMessageBox } from 'element-plus'
@@ -242,7 +242,10 @@ const addToInfraredModel = async (modelPath: string) => {
     itemsOptions: itemsOptions,
     model: res.data,
     api: addAlgorithmModelTrackApi,
-    getTableList: proTable.value?.getTableList
+    getTableList: proTable.value?.getTableList,
+    closedEvent: async () => {
+      await updateWnumsAlgorithmModelTrack()
+    }
   }
   formDialogRef.value?.openDialog(params)
 }
@@ -410,7 +413,8 @@ const openDialog = async (type: number, title: string, row?: any) => {
     itemsOptions: itemsOptions,
     model: type == 1 ? {} : res.data,
     api: type == 1 ? addToInfraredApi : updateToInfraredApi,
-    getTableList: proTable.value?.getTableList
+    getTableList: proTable.value?.getTableList,
+    closedEvent: () => {}
   }
   formDialogRef.value?.openDialog(params)
 }
@@ -578,7 +582,7 @@ onMounted(async () => {
 
 const enumsAlgorithmModelTrack = ref<any>([])
 
-onMounted(async () => {
+const updateWnumsAlgorithmModelTrack = async () => {
   const result: any = await enumAlgorithmModelTrackApi()
   // console.log(result.data);
   enumsAlgorithmModelTrack.value = []
@@ -588,6 +592,10 @@ onMounted(async () => {
       enumsAlgorithmModelTrack.value.push(item)
     }
   }
+}
+
+onMounted(async () => {
+  updateWnumsAlgorithmModelTrack()
 })
 
 const setItemsOptions2 = () => {