修改家庭组号
This commit is contained in:
parent
73804519e4
commit
ed421f94fc
@ -11,6 +11,7 @@ export interface DeviceuserVO {
|
||||
updateby: string // 更新人
|
||||
username: string // 用户姓名
|
||||
devicetype: string // 设备类型
|
||||
familyid: string // 家庭组号
|
||||
}
|
||||
|
||||
// 设备人员关联 API
|
||||
|
@ -55,13 +55,14 @@
|
||||
<el-table
|
||||
v-loading="boundLoading"
|
||||
:data="boundList"
|
||||
style="height: 100%"
|
||||
style="height: 400px"
|
||||
max-height="400px"
|
||||
>
|
||||
<el-table-column
|
||||
label="设备名称"
|
||||
align="center"
|
||||
prop="devicename"
|
||||
width="100"
|
||||
width="110"
|
||||
/>
|
||||
<el-table-column
|
||||
label="设备编号"
|
||||
@ -148,7 +149,8 @@
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
style="height: 100%"
|
||||
style="height: 400px"
|
||||
max-height="400px"
|
||||
>
|
||||
<el-table-column
|
||||
label="设备名称"
|
||||
@ -229,6 +231,7 @@ const list = ref<DeviceVO[]>([])
|
||||
const boundList = ref<DeviceVO[]>([])
|
||||
const personId = ref<number>()
|
||||
const personName = ref<string>()
|
||||
const familyId = ref<string>()
|
||||
|
||||
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()
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user