...
|
...
|
@@ -714,62 +714,67 @@ export const TokenSchemas: FormSchema[] = [ |
714
|
714
|
},
|
715
|
715
|
];
|
716
|
716
|
|
717
|
|
-export const CommandSchemas: FormSchema[] = [
|
718
|
|
- {
|
719
|
|
- field: 'commandType',
|
720
|
|
- component: 'RadioGroup',
|
721
|
|
- label: '下发类型',
|
722
|
|
- colProps: {
|
723
|
|
- span: 8,
|
724
|
|
- },
|
725
|
|
- defaultValue: 'OneWay',
|
726
|
|
- componentProps: {
|
727
|
|
- options: [
|
728
|
|
- {
|
729
|
|
- label: '单向',
|
730
|
|
- value: 'OneWay',
|
731
|
|
- },
|
732
|
|
- {
|
733
|
|
- label: '双向',
|
734
|
|
- value: 'TwoWay',
|
735
|
|
- },
|
736
|
|
- ],
|
737
|
|
- },
|
738
|
|
- },
|
739
|
|
- {
|
740
|
|
- field: 'valueType',
|
741
|
|
- label: '命令类型',
|
742
|
|
- component: 'RadioGroup',
|
743
|
|
- defaultValue: 'json',
|
744
|
|
- componentProps: () => {
|
745
|
|
- return {
|
|
717
|
+export const CommandSchemas = (transportType: TransportTypeEnum): FormSchema[] => {
|
|
718
|
+ return [
|
|
719
|
+ {
|
|
720
|
+ field: 'commandType',
|
|
721
|
+ component: 'RadioGroup',
|
|
722
|
+ label: '下发类型',
|
|
723
|
+ colProps: {
|
|
724
|
+ span: 8,
|
|
725
|
+ },
|
|
726
|
+ defaultValue: 'OneWay',
|
|
727
|
+ componentProps: {
|
746
|
728
|
options: [
|
747
|
|
- { label: 'JSON', value: 'json' },
|
748
|
|
- { label: '字符串', value: 'string' },
|
|
729
|
+ {
|
|
730
|
+ label: '单向',
|
|
731
|
+ value: 'OneWay',
|
|
732
|
+ },
|
|
733
|
+ {
|
|
734
|
+ label: '双向',
|
|
735
|
+ value: 'TwoWay',
|
|
736
|
+ },
|
749
|
737
|
],
|
750
|
|
- };
|
|
738
|
+ },
|
751
|
739
|
},
|
752
|
|
- },
|
753
|
|
- {
|
754
|
|
- field: 'commandText',
|
755
|
|
- label: '请输入命令内容',
|
756
|
|
- ifShow: ({ model }) => {
|
757
|
|
- return model['valueType'] === 'string';
|
|
740
|
+ {
|
|
741
|
+ field: 'valueType',
|
|
742
|
+ label: '命令类型',
|
|
743
|
+ component: 'RadioGroup',
|
|
744
|
+ defaultValue: transportType === TransportTypeEnum.TCP ? 'string' : 'json',
|
|
745
|
+ componentProps: () => {
|
|
746
|
+ const options: Record<'label' | 'value', string>[] = [];
|
|
747
|
+ if (transportType === TransportTypeEnum.TCP) {
|
|
748
|
+ options.push({ label: '字符串', value: 'string' });
|
|
749
|
+ } else {
|
|
750
|
+ options.push({ label: 'JSON', value: 'json' });
|
|
751
|
+ }
|
|
752
|
+ return {
|
|
753
|
+ options,
|
|
754
|
+ };
|
|
755
|
+ },
|
758
|
756
|
},
|
759
|
|
- component: 'InputTextArea',
|
760
|
|
- componentProps: {
|
761
|
|
- autosize: {
|
762
|
|
- minRows: 6,
|
|
757
|
+ {
|
|
758
|
+ field: 'commandText',
|
|
759
|
+ label: '请输入命令内容',
|
|
760
|
+ ifShow: ({ model }) => {
|
|
761
|
+ return model['valueType'] === 'string';
|
|
762
|
+ },
|
|
763
|
+ component: 'InputTextArea',
|
|
764
|
+ componentProps: {
|
|
765
|
+ autosize: {
|
|
766
|
+ minRows: 6,
|
|
767
|
+ },
|
763
|
768
|
},
|
764
|
769
|
},
|
765
|
|
- },
|
766
|
|
- {
|
767
|
|
- field: 'commandValue',
|
768
|
|
- label: '请输入命令内容',
|
769
|
|
- slot: 'commandSlot',
|
770
|
|
- component: 'InputTextArea',
|
771
|
|
- show: ({ model }) => {
|
772
|
|
- return model['valueType'] === 'json';
|
|
770
|
+ {
|
|
771
|
+ field: 'commandValue',
|
|
772
|
+ label: '请输入命令内容',
|
|
773
|
+ slot: 'commandSlot',
|
|
774
|
+ component: 'InputTextArea',
|
|
775
|
+ show: ({ model }) => {
|
|
776
|
+ return model['valueType'] === 'json';
|
|
777
|
+ },
|
773
|
778
|
},
|
774
|
|
- },
|
775
|
|
-]; |
|
779
|
+ ];
|
|
780
|
+}; |
...
|
...
|
|