diff --git a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/StandardThingModelCodeSelect.vue b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/StandardThingModelCodeSelect.vue
index 116da3a..de4d207 100644
--- a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/StandardThingModelCodeSelect.vue
+++ b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/StandardThingModelCodeSelect.vue
@@ -1,5 +1,5 @@
diff --git a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/index.vue b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/index.vue
index 541d3fd..cec9685 100644
--- a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/index.vue
+++ b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/index.vue
@@ -2,20 +2,20 @@
import type { VbenFormProps } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
-import { computed, h, nextTick, ref, watch } from 'vue';
+import { h, nextTick, ref, watch } from 'vue';
import { useVbenModal } from '@vben/common-ui';
-import { message as Message, Tag, Modal } from 'ant-design-vue';
+import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
- postThingModelInfoPageAsync,
- postThingModelInfoDeleteAsync,
- postThingModelInfoCreateAsync,
- postThingModelInfoUpdateAsync,
postThingModelInfoCopyStandardThingModel,
+ postThingModelInfoCreateAsync,
+ postThingModelInfoDeleteAsync,
+ postThingModelInfoPageAsync,
+ postThingModelInfoUpdateAsync,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@@ -31,14 +31,6 @@ defineOptions({
name: 'ThingModelInfoModal',
});
-// 定义props
-interface Props {
- visible?: boolean;
- productId?: string;
- productName?: string;
- ioTPlatform?: string;
-}
-
const props = withDefaults(defineProps(), {
visible: false,
productId: '',
@@ -48,10 +40,18 @@ const props = withDefaults(defineProps(), {
// 定义emits
const emit = defineEmits<{
+ close: [];
'update:visible': [value: boolean];
- 'close': [];
}>();
+// 定义props
+interface Props {
+ visible?: boolean;
+ productId?: string;
+ productName?: string;
+ ioTPlatform?: string;
+}
+
const formOptions: VbenFormProps = {
schema: querySchema.value,
};
@@ -154,11 +154,11 @@ watch(
try {
// 设置表单筛选条件
const filterValues: any = {};
-
+
if (ioTPlatform) {
filterValues.ioTPlatform = ioTPlatform;
}
-
+
if (productId) {
filterValues.oneNETProductId = productId;
}
@@ -177,7 +177,7 @@ watch(
}, 100);
}
},
- { immediate: true }
+ { immediate: true },
);
// 新增和编辑提交的逻辑
@@ -193,16 +193,12 @@ async function submit() {
const formValues = await formApi.getValues();
const fetchParams: any = {
- query: {
- input: {
- ...formValues,
- // 自动添加平台和产品信息
- ioTPlatform: parseInt(props.ioTPlatform) as 1 | 2,
- ioTPlatformProductId: props.productId,
- // 编辑时需要添加ID
- ...(isEdit && { id: editRow.value.id }),
- },
- },
+ ...formValues,
+ // 自动添加平台和产品信息
+ ioTPlatform: Number.parseInt(props.ioTPlatform) as 1 | 2,
+ ioTPlatformProductId: props.productId,
+ // 编辑时需要添加ID
+ ...(isEdit && { id: editRow.value.id }),
};
try {
@@ -284,17 +280,11 @@ function closeModal() {
-
-
-
+
+
+
- (row.isValueNeedConvert ? '是' : '否'),
)
" />
@@ -330,11 +322,12 @@ function closeModal() {
auth: ['AbpIdentity.Users.Update'],
onClick: onEdit.bind(null, row),
},
- ]" :drop-down-actions="[
{
label: $t('common.delete'),
icon: 'ant-design:delete-outlined',
- type: 'primary',
+ type: 'link',
+ size: 'small',
+ auth: ['AbpIdentity.Users.Delete'],
popConfirm: {
title: $t('common.askConfirmDelete'),
confirm: onDel.bind(null, row),
diff --git a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts
index 7fe0eef..4d467ab 100644
--- a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts
+++ b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts
@@ -146,24 +146,18 @@ export const addThingModelFormSchema = computed(() => [
},
{
component: 'StandardThingModelCodeSelect',
- fieldName: 'standardFieldName',
- label: $t('abp.thingModelInfos.StandardFieldName'),
+ fieldName: 'standardFieldDisplayName',
+ label: $t('abp.thingModelInfos.StandardFieldDisplayName'),
rules: z.preprocess(
(v) => (v == null ? '' : v),
z.string().min(1, $t('common.required')),
),
- dependencies: {
- show(values: any) {
- return !!values?.filedType;
- },
- triggerFields: ['filedType'],
- },
componentProps: (formValues: any) => ({
// 传入联动的类型编码(运行时具体值)
typeCode: formValues?.filedType ?? null,
onResolve: (item: any | null) => {
// 选择后自动回填:名称=displayText,值类型=extendedAttribute(转大写)
- formValues.standardFieldDisplayName = item?.displayText ?? '';
+ formValues.standardFieldName = item?.code ?? '';
formValues.standardFieldValueType = (item?.extendedAttribute ?? '')
.toString()
.toUpperCase();
@@ -172,6 +166,20 @@ export const addThingModelFormSchema = computed(() => [
$t('common.pleaseSelect') + $t('abp.thingModelInfos.StandardFieldName'),
}),
},
+ {
+ component: 'Input',
+ fieldName: 'standardFieldName',
+ label: $t('abp.thingModelInfos.StandardFieldName'),
+ rules: z.preprocess(
+ (v) => (v == null ? '' : v),
+ z.string().min(1, $t('common.required')),
+ ),
+ componentProps: {
+ placeholder:
+ $t('common.pleaseInput') +
+ $t('abp.thingModelInfos.StandardFieldDisplayName'),
+ },
+ },
{
component: 'ApiSelect',
fieldName: 'standardFieldValueType',
@@ -209,21 +217,7 @@ export const addThingModelFormSchema = computed(() => [
return [];
},
},
- },
- {
- component: 'Input',
- fieldName: 'standardFieldDisplayName',
- label: $t('abp.thingModelInfos.StandardFieldDisplayName'),
- rules: z.preprocess(
- (v) => (v == null ? '' : v),
- z.string().min(1, $t('common.required')),
- ),
- componentProps: {
- placeholder:
- $t('common.pleaseInput') +
- $t('abp.thingModelInfos.StandardFieldDisplayName'),
- },
- },
+ },
{
component: 'Switch',
fieldName: 'isValueNeedConvert',
@@ -253,10 +247,11 @@ export const editThingModelFormSchema = computed(() => [
},
},
labelField: 'value',
- valueField: 'value',
+ valueField: 'key',
optionsPropName: 'options',
immediate: true,
- placeholder: $t('abp.thingModelInfos.PleaseSelectFiledType'),
+ disabled: true, // 编辑时禁用
+ placeholder: $t('common.pleaseSelect') + $t('abp.thingModelInfos.FiledType'),
afterFetch: (res: any) => {
// 确保返回的是数组格式
if (Array.isArray(res)) {
@@ -281,39 +276,49 @@ export const editThingModelFormSchema = computed(() => [
z.string().min(1, $t('common.required')),
),
componentProps: {
- placeholder: $t('abp.thingModelInfos.PleaseInputIoTPlatformRawFieldName'),
+ // disabled: true, // 编辑时禁用
+ placeholder: $t('common.pleaseInput') +
+ $t('abp.thingModelInfos.IoTPlatformRawFieldName'),
},
},
{
component: 'StandardThingModelCodeSelect',
- fieldName: 'standardFieldName',
- label: $t('abp.thingModelInfos.StandardFieldName'),
+ fieldName: 'standardFieldDisplayName',
+ label: $t('abp.thingModelInfos.StandardFieldDisplayName'),
rules: z.preprocess(
(v) => (v == null ? '' : v),
z.string().min(1, $t('common.required')),
),
- dependencies: {
- show(values: any) {
- return !!values?.filedType;
- },
- triggerFields: ['filedType'],
- },
componentProps: (formValues: any) => ({
typeCode: formValues?.filedType ?? null,
+ disabled: true, // 编辑时禁用
onResolve: (item: any | null) => {
- formValues.standardFieldDisplayName = item?.displayText ?? '';
+ formValues.standardFieldDisplayName = item?.code ?? '';
formValues.standardFieldValueType = (item?.extendedAttribute ?? '')
.toString()
.toUpperCase();
},
- placeholder: $t('abp.thingModelInfos.PleaseSelectStandardFieldName'),
+ placeholder: $t('common.pleaseInput') + $t('abp.thingModelInfos.StandardFieldDisplayName'),
}),
},
+ {
+ component: 'Input',
+ fieldName: 'standardFieldName',
+ label: $t('abp.thingModelInfos.StandardFieldName'),
+ rules: z.string().min(1, $t('common.required')),
+ componentProps: {
+ disabled: true, // 编辑时禁用
+ placeholder: $t('common.pleaseSelect') + $t('abp.thingModelInfos.StandardFieldName')
+ },
+ },
{
component: 'ApiSelect',
fieldName: 'standardFieldValueType',
label: $t('abp.thingModelInfos.StandardFieldValueType'),
- rules: z.string().min(1, $t('common.required')),
+ rules: z.preprocess(
+ (v) => (v == null ? '' : v),
+ z.string().min(1, $t('common.required')),
+ ),
componentProps: {
api: getCommonGetSelectList,
params: {
@@ -321,30 +326,31 @@ export const editThingModelFormSchema = computed(() => [
typeName: 'StandardThingModelDataTypeEnum',
},
},
- labelField: 'value',
- valueField: 'value',
optionsPropName: 'options',
immediate: true,
- placeholder: $t('abp.thingModelInfos.PleaseSelectStandardFieldValueType'),
+ allowClear: true,
+ disabled: true, // 编辑时禁用
+ placeholder: $t('common.pleaseSelect') +
+ $t('abp.thingModelInfos.StandardFieldValueType'),
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;
- return [];
+ 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;
+ }
+ // 转换选项值以匹配列表中的小写值
+ return items.map((item: any) => ({
+ ...item,
+ // 使用secondValue的小写版本作为value,保持label为原始value
+ value: item.secondValue?.toLowerCase() || item.value?.toLowerCase(),
+ label: item.value, // 显示文本
+ }));
},
},
- },
- {
- component: 'Input',
- fieldName: 'standardFieldDisplayName',
- label: $t('abp.thingModelInfos.StandardFieldDisplayName'),
- rules: z.string().min(1, $t('common.required')),
- componentProps: {
- placeholder: $t(
- 'abp.thingModelInfos.PleaseInputStandardFieldDisplayName',
- ),
- },
- },
+ },
{
component: 'Switch',
fieldName: 'isValueNeedConvert',