Browse Source

[Fix 0000]皮带巷三级防灭火系统组件bug修复

bobo04052021@163.com 2 weeks ago
parent
commit
2a0bc3f33b

+ 3 - 5
src/views/vent/home/configurable/belt/belt-new.vue

@@ -231,9 +231,9 @@ function getLevelClass(level: string) {
   }
 }
 // 刷新数据
-async function refresh() {
-  await nextTick();
-  fetchConfigs('').then(() => {
+function refresh() {
+  fetchConfigs('sys_Leather').then(() => {
+    console.log(pageType.value, '========');
     if (pageType.value == 'fire_risk_warn') {
       configs.value = testBeltNew;
       const params = {
@@ -275,7 +275,6 @@ async function refresh() {
     } else {
       configs.value = testBeltNew;
     }
-    updateEnhancedConfigs(configs.value);
   });
 }
 
@@ -289,7 +288,6 @@ function initInterval() {
 async function changePage(pageTypeStr: string) {
   const finalPageType = pageTypeStr || (route.query.pageType as string) || '';
   pageType.value = finalPageType;
-  console.log(pageType.value, '-------');
   await refresh();
 }
 

+ 3 - 9
src/views/vent/home/configurable/belt/components/ModuleCommon.vue

@@ -11,20 +11,14 @@
       <template #container>
         <slot>
           <Header :deviceType="deviceType" :moduleData="moduleData" :data="data" @select="handleSelect" />
-          <Content
+          <!-- <Content
             v-if="pageType == 'belt'"
             :style="{ height: header.show ? 'calc(100% - 30px)' : '100%' }"
             :moduleData="moduleData"
             :data="selectedDevice"
             :chartData="chartData"
-          />
-          <Content
-            v-else
-            :style="{ height: header.show ? 'calc(100% - 30px)' : '100%' }"
-            :moduleData="moduleData"
-            :data="data"
-            :chartData="chartData"
-          />
+          /> -->
+          <Content :style="{ height: header.show ? 'calc(100% - 30px)' : '100%' }" :moduleData="moduleData" :data="data" :chartData="chartData" />
         </slot>
       </template>
     </ventBox1>

+ 10 - 8
src/views/vent/home/configurable/components/belt/CameraList.vue

@@ -24,8 +24,8 @@ const renderPlayer = ref(true);
 
 // 提取所有摄像头
 const allCameras = () => {
-  const list = [];
-  props.data.forEach((device) => {
+  const list: any[] = [];
+  props.data.forEach((device: any) => {
     if (device.cameras && device.cameras.length > 0) {
       device.cameras.forEach((item) => {
         list.push({
@@ -38,7 +38,7 @@ const allCameras = () => {
   return list;
 };
 const loadCameras = async () => {
-  await nextTick();
+  // await nextTick();
   const cameras = allCameras();
   if (cameras.length === 0) return;
   removeCamera(playerRef);
@@ -46,13 +46,15 @@ const loadCameras = async () => {
 };
 watch(
   () => props.data,
-  () => {
-    loadCameras();
+  (newVal, oldVal) => {
+    if (newVal && newVal !== oldVal) {
+      loadCameras();
+    }
   },
-  { deep: true, immediate: true }
+  { deep: true }
 );
-onMounted(() => {
-  loadCameras();
+onMounted(async () => {
+  await loadCameras();
 });
 
 // 销毁

+ 3 - 3
src/views/vent/home/configurable/components/belt/VehicleCOAnalysis.vue

@@ -96,7 +96,7 @@ const props = withDefaults(
     }),
   }
 );
-const statusValue = ref(0);
+const statusValue = ref('');
 const visible = ref(false);
 const scroll = reactive({
   y: 400,
@@ -110,7 +110,7 @@ const filteredList = (type: string) => {
 //滑块滑动
 const isOn = ref(false);
 const toggleSwitch = async () => {
-  const newStatus = statusValue.value === 1 ? 0 : 1;
+  const newStatus = statusValue.value === '1' ? '0' : '1';
   try {
     // 请求后端修改状态
     const params = { status: newStatus };
@@ -139,7 +139,7 @@ const getStatusData = async () => {
   try {
     const res = await getStatus();
     statusValue.value = res;
-    isOn.value = statusValue.value === 1 ? true : false;
+    isOn.value = statusValue.value === '1' ? true : false;
   } catch (err) {
     console.error(err);
   }