| 
					
				 | 
			
			
				@@ -80,7 +80,7 @@ export function useInitDevices(devicekind: string, config: Config['moduleData']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // 获取设备数据,赋值并以选项格式返回给 Header 消费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  function fetchDevices() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  function fetchDevices({ init = false } = {}) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const { value } = header.selector; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const promise = mock ? Promise.resolve(mock) : getHomeData({}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return promise.then((result) => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -99,7 +99,44 @@ export function useInitDevices(devicekind: string, config: Config['moduleData']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value: e.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        selectedDeviceID.value = options.value[0]?.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (init) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          selectedDeviceID.value = options.value[0]?.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 没有的话按默认的,将返回结果直接作为一整个设备信息供模块使用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const record = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ...result, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          id: '00000000', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        devices.value = [record]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        selectedDeviceID.value = record.id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // 保德专用-获取设备数据,赋值并以选项格式返回给 Header 消费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  function fetchDevicesBD({ init = false } = {}) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const { value } = header.selector; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const promise = mock ? Promise.resolve(mock) : getHomeData({}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return promise.then((result) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (header.show && header.showSelector && result[devicekind]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 如果配置里指明需要 header,检验后初始化设备信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const records: Record<string, any>[] = result[devicekind]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        devices.value = records.map((e, i) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            id: i, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ...e, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        options.value = devices.value.map((e) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            label: getFormattedText(e, value), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            value: e.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (init) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          selectedDeviceID.value = options.value[0]?.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 没有的话按默认的,将返回结果直接作为一整个设备信息供模块使用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const record = { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -114,6 +151,7 @@ export function useInitDevices(devicekind: string, config: Config['moduleData']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     fetchDevices, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fetchDevicesBD, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     selectedDevice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     selectedDeviceID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     selectedDeviceSlot, 
			 |