From 706edf7dadc7ef0a3296347d1368d18c7148c87f Mon Sep 17 00:00:00 2001 From: hwj Date: Thu, 22 Jan 2026 15:54:24 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E9=87=87=E9=9B=86=E8=AE=BE?= =?UTF-8?q?=E5=A4=87-=E7=82=B9=E4=BD=8D=E8=A7=84=E5=88=99-=E8=A7=84?= =?UTF-8?q?=E5=88=99=E4=B8=8B=E6=8B=89=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/iot/device/index.vue | 50 ++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 544e231f..b6efdf8b 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -222,13 +222,21 @@ link :type="isRowConnected(scope.row) ? 'warning' : 'success'" :formatter="dateFormatter" width="180px" /> - - - + + +
-
+
{ const loadRuleAttributeOptions = async (deviceId: number) => { try { - const res = await DeviceApi.getDeviceAttributePage({ pageNo: 1, pageSize: 1000, deviceId }) - const data = Array.isArray((res as any)?.list) ? (res as any).list : (Array.isArray(res) ? res : []) + const res = await request.get({ url: '/iot/device-contact-model/list', params: { id: deviceId } }) + const data = Array.isArray(res) ? res : (res as any)?.list ?? [] ruleAttributeOptions.value = data as any[] } catch { ruleAttributeOptions.value = [] @@ -638,7 +646,7 @@ watch( return } ruleQueryParams.pageNo = 1 - await Promise.all([getRuleList(), loadRuleAttributeOptions(val)]) + await getRuleList() } ) @@ -704,7 +712,15 @@ const isRunningIdentifier = computed(() => { return (ruleForm.identifier || '').toString().toUpperCase() === 'RUNNING' }) -const openRuleForm = (row: DevicePointRuleVO & { pointRulesVOList?: any[] }) => { +const openRuleForm = async (row: DevicePointRuleVO & { pointRulesVOList?: any[] }) => { + const deviceId = row.deviceId || attributeDeviceId.value + if (!deviceId) { + message.error('设备信息缺失,无法加载点位规则') + return + } + + await loadRuleAttributeOptions(deviceId) + ruleForm.id = row.id ruleForm.identifier = row.identifier ruleForm.fieldName = row.fieldName @@ -785,6 +801,16 @@ const handleRuleSubmit = async () => { } } +const handleRuleDelete = async (id: number) => { + if (!id) return + try { + await message.delConfirm() + await request.delete({ url: '/iot/device-point-rules/delete?id=' + id }) + message.success(t('common.delSuccess')) + await getRuleList() + } catch { } +} + const handleAddPointRule = () => { if (!isRunningIdentifier.value) return const allOptions = currentRuleOptions.value || []