bill недель назад: 3
Родитель
Сommit
5947307101

+ 1 - 0
src/api/scene.ts

@@ -75,6 +75,7 @@ export const fetchScenes = async () => {
 export const fetchScenesAll = async (params: {
   numList?: string[];
   isObj: number;
+  sceneName?: string
   pageNum: number;
   pageSize: number;
 }) => {

+ 18 - 11
src/layout/edit/scene-select.vue

@@ -37,7 +37,7 @@
             />
             <div style="padding: 1px" v-else>
               <Empty
-                :description="$t('sys.unSearchData')"
+                description="暂无搜索结果"
                 :image="Empty.PRESENTED_IMAGE_SIMPLE"
                 className="ant-empty ant-empty-normal"
               />
@@ -118,17 +118,23 @@ const handleTableChange: TableProps["onChange"] = (pag) => {
   params.value.pageSize = pag.pageSize!;
   params.value.pageNum = pag.current!;
 };
-const meshParams = ref({ isObj: 1, pageNum: 1, pageSize: 12, total: 0 })
-const cloudParams = ref({ isObj: 0, pageNum: 1, pageSize: 12, total: 0 })
+const meshParams = ref({ isObj: 1, pageNum: 1, pageSize: 12, total: 0, sceneName: '' })
+const cloudParams = ref({ isObj: 0, pageNum: 1, pageSize: 12, total: 0, sceneName: '' })
 const meshList = ref<Scene[]>([])
 const cloudList = ref<Scene[]>([])
 const params = computed(() => type.value === ui18n.t('scene.typeRaws.0') ? meshParams.value : cloudParams.value)
 
+watch(
+  () => keyword.value,
+  () => (params.value.pageNum = 1),
+  { flush: "sync" }
+);
+
 let loadCount = 0
 watchEffect(() => {
   const list = type.value === ui18n.t('scene.typeRaws.2') ? meshList : cloudList
   const currentCount = ++loadCount
-  fetchScenesAll(params.value).then((data) => {
+  fetchScenesAll({...params.value, sceneName: keyword.value, }).then((data) => {
     console.log('====>', currentCount, loadCount, params.value)
     if (currentCount === loadCount) {
 
@@ -145,7 +151,7 @@ const typeFilterScenes = computed(() => {
   const typeScenes: any = {};
   for (const type of types.value) {
     typeScenes[type] = origin.value
-      .filter((item) => item.name && item.num && item.name.includes(keyword.value))
+      .filter((item) => item.name && item.num )
       .filter((item) => item.type === type);
   }
   return typeScenes;
@@ -214,19 +220,19 @@ const addModelHandler = createLoadPack(async (attachs: any[]) => {
         if (fuseModelsLoaded.value) {
           nextTick(() => {
             stop();
-            resolve();
+            setTimeout(resolve, 500)
           });
         }
       });
     });
   });
 
-  items.forEach(item => {
-    console.error('--->', item, getSceneModel(item.data), sceneModelMap)
-    if (getSceneModel(item.data)) {
-      item.data.rotation = getSceneModel(item.data)!.getDefaultRotation();
-      console.log('rotate', item.data.rotation)
+  addModels.forEach(item => {
+    if (getSceneModel(item)) {
+      item.rotation = getSceneModel(item)!.getDefaultRotation();
+      // getSceneModel(item)!.putInFrontOfCam()
     }
+
   });
   await asyncTimeout(100);
   await save();
@@ -264,6 +270,7 @@ const selectModel = async () => {
   });
   if (!list?.length) return;
   list = list.filter(item => item.uploadId)
+
   // const modelList = await Promise.all(list.map(item => uploadMaterialToModel(item.uploadId!)))
   const attachs: any[] = []
   for (let i = 0; i < list.length; i++) {

+ 0 - 1
src/sdk/association/fuseMode.ts

@@ -306,7 +306,6 @@ export const associationModels = (sdk: SDK) => {
             () => item.rotation,
             () => {
               if (!us.isUnSet) {
-                console.error('rotation', item.raw.modelTitle,  toRaw(item.rotation))
                 getSceneModel(item)?.changeRotation(toRaw(item.rotation));
               }
             }

+ 7 - 1
src/sdk/association/measure.ts

@@ -39,7 +39,13 @@ export const associationMessaure = <T extends MeasureType>(smMeasure: SceneMeasu
   smMeasure.bus.on('update', ([points, modelIds]) => {
     us.unSet(() => measure.positions = points.map((point, i) => ({ point, modelId: modelIds[i] })))
   })
-  smMeasure.bus.on('highlight', selected => us.unSet(() => measure.selected = selected))
+  let timeout: any
+  smMeasure.bus.on('highlight', selected => {
+    clearTimeout(timeout)
+    timeout = setTimeout(() => {
+      us.unSet(() => measure.selected = selected)
+    })
+  })
 }
 
 export const associationMessaures = (sdk: SDK) => {

+ 1 - 0
src/sdk/sdk.ts

@@ -52,6 +52,7 @@ export type SceneModel = ToChangeAPI<SceneModelAttrs> & {
   enterMoveMode: () => void;
   leaveTransform: () => void;
   getDefaultRotation: () => SceneLocalPos;
+  putInFrontOfCam: () => void
   enterAlignment: () => void;
   leaveAlignment: () => void;
   enterScaleSet: () => ScaleSet;

+ 1 - 0
src/utils/unset.ts

@@ -5,6 +5,7 @@ export const unsetFactory = () => {
   let isUnSet = false;
   
   const unSet = (fn: () => void) => {
+    console.error('unset')
     const pop = isStoreUnset.push(true)
     isUnSet = true;
     fn();