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