设备绑定设备端物模型
This commit is contained in:
parent
ba5a5ee8f4
commit
e860a539fa
@ -464,6 +464,29 @@ export const BatchCreateDeviceAggregationInputSchema = {
|
|||||||
description: '批量创建设备信息'
|
description: '批量创建设备信息'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const BindingDeviceThingModelInputSchema = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
devieDataId: {
|
||||||
|
type: 'string',
|
||||||
|
description: '设备数据Id',
|
||||||
|
format: 'uuid'
|
||||||
|
},
|
||||||
|
isNeedConfigDevicMdoel: {
|
||||||
|
type: 'boolean',
|
||||||
|
description: '是否需要配置设备模型,默认false'
|
||||||
|
},
|
||||||
|
deviceThingModelDataId: {
|
||||||
|
type: 'string',
|
||||||
|
description: '设备物模型数据Id',
|
||||||
|
format: 'uuid',
|
||||||
|
nullable: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
additionalProperties: false,
|
||||||
|
description: '绑定设备物模型输入'
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const BuildAnalysisScriptInputSchema = {
|
export const BuildAnalysisScriptInputSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
@ -5390,6 +5413,11 @@ export const IoTPlatformThingModelInfoDtoSchema = {
|
|||||||
description: '物联网平台中对应的产品物模型属性或者事件名称',
|
description: '物联网平台中对应的产品物模型属性或者事件名称',
|
||||||
nullable: true
|
nullable: true
|
||||||
},
|
},
|
||||||
|
ioTPlatformRawFieldDataType: {
|
||||||
|
type: 'string',
|
||||||
|
description: '物联网平台中对应的产品物模型属性或者事件数据类型,int等,JiShe.ServicePro.Core.OneNETAllThingModel',
|
||||||
|
nullable: true
|
||||||
|
},
|
||||||
standardFieldName: {
|
standardFieldName: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: '管理后台产品标准的物模型属性或者事件名称',
|
description: '管理后台产品标准的物模型属性或者事件名称',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -172,6 +172,24 @@ export type BatchCreateDeviceAggregationInput = {
|
|||||||
deviceSourceTypeEnum?: DeviceSourceTypeEnum;
|
deviceSourceTypeEnum?: DeviceSourceTypeEnum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定设备物模型输入
|
||||||
|
*/
|
||||||
|
export type BindingDeviceThingModelInput = {
|
||||||
|
/**
|
||||||
|
* 设备数据Id
|
||||||
|
*/
|
||||||
|
devieDataId?: string;
|
||||||
|
/**
|
||||||
|
* 是否需要配置设备模型,默认false
|
||||||
|
*/
|
||||||
|
isNeedConfigDevicMdoel?: boolean;
|
||||||
|
/**
|
||||||
|
* 设备物模型数据Id
|
||||||
|
*/
|
||||||
|
deviceThingModelDataId?: (string) | null;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建物模型脚本输入
|
* 构建物模型脚本输入
|
||||||
*/
|
*/
|
||||||
@ -2706,6 +2724,10 @@ export type IoTPlatformThingModelInfoDto = {
|
|||||||
* 物联网平台中对应的产品物模型属性或者事件名称
|
* 物联网平台中对应的产品物模型属性或者事件名称
|
||||||
*/
|
*/
|
||||||
ioTPlatformRawFieldName?: (string) | null;
|
ioTPlatformRawFieldName?: (string) | null;
|
||||||
|
/**
|
||||||
|
* 物联网平台中对应的产品物模型属性或者事件数据类型,int等,JiShe.ServicePro.Core.OneNETAllThingModel
|
||||||
|
*/
|
||||||
|
ioTPlatformRawFieldDataType?: (string) | null;
|
||||||
/**
|
/**
|
||||||
* 管理后台产品标准的物模型属性或者事件名称
|
* 管理后台产品标准的物模型属性或者事件名称
|
||||||
*/
|
*/
|
||||||
@ -5947,6 +5969,16 @@ export type PostDeviceInfoCacheDeviceDataToRedisResponse = (boolean);
|
|||||||
|
|
||||||
export type PostDeviceInfoCacheDeviceDataToRedisError = unknown;
|
export type PostDeviceInfoCacheDeviceDataToRedisError = unknown;
|
||||||
|
|
||||||
|
export type PostDeviceInfoBindingDeviceThingModelData = {
|
||||||
|
query?: {
|
||||||
|
input?: BindingDeviceThingModelInput;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostDeviceInfoBindingDeviceThingModelResponse = (boolean);
|
||||||
|
|
||||||
|
export type PostDeviceInfoBindingDeviceThingModelError = unknown;
|
||||||
|
|
||||||
export type PostDeviceThingModelManagementCreateAsyncData = {
|
export type PostDeviceThingModelManagementCreateAsyncData = {
|
||||||
query?: {
|
query?: {
|
||||||
input?: DeviceThingModelCreateInput;
|
input?: DeviceThingModelCreateInput;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import {
|
|||||||
postAggregationDeviceDeviceCommandForApiAsync,
|
postAggregationDeviceDeviceCommandForApiAsync,
|
||||||
postAggregationDeviceRepushDeviceInfoToIoTplatform,
|
postAggregationDeviceRepushDeviceInfoToIoTplatform,
|
||||||
postDeviceInfoCacheDeviceDataToRedis,
|
postDeviceInfoCacheDeviceDataToRedis,
|
||||||
|
postDeviceInfoBindingDeviceThingModel,
|
||||||
postDeviceInfoPage,
|
postDeviceInfoPage,
|
||||||
} from '#/api-client';
|
} from '#/api-client';
|
||||||
import { Icon } from '#/components/icon';
|
import { Icon } from '#/components/icon';
|
||||||
@ -38,6 +39,7 @@ import {
|
|||||||
batchAddDeviceFormSchema,
|
batchAddDeviceFormSchema,
|
||||||
commandFormSchema,
|
commandFormSchema,
|
||||||
editDeviceFormSchemaEdit,
|
editDeviceFormSchemaEdit,
|
||||||
|
bindDeviceThingModelFormSchema,
|
||||||
querySchema,
|
querySchema,
|
||||||
tableSchema,
|
tableSchema,
|
||||||
} from './schema';
|
} from './schema';
|
||||||
@ -162,6 +164,9 @@ const pageLoading = ref(false);
|
|||||||
const loadingTip = ref('缓存刷新中...');
|
const loadingTip = ref('缓存刷新中...');
|
||||||
const commandRow: Record<string, any> = ref({});
|
const commandRow: Record<string, any> = ref({});
|
||||||
|
|
||||||
|
// 绑定设备端物模型相关
|
||||||
|
const bindRow: Record<string, any> = ref({});
|
||||||
|
|
||||||
// 指令属性-值对列表
|
// 指令属性-值对列表
|
||||||
interface CommandProperty {
|
interface CommandProperty {
|
||||||
id: string; // 唯一标识
|
id: string; // 唯一标识
|
||||||
@ -264,6 +269,16 @@ const [CommandModal, commandModalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 设备绑定设备端物模型弹窗
|
||||||
|
const [BindModal, bindModalApi] = useVbenModal({
|
||||||
|
draggable: true,
|
||||||
|
onConfirm: submitBindDeviceThingModel,
|
||||||
|
onBeforeClose: () => {
|
||||||
|
bindRow.value = {};
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const [AddForm, addFormApi] = useVbenForm({
|
const [AddForm, addFormApi] = useVbenForm({
|
||||||
// 默认展开
|
// 默认展开
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
@ -315,6 +330,21 @@ const [CommandForm, commandFormApi] = useVbenForm({
|
|||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [BindForm, bindFormApi] = useVbenForm({
|
||||||
|
collapsed: false,
|
||||||
|
commonConfig: {
|
||||||
|
labelWidth: 160,
|
||||||
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
layout: 'horizontal',
|
||||||
|
schema: bindDeviceThingModelFormSchema.value,
|
||||||
|
showCollapseButton: false,
|
||||||
|
showDefaultActions: false,
|
||||||
|
wrapperClass: 'grid-cols-1',
|
||||||
|
});
|
||||||
|
|
||||||
const [BatchAddForm, batchAddFormApi] = useVbenForm({
|
const [BatchAddForm, batchAddFormApi] = useVbenForm({
|
||||||
// 默认展开
|
// 默认展开
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
@ -555,6 +585,19 @@ const openCommandModal = (row: Record<string, any>) => {
|
|||||||
commandModalApi.open();
|
commandModalApi.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 打开绑定设备端物模型弹窗
|
||||||
|
const openBindModal = async (row: Record<string, any>) => {
|
||||||
|
bindRow.value = row;
|
||||||
|
bindModalApi.open();
|
||||||
|
// 设置表单初始值(包括供下拉使用的平台产品ID)
|
||||||
|
await nextTick();
|
||||||
|
await bindFormApi.setValues({
|
||||||
|
isNeedConfigDevicMdoel: false,
|
||||||
|
deviceThingModelDataId: undefined,
|
||||||
|
_ioTPlatformProductId: row.ioTPlatformProductId,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 指令提交逻辑
|
// 指令提交逻辑
|
||||||
async function submitCommand() {
|
async function submitCommand() {
|
||||||
// 验证所有属性-值对都已填写
|
// 验证所有属性-值对都已填写
|
||||||
@ -629,6 +672,54 @@ async function submitCommand() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 绑定设备端物模型提交逻辑
|
||||||
|
async function submitBindDeviceThingModel() {
|
||||||
|
const formValues = await bindFormApi.getValues();
|
||||||
|
|
||||||
|
// 开关关闭时,直接提交无需选择物模型
|
||||||
|
const isNeedConfig = !!formValues.isNeedConfigDevicMdoel;
|
||||||
|
const deviceThingModelDataId = formValues.deviceThingModelDataId as
|
||||||
|
| string
|
||||||
|
| undefined;
|
||||||
|
|
||||||
|
if (isNeedConfig && !deviceThingModelDataId) {
|
||||||
|
Message.error('请先选择设备端物模型');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bindRow.value?.id) {
|
||||||
|
Message.error('设备信息缺失,无法绑定设备端物模型');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
bindModalApi.setState({ loading: true, confirmLoading: true });
|
||||||
|
const result = await postDeviceInfoBindingDeviceThingModel({
|
||||||
|
query: {
|
||||||
|
input: {
|
||||||
|
devieDataId: bindRow.value.id,
|
||||||
|
isNeedConfigDevicMdoel: isNeedConfig,
|
||||||
|
deviceThingModelDataId: isNeedConfig ? deviceThingModelDataId : null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
Message.success('绑定设备端物模型成功');
|
||||||
|
bindModalApi.close();
|
||||||
|
bindRow.value = {};
|
||||||
|
gridApi.reload();
|
||||||
|
} else {
|
||||||
|
Message.error('绑定设备端物模型失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('绑定设备端物模型失败:', error);
|
||||||
|
Message.error('绑定设备端物模型失败');
|
||||||
|
} finally {
|
||||||
|
bindModalApi.setState({ loading: false, confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 批量添加设备提交逻辑
|
// 批量添加设备提交逻辑
|
||||||
async function submitBatchAdd() {
|
async function submitBatchAdd() {
|
||||||
const { valid } = await batchAddFormApi.validate();
|
const { valid } = await batchAddFormApi.validate();
|
||||||
@ -958,6 +1049,9 @@ const toolbarActions = computed(() => [
|
|||||||
<Button size="small" type="link" @click="openCommandModal.bind(null, row)()">
|
<Button size="small" type="link" @click="openCommandModal.bind(null, row)()">
|
||||||
{{ $t('abp.IoTDBBase.Command') }}
|
{{ $t('abp.IoTDBBase.Command') }}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button size="small" type="link" @click="openBindModal.bind(null, row)()">
|
||||||
|
绑定设备端物模型
|
||||||
|
</Button>
|
||||||
<Popover trigger="hover" placement="bottomRight" :overlay-style="{ minWidth: '120px' }">
|
<Popover trigger="hover" placement="bottomRight" :overlay-style="{ minWidth: '120px' }">
|
||||||
<template #content>
|
<template #content>
|
||||||
<div style="display: flex; flex-direction: column; gap: 4px">
|
<div style="display: flex; flex-direction: column; gap: 4px">
|
||||||
@ -1067,6 +1161,9 @@ const toolbarActions = computed(() => [
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CommandModal>
|
</CommandModal>
|
||||||
|
<BindModal title="绑定设备端物模型" class="w-[600px]">
|
||||||
|
<BindForm />
|
||||||
|
</BindModal>
|
||||||
<BatchAddModal title="批量添加设备" class="w-[800px]">
|
<BatchAddModal title="批量添加设备" class="w-[800px]">
|
||||||
<BatchAddForm />
|
<BatchAddForm />
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import {
|
|||||||
getCommonGetSelectList,
|
getCommonGetSelectList,
|
||||||
postCtWingAccountListAsync,
|
postCtWingAccountListAsync,
|
||||||
postCtWingProductListAsync,
|
postCtWingProductListAsync,
|
||||||
|
postIoTplatformThingModelInfoFindByPlatformProductIdAsync,
|
||||||
postOneNetAccountListAsync,
|
postOneNetAccountListAsync,
|
||||||
postOneNetProductListAsync,
|
postOneNetProductListAsync,
|
||||||
} from '#/api-client';
|
} from '#/api-client';
|
||||||
@ -39,7 +40,7 @@ export const querySchema = computed(() => [
|
|||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.ioTPlatform')}`,
|
placeholder: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.ioTPlatform')}`,
|
||||||
afterFetch: (res: any) => {
|
afterFetch: (res: any) => {
|
||||||
console.log('产品选择器API调用 - 平台类型:',res);
|
console.log('产品选择器API调用 - 平台类型:', res);
|
||||||
|
|
||||||
// 确保返回的是数组格式
|
// 确保返回的是数组格式
|
||||||
if (Array.isArray(res)) {
|
if (Array.isArray(res)) {
|
||||||
@ -64,8 +65,14 @@ export const querySchema = computed(() => [
|
|||||||
label: $t('common.BelongingProductName'),
|
label: $t('common.BelongingProductName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
const shouldShow = values.ioTPlatform === 2 || values.ioTPlatform === '2';
|
const shouldShow =
|
||||||
console.log('OneNET产品选择器显示检查 - 平台类型:', values.ioTPlatform, '是否显示:', shouldShow);
|
values.ioTPlatform === 2 || values.ioTPlatform === '2';
|
||||||
|
console.log(
|
||||||
|
'OneNET产品选择器显示检查 - 平台类型:',
|
||||||
|
values.ioTPlatform,
|
||||||
|
'是否显示:',
|
||||||
|
shouldShow,
|
||||||
|
);
|
||||||
return shouldShow; // OneNET平台
|
return shouldShow; // OneNET平台
|
||||||
},
|
},
|
||||||
triggerFields: ['ioTPlatform'],
|
triggerFields: ['ioTPlatform'],
|
||||||
@ -113,8 +120,14 @@ export const querySchema = computed(() => [
|
|||||||
label: $t('common.BelongingProductName'),
|
label: $t('common.BelongingProductName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
const shouldShow = values.ioTPlatform === 1 || values.ioTPlatform === '1';
|
const shouldShow =
|
||||||
console.log('CTWing产品选择器显示检查 - 平台类型:', values.ioTPlatform, '是否显示:', shouldShow);
|
values.ioTPlatform === 1 || values.ioTPlatform === '1';
|
||||||
|
console.log(
|
||||||
|
'CTWing产品选择器显示检查 - 平台类型:',
|
||||||
|
values.ioTPlatform,
|
||||||
|
'是否显示:',
|
||||||
|
shouldShow,
|
||||||
|
);
|
||||||
return shouldShow; // CTWing平台
|
return shouldShow; // CTWing平台
|
||||||
},
|
},
|
||||||
triggerFields: ['ioTPlatform'],
|
triggerFields: ['ioTPlatform'],
|
||||||
@ -226,7 +239,7 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
|||||||
title: $t('common.action'),
|
title: $t('common.action'),
|
||||||
field: 'action',
|
field: 'action',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: '180',
|
width: '280',
|
||||||
slots: { default: 'action' },
|
slots: { default: 'action' },
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
@ -514,6 +527,76 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// 设备绑定设备端物模型表单
|
||||||
|
export const bindDeviceThingModelFormSchema: any = computed(() => [
|
||||||
|
{
|
||||||
|
component: 'Switch',
|
||||||
|
fieldName: 'isNeedConfigDevicMdoel',
|
||||||
|
label: '是否需要配置设备模型',
|
||||||
|
defaultValue: false,
|
||||||
|
componentProps: {
|
||||||
|
style: { width: 'auto' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'ApiSelect',
|
||||||
|
fieldName: 'deviceThingModelDataId',
|
||||||
|
label: '设备物模型',
|
||||||
|
// 仅在需要配置设备模型时显示
|
||||||
|
dependencies: {
|
||||||
|
show(values: any) {
|
||||||
|
return !!values.isNeedConfigDevicMdoel;
|
||||||
|
},
|
||||||
|
triggerFields: ['isNeedConfigDevicMdoel', '_ioTPlatformProductId'],
|
||||||
|
},
|
||||||
|
// 选择设备端物模型
|
||||||
|
componentProps: (formValues: any) => {
|
||||||
|
const productId =
|
||||||
|
formValues?._ioTPlatformProductId || formValues?.ioTPlatformProductId;
|
||||||
|
|
||||||
|
return {
|
||||||
|
api: productId
|
||||||
|
? postIoTplatformThingModelInfoFindByPlatformProductIdAsync
|
||||||
|
: null,
|
||||||
|
params: productId
|
||||||
|
? {
|
||||||
|
query: {
|
||||||
|
input: {
|
||||||
|
id: String(productId),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
// 平台物模型信息里的显示字段(优先显示标准字段显示名)
|
||||||
|
labelField: 'standardFieldDisplayName',
|
||||||
|
valueField: 'id',
|
||||||
|
optionsPropName: 'options',
|
||||||
|
immediate: !!productId,
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: '请选择设备物模型',
|
||||||
|
afterFetch: (res: any) => {
|
||||||
|
// 确保返回数组
|
||||||
|
if (Array.isArray(res)) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
if (res && Array.isArray(res.items)) {
|
||||||
|
return res.items;
|
||||||
|
}
|
||||||
|
if (res && Array.isArray(res.data)) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
if (res && res.data && Array.isArray(res.data.items)) {
|
||||||
|
return res.data.items;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// 规则在提交中按开关手动校验,这里设为可选
|
||||||
|
rules: z.string().optional(),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
export const editDeviceFormSchemaEdit: any = computed(() => [
|
export const editDeviceFormSchemaEdit: any = computed(() => [
|
||||||
{
|
{
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
|
|||||||
@ -175,7 +175,7 @@ async function loadPropertyOptions() {
|
|||||||
const items = data?.items || [];
|
const items = data?.items || [];
|
||||||
propertyOptions.value = items.map((item: any) => ({
|
propertyOptions.value = items.map((item: any) => ({
|
||||||
label: `${item.standardFieldDisplayName || item.standardFieldName} (${item.standardFieldName})`,
|
label: `${item.standardFieldDisplayName || item.standardFieldName} (${item.standardFieldName})`,
|
||||||
value: item.standardFieldName || '',
|
value: item.ioTPlatformRawFieldName
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载属性列表失败:', error);
|
console.error('加载属性列表失败:', error);
|
||||||
|
|||||||
@ -23,9 +23,9 @@ import { TableAction } from '#/components/table-action';
|
|||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addThingModelFormSchema,
|
getAddThingModelFormSchema,
|
||||||
copyThingModelFormSchema,
|
copyThingModelFormSchema,
|
||||||
editThingModelFormSchema,
|
getEditThingModelFormSchema,
|
||||||
querySchema,
|
querySchema,
|
||||||
tableSchema,
|
tableSchema,
|
||||||
} from './schema';
|
} from './schema';
|
||||||
@ -178,12 +178,69 @@ const [ThingModelModal, thingModelModalApi] = useVbenModal({
|
|||||||
onBeforeClose: () => {
|
onBeforeClose: () => {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
onOpenChange: (isOpen: boolean) => {
|
onOpenChange: async (isOpen: boolean) => {
|
||||||
if (isOpen && editRow.value.id) {
|
if (isOpen) {
|
||||||
// 编辑模式下,模态框打开后设置表单值
|
// 打开弹窗时,设置平台和产品ID到表单中(用于下拉框依赖)
|
||||||
nextTick(() => {
|
await nextTick();
|
||||||
editFormApi.setValues({ ...editRow.value });
|
const formApi = editRow.value.id ? editFormApi : addFormApi;
|
||||||
|
const isEdit = !!editRow.value.id;
|
||||||
|
|
||||||
|
// 编辑时从选中对象获取,新增时从搜索表单获取
|
||||||
|
let platformValue: 1 | 2;
|
||||||
|
let productIdValue: string;
|
||||||
|
|
||||||
|
if (isEdit) {
|
||||||
|
// 编辑时从 editRow.value 获取
|
||||||
|
platformValue = editRow.value.ioTPlatform
|
||||||
|
? (typeof editRow.value.ioTPlatform === 'string'
|
||||||
|
? Number.parseInt(editRow.value.ioTPlatform)
|
||||||
|
: editRow.value.ioTPlatform) as 1 | 2
|
||||||
|
: Number.parseInt(ioTPlatform.value) as 1 | 2;
|
||||||
|
productIdValue = editRow.value.ioTPlatformProductId || productId.value;
|
||||||
|
} else {
|
||||||
|
// 新增时从搜索表单获取最新的值
|
||||||
|
const formValues = gridApi?.formApi ? await gridApi.formApi.getValues() : {};
|
||||||
|
platformValue = formValues.ioTPlatform
|
||||||
|
? (typeof formValues.ioTPlatform === 'string'
|
||||||
|
? Number.parseInt(formValues.ioTPlatform)
|
||||||
|
: formValues.ioTPlatform) as 1 | 2
|
||||||
|
: Number.parseInt(ioTPlatform.value) as 1 | 2;
|
||||||
|
productIdValue = formValues.ioTPlatformProductId || productId.value;
|
||||||
|
|
||||||
|
// 同步更新响应式变量
|
||||||
|
if (formValues.ioTPlatform) {
|
||||||
|
ioTPlatform.value = String(formValues.ioTPlatform);
|
||||||
|
}
|
||||||
|
if (formValues.ioTPlatformProductId) {
|
||||||
|
productId.value = String(formValues.ioTPlatformProductId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('设置表单值:', {
|
||||||
|
isEdit,
|
||||||
|
platformValue,
|
||||||
|
productIdValue,
|
||||||
|
editRowValue: isEdit ? editRow.value : null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await formApi.setValues({
|
||||||
|
...(isEdit ? editRow.value : {}),
|
||||||
|
_ioTPlatform: platformValue,
|
||||||
|
_ioTPlatformProductId: productIdValue,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 手动触发平台物模型编码字段的重新加载
|
||||||
|
setTimeout(() => {
|
||||||
|
const fieldRef = formApi.getFieldComponentRef('ioTPlatformRawFieldName');
|
||||||
|
if (fieldRef && typeof fieldRef.updateParam === 'function') {
|
||||||
|
fieldRef.updateParam({
|
||||||
|
body: {
|
||||||
|
ioTPlatformType: platformValue,
|
||||||
|
ioTPlatformProductId: productIdValue,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
@ -205,6 +262,19 @@ const [CopyModal, copyModalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 创建新增表单 schema(传入获取平台和产品ID的函数,作为后备方案)
|
||||||
|
// 注意:实际使用时,值会从表单的 _ioTPlatform 和 _ioTPlatformProductId 字段获取
|
||||||
|
const addThingModelFormSchema = getAddThingModelFormSchema(
|
||||||
|
() => {
|
||||||
|
// 作为后备方案,返回响应式变量的值
|
||||||
|
return ioTPlatform.value ? Number.parseInt(ioTPlatform.value) as 1 | 2 : undefined;
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// 作为后备方案,返回响应式变量的值
|
||||||
|
return productId.value || undefined;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const [AddForm, addFormApi] = useVbenForm({
|
const [AddForm, addFormApi] = useVbenForm({
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
@ -221,6 +291,24 @@ const [AddForm, addFormApi] = useVbenForm({
|
|||||||
wrapperClass: 'grid-cols-2',
|
wrapperClass: 'grid-cols-2',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 创建编辑表单 schema(传入获取平台和产品ID的函数,编辑时从 editRow 获取)
|
||||||
|
const editThingModelFormSchema = getEditThingModelFormSchema(
|
||||||
|
() => {
|
||||||
|
// 编辑时优先从 editRow 获取
|
||||||
|
if (editRow.value?.ioTPlatform) {
|
||||||
|
return typeof editRow.value.ioTPlatform === 'string'
|
||||||
|
? Number.parseInt(editRow.value.ioTPlatform)
|
||||||
|
: editRow.value.ioTPlatform;
|
||||||
|
}
|
||||||
|
// 如果没有,使用响应式变量
|
||||||
|
return ioTPlatform.value ? Number.parseInt(ioTPlatform.value) as 1 | 2 : undefined;
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// 编辑时优先从 editRow 获取
|
||||||
|
return editRow.value?.ioTPlatformProductId || productId.value || undefined;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const [EditForm, editFormApi] = useVbenForm({
|
const [EditForm, editFormApi] = useVbenForm({
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
@ -371,12 +459,75 @@ async function submit() {
|
|||||||
|
|
||||||
async function onEdit(record: any) {
|
async function onEdit(record: any) {
|
||||||
editRow.value = record;
|
editRow.value = record;
|
||||||
|
// 编辑时从选中对象获取平台和产品ID
|
||||||
|
const platformValue = record.ioTPlatform
|
||||||
|
? (typeof record.ioTPlatform === 'string'
|
||||||
|
? Number.parseInt(record.ioTPlatform)
|
||||||
|
: record.ioTPlatform) as 1 | 2
|
||||||
|
: Number.parseInt(ioTPlatform.value) as 1 | 2;
|
||||||
|
const productIdValue = record.ioTPlatformProductId || productId.value;
|
||||||
|
|
||||||
thingModelModalApi.open();
|
thingModelModalApi.open();
|
||||||
|
await nextTick();
|
||||||
|
setTimeout(async () => {
|
||||||
|
await editFormApi.setValues({
|
||||||
|
...record,
|
||||||
|
_ioTPlatform: platformValue,
|
||||||
|
_ioTPlatformProductId: productIdValue,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 手动触发平台物模型编码字段的重新加载
|
||||||
|
const fieldRef = editFormApi.getFieldComponentRef('ioTPlatformRawFieldName');
|
||||||
|
if (fieldRef && typeof fieldRef.updateParam === 'function') {
|
||||||
|
fieldRef.updateParam({
|
||||||
|
body: {
|
||||||
|
ioTPlatformType: platformValue,
|
||||||
|
ioTPlatformProductId: productIdValue,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
const openAddModal = async () => {
|
const openAddModal = async () => {
|
||||||
editRow.value = {};
|
editRow.value = {};
|
||||||
|
// 打开新增弹窗时,从搜索表单中获取平台和产品ID(确保是最新的值)
|
||||||
|
const formValues = gridApi?.formApi ? await gridApi.formApi.getValues() : {};
|
||||||
|
const platformValue = formValues.ioTPlatform
|
||||||
|
? (typeof formValues.ioTPlatform === 'string'
|
||||||
|
? Number.parseInt(formValues.ioTPlatform)
|
||||||
|
: formValues.ioTPlatform) as 1 | 2
|
||||||
|
: Number.parseInt(ioTPlatform.value) as 1 | 2;
|
||||||
|
const productIdValue = formValues.ioTPlatformProductId || productId.value;
|
||||||
|
|
||||||
|
// 更新响应式变量(保持同步)
|
||||||
|
if (formValues.ioTPlatform) {
|
||||||
|
ioTPlatform.value = String(formValues.ioTPlatform);
|
||||||
|
}
|
||||||
|
if (formValues.ioTPlatformProductId) {
|
||||||
|
productId.value = String(formValues.ioTPlatformProductId);
|
||||||
|
}
|
||||||
|
|
||||||
thingModelModalApi.open();
|
thingModelModalApi.open();
|
||||||
|
// 确保值已设置
|
||||||
|
await nextTick();
|
||||||
|
setTimeout(async () => {
|
||||||
|
await addFormApi.setValues({
|
||||||
|
_ioTPlatform: platformValue,
|
||||||
|
_ioTPlatformProductId: productIdValue,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 手动触发平台物模型编码字段的重新加载
|
||||||
|
const fieldRef = addFormApi.getFieldComponentRef('ioTPlatformRawFieldName');
|
||||||
|
if (fieldRef && typeof fieldRef.updateParam === 'function') {
|
||||||
|
fieldRef.updateParam({
|
||||||
|
body: {
|
||||||
|
ioTPlatformType: platformValue,
|
||||||
|
ioTPlatformProductId: productIdValue,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开复制已有模型模态框
|
// 打开复制已有模型模态框
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import dayjs from 'dayjs';
|
|||||||
import {
|
import {
|
||||||
getCommonGetSelectList,
|
getCommonGetSelectList,
|
||||||
postAggregationIoTplatformGetIoTplatformProductInfoAsync,
|
postAggregationIoTplatformGetIoTplatformProductInfoAsync,
|
||||||
|
postAggregationIoTplatformGetIoTplatformProductPropertyInfoAsync,
|
||||||
postOneNetProductListAsync,
|
postOneNetProductListAsync,
|
||||||
} from '#/api-client';
|
} from '#/api-client';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
@ -179,7 +180,7 @@ export const tableSchema = computed(() => [
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// 添加物模型表单schema
|
// 添加物模型表单schema
|
||||||
export const addThingModelFormSchema = computed(() => [
|
export const getAddThingModelFormSchema = (getPlatform: () => number | string | undefined, getProductId: () => string | undefined) => computed(() => [
|
||||||
{
|
{
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
fieldName: 'filedType',
|
fieldName: 'filedType',
|
||||||
@ -293,17 +294,128 @@ export const addThingModelFormSchema = computed(() => [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'ApiSelect',
|
||||||
fieldName: 'ioTPlatformRawFieldName',
|
fieldName: 'ioTPlatformRawFieldName',
|
||||||
label: $t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
label: $t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
||||||
rules: z.preprocess(
|
rules: z.preprocess(
|
||||||
(v) => (v == null ? '' : v),
|
(v) => (v == null ? '' : v),
|
||||||
z.string().min(1, $t('common.required')),
|
z.string().min(1, $t('common.required')),
|
||||||
),
|
),
|
||||||
componentProps: {
|
dependencies: {
|
||||||
|
triggerFields: ['_ioTPlatform', '_ioTPlatformProductId'],
|
||||||
|
componentProps: (formValues: any) => {
|
||||||
|
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
|
||||||
|
let platform = formValues?._ioTPlatform;
|
||||||
|
let productId = formValues?._ioTPlatformProductId;
|
||||||
|
|
||||||
|
// 如果表单值中没有,尝试从其他字段获取
|
||||||
|
if (!platform && formValues?.ioTPlatform) {
|
||||||
|
platform = typeof formValues.ioTPlatform === 'string'
|
||||||
|
? Number.parseInt(formValues.ioTPlatform)
|
||||||
|
: formValues.ioTPlatform;
|
||||||
|
}
|
||||||
|
if (!productId && formValues?.ioTPlatformProductId) {
|
||||||
|
productId = formValues.ioTPlatformProductId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果还是没有,尝试从外部函数获取(作为后备方案)
|
||||||
|
if (!platform) {
|
||||||
|
const externalPlatform = getPlatform();
|
||||||
|
if (externalPlatform) {
|
||||||
|
platform = typeof externalPlatform === 'string'
|
||||||
|
? Number.parseInt(externalPlatform)
|
||||||
|
: externalPlatform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!productId) {
|
||||||
|
const externalProductId = getProductId();
|
||||||
|
if (externalProductId) {
|
||||||
|
productId = String(externalProductId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保平台类型是数字
|
||||||
|
if (platform && typeof platform === 'string') {
|
||||||
|
platform = Number.parseInt(platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调试信息
|
||||||
|
console.log('平台物模型编码下拉框配置:', {
|
||||||
|
platform,
|
||||||
|
productId,
|
||||||
|
hasApi: !!(platform && productId),
|
||||||
|
fromForm: {
|
||||||
|
_ioTPlatform: formValues?._ioTPlatform,
|
||||||
|
_ioTPlatformProductId: formValues?._ioTPlatformProductId,
|
||||||
|
ioTPlatform: formValues?.ioTPlatform,
|
||||||
|
ioTPlatformProductId: formValues?.ioTPlatformProductId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
api:
|
||||||
|
platform && productId
|
||||||
|
? postAggregationIoTplatformGetIoTplatformProductPropertyInfoAsync
|
||||||
|
: null,
|
||||||
|
params:
|
||||||
|
platform && productId
|
||||||
|
? {
|
||||||
|
body: {
|
||||||
|
ioTPlatformType:
|
||||||
|
typeof platform === 'string'
|
||||||
|
? Number.parseInt(platform)
|
||||||
|
: platform,
|
||||||
|
ioTPlatformProductId: String(productId),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
labelField: 'value',
|
||||||
|
valueField: 'key',
|
||||||
|
optionsPropName: 'options',
|
||||||
|
immediate: !!(platform && productId), // 当有平台和产品ID时立即加载
|
||||||
|
allowClear: true,
|
||||||
placeholder:
|
placeholder:
|
||||||
$t('common.pleaseInput') +
|
$t('common.pleaseSelect') +
|
||||||
$t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
$t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
||||||
|
afterFetch: (res: any) => {
|
||||||
|
// 确保返回的是数组格式
|
||||||
|
let items = [];
|
||||||
|
if (Array.isArray(res)) {
|
||||||
|
items = res;
|
||||||
|
} else if (res && Array.isArray(res.items)) {
|
||||||
|
items = res.items;
|
||||||
|
} else if (res && Array.isArray(res.data)) {
|
||||||
|
items = res.data;
|
||||||
|
}
|
||||||
|
// 存储原始数据映射,用于后续查找 secondValue
|
||||||
|
const optionMap = new Map();
|
||||||
|
items.forEach((item: any) => {
|
||||||
|
if (item.key) {
|
||||||
|
optionMap.set(item.key, item.secondValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
(formValues as any)._platformPropertyMap = optionMap;
|
||||||
|
return items;
|
||||||
|
},
|
||||||
|
onChange: (value: string) => {
|
||||||
|
// 选择后自动设置平台物模型数值类型为选中项的 secondValue
|
||||||
|
const optionMap = (formValues as any)._platformPropertyMap;
|
||||||
|
if (optionMap && value) {
|
||||||
|
let secondValue = optionMap.get(value);
|
||||||
|
if (secondValue) {
|
||||||
|
// 兼容 BOOL / BOOLEAN 差异,统一转换为后端 / 枚举使用的 BOOLEAN
|
||||||
|
if (
|
||||||
|
typeof secondValue === 'string' &&
|
||||||
|
secondValue.toUpperCase() === 'BOOL'
|
||||||
|
) {
|
||||||
|
secondValue = 'BOOLEAN';
|
||||||
|
}
|
||||||
|
formValues.ioTPlatformRawFieldDataType = secondValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -368,7 +480,7 @@ export const addThingModelFormSchema = computed(() => [
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// 编辑物模型表单schema
|
// 编辑物模型表单schema
|
||||||
export const editThingModelFormSchema = computed(() => [
|
export const getEditThingModelFormSchema = (getPlatform: () => number | string | undefined, getProductId: () => string | undefined) => computed(() => [
|
||||||
{
|
{
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
fieldName: 'filedType',
|
fieldName: 'filedType',
|
||||||
@ -481,18 +593,128 @@ export const editThingModelFormSchema = computed(() => [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'ApiSelect',
|
||||||
fieldName: 'ioTPlatformRawFieldName',
|
fieldName: 'ioTPlatformRawFieldName',
|
||||||
label: $t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
label: $t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
||||||
rules: z.preprocess(
|
rules: z.preprocess(
|
||||||
(v) => (v == null ? '' : v),
|
(v) => (v == null ? '' : v),
|
||||||
z.string().min(1, $t('common.required')),
|
z.string().min(1, $t('common.required')),
|
||||||
),
|
),
|
||||||
componentProps: {
|
dependencies: {
|
||||||
// disabled: true, // 编辑时禁用
|
triggerFields: ['_ioTPlatform', '_ioTPlatformProductId'],
|
||||||
|
componentProps: (formValues: any) => {
|
||||||
|
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
|
||||||
|
let platform = formValues?._ioTPlatform;
|
||||||
|
let productId = formValues?._ioTPlatformProductId;
|
||||||
|
|
||||||
|
// 如果表单值中没有,尝试从其他字段获取
|
||||||
|
if (!platform && formValues?.ioTPlatform) {
|
||||||
|
platform = typeof formValues.ioTPlatform === 'string'
|
||||||
|
? Number.parseInt(formValues.ioTPlatform)
|
||||||
|
: formValues.ioTPlatform;
|
||||||
|
}
|
||||||
|
if (!productId && formValues?.ioTPlatformProductId) {
|
||||||
|
productId = formValues.ioTPlatformProductId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果还是没有,尝试从外部函数获取(作为后备方案)
|
||||||
|
if (!platform) {
|
||||||
|
const externalPlatform = getPlatform();
|
||||||
|
if (externalPlatform) {
|
||||||
|
platform = typeof externalPlatform === 'string'
|
||||||
|
? Number.parseInt(externalPlatform)
|
||||||
|
: externalPlatform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!productId) {
|
||||||
|
const externalProductId = getProductId();
|
||||||
|
if (externalProductId) {
|
||||||
|
productId = String(externalProductId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保平台类型是数字
|
||||||
|
if (platform && typeof platform === 'string') {
|
||||||
|
platform = Number.parseInt(platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调试信息
|
||||||
|
console.log('平台物模型编码下拉框配置:', {
|
||||||
|
platform,
|
||||||
|
productId,
|
||||||
|
hasApi: !!(platform && productId),
|
||||||
|
fromForm: {
|
||||||
|
_ioTPlatform: formValues?._ioTPlatform,
|
||||||
|
_ioTPlatformProductId: formValues?._ioTPlatformProductId,
|
||||||
|
ioTPlatform: formValues?.ioTPlatform,
|
||||||
|
ioTPlatformProductId: formValues?.ioTPlatformProductId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
api:
|
||||||
|
platform && productId
|
||||||
|
? postAggregationIoTplatformGetIoTplatformProductPropertyInfoAsync
|
||||||
|
: null,
|
||||||
|
params:
|
||||||
|
platform && productId
|
||||||
|
? {
|
||||||
|
body: {
|
||||||
|
ioTPlatformType:
|
||||||
|
typeof platform === 'string'
|
||||||
|
? Number.parseInt(platform)
|
||||||
|
: platform,
|
||||||
|
ioTPlatformProductId: String(productId),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
labelField: 'value',
|
||||||
|
valueField: 'key',
|
||||||
|
optionsPropName: 'options',
|
||||||
|
immediate: !!(platform && productId), // 当有平台和产品ID时立即加载
|
||||||
|
allowClear: true,
|
||||||
placeholder:
|
placeholder:
|
||||||
$t('common.pleaseInput') +
|
$t('common.pleaseSelect') +
|
||||||
$t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
$t('abp.thingModelInfos.IoTPlatformRawFieldName'),
|
||||||
|
afterFetch: (res: any) => {
|
||||||
|
// 确保返回的是数组格式
|
||||||
|
let items = [];
|
||||||
|
if (Array.isArray(res)) {
|
||||||
|
items = res;
|
||||||
|
} else if (res && Array.isArray(res.items)) {
|
||||||
|
items = res.items;
|
||||||
|
} else if (res && Array.isArray(res.data)) {
|
||||||
|
items = res.data;
|
||||||
|
}
|
||||||
|
// 存储原始数据映射,用于后续查找 secondValue
|
||||||
|
const optionMap = new Map();
|
||||||
|
items.forEach((item: any) => {
|
||||||
|
if (item.key) {
|
||||||
|
optionMap.set(item.key, item.secondValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
(formValues as any)._platformPropertyMap = optionMap;
|
||||||
|
return items;
|
||||||
|
},
|
||||||
|
onChange: (value: string) => {
|
||||||
|
// 选择后自动设置平台物模型数值类型为选中项的 secondValue
|
||||||
|
const optionMap = (formValues as any)._platformPropertyMap;
|
||||||
|
if (optionMap && value) {
|
||||||
|
let secondValue = optionMap.get(value);
|
||||||
|
if (secondValue) {
|
||||||
|
// 兼容 BOOL / BOOLEAN 差异,统一转换为后端 / 枚举使用的 BOOLEAN
|
||||||
|
if (
|
||||||
|
typeof secondValue === 'string' &&
|
||||||
|
secondValue.toUpperCase() === 'BOOL'
|
||||||
|
) {
|
||||||
|
secondValue = 'BOOLEAN';
|
||||||
|
}
|
||||||
|
formValues.ioTPlatformRawFieldDataType = secondValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user