安全王 单灯控
发送
开始时间:
发送
取消 确定
Security_King: [], Single_lightcontrol: [], tableData: [ { segment: '第一段', time: '', brightness: '' }, { segment: '第二段', time: '', brightness: '' }, { segment: '第三段', time: '', brightness: '' }, { segment: '第四段', time: '', brightness: '' } ], startTime: '', paramUploadInterval: '', groundResistanceTestInterval: '', dialogVisible: false, // 控制对话框显示的变量 activeMenu: '1', // 默认选中的菜单项 getGroupdeviceList(groupId) { this.dialogVisible = true; // 打开对话框 const GroupListqueryParams = { pageNum: 1, pageSize: 12, showChild: true, groupId: groupId, }; listDeviceShort(GroupListqueryParams).then((response) => { this.deviceList = response.rows; this.total = response.total; // 按 productId 分成两个数组 const product138Devices = this.deviceList.filter(device => device.productId === 138); const otherDevices = this.deviceList.filter(device => device.productId !== 138); // this.mqttSubscribe(product138Devices); // this.mqttSubscribe(otherDevices); this.Security_King = product138Devices; this.Single_lightcontrol = otherDevices; console.log("Product ID 138 Devices:", JSON.stringify(product138Devices)); console.log("Other Devices:", JSON.stringify(otherDevices)); }); }, DivideDevices(deviceList) { const product138Devices = deviceList.filter(device => device.productId === 138); const otherDevices = deviceList.filter(device => device.productId !== 138); return { product138Devices, otherDevices }; }, submitFormreglin(devicelist) { console.log('提交的数据:', { paramUploadInterval: this.paramUploadInterval, groundResistanceTestInterval: this.groundResistanceTestInterval, }); let message = JSON.stringify({ paramUploadInterval: this.paramUploadInterval, groundResistanceTestInterval: this.groundResistanceTestInterval, }); this.mqttSubscribe(devicelist, message); }, submitlightcontrol(devicelist) { console.log('提交的数据:', { paramUploadInterval: this.paramUploadInterval, groundResistanceTestInterval: this.groundResistanceTestInterval, }); let message = JSON.stringify({ paramUploadInterval: this.paramUploadInterval, groundResistanceTestInterval: this.groundResistanceTestInterval, }); this.mqttSubscribe(devicelist, message); }, openDialog() { console.log('打开对话框'); }, handleConfirm() { // 处理确认按钮点击事件 this.dialogVisible = false; // 在这里可以执行删除逻辑或者其他操作 }, handleMenuSelect(index) { this.activeMenu = index; // 切换菜单项 console.log('选择的菜单项:', index); }, AreamqttSubscribe(list, message) { // 订阅当前页面设备的服务主题 let topics = []; for (let i = 0; i < list.length; i++) { let topicService = '/' + list[i].productId + '/' + list[i].serialNumber + '/property/post'; topics.push(topicService); // 订阅主题 this.$mqttTool.subscribe([topicService]); // 下发消息 // let message = JSON.stringify({ data: "Your initial data" }); // 自定义消息内容 this.$mqttTool.publish(topicService, message, list[i].serialNumber) .then((res) => { console.log(res); }) .catch((err) => { console.log(err); }); } console.log("Subscribe Topics:", JSON.stringify(topics)); },