浏览代码

[Fix 0000] 部分支持svg模型的设备修复了初始化部分出错的问题

houzekong 3 天之前
父节点
当前提交
0da2ac9b82

+ 3 - 0
src/views/vent/monitorManager/fanLocalMonitor/fanLocal.threejs.ts

@@ -198,15 +198,18 @@ export const destroy = () => {
 
 // 为了兼容性而添加的方法导出
 export function addText(d, e) {
+  if (!model) return;
   if (modelContextList[0]) modelContextList[0].context?.addText(d);
   if (modelContextList[1]) modelContextList[1].context?.addText(e);
   if (modelContextList[2]) modelContextList[2].context?.addText(d);
 }
 export function addCssText() {
+  if (!model) return;
   if (modelContextList[0] && modelContextList[0].context && modelContextList[0].context['addCssText']) modelContextList[0].context['addCssText']();
   if (modelContextList[2] && modelContextList[2].context && modelContextList[2].context['addCssText']) modelContextList[2].context['addCssText']();
 }
 export function playSmoke(d) {
+  if (!model) return;
   for (let i = 0; i < modelContextList.length; i++) {
     const item = modelContextList[i];
     if (item.context && item.context.playSmoke) item.context.playSmoke(d);

+ 11 - 7
src/views/vent/monitorManager/mainFanMonitor/index.vue

@@ -1635,15 +1635,19 @@
   onMounted(async () => {
     const { query } = unref(currentRoute);
     if (query['deviceType']) deviceType.value = query['deviceType'] as string;
-    loading.value = true;
     modelList.value = await getDictItems('mainFanModel');
-    mountedThree(player1.value).then(async () => {
-      // await setModelType('mainWindRect');
+    if (globalConfig.is2DModel) {
       getMonitor(true);
-      addText();
-      // addText();
-      // play('initiatePlay', 'front', frequencyVal.value, 'open', 'tubPositivePath');
-    });
+    } else {
+      loading.value = true;
+      mountedThree(player1.value).then(async () => {
+        // await setModelType('mainWindRect');
+        getMonitor(true);
+        addText();
+        // addText();
+        // play('initiatePlay', 'front', frequencyVal.value, 'open', 'tubPositivePath');
+      });
+    }
   });
 
   onUnmounted(() => {

+ 8 - 4
src/views/vent/monitorManager/windrectMonitor/index.vue

@@ -899,11 +899,15 @@
     // });
     const { query } = unref(currentRoute);
     if (query['deviceType']) deviceType.value = query['deviceType'] as string;
-    loading.value = true;
-    mountedThree(null).then(async () => {
+    if (globalConfig.is2DModel) {
       await getMonitor(true);
-      loading.value = false;
-    });
+    } else {
+      loading.value = true;
+      mountedThree(null).then(async () => {
+        await getMonitor(true);
+        loading.value = false;
+      });
+    }
   });
 
   onUnmounted(() => {