Commit 952f89b4f3446895d230476515e72330f7a2d6d8

Authored by ww
1 parent 6cbaaabf

perf: device list page new add device select device configuration automatically link device type

@@ -34,10 +34,30 @@ export const step1Schemas: FormSchema[] = [ @@ -34,10 +34,30 @@ export const step1Schemas: FormSchema[] = [
34 slot: 'snCode', 34 slot: 'snCode',
35 }, 35 },
36 { 36 {
  37 + field: 'profileId',
  38 + label: '设备配置',
  39 + required: true,
  40 + component: 'ApiSelect',
  41 + componentProps: ({ formActionType }) => {
  42 + const { setFieldsValue } = formActionType;
  43 + return {
  44 + api: deviceProfile,
  45 + labelField: 'name',
  46 + valueField: 'id',
  47 + onChange(_value: string, option: { deviceType: string }) {
  48 + const { deviceType } = option;
  49 + setFieldsValue({ deviceType: deviceType });
  50 + },
  51 + };
  52 + },
  53 + },
  54 + {
37 field: 'deviceType', 55 field: 'deviceType',
38 label: '设备类型', 56 label: '设备类型',
39 required: true, 57 required: true,
40 component: 'ApiSelect', 58 component: 'ApiSelect',
  59 + dynamicDisabled: true,
  60 + helpMessage: ['选择设备配置,自动关联设备类型'],
41 componentProps: { 61 componentProps: {
42 placeholder: '设备类型', 62 placeholder: '设备类型',
43 api: findDictItemByCode, 63 api: findDictItemByCode,
@@ -67,17 +87,7 @@ export const step1Schemas: FormSchema[] = [ @@ -67,17 +87,7 @@ export const step1Schemas: FormSchema[] = [
67 }, 87 },
68 ifShow: ({ values }) => isGateWay(values.deviceType), 88 ifShow: ({ values }) => isGateWay(values.deviceType),
69 }, 89 },
70 - {  
71 - field: 'profileId',  
72 - label: '设备配置',  
73 - required: true,  
74 - component: 'ApiSelect',  
75 - componentProps: {  
76 - api: deviceProfile,  
77 - labelField: 'name',  
78 - valueField: 'id',  
79 - },  
80 - }, 90 +
81 { 91 {
82 field: 'organizationId', 92 field: 'organizationId',
83 label: '所属组织', 93 label: '所属组织',