Compare commits

..

4 Commits

Author SHA1 Message Date
ChenYi
0ffc2a3098 重构设备管理新增逻辑 2025-12-23 10:45:49 +08:00
ChenYi
eb12d8f38a 接口配置更新 2025-12-23 10:18:55 +08:00
ChenYi
0b96ff4ff7 批量绑定设备端物模型 2025-12-23 09:45:09 +08:00
ChenYi
33dd206da0 绑定设备端物模型 2025-12-23 09:00:53 +08:00
7 changed files with 867 additions and 800 deletions

View File

@ -467,11 +467,15 @@ export const BatchCreateDeviceAggregationInputSchema = {
export const BindingDeviceThingModelInputSchema = {
type: 'object',
properties: {
devieDataId: {
devieDataIdList: {
type: 'array',
items: {
type: 'string',
description: '设备数据Id',
format: 'uuid'
},
description: '设备数据Id集合',
nullable: true
},
isNeedConfigDevicMdoel: {
type: 'boolean',
description: '是否需要配置设备模型默认false'
@ -2140,6 +2144,11 @@ export const DeviceManagementInfoDtoSchema = {
description: '设备物模型数据Id',
format: 'uuid',
nullable: true
},
deviceThingModelName: {
type: 'string',
description: '设备物模型名称',
nullable: true
}
},
additionalProperties: false
@ -5213,12 +5222,50 @@ export const IoTDBDynamicObjectPagedResultDtoSchema = {
additionalProperties: false
} as const;
export const IoTPlatformAccountInfoInputSchema = {
required: ['ioTPlatformType'],
type: 'object',
properties: {
ioTPlatformType: {
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
}
},
additionalProperties: false,
description: '平台账号信息输入'
} as const;
export const IoTPlatformAccountInfoOutputSchema = {
type: 'object',
properties: {
ioTPlatformType: {
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
},
ioTPlatformAccount: {
type: 'string',
description: '平台账号',
nullable: true
},
ioTPlatformPhoneNumber: {
type: 'string',
description: '平台账号手机号',
nullable: true
}
},
additionalProperties: false,
description: '平台账号信息'
} as const;
export const IoTPlatformProductInfoInputSchema = {
required: ['ioTPlatformType'],
type: 'object',
properties: {
ioTPlatformType: {
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
},
ioTPlatformAccount: {
type: 'string',
description: '平台账号',
nullable: true
}
},
additionalProperties: false,
@ -6881,6 +6928,11 @@ export const PageDeviceInputSchema = {
description: '物联网平台中对应的设备Id或者名称',
nullable: true
},
ioTPlatformProductId: {
type: 'string',
description: '物联网平台中对应的产品Id',
nullable: true
},
searchKeyword: {
type: 'string',
description: '搜索关键字',

File diff suppressed because one or more lines are too long

View File

@ -177,9 +177,9 @@ export type BatchCreateDeviceAggregationInput = {
*/
export type BindingDeviceThingModelInput = {
/**
* Id
* Id集合
*/
devieDataId?: string;
devieDataIdList?: Array<(string)> | null;
/**
* false
*/
@ -1183,6 +1183,10 @@ export type DeviceManagementInfoDto = {
* Id
*/
deviceThingModelDataId?: (string) | null;
/**
*
*/
deviceThingModelName?: (string) | null;
};
export type DeviceManagementInfoDtoPagedResultDto = {
@ -2596,11 +2600,37 @@ export type IoTDBDynamicObjectPagedResultDto = {
totalCount?: number;
};
/**
*
*/
export type IoTPlatformAccountInfoInput = {
ioTPlatformType: IoTPlatformTypeEnum;
};
/**
*
*/
export type IoTPlatformAccountInfoOutput = {
ioTPlatformType?: IoTPlatformTypeEnum;
/**
*
*/
ioTPlatformAccount?: (string) | null;
/**
*
*/
ioTPlatformPhoneNumber?: (string) | null;
};
/**
*
*/
export type IoTPlatformProductInfoInput = {
ioTPlatformType: IoTPlatformTypeEnum;
/**
*
*/
ioTPlatformAccount?: (string) | null;
};
/**
@ -3648,6 +3678,10 @@ export type PageDeviceInput = {
* Id或者名称
*/
ioTPlatformDeviceOpenInfo?: (string) | null;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
*
*/
@ -6301,6 +6335,16 @@ export type PostAggregationIoTplatformGetIoTplatformProductInfoAsyncResponse = (
export type PostAggregationIoTplatformGetIoTplatformProductInfoAsyncError = unknown;
export type PostAggregationIoTplatformGetIoTplatformAccountInfoAsyncData = {
query?: {
input?: IoTPlatformAccountInfoInput;
};
};
export type PostAggregationIoTplatformGetIoTplatformAccountInfoAsyncResponse = (Array<IoTPlatformAccountInfoOutput>);
export type PostAggregationIoTplatformGetIoTplatformAccountInfoAsyncError = unknown;
export type PostAggregationIoTplatformGetIoTplatformProductPropertyInfoAsyncData = {
query?: {
input?: IoTPlatformProductPropertyInfoInput;

View File

@ -216,7 +216,9 @@
"LastOnlineTime": "LastOnlineTime",
"LastOfflineTime": "LastOfflineTime",
"deviceInfoManage": "DeviceInfoManage",
"thingModelInfoManage": "ThingModelInfoManage"
"thingModelInfoManage": "ThingModelInfoManage",
"isNeedConfigDevicMdoel": "IsNeedConfigDevicMdoel",
"deviceThingModelName": "ThingModelInfoManage"
},
"thingModelInfos": {
"FiledType": "FiledType",

View File

@ -209,7 +209,9 @@
"LastOnlineTime": "最后在线时间",
"LastOfflineTime": "最后离线时间",
"deviceInfoManage": "设备管理",
"thingModelInfoManage": "物模型管理"
"thingModelInfoManage": "物模型管理",
"isNeedConfigDevicMdoel": "是否绑定设备模型",
"deviceThingModelName": "设备物模型名称"
},
"thingModelInfos": {
"FiledType": "物模型类型",

View File

@ -52,6 +52,23 @@ const router = useRouter();
const route = useRoute();
const formOptions: VbenFormProps = {
schema: querySchema.value,
submitOnChange: false,
handleValuesChange: async (values, changedFields) => {
//
if (changedFields.includes('ioTPlatformProductId')) {
//
await nextTick();
if (gridApi?.reload && gridApi?.formApi) {
try {
// reload
const latestValues = await gridApi.formApi.getValues();
await gridApi.reload(latestValues);
} catch (error) {
console.error('重新加载数据时出错:', error);
}
}
}
},
};
const gridOptions: VxeGridProps<any> = {
checkboxConfig: {
@ -71,17 +88,101 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
// APIformValues
const currentFormValues = gridApi?.formApi
? await gridApi.formApi.getValues()
: formValues || {};
// 使API使formValues
const finalFormValues = { ...(formValues || {}), ...currentFormValues };
const { data } = await postDeviceInfoPage({
body: {
pageIndex: page.currentPage,
pageSize: page.pageSize,
...formValues,
...finalFormValues,
},
});
return data;
},
},
},
//
onCheckboxChange: ({ row, checked }: any) => {
if (!checked) {
//
return;
}
//
let currentSelected: any[] = [];
if (gridApi?.grid) {
const gridInstance = gridApi.grid as any;
if (typeof gridInstance.getCheckboxRecords === 'function') {
currentSelected = gridInstance.getCheckboxRecords();
} else if (gridInstance.checkboxRecords) {
currentSelected = gridInstance.checkboxRecords;
}
}
// ID
if (currentSelected.length > 0) {
const firstProductId = currentSelected[0]?.ioTPlatformProductId;
const currentProductId = row?.ioTPlatformProductId;
// ID
if (firstProductId && currentProductId && firstProductId !== currentProductId) {
// ID
Message.warning('只能选择同一种产品的设备进行批量绑定,当前设备的产品与已选设备的产品不一致');
//
setTimeout(() => {
if (gridApi?.grid) {
const gridInstance = gridApi.grid as any;
if (typeof gridInstance.setCheckboxRow === 'function') {
gridInstance.setCheckboxRow(row, false);
} else if (typeof gridInstance.clearCheckboxRow === 'function') {
gridInstance.clearCheckboxRow(row);
}
}
}, 100);
return;
}
}
},
//
onCheckboxAll: ({ checked, records }: any) => {
if (!checked || records.length <= 1) {
//
return;
}
// ID
const productIds = records
.map((r: any) => r.ioTPlatformProductId)
.filter((id: any) => id);
if (productIds.length > 0) {
const uniqueProductIds = [...new Set(productIds)];
if (uniqueProductIds.length > 1) {
// ID
Message.warning('只能选择同一种产品的设备进行批量绑定,当前页面包含多种产品');
//
setTimeout(() => {
if (gridApi?.grid) {
const gridInstance = gridApi.grid as any;
if (typeof gridInstance.clearCheckboxAll === 'function') {
gridInstance.clearCheckboxAll();
} else if (typeof gridInstance.setAllCheckboxRow === 'function') {
gridInstance.setAllCheckboxRow(false);
}
}
}, 100);
return;
}
}
},
};
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
@ -104,12 +205,8 @@ watch(
}
if (newQuery.ioTPlatformDeviceOpenInfo) {
// ID
if (newQuery.ioTPlatform === '2' || newQuery.ioTPlatform === 2) {
filterValues.oneNETProductId = newQuery.ioTPlatformDeviceOpenInfo;
} else if (newQuery.ioTPlatform === '1' || newQuery.ioTPlatform === 1) {
filterValues.ctWingProductId = newQuery.ioTPlatformDeviceOpenInfo;
}
// ID
filterValues.ioTPlatformProductId = newQuery.ioTPlatformDeviceOpenInfo;
//
filterValues.ioTPlatformDeviceOpenInfo = newQuery.ioTPlatformDeviceOpenInfo;
}
@ -135,22 +232,14 @@ watch(
() => gridApi?.formApi?.getValues,
(formValues) => {
if (formValues) {
const { oneNETProductId, ctWingProductId } = formValues;
const { ioTPlatformProductId } = formValues;
// OneNETioTPlatformDeviceOpenInfo
if (oneNETProductId) {
console.log('检测到OneNET产品选择变化:', oneNETProductId);
gridApi?.formApi?.setFieldValue('ioTPlatformDeviceOpenInfo', oneNETProductId);
console.log('已设置ioTPlatformDeviceOpenInfo为:', oneNETProductId);
}
// CTWingioTPlatformDeviceOpenInfo
else if (ctWingProductId) {
console.log('检测到CTWing产品选择变化:', ctWingProductId);
gridApi?.formApi?.setFieldValue('ioTPlatformDeviceOpenInfo', ctWingProductId);
console.log('已设置ioTPlatformDeviceOpenInfo为:', ctWingProductId);
}
// ioTPlatformDeviceOpenInfo
else if (!oneNETProductId && !ctWingProductId) {
// ioTPlatformDeviceOpenInfo
if (ioTPlatformProductId) {
console.log('检测到产品选择变化:', ioTPlatformProductId);
gridApi?.formApi?.setFieldValue('ioTPlatformDeviceOpenInfo', ioTPlatformProductId);
console.log('已设置ioTPlatformDeviceOpenInfo为:', ioTPlatformProductId);
} else {
console.log('清空产品选择');
gridApi?.formApi?.setFieldValue('ioTPlatformDeviceOpenInfo', '');
}
@ -165,7 +254,7 @@ const loadingTip = ref('缓存刷新中...');
const commandRow: Record<string, any> = ref({});
//
const bindRow: Record<string, any> = ref({});
const bindRows: Array<Record<string, any>> = ref([]);
// -
interface CommandProperty {
@ -274,9 +363,18 @@ const [BindModal, bindModalApi] = useVbenModal({
draggable: true,
onConfirm: submitBindDeviceThingModel,
onBeforeClose: () => {
bindRow.value = {};
bindRows.value = [];
return true;
},
onOpenChange: async (isOpen: boolean) => {
if (isOpen) {
console.log('绑定弹窗打开,选中的设备:', bindRows.value);
await nextTick();
//
const formValues = await bindFormApi.getValues();
console.log('弹窗打开时的表单值:', formValues);
}
},
});
const [AddForm, addFormApi] = useVbenForm({
@ -294,6 +392,12 @@ const [AddForm, addFormApi] = useVbenForm({
showCollapseButton: false,
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
handleValuesChange: async (values, changedFields) => {
//
if (changedFields.includes('ioTPlatformAccountId')) {
await addFormApi.setFieldValue('ioTPlatformProductId', undefined);
}
},
});
const [EditForm, editFormApi] = useVbenForm({
@ -312,6 +416,12 @@ const [EditForm, editFormApi] = useVbenForm({
showCollapseButton: false,
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
handleValuesChange: async (values, changedFields) => {
//
if (changedFields.includes('ioTPlatformAccountId')) {
await editFormApi.setFieldValue('ioTPlatformProductId', undefined);
}
},
});
const [CommandForm, commandFormApi] = useVbenForm({
@ -343,6 +453,36 @@ const [BindForm, bindFormApi] = useVbenForm({
showCollapseButton: false,
showDefaultActions: false,
wrapperClass: 'grid-cols-1',
handleValuesChange: async (values, changedFields) => {
//
if (changedFields.includes('isNeedConfigDevicMdoel') && values.isNeedConfigDevicMdoel) {
console.log('开关打开,准备触发设备物模型下拉框重新加载');
await nextTick();
setTimeout(async () => {
try {
const productId = values._ioTPlatformProductId || values.ioTPlatformProductId;
console.log('手动触发下拉框重新加载产品ID:', productId);
if (productId) {
const fieldRef = bindFormApi.getFieldComponentRef('deviceThingModelDataId');
if (fieldRef && typeof fieldRef.updateParam === 'function') {
fieldRef.updateParam({
query: {
input: {
id: String(productId),
},
},
});
console.log('已手动触发下拉框重新加载');
} else {
console.warn('无法获取设备物模型下拉框的引用');
}
}
} catch (error) {
console.error('手动触发下拉框重新加载失败:', error);
}
}, 100);
}
},
});
const [BatchAddForm, batchAddFormApi] = useVbenForm({
@ -362,6 +502,12 @@ const [BatchAddForm, batchAddFormApi] = useVbenForm({
wrapperClass: 'grid-cols-2',
//
autoSubmitOnEnter: false,
handleValuesChange: async (values, changedFields) => {
//
if (changedFields.includes('ioTPlatformAccountId')) {
await batchAddFormApi.setFieldValue('ioTPlatformProductId', undefined);
}
},
});
const [BatchAddModal, batchAddModalApi] = useVbenModal({
@ -398,36 +544,13 @@ async function submit() {
const formValues = await formApi.getValues();
//
const processedFormValues = { ...formValues };
if (formValues.ioTPlatform === 2 || formValues.ioTPlatform === '2') {
// OneNET
processedFormValues.ioTPlatformAccountId = formValues.oneNETAccountId;
processedFormValues.ioTPlatformProductId = formValues.oneNETProductId;
//
delete processedFormValues.oneNETAccountId;
delete processedFormValues.oneNETProductId;
delete processedFormValues.ctWingAccountId;
delete processedFormValues.ctWingProductId;
} else if (formValues.ioTPlatform === 1 || formValues.ioTPlatform === '1') {
// CTWing
processedFormValues.ioTPlatformAccountId = formValues.ctWingAccountId;
processedFormValues.ioTPlatformProductId = formValues.ctWingProductId;
//
delete processedFormValues.ctWingAccountId;
delete processedFormValues.ctWingProductId;
delete processedFormValues.oneNETAccountId;
delete processedFormValues.oneNETProductId;
}
const fetchParams: any = isEdit
? {
id: editRow.value.id,
...processedFormValues,
...formValues,
}
: {
...processedFormValues,
...formValues,
};
try {
@ -459,7 +582,7 @@ async function onEdit(record: any) {
editRow.value = record;
userModalApi.open();
//
//
const formValues = { ...record };
// ioTPlatformApiSelectvalueField'key'
@ -467,16 +590,6 @@ async function onEdit(record: any) {
formValues.ioTPlatform = String(formValues.ioTPlatform);
}
if (record.ioTPlatform === 2 || record.ioTPlatform === '2') {
// OneNET
formValues.oneNETAccountId = record.ioTPlatformAccountId;
formValues.oneNETProductId = record.ioTPlatformProductId;
} else if (record.ioTPlatform === 1 || record.ioTPlatform === '1') {
// CTWing
formValues.ctWingAccountId = record.ioTPlatformAccountId;
formValues.ctWingProductId = record.ioTPlatformProductId;
}
editFormApi.setValues(formValues);
}
@ -585,17 +698,96 @@ const openCommandModal = (row: Record<string, any>) => {
commandModalApi.open();
};
//
const openBindModal = async (row: Record<string, any>) => {
bindRow.value = row;
//
const openBindModal = async (rowOrRows?: Record<string, any> | Array<Record<string, any>>) => {
//
let selectedRows: Array<Record<string, any>> = [];
if (rowOrRows) {
// 使
if (Array.isArray(rowOrRows)) {
selectedRows = rowOrRows;
} else {
//
selectedRows = [rowOrRows];
}
} else {
//
try {
let checkboxRecords: any[] = [];
// grid
if (gridApi?.grid) {
const gridInstance = gridApi.grid as any;
if (typeof gridInstance.getCheckboxRecords === 'function') {
checkboxRecords = gridInstance.getCheckboxRecords();
} else if (gridInstance.checkboxRecords) {
checkboxRecords = gridInstance.checkboxRecords;
}
}
// store
if (checkboxRecords.length === 0 && gridApi?.store) {
const store = gridApi.store as any;
if (store.checkboxRecords) {
checkboxRecords = store.checkboxRecords;
}
}
selectedRows = checkboxRecords;
} catch (error) {
console.warn('无法获取表格选中的设备:', error);
}
}
if (selectedRows.length === 0) {
Message.warning('请先选择要绑定的设备');
return;
}
//
if (selectedRows.length > 1) {
const productIds = selectedRows
.map((row) => row.ioTPlatformProductId)
.filter((id) => id); //
if (productIds.length === 0) {
Message.error('选中的设备中没有有效的产品ID无法进行绑定');
return;
}
// ID
const uniqueProductIds = [...new Set(productIds)];
if (uniqueProductIds.length > 1) {
Message.error(`选中的设备包含 ${uniqueProductIds.length} 种不同的产品,请只选择同一种产品的设备进行批量绑定`);
return;
}
}
console.log('打开绑定弹窗,选中的设备:', selectedRows);
bindRows.value = selectedRows;
// ID
const firstDevice = selectedRows[0];
const productId = firstDevice.ioTPlatformProductId;
console.log('设置表单值产品ID:', productId, '类型:', typeof productId);
if (!productId) {
console.warn('警告:设备行数据中没有 ioTPlatformProductId 字段,请检查表格数据是否包含该字段');
}
bindModalApi.open();
// 使ID
await nextTick();
await bindFormApi.setValues({
isNeedConfigDevicMdoel: false,
deviceThingModelDataId: undefined,
_ioTPlatformProductId: row.ioTPlatformProductId,
_ioTPlatformProductId: productId ? String(productId) : undefined,
});
const formValues = await bindFormApi.getValues();
console.log('表单值设置完成,当前表单值:', formValues);
console.log('表单值中的 _ioTPlatformProductId:', formValues._ioTPlatformProductId);
};
//
@ -687,27 +879,35 @@ async function submitBindDeviceThingModel() {
return;
}
if (!bindRow.value?.id) {
Message.error('设备信息缺失,无法绑定设备端物模型');
if (!bindRows.value || bindRows.value.length === 0) {
Message.error('请选择要绑定的设备');
return;
}
// ID
const deviceIds = bindRows.value
.map((row) => row.id)
.filter((id) => id); //
if (deviceIds.length === 0) {
Message.error('选中的设备中没有有效的设备ID');
return;
}
try {
bindModalApi.setState({ loading: true, confirmLoading: true });
const result = await postDeviceInfoBindingDeviceThingModel({
query: {
input: {
devieDataId: bindRow.value.id,
body: {
devieDataIdList: deviceIds,
isNeedConfigDevicMdoel: isNeedConfig,
deviceThingModelDataId: isNeedConfig ? deviceThingModelDataId : null,
},
},
});
if (result) {
Message.success('绑定设备端物模型成功');
if (result.data) {
Message.success(`成功绑定 ${deviceIds.length} 个设备的设备端物模型`);
bindModalApi.close();
bindRow.value = {};
bindRows.value = [];
gridApi.reload();
} else {
Message.error('绑定设备端物模型失败');
@ -753,15 +953,11 @@ async function submitBatchAdd() {
return;
}
//
let ioTPlatformProductId = '';
if (formValues.ioTPlatform === 2 || formValues.ioTPlatform === '2') {
// OneNET
ioTPlatformProductId = formValues.oneNETProductId;
} else if (formValues.ioTPlatform === 1 || formValues.ioTPlatform === '1') {
// CTWing
ioTPlatformProductId = formValues.ctWingProductId;
}
// ID
const ioTPlatformProductId =
formValues.ioTPlatformProductId ||
formValues.oneNETProductId ||
formValues.ctWingProductId;
if (!ioTPlatformProductId) {
Message.error('请选择产品');
@ -951,6 +1147,94 @@ const handleCacheRefresh = async () => {
}
};
//
const openBatchBindModal = async () => {
//
try {
console.log('gridApi:', gridApi);
console.log('gridApi.grid:', gridApi?.grid);
//
let checkboxRecords: any[] = [];
// 1 grid
if (gridApi?.grid) {
console.log('grid 可用,尝试获取选中行');
const gridInstance = gridApi.grid as any;
//
if (typeof gridInstance.getCheckboxRecords === 'function') {
checkboxRecords = gridInstance.getCheckboxRecords();
console.log('通过 grid.getCheckboxRecords 获取:', checkboxRecords);
} else if (typeof gridInstance.getCheckboxReserveRecords === 'function') {
checkboxRecords = gridInstance.getCheckboxReserveRecords();
console.log('通过 grid.getCheckboxReserveRecords 获取:', checkboxRecords);
}
// 访
if (checkboxRecords.length === 0 && gridInstance.checkboxRecords) {
checkboxRecords = gridInstance.checkboxRecords;
console.log('通过 grid.checkboxRecords 属性获取:', checkboxRecords);
}
// store
if (checkboxRecords.length === 0 && gridInstance.$store) {
const store = gridInstance.$store;
if (store.checkboxRecords) {
checkboxRecords = store.checkboxRecords;
console.log('通过 grid.$store.checkboxRecords 获取:', checkboxRecords);
}
}
}
// 2 gridApi.store
if (checkboxRecords.length === 0 && gridApi?.store) {
const store = gridApi.store as any;
if (store.checkboxRecords) {
checkboxRecords = store.checkboxRecords;
console.log('通过 gridApi.store.checkboxRecords 获取:', checkboxRecords);
}
}
// 3 gridApi
if (checkboxRecords.length === 0 && typeof (gridApi as any).getCheckboxRecords === 'function') {
checkboxRecords = (gridApi as any).getCheckboxRecords();
console.log('通过 gridApi.getCheckboxRecords 获取:', checkboxRecords);
}
console.log('最终获取到的选中设备:', checkboxRecords);
console.log('选中设备数量:', checkboxRecords.length);
if (!checkboxRecords || checkboxRecords.length === 0) {
Message.warning('请先在表格中勾选要绑定的设备(点击每行前面的复选框)');
return;
}
//
const productIds = checkboxRecords
.map((row) => row.ioTPlatformProductId)
.filter((id) => id); //
if (productIds.length === 0) {
Message.error('选中的设备中没有有效的产品ID无法进行绑定');
return;
}
// ID
const uniqueProductIds = [...new Set(productIds)];
if (uniqueProductIds.length > 1) {
Message.error(`选中的设备包含 ${uniqueProductIds.length} 种不同的产品,请只选择同一种产品的设备进行批量绑定`);
return;
}
await openBindModal(checkboxRecords);
} catch (error) {
console.error('获取表格选中的设备失败:', error);
console.error('错误详情:', error);
Message.error('获取表格选中的设备失败,请确保已勾选设备');
}
};
//
const toolbarActions = computed(() => [
{
@ -967,6 +1251,13 @@ const toolbarActions = computed(() => [
onClick: openBatchAddModal.bind(null),
auth: ['AbpIdentity.Users.Create'],
},
{
label: '批量绑定设备端物模型',
type: 'default',
icon: 'ant-design:link-outlined',
onClick: openBatchBindModal,
auth: ['AbpIdentity.Users.Create'],
},
{
label: cacheRefreshLoading.value
? $t('common.loading')
@ -1161,7 +1452,21 @@ const toolbarActions = computed(() => [
</div>
</div>
</CommandModal>
<BindModal title="绑定设备端物模型" class="w-[600px]">
<BindModal :title="`绑定设备端物模型${bindRows.length > 0 ? ` (已选择 ${bindRows.length} 个设备)` : ''}`" class="w-[600px]">
<div v-if="bindRows.length > 0" class="mb-4 p-3 bg-blue-50 rounded border border-blue-200">
<div class="text-sm font-medium text-blue-800 mb-2">
已选择 {{ bindRows.length }} 个设备
</div>
<div class="text-xs text-blue-600 max-h-32 overflow-y-auto">
<div
v-for="(row, index) in bindRows"
:key="row.id || index"
class="mb-1"
>
{{ index + 1 }}. {{ row.deviceName || row.deviceAddress || row.id }}
</div>
</div>
</div>
<BindForm />
</BindModal>
<BatchAddModal title="批量添加设备" class="w-[800px]">

File diff suppressed because it is too large Load Diff