修改绑定设备

This commit is contained in:
Flow 2025-06-16 16:01:02 +08:00
parent 88e89c56f9
commit 73804519e4

View File

@ -82,11 +82,9 @@
min-width="100"
:show-overflow-tooltip="true"
/>
<el-table-column label="设备状态" align="center" prop="devicestatus" width="100">
<el-table-column label="家庭组号" align="center" prop="familyid" width="100">
<template #default="scope">
<el-tag :type="getDeviceStatusType(scope.row.devicestatus)">
{{ getDeviceStatusLabel(scope.row.devicestatus) }}
</el-tag>
{{ scope.row.familyid }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" fixed="right">
@ -177,11 +175,9 @@
min-width="100"
:show-overflow-tooltip="true"
/>
<el-table-column label="设备状态" align="center" prop="devicestatus" width="120">
<el-table-column label="家庭组号" align="center" prop="familyid" width="120">
<template #default="scope">
<el-tag :type="getDeviceStatusType(scope.row.devicestatus)">
{{ getDeviceStatusLabel(scope.row.devicestatus) }}
</el-tag>
{{ scope.row.familyid }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" fixed="right">
@ -220,6 +216,7 @@ import { DICT_TYPE } from '@/utils/dict'
import { ContentWrap } from '@/components/ContentWrap'
import { DeviceuserApi, DeviceuserVO } from '@/api/deviceuser'
import dayjs from 'dayjs'
import { ElMessageBox } from 'element-plus'
defineOptions({ name: 'DeviceBind' })
const userProfile = ref()
@ -236,7 +233,7 @@ const personName = ref<string>()
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
orgid: undefined
orgid: undefined,
})
const queryFormRef = ref()
@ -254,9 +251,16 @@ const getList = async () => {
try {
userProfile.value = await getUserProfile()
queryParams.orgid = userProfile.value.dept.id
console.log(queryParams)
const data = await DeviceApi.getDeviceNotBind(queryParams)
list.value = data.list
const data = await DeviceApi.getDevicePage(queryParams)
//
const devicePromises = data.list.map(async (device) => {
const deviceuserData = await DeviceuserApi.getDeviceuserByDeviceId(device.devicecode)
return {
...device,
familyid: deviceuserData?.[0]?.familyid || ''
}
})
list.value = await Promise.all(devicePromises)
total.value = data.total
} finally {
loading.value = false