Commit 0490633d40008179f98f35b547da113fce1cfc2d

Authored by ww
1 parent 60192cc7

fix: 修复服务命令输入参数过滤只读参数

@@ -30,6 +30,7 @@ export interface StructJSON { @@ -30,6 +30,7 @@ export interface StructJSON {
30 remark?: string; 30 remark?: string;
31 dataType?: DataType; 31 dataType?: DataType;
32 serviceCommand?: string; 32 serviceCommand?: string;
  33 + accessMode?: string;
33 } 34 }
34 35
35 export interface FunctionJson { 36 export interface FunctionJson {
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 import { DynamicProps } from '/#/utils'; 6 import { DynamicProps } from '/#/utils';
7 import { Specs, StructJSON } from '/@/api/device/model/modelOfMatterModel'; 7 import { Specs, StructJSON } from '/@/api/device/model/modelOfMatterModel';
8 import { BasicForm, FormProps, FormSchema, useForm } from '/@/components/Form'; 8 import { BasicForm, FormProps, FormSchema, useForm } from '/@/components/Form';
  9 + import { ReadAndWriteEnum } from '/@/enums/toolEnum';
9 10
10 const props = withDefaults( 11 const props = withDefaults(
11 defineProps<{ 12 defineProps<{
@@ -174,7 +175,10 @@ @@ -174,7 +175,10 @@
174 const transformToFormSchema = (inputData: StructJSON[]) => { 175 const transformToFormSchema = (inputData: StructJSON[]) => {
175 const schemas: FormSchema[] = []; 176 const schemas: FormSchema[] = [];
176 for (const item of inputData) { 177 for (const item of inputData) {
177 - const { dataType, identifier, functionName } = item; 178 + const { dataType, identifier, functionName, accessMode } = item;
  179 + if (accessMode === ReadAndWriteEnum.READ) {
  180 + continue;
  181 + }
178 const { type, specs } = dataType! || {}; 182 const { type, specs } = dataType! || {};
179 183
180 const params: BasicCreateFormParams = { 184 const params: BasicCreateFormParams = {
@@ -18,6 +18,7 @@ import { TransportTypeEnum } from '/@/views/device/profiles/components/Transport @@ -18,6 +18,7 @@ import { TransportTypeEnum } from '/@/views/device/profiles/components/Transport
18 import { useComponentRegister } from '/@/components/Form'; 18 import { useComponentRegister } from '/@/components/Form';
19 import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect'; 19 import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';
20 import { isArray } from '/@/utils/is'; 20 import { isArray } from '/@/utils/is';
  21 +import { ReadAndWriteEnum } from '/@/enums/toolEnum';
21 22
22 useComponentRegister('OrgTreeSelect', OrgTreeSelect); 23 useComponentRegister('OrgTreeSelect', OrgTreeSelect);
23 24
@@ -646,7 +647,9 @@ export const actionSchema: FormSchema[] = [ @@ -646,7 +647,9 @@ export const actionSchema: FormSchema[] = [
646 callType: selected.callType, 647 callType: selected.callType,
647 serviceIdentifier: selected?.identifier, 648 serviceIdentifier: selected?.identifier,
648 thingsModelKeys: isArray(selected?.functionJson?.inputData) 649 thingsModelKeys: isArray(selected?.functionJson?.inputData)
649 - ? selected?.functionJson?.inputData.map((item) => item.identifier) 650 + ? selected?.functionJson?.inputData
  651 + .filter((item) => item.accessMode === ReadAndWriteEnum.READ_AND_WRITE)
  652 + .map((item) => item.identifier)
650 : [], 653 : [],
651 }); 654 });
652 return record; 655 return record;
@@ -669,7 +672,9 @@ export const actionSchema: FormSchema[] = [ @@ -669,7 +672,9 @@ export const actionSchema: FormSchema[] = [
669 callType: options.callType, 672 callType: options.callType,
670 serviceIdentifier: options.identifier, 673 serviceIdentifier: options.identifier,
671 thingsModelKeys: isArray(options?.functionJson?.inputData) 674 thingsModelKeys: isArray(options?.functionJson?.inputData)
672 - ? options?.functionJson?.inputData.map((item) => item.identifier) 675 + ? options?.functionJson?.inputData
  676 + .filter((item) => item.accessMode === ReadAndWriteEnum.READ_AND_WRITE)
  677 + .filter((item) => item.identifier)
673 : [], 678 : [],
674 }; 679 };
675 transportType === TransportTypeEnum.TCP 680 transportType === TransportTypeEnum.TCP