Commit c9ca4c2e378e05d4ca3cd75e30864a705762c676

Authored by xp.Huang
2 parents 77ed229f 1e70c307

Merge branch 'ww' into 'main'

feat: model of matter save accessMode, callType, eventType fields

See merge request huang/yun-teng-iot-front!395
... ... @@ -42,7 +42,9 @@ export interface ModelOfMatterParams {
42 42 identifier: string;
43 43 remark: string;
44 44 id?: string;
45   - // callType
  45 + callType?: string;
  46 + eventType?: string;
  47 + accessMode?: string;
46 48 }
47 49
48 50 export interface GetModelTslParams {
... ...
... ... @@ -236,14 +236,14 @@ export const formSchemas: FormSchema[] = [
236 236 ifShow: ({ values }) => values[FormField.TYPE] === DateTypeEnum.IS_STRING,
237 237 },
238 238 {
239   - field: FormField.R_W_FLAG,
  239 + field: FormField.ACCESS_MODE,
240 240 component: 'ApiRadioGroup',
241 241 label: '读写类型',
242 242 required: true,
243 243 colProps: {
244 244 span: 24,
245 245 },
246   - defaultValue: 'READ_ONLY',
  246 + defaultValue: 'r',
247 247 componentProps: {
248 248 placeholder: '请选择读写类型',
249 249 api: findDictItemByCode,
... ...
... ... @@ -16,8 +16,9 @@ export function transfromToStructJSON(value: StructFormValue): StructJSON {
16 16 identifier,
17 17 remark,
18 18 specs,
  19 + assessMode,
19 20 } = value;
20   - const basic = { functionName, identifier, remark };
  21 + const basic = { functionName, identifier, remark, assessMode };
21 22 let dataType = {} as unknown as DataType;
22 23
23 24 switch (type) {
... ...
... ... @@ -24,13 +24,14 @@
24 24 async function getFormData(): Promise<Partial<ModelOfMatterParams>> {
25 25 const _values = (await validate()) as StructFormValue;
26 26 if (!_values) return {};
27   - const { functionName, remark, identifier } = _values;
  27 + const { functionName, remark, identifier, accessMode } = _values;
28 28 const structJSON = transfromToStructJSON(_values);
29 29 const value = {
30 30 functionName,
31 31 functionType: FunctionType.PROPERTIES,
32 32 remark,
33 33 identifier,
  34 + accessMode,
34 35 functionJson: {
35 36 dataType: structJSON.dataType,
36 37 },
... ...
... ... @@ -20,28 +20,28 @@
20 20
21 21 //回显数据
22 22 const setFormData = (record: ModelOfMatterParams) => {
23   - const { functionJson = {}, functionName, identifier, remark } = record;
  23 + const { functionJson = {}, functionName, identifier, remark, eventType } = record;
24 24 const { outputData } = functionJson;
25 25 const value = {
26 26 functionName,
27 27 identifier,
28 28 remark,
29 29 outputData,
  30 + eventType,
30 31 };
31 32 setFieldsValue(value);
32 33 };
33 34
34 35 async function getFormData() {
35 36 const _values = (await validate()) as StructFormValue;
36   - const { functionName, remark, identifier, outputData } = _values;
  37 + const { functionName, remark, identifier, outputData, eventType } = _values;
37 38 if (!_values) return {} as unknown as ModelOfMatterParams;
38 39 const value = {
39 40 functionName,
40 41 identifier,
41 42 remark,
42 43 functionType: FunctionType.EVENTS,
43   - // callType,
44   - // eventType,
  44 + eventType,
45 45 functionJson: {
46 46 outputData,
47 47 },
... ...
... ... @@ -26,7 +26,7 @@
26 26
27 27 //回显数据
28 28 const setFormData = (record: ModelOfMatterParams) => {
29   - const { functionJson = {}, functionName, identifier, remark } = record;
  29 + const { functionJson = {}, functionName, identifier, remark, callType } = record;
30 30 const { inputData, outputData, serviceCommand } = functionJson;
31 31 const value = {
32 32 functionName,
... ... @@ -35,6 +35,7 @@
35 35 inputData,
36 36 outputData,
37 37 serviceCommand,
  38 + callType,
38 39 };
39 40 setFieldsValue(value);
40 41 };
... ... @@ -42,14 +43,15 @@
42 43 //获取数据
43 44 async function getFormData() {
44 45 const _values = (await validate()) as StructFormValue;
45   - const { functionName, remark, identifier, inputData, outputData, serviceCommand } = _values;
  46 + const { functionName, remark, identifier, inputData, outputData, serviceCommand, callType } =
  47 + _values;
46 48 if (!_values) return {};
47 49 const value = {
48 50 functionName,
49 51 identifier,
50 52 remark,
51 53 functionType: FunctionType.SERVICE,
52   - // callType,
  54 + callType,
53 55 functionJson: {
54 56 inputData,
55 57 outputData,
... ...
... ... @@ -17,13 +17,13 @@ export enum FormField {
17 17 BOOL_CLOSE = 'boolClose',
18 18 BOOL_OPEN = 'boolOpen',
19 19 LENGTH = 'length',
20   - R_W_FLAG = 'rwFlag',
21 20 SPECS_LIST = 'specs',
22 21 CALL_TYPE = 'callType',
23 22 INPUT_PARAM = 'inputData',
24 23 OUTPUT_PARAM = 'outputData',
25 24 EVENT_TYPE = 'eventType',
26 25 SERVICE_COMMAND = 'serviceCommand',
  26 + ACCESS_MODE = 'accessMode',
27 27
28 28 STRUCT = 'struct',
29 29 }
... ... @@ -34,6 +34,11 @@ export enum FunctionType {
34 34 SERVICE = 'services',
35 35 }
36 36
  37 +export enum AssessMode {
  38 + READ = 'r',
  39 + WRITE = 'w',
  40 +}
  41 +
37 42 /**
38 43 * 新增参数 动态显示表单
39 44 */
... ... @@ -205,7 +210,7 @@ export const eventSchemas: FormSchema[] = [
205 210 colProps: {
206 211 span: 24,
207 212 },
208   - defaultValue: 'INFO_EVENT_TYPE',
  213 + defaultValue: 'INFO',
209 214 componentProps: {
210 215 placeholder: '请选择事件类型',
211 216 api: findDictItemByCode,
... ...