From ed421f94fc1e5d3604cfc46ed32f4ddd5afbce14 Mon Sep 17 00:00:00 2001 From: Flow <958079825@qq.com> Date: Mon, 16 Jun 2025 16:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=B6=E5=BA=AD=E7=BB=84?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/deviceuser/index.ts | 1 + src/views/person/devicebind.vue | 18 ++++++++++++------ src/views/person/index.vue | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/api/deviceuser/index.ts b/src/api/deviceuser/index.ts index 64c9faa5f..abf3d0f3b 100644 --- a/src/api/deviceuser/index.ts +++ b/src/api/deviceuser/index.ts @@ -11,6 +11,7 @@ export interface DeviceuserVO { updateby: string // 更新人 username: string // 用户姓名 devicetype: string // 设备类型 + familyid: string // 家庭组号 } // 设备人员关联 API diff --git a/src/views/person/devicebind.vue b/src/views/person/devicebind.vue index 0de490e81..1619f1653 100644 --- a/src/views/person/devicebind.vue +++ b/src/views/person/devicebind.vue @@ -55,13 +55,14 @@ ([]) const boundList = ref([]) const personId = ref() const personName = ref() +const familyId = ref() const queryParams = reactive({ pageNo: 1, @@ -278,7 +281,8 @@ const getBoundList = async () => { const deviceInfo = await DeviceApi.getDeviceId(item.deviceid) return { ...deviceInfo, - devicecode: item.deviceid // 确保devicecode字段存在 + devicecode: item.deviceid, // 确保devicecode字段存在 + familyid: item.familyid // 添加familyid字段 } }) boundList.value = await Promise.all(devicePromises) @@ -345,7 +349,7 @@ const handleBind = async (row: DeviceVO) => { return } // 检查是否已经绑定 - const bindData = await DeviceuserApi.getDeviceuserByDeviceId(row.id) + const bindData = await DeviceuserApi.getDeviceuserByDeviceId(row.devicecode) if (bindData && bindData.some((item: DeviceuserVO) => item.userid === personId.value)) { message.error('该设备已经绑定过此用户') return @@ -358,6 +362,7 @@ const handleBind = async (row: DeviceVO) => { devicetype: row.devicetype, userid: personId.value, username: personName.value || '', + familyid: familyId.value || '', createtime: datetime, updatetime: datetime, createby: userProfile.value.nickname, @@ -398,9 +403,10 @@ const handleUnbind = async (row: DeviceVO) => { } /** 打开弹窗 */ -const open = (id: number, name: string) => { +const open = (id: number, name: string, familyid: string) => { personId.value = id personName.value = name + familyId.value = familyid dialogVisible.value = true getList() getBoundList() diff --git a/src/views/person/index.vue b/src/views/person/index.vue index a8e69c85c..922541725 100644 --- a/src/views/person/index.vue +++ b/src/views/person/index.vue @@ -224,7 +224,8 @@ const memberRef = ref() const deviceBindRef = ref() const openForm = (type: string, id?: number, name?: string) => { if (type === 'bind') { - deviceBindRef.value?.open(id, name) + const row = list.value.find(item => item.id === id) + deviceBindRef.value?.open(id, name, row?.familyid) } else { formRef.value?.open(type, id,userProfile.value) }