Commit c9aab2f3c9b46aac274bc63604344ca9b1cc7353

Authored by xp.Huang
2 parents b53b1b71 318fe959

Merge branch 'fix/DEFECT-208622' into 'v1.4.0_dev'

fix: TCP转换脚本点击确认时,提示Validation error: scriptType 脚本类型不能为空

See merge request yunteng/thingskit-front!1343
... ... @@ -23,12 +23,14 @@
23 23 if ([DataActionModeEnum.UPDATE, DataActionModeEnum.READ].includes(mode)) {
24 24 const { name, description, convertTbel, convertJs, scriptLanguage, serviceType } =
25 25 record || {};
  26 + activeLanguage.value = scriptLanguage;
26 27 setFieldsValue({
27 28 name,
28 29 description,
29 30 serviceType,
  31 + language: scriptLanguage,
30 32 scriptContent: {
31   - scriptLanguage,
  33 + scriptLanguage: 'JS',
32 34 value: convertJs,
33 35 },
34 36 tbelContent: {
... ... @@ -60,6 +62,7 @@
60 62 description,
61 63 scriptContent: { value },
62 64 language,
  65 + scriptType,
63 66 tbelContent: { value: taelValue },
64 67 serviceType,
65 68 } = getFieldsValue() as FormFieldsValueType;
... ... @@ -68,6 +71,7 @@
68 71 name,
69 72 description,
70 73 status: 1,
  74 + scriptType,
71 75 scriptLanguage: language,
72 76 serviceType,
73 77 };
... ...
... ... @@ -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 61 label: '脚本服务类型',
45 62 field: FormFieldsEnum.ServiceType,
46 63 component: 'ApiRadioGroup',
... ... @@ -81,7 +98,7 @@ export const formSchemas: FormSchema[] = [
81 98 label: '',
82 99 field: FormFieldsEnum.ScriptContent,
83 100 component: 'JavascriptEditorWithTestModal',
84   - show: ({ model }) => {
  101 + ifShow: ({ model }) => {
85 102 return model.language === ScriptLanguageEnum.JavaScript;
86 103 },
87 104 componentProps: {
... ... @@ -167,7 +184,7 @@ export const formSchemas: FormSchema[] = [
167 184 label: '',
168 185 field: FormFieldsEnum.TbelContent,
169 186 component: 'JavascriptEditorWithTestModal',
170   - show: ({ model }) => {
  187 + ifShow: ({ model }) => {
171 188 return model.language === ScriptLanguageEnum.TBEL;
172 189 },
173 190 componentProps: {
... ...
... ... @@ -37,10 +37,10 @@ export const aceEditorOptions = {
37 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 46 export const columns: BasicColumn[] = [
... ...