Commit 78a878dc864906c3f9de2ac8e8a84ed2799a5970

Authored by xp.Huang
2 parents 027cf3dc 0490633d

Merge branch 'fix/service-command-issue' into 'main_dev'

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

See merge request yunteng/thingskit-front!710
... ... @@ -30,6 +30,7 @@ export interface StructJSON {
30 30 remark?: string;
31 31 dataType?: DataType;
32 32 serviceCommand?: string;
  33 + accessMode?: string;
33 34 }
34 35
35 36 export interface FunctionJson {
... ...
... ... @@ -6,6 +6,7 @@
6 6 import { DynamicProps } from '/#/utils';
7 7 import { Specs, StructJSON } from '/@/api/device/model/modelOfMatterModel';
8 8 import { BasicForm, FormProps, FormSchema, useForm } from '/@/components/Form';
  9 + import { ReadAndWriteEnum } from '/@/enums/toolEnum';
9 10
10 11 const props = withDefaults(
11 12 defineProps<{
... ... @@ -174,7 +175,10 @@
174 175 const transformToFormSchema = (inputData: StructJSON[]) => {
175 176 const schemas: FormSchema[] = [];
176 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 182 const { type, specs } = dataType! || {};
179 183
180 184 const params: BasicCreateFormParams = {
... ...
... ... @@ -18,6 +18,7 @@ import { TransportTypeEnum } from '/@/views/device/profiles/components/Transport
18 18 import { useComponentRegister } from '/@/components/Form';
19 19 import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';
20 20 import { isArray } from '/@/utils/is';
  21 +import { ReadAndWriteEnum } from '/@/enums/toolEnum';
21 22
22 23 useComponentRegister('OrgTreeSelect', OrgTreeSelect);
23 24
... ... @@ -646,7 +647,9 @@ export const actionSchema: FormSchema[] = [
646 647 callType: selected.callType,
647 648 serviceIdentifier: selected?.identifier,
648 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 655 return record;
... ... @@ -669,7 +672,9 @@ export const actionSchema: FormSchema[] = [
669 672 callType: options.callType,
670 673 serviceIdentifier: options.identifier,
671 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 680 transportType === TransportTypeEnum.TCP
... ...