Commit 8919a212b99e1599883664f4b64487cc156f9cac

Authored by ww
1 parent c2544ad5

feat: device list create new device add code field

... ... @@ -34,6 +34,12 @@ export const step1Schemas: FormSchema[] = [
34 34 slot: 'snCode',
35 35 },
36 36 {
  37 + field: 'transportType',
  38 + label: '类型',
  39 + component: 'Input',
  40 + show: false,
  41 + },
  42 + {
37 43 field: 'profileId',
38 44 label: '所属产品',
39 45 required: true,
... ... @@ -44,9 +50,9 @@ export const step1Schemas: FormSchema[] = [
44 50 api: deviceProfile,
45 51 labelField: 'name',
46 52 valueField: 'tbProfileId',
47   - onChange(_value: string, option: { deviceType: string }) {
48   - const { deviceType } = option;
49   - setFieldsValue({ deviceType: deviceType });
  53 + onChange(_value: string, option: { deviceType: string; transportType: string }) {
  54 + const { deviceType, transportType } = option;
  55 + setFieldsValue({ deviceType: deviceType, transportType });
50 56 },
51 57 };
52 58 },
... ... @@ -69,6 +75,17 @@ export const step1Schemas: FormSchema[] = [
69 75 },
70 76 },
71 77 {
  78 + field: 'code',
  79 + label: '地址码',
  80 + component: 'Input',
  81 + ifShow: ({ model }) => {
  82 + return model['transportType'] === 'TCP';
  83 + },
  84 + dynamicRules: ({ model }) => {
  85 + return [{ required: model['transportType'] === 'TCP', message: '地址码为必填项' }];
  86 + },
  87 + },
  88 + {
72 89 field: 'brand',
73 90 component: 'ApiRadioGroup',
74 91 label: '选择厂家',
... ...