设备上下线通知
This commit is contained in:
parent
ffc2d6a346
commit
569f75e96d
@ -1378,9 +1378,37 @@ const openBindModal = async (
|
||||
bindModalApi.open();
|
||||
await nextTick();
|
||||
|
||||
// 根据已选设备的当前绑定状态,预填表单
|
||||
// 单选设备时,直接使用该设备当前的绑定配置
|
||||
let isNeedConfigDevicMdoel = false;
|
||||
let deviceThingModelDataId: string | undefined;
|
||||
|
||||
if (selectedRows.length === 1) {
|
||||
const row = selectedRows[0] || {};
|
||||
isNeedConfigDevicMdoel = !!row.isNeedConfigDevicMdoel;
|
||||
if (row.deviceThingModelDataId) {
|
||||
deviceThingModelDataId = String(row.deviceThingModelDataId);
|
||||
}
|
||||
} else {
|
||||
// 多选时:如果所有设备都已开启配置并且绑定的是同一个物模型,则进行统一预填
|
||||
const allNeedConfig = selectedRows.every(
|
||||
(row) => !!row.isNeedConfigDevicMdoel,
|
||||
);
|
||||
const firstModelId = selectedRows[0]?.deviceThingModelDataId;
|
||||
const allSameModel =
|
||||
allNeedConfig &&
|
||||
!!firstModelId &&
|
||||
selectedRows.every(
|
||||
(row) => row.deviceThingModelDataId === firstModelId,
|
||||
);
|
||||
|
||||
isNeedConfigDevicMdoel = allNeedConfig;
|
||||
deviceThingModelDataId = allSameModel ? String(firstModelId) : undefined;
|
||||
}
|
||||
|
||||
await bindFormApi.setValues({
|
||||
isNeedConfigDevicMdoel: false,
|
||||
deviceThingModelDataId: undefined,
|
||||
isNeedConfigDevicMdoel,
|
||||
deviceThingModelDataId,
|
||||
_ioTPlatformProductId: productId ? String(productId) : undefined,
|
||||
});
|
||||
|
||||
@ -2047,8 +2075,22 @@ const toolbarActions = computed(() => [
|
||||
已选择 {{ bindRows.length }} 个设备:
|
||||
</div>
|
||||
<div class="max-h-32 overflow-y-auto text-xs text-blue-600">
|
||||
<div v-for="(row, index) in bindRows" :key="row.id || index" class="mb-1">
|
||||
{{ index + 1 }}. {{ row.deviceName || row.deviceAddress || row.id }}
|
||||
<div
|
||||
v-for="(row, index) in bindRows"
|
||||
:key="row.id || index"
|
||||
class="mb-1"
|
||||
>
|
||||
<div>
|
||||
{{ index + 1 }}.
|
||||
{{ row.deviceName || row.deviceAddress || row.id }}
|
||||
</div>
|
||||
<div class="ml-4 text-[11px] text-blue-700">
|
||||
当前是否需要配置设备模型:
|
||||
{{ row.isNeedConfigDevicMdoel ? '是' : '否' }}
|
||||
<span class="mx-1">|</span>
|
||||
当前已绑定设备端物模型:
|
||||
{{ row.deviceThingModelName || '未绑定' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user