Commit c9aab2f3c9b46aac274bc63604344ca9b1cc7353
Merge branch 'fix/DEFECT-208622' into 'v1.4.0_dev'
fix: TCP转换脚本点击确认时,提示Validation error: scriptType 脚本类型不能为空 See merge request yunteng/thingskit-front!1343
Showing
3 changed files
with
28 additions
and
7 deletions
@@ -23,12 +23,14 @@ | @@ -23,12 +23,14 @@ | ||
23 | if ([DataActionModeEnum.UPDATE, DataActionModeEnum.READ].includes(mode)) { | 23 | if ([DataActionModeEnum.UPDATE, DataActionModeEnum.READ].includes(mode)) { |
24 | const { name, description, convertTbel, convertJs, scriptLanguage, serviceType } = | 24 | const { name, description, convertTbel, convertJs, scriptLanguage, serviceType } = |
25 | record || {}; | 25 | record || {}; |
26 | + activeLanguage.value = scriptLanguage; | ||
26 | setFieldsValue({ | 27 | setFieldsValue({ |
27 | name, | 28 | name, |
28 | description, | 29 | description, |
29 | serviceType, | 30 | serviceType, |
31 | + language: scriptLanguage, | ||
30 | scriptContent: { | 32 | scriptContent: { |
31 | - scriptLanguage, | 33 | + scriptLanguage: 'JS', |
32 | value: convertJs, | 34 | value: convertJs, |
33 | }, | 35 | }, |
34 | tbelContent: { | 36 | tbelContent: { |
@@ -60,6 +62,7 @@ | @@ -60,6 +62,7 @@ | ||
60 | description, | 62 | description, |
61 | scriptContent: { value }, | 63 | scriptContent: { value }, |
62 | language, | 64 | language, |
65 | + scriptType, | ||
63 | tbelContent: { value: taelValue }, | 66 | tbelContent: { value: taelValue }, |
64 | serviceType, | 67 | serviceType, |
65 | } = getFieldsValue() as FormFieldsValueType; | 68 | } = getFieldsValue() as FormFieldsValueType; |
@@ -68,6 +71,7 @@ | @@ -68,6 +71,7 @@ | ||
68 | name, | 71 | name, |
69 | description, | 72 | description, |
70 | status: 1, | 73 | status: 1, |
74 | + scriptType, | ||
71 | scriptLanguage: language, | 75 | scriptLanguage: language, |
72 | serviceType, | 76 | serviceType, |
73 | }; | 77 | }; |
@@ -41,6 +41,23 @@ export const formSchemas: FormSchema[] = [ | @@ -41,6 +41,23 @@ export const formSchemas: FormSchema[] = [ | ||
41 | }, | 41 | }, |
42 | }, | 42 | }, |
43 | { | 43 | { |
44 | + label: '脚本类型', | ||
45 | + field: 'scriptType', | ||
46 | + required: true, | ||
47 | + component: 'ApiRadioGroup', | ||
48 | + defaultValue: 'TRANSPORT_TCP_UP', | ||
49 | + componentProps: () => { | ||
50 | + return { | ||
51 | + api: findDictItemByCode, | ||
52 | + params: { | ||
53 | + dictCode: 'script_type', | ||
54 | + }, | ||
55 | + labelField: 'itemText', | ||
56 | + valueField: 'itemValue', | ||
57 | + }; | ||
58 | + }, | ||
59 | + }, | ||
60 | + { | ||
44 | label: '脚本服务类型', | 61 | label: '脚本服务类型', |
45 | field: FormFieldsEnum.ServiceType, | 62 | field: FormFieldsEnum.ServiceType, |
46 | component: 'ApiRadioGroup', | 63 | component: 'ApiRadioGroup', |
@@ -81,7 +98,7 @@ export const formSchemas: FormSchema[] = [ | @@ -81,7 +98,7 @@ export const formSchemas: FormSchema[] = [ | ||
81 | label: '', | 98 | label: '', |
82 | field: FormFieldsEnum.ScriptContent, | 99 | field: FormFieldsEnum.ScriptContent, |
83 | component: 'JavascriptEditorWithTestModal', | 100 | component: 'JavascriptEditorWithTestModal', |
84 | - show: ({ model }) => { | 101 | + ifShow: ({ model }) => { |
85 | return model.language === ScriptLanguageEnum.JavaScript; | 102 | return model.language === ScriptLanguageEnum.JavaScript; |
86 | }, | 103 | }, |
87 | componentProps: { | 104 | componentProps: { |
@@ -167,7 +184,7 @@ export const formSchemas: FormSchema[] = [ | @@ -167,7 +184,7 @@ export const formSchemas: FormSchema[] = [ | ||
167 | label: '', | 184 | label: '', |
168 | field: FormFieldsEnum.TbelContent, | 185 | field: FormFieldsEnum.TbelContent, |
169 | component: 'JavascriptEditorWithTestModal', | 186 | component: 'JavascriptEditorWithTestModal', |
170 | - show: ({ model }) => { | 187 | + ifShow: ({ model }) => { |
171 | return model.language === ScriptLanguageEnum.TBEL; | 188 | return model.language === ScriptLanguageEnum.TBEL; |
172 | }, | 189 | }, |
173 | componentProps: { | 190 | componentProps: { |
@@ -37,10 +37,10 @@ export const aceEditorOptions = { | @@ -37,10 +37,10 @@ export const aceEditorOptions = { | ||
37 | enableEmmet: true, | 37 | enableEmmet: true, |
38 | }; | 38 | }; |
39 | 39 | ||
40 | -// const scriptTypeInfo = { | ||
41 | -// TRANSPORT_TCP_UP: '上行数据解析', | ||
42 | -// TRANSPORT_TCP_AUTH: '设备鉴权', | ||
43 | -// }; | 40 | +export const scriptTypeInfo = { |
41 | + TRANSPORT_TCP_UP: '上行数据解析', | ||
42 | + TRANSPORT_TCP_AUTH: '设备鉴权', | ||
43 | +}; | ||
44 | 44 | ||
45 | // 表格配置 | 45 | // 表格配置 |
46 | export const columns: BasicColumn[] = [ | 46 | export const columns: BasicColumn[] = [ |