|
@@ -34,6 +34,7 @@ export enum DataSourceField { |
|
@@ -34,6 +34,7 @@ export enum DataSourceField { |
34
|
DEVICE_ID = 'deviceId',
|
34
|
DEVICE_ID = 'deviceId',
|
35
|
DEVICE_PROFILE_ID = 'deviceProfileId',
|
35
|
DEVICE_PROFILE_ID = 'deviceProfileId',
|
36
|
ATTRIBUTE = 'attribute',
|
36
|
ATTRIBUTE = 'attribute',
|
|
|
37
|
+ ATTRIBUTE_NAME = 'attributeName',
|
37
|
ATTRIBUTE_RENAME = 'attributeRename',
|
38
|
ATTRIBUTE_RENAME = 'attributeRename',
|
38
|
DEVICE_NAME = 'deviceName',
|
39
|
DEVICE_NAME = 'deviceName',
|
39
|
DEVICE_RENAME = 'deviceRename',
|
40
|
DEVICE_RENAME = 'deviceRename',
|
|
@@ -113,6 +114,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
|
@@ -113,6 +114,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
113
|
[DataSourceField.DEVICE_PROFILE_ID]: null,
|
114
|
[DataSourceField.DEVICE_PROFILE_ID]: null,
|
114
|
[DataSourceField.DEVICE_ID]: null,
|
115
|
[DataSourceField.DEVICE_ID]: null,
|
115
|
[DataSourceField.ATTRIBUTE]: null,
|
116
|
[DataSourceField.ATTRIBUTE]: null,
|
|
|
117
|
+ [DataSourceField.ATTRIBUTE_NAME]: null,
|
116
|
[DataSourceField.TRANSPORT_TYPE]: null,
|
118
|
[DataSourceField.TRANSPORT_TYPE]: null,
|
117
|
});
|
119
|
});
|
118
|
},
|
120
|
},
|
|
@@ -147,6 +149,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
|
@@ -147,6 +149,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
147
|
setFieldsValue({
|
149
|
setFieldsValue({
|
148
|
[DataSourceField.DEVICE_ID]: null,
|
150
|
[DataSourceField.DEVICE_ID]: null,
|
149
|
[DataSourceField.ATTRIBUTE]: null,
|
151
|
[DataSourceField.ATTRIBUTE]: null,
|
|
|
152
|
+ [DataSourceField.ATTRIBUTE_NAME]: null,
|
150
|
[DataSourceField.TRANSPORT_TYPE]: option[DataSourceField.TRANSPORT_TYPE],
|
153
|
[DataSourceField.TRANSPORT_TYPE]: option[DataSourceField.TRANSPORT_TYPE],
|
151
|
});
|
154
|
});
|
152
|
},
|
155
|
},
|
|
@@ -223,6 +226,12 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
|
@@ -223,6 +226,12 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
223
|
},
|
226
|
},
|
224
|
},
|
227
|
},
|
225
|
{
|
228
|
{
|
|
|
229
|
+ field: DataSourceField.ATTRIBUTE_NAME,
|
|
|
230
|
+ component: 'Input',
|
|
|
231
|
+ label: '属性名',
|
|
|
232
|
+ show: false,
|
|
|
233
|
+ },
|
|
|
234
|
+ {
|
226
|
field: DataSourceField.ATTRIBUTE,
|
235
|
field: DataSourceField.ATTRIBUTE,
|
227
|
component: 'ApiSelect',
|
236
|
component: 'ApiSelect',
|
228
|
label: '属性',
|
237
|
label: '属性',
|
|
@@ -230,7 +239,8 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
|
@@ -230,7 +239,8 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
230
|
rules: [{ required: true, message: '请选择属性' }],
|
239
|
rules: [{ required: true, message: '请选择属性' }],
|
231
|
ifShow: ({ model }) =>
|
240
|
ifShow: ({ model }) =>
|
232
|
!(isTcpProfile(model[DataSourceField.TRANSPORT_TYPE]) && isControlComponent(category!)),
|
241
|
!(isTcpProfile(model[DataSourceField.TRANSPORT_TYPE]) && isControlComponent(category!)),
|
233
|
- componentProps({ formModel }) {
|
242
|
+ componentProps({ formModel, formActionType }) {
|
|
|
243
|
+ const { setFieldsValue } = formActionType;
|
234
|
const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID];
|
244
|
const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID];
|
235
|
return {
|
245
|
return {
|
236
|
api: async () => {
|
246
|
api: async () => {
|
|
@@ -246,6 +256,9 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
|
@@ -246,6 +256,9 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
246
|
},
|
256
|
},
|
247
|
placeholder: '请选择属性',
|
257
|
placeholder: '请选择属性',
|
248
|
getPopupContainer: () => document.body,
|
258
|
getPopupContainer: () => document.body,
|
|
|
259
|
+ onChange(value: string, option: Record<'label' | 'value', string>) {
|
|
|
260
|
+ setFieldsValue({ [DataSourceField.ATTRIBUTE_NAME]: value ? option.label : null });
|
|
|
261
|
+ },
|
249
|
};
|
262
|
};
|
250
|
},
|
263
|
},
|
251
|
},
|
264
|
},
|