@lcap/nasl 0.3.9-beta → 0.3.10-beta.nocache

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/out/service/create/errHandles.js +7 -2
  2. package/out/service/create/errHandles.js.map +1 -1
  3. package/out/service/logic/logic.d.ts +27 -0
  4. package/out/service/logic/logic.js +20 -0
  5. package/out/service/logic/logic.js.map +1 -1
  6. package/out/service/page/element.d.ts +9 -0
  7. package/out/service/page/element.js +6 -0
  8. package/out/service/page/element.js.map +1 -1
  9. package/out/service/permission/api.d.ts +57 -0
  10. package/out/service/permission/api.js +41 -0
  11. package/out/service/permission/api.js.map +1 -0
  12. package/out/service/permission/index.d.ts +2 -0
  13. package/out/service/permission/index.js +17 -0
  14. package/out/service/permission/index.js.map +1 -0
  15. package/out/service/webFile/index.js +5 -0
  16. package/out/service/webFile/index.js.map +1 -1
  17. package/out/types/app/Service.d.ts +2 -2
  18. package/out/types/app/Service.js +28 -3
  19. package/out/types/app/Service.js.map +1 -1
  20. package/out/types/cache.d.ts +6 -0
  21. package/out/types/cache.js +54 -0
  22. package/out/types/cache.js.map +1 -0
  23. package/out/types/common/Vertex.d.ts +25 -0
  24. package/out/types/common/Vertex.js +40 -0
  25. package/out/types/common/Vertex.js.map +1 -1
  26. package/out/types/data/Entity.js +1 -0
  27. package/out/types/data/Entity.js.map +1 -1
  28. package/out/types/data/Enum.d.ts +5 -0
  29. package/out/types/data/Enum.js +5 -0
  30. package/out/types/data/Enum.js.map +1 -1
  31. package/out/types/data/Interface.js +5 -3
  32. package/out/types/data/Interface.js.map +1 -1
  33. package/out/types/data/genBlock/genCreateBlock.js +5 -5
  34. package/out/types/data/genBlock/genCreateBlock.js.map +1 -1
  35. package/out/types/data/genBlock/genCurdBlock.js +3 -3
  36. package/out/types/data/genBlock/genCurdBlock.js.map +1 -1
  37. package/out/types/data/genBlock/genEnumSelectBlock.d.ts +1 -1
  38. package/out/types/data/genBlock/genEnumSelectBlock.js +2 -2
  39. package/out/types/data/genBlock/genEnumSelectBlock.js.map +1 -1
  40. package/out/types/data/genBlock/genGridViewBlock.js +12 -1
  41. package/out/types/data/genBlock/genGridViewBlock.js.map +1 -1
  42. package/out/types/data/genBlock/genListViewBlock.js +2 -2
  43. package/out/types/data/genBlock/genSelectBlock.js +2 -2
  44. package/out/types/data/genBlock/genTableBlock.js +14 -3
  45. package/out/types/data/genBlock/genTableBlock.js.map +1 -1
  46. package/out/types/data/genBlock/genUpdateBlock.js +5 -5
  47. package/out/types/data/genBlock/genUpdateBlock.js.map +1 -1
  48. package/out/types/data/systemTypes.js +47 -0
  49. package/out/types/data/systemTypes.js.map +1 -1
  50. package/out/types/enum.d.ts +6 -0
  51. package/out/types/enum.js +11 -0
  52. package/out/types/enum.js.map +1 -0
  53. package/out/types/generator/hotReload.d.ts +2 -0
  54. package/out/types/generator/hotReload.js +12 -1
  55. package/out/types/generator/hotReload.js.map +1 -1
  56. package/out/types/index.d.ts +4 -0
  57. package/out/types/index.js +6 -1
  58. package/out/types/index.js.map +1 -1
  59. package/out/types/logic/Logic.d.ts +28 -0
  60. package/out/types/logic/Logic.js +116 -31
  61. package/out/types/logic/Logic.js.map +1 -1
  62. package/out/types/logic/LogicItem.d.ts +1 -0
  63. package/out/types/logic/LogicItem.js +43 -24
  64. package/out/types/logic/LogicItem.js.map +1 -1
  65. package/out/types/logic/Param.d.ts +1 -0
  66. package/out/types/logic/Param.js +38 -20
  67. package/out/types/logic/Param.js.map +1 -1
  68. package/out/types/logic/Return.js +14 -19
  69. package/out/types/logic/Return.js.map +1 -1
  70. package/out/types/logic/Variable.js +14 -19
  71. package/out/types/logic/Variable.js.map +1 -1
  72. package/out/types/logic/translator.js +0 -2
  73. package/out/types/logic/translator.js.map +1 -1
  74. package/out/types/nuims/Nuims.d.ts +1 -1
  75. package/out/types/nuims/Nuims.js +11 -4
  76. package/out/types/nuims/Nuims.js.map +1 -1
  77. package/out/types/page/Element.d.ts +8 -0
  78. package/out/types/page/Element.js +145 -129
  79. package/out/types/page/Element.js.map +1 -1
  80. package/out/types/page/Event.js.map +1 -1
  81. package/out/types/page/Page.d.ts +1 -0
  82. package/out/types/page/Page.js +71 -37
  83. package/out/types/page/Page.js.map +1 -1
  84. package/out/types/page/View.d.ts +1 -1
  85. package/out/types/page/View.js +50 -42
  86. package/out/types/page/View.js.map +1 -1
  87. package/out/types/page/ViewParam.d.ts +1 -0
  88. package/out/types/page/ViewParam.js +23 -4
  89. package/out/types/page/ViewParam.js.map +1 -1
  90. package/out/types/page/ViewVariable.js +13 -18
  91. package/out/types/page/ViewVariable.js.map +1 -1
  92. package/out/types/permission/Permission.d.ts +41 -0
  93. package/out/types/permission/Permission.js +122 -0
  94. package/out/types/permission/Permission.js.map +1 -0
  95. package/package.json +2 -3
  96. package/src/service/create/errHandles.js +6 -2
  97. package/src/service/developPermission/api.js +37 -0
  98. package/src/service/developPermission/index.js +13 -0
  99. package/src/service/logic/logic.js +20 -0
  100. package/src/service/page/element.js +6 -0
  101. package/src/service/permission/api.js +38 -0
  102. package/src/service/permission/index.js +13 -0
  103. package/src/service/webFile/index.js +6 -1
  104. package/src/types/app/Service.ts +32 -3
  105. package/src/types/cache.ts +50 -0
  106. package/src/types/common/Vertex.ts +30 -0
  107. package/src/types/data/Entity.ts +1 -0
  108. package/src/types/data/Enum.ts +5 -0
  109. package/src/types/data/Interface.ts +4 -3
  110. package/src/types/data/genBlock/genCreateBlock.ts +5 -5
  111. package/src/types/data/genBlock/genCurdBlock.ts +3 -3
  112. package/src/types/data/genBlock/genEnumSelectBlock.ts +2 -2
  113. package/src/types/data/genBlock/genGridViewBlock.ts +12 -1
  114. package/src/types/data/genBlock/genListViewBlock.ts +2 -2
  115. package/src/types/data/genBlock/genSelectBlock.ts +2 -2
  116. package/src/types/data/genBlock/genTableBlock.ts +14 -3
  117. package/src/types/data/genBlock/genUpdateBlock.ts +5 -5
  118. package/src/types/data/systemTypes.ts +47 -0
  119. package/src/types/enum.ts +6 -0
  120. package/src/types/generator/hotReload.ts +10 -0
  121. package/src/types/index.ts +4 -0
  122. package/src/types/logic/Logic.ts +109 -28
  123. package/src/types/logic/LogicItem.ts +48 -28
  124. package/src/types/logic/Param.ts +26 -8
  125. package/src/types/logic/Return.ts +4 -9
  126. package/src/types/logic/Variable.ts +4 -8
  127. package/src/types/logic/translator.js +0 -4
  128. package/src/types/logic/translator_backup.js +5 -16
  129. package/src/types/nuims/Nuims.ts +11 -5
  130. package/src/types/page/Element.ts +101 -73
  131. package/src/types/page/Event.ts +0 -3
  132. package/src/types/page/Page.ts +86 -49
  133. package/src/types/page/View.ts +31 -22
  134. package/src/types/page/ViewParam.ts +22 -3
  135. package/src/types/page/ViewVariable.ts +4 -8
  136. package/src/types/page/dist/View.js +727 -0
  137. package/src/types/permission/Permission.ts +112 -0
  138. package/out/test/units/config.spec.d.ts +0 -1
  139. package/out/test/units/config.spec.js +0 -12
  140. package/out/test/units/config.spec.js.map +0 -1
@@ -93,6 +93,36 @@ export class Vertex extends EventEmitter {
93
93
  */
94
94
  @excludedInJSON()
95
95
  public expanded: boolean = false;
96
+ /**
97
+ * 节点是否显示
98
+ * 前端 UI 状态
99
+ */
100
+ @excludedInJSON()
101
+ public hidden: boolean = false;
102
+ /**
103
+ * 页面树节点是否显示
104
+ * 前端 UI 状态
105
+ */
106
+ @excludedInJSON()
107
+ public pageTreeNodeHidden: boolean = false;
108
+ /**
109
+ * 逻辑树节点是否显示
110
+ * 前端 UI 状态
111
+ */
112
+ @excludedInJSON()
113
+ public logicTreeNodeHidden: boolean = false;
114
+ /**
115
+ * 数据树节点是否显示
116
+ * 前端 UI 状态
117
+ */
118
+ @excludedInJSON()
119
+ public dataTreeNodeHidden: boolean = false;
120
+ /**
121
+ * 数据树节点是否展开
122
+ * 前端 UI 状态
123
+ */
124
+ @excludedInJSON()
125
+ public logicTreeNodeExpanded: boolean = false;
96
126
  /**
97
127
  * 是否为叶子节点
98
128
  * 前端 UI 状态
@@ -27,6 +27,7 @@ export const systemProperty: { [name: string]: any, } = {
27
27
  type: 'integer',
28
28
  format: 'long',
29
29
  editable: false,
30
+ required: true,
30
31
  display: {
31
32
  inTable: false,
32
33
  inFilter: false,
@@ -66,6 +66,11 @@ export class Enum extends Vertex {
66
66
  */
67
67
  @immutable()
68
68
  public readonly service: Service = undefined;
69
+ /**
70
+ * 节点是否为叶子节点
71
+ * 前端 UI 状态
72
+ */
73
+ public isLeaf = true;
69
74
  /**
70
75
  * 父节点
71
76
  */
@@ -5,6 +5,7 @@ import {
5
5
  } from '..';
6
6
  import { interfaceService } from '../../service/data';
7
7
  import { findUsageService } from '../../service/common';
8
+ import { catchFn } from '../logic/Logic';
8
9
 
9
10
  /**
10
11
  * 接口类
@@ -199,9 +200,9 @@ export class Interface extends Vertex {
199
200
  */
200
201
  @action('删除接口')
201
202
  async delete(none?: void, actionOptions?: ActionOptions) {
202
- config.defaultApp?.emit('saving');
203
+ if(this.id) config.defaultApp?.emit('saving');
203
204
 
204
- if (this.logic)
205
+ if (this.logic && this.serviceType?.toLowerCase() !== 'export')
205
206
  await this.logic.delete();
206
207
 
207
208
  if (this.id) {
@@ -245,7 +246,7 @@ export class Interface extends Vertex {
245
246
  operationDesc: actionOptions?.actionDesc || `修改接口"${this.name}"`,
246
247
  },
247
248
  body,
248
- });
249
+ }).catch(catchFn(this.logic));
249
250
  await then?.();
250
251
  await config.defaultApp?.history.load();
251
252
  config.defaultApp?.emit('saved');
@@ -29,7 +29,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
29
29
  const lowerEntityName = utils.firstLowerCase(relationEntity.name);
30
30
  formItem += `
31
31
  <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
32
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" pageable remote-paging v-model="${nameGroup.model}.${property.name}">
32
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="${nameGroup.model}.${property.name}">
33
33
  </u-select>
34
34
  `;
35
35
  } else
@@ -51,7 +51,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
51
51
  } else if (property.typeKey === '#/basicTypes/DateTime') {
52
52
  formItem += `<u-date-time-picker clearable :date.sync="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></u-date-time-picker>`;
53
53
  } else if (dataTypesMap[property.typeKey].type === 'enum') {
54
- formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${label}`);
54
+ formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${label}`, true);
55
55
  } else {
56
56
  formItem += `<u-input v-model="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></u-input>`;
57
57
  }
@@ -94,7 +94,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
94
94
  <template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
95
95
  v-model="${nameGroup.model}.${property.name}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
96
96
  text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
97
- pageable remote-paging></van-cascader></template>
97
+ :pageable="true" :remote-paging="true"></van-cascader></template>
98
98
  `;
99
99
  } else
100
100
  return '';
@@ -112,9 +112,9 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
112
112
  } else if (property.typeKey === '#/basicTypes/Date') {
113
113
  formItem += `<template #input><van-calendar v-model="${nameGroup.model}.${property.name}" title="请输入${property.label || property.name}"></van-calendar></template>`;
114
114
  } else if (property.typeKey === '#/basicTypes/Time') {
115
- formItem += `<template #input><van-datetime-picker type="time" v-model="${nameGroup.model}.${property.name}" title="请输入${property.label || property.name}"></van-datetime-picker></template>`;
115
+ formItem += `<template #input><van-datetime-picker type="time" v-model="${nameGroup.model}.${property.name}" title="请选择${property.label || property.name}" label-field=""></van-datetime-picker></template>`;
116
116
  } else if (property.typeKey === '#/basicTypes/DateTime') {
117
- formItem += `<template #input><van-datetime-picker type="datetime" v-model="${nameGroup.model}.${property.name}" title="请输入${property.label || property.name}"></van-datetime-picker></template>`;
117
+ formItem += `<template #input><van-datetime-picker type="datetime" v-model="${nameGroup.model}.${property.name}" title="请选择${property.label || property.name}" label-field=""></van-datetime-picker></template>`;
118
118
  } else if (dataTypesMap[property.typeKey].type === 'enum') {
119
119
  formItem += '<template #input>' + genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${property.label || property.name}`) + '</template>';
120
120
  } else {
@@ -25,7 +25,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
25
25
  const lowerEntityName = utils.firstLowerCase(relationEntity.name);
26
26
  formItem += `
27
27
  <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
28
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" pageable remote-paging v-model="filter.${property.name}">
28
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="filter.${property.name}">
29
29
  </u-select>
30
30
  `;
31
31
  } else
@@ -111,7 +111,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
111
111
  const lowerEntityName = utils.firstLowerCase(relationEntity.name);
112
112
  formItem += `
113
113
  <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
114
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" pageable remote-paging v-model="input.${property.name}">
114
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="input.${property.name}">
115
115
  </u-select>
116
116
  `;
117
117
  } else
@@ -137,7 +137,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
137
137
  } else if (property.typeKey === '#/basicTypes/DateTime') {
138
138
  formItem += `<u-date-time-picker clearable :date.sync="input.${property.name}" placeholder="请输入${label}"></u-date-time-picker>`;
139
139
  } else if (dataTypesMap[property.typeKey].type === 'enum') {
140
- formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `input.${property.name}`, '', `请选择${label}`);
140
+ formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `input.${property.name}`, '', `请选择${label}`, true);
141
141
  } else {
142
142
  formItem += `<u-input v-model="input.${property.name}" placeholder="请输入${label}"></u-input>`;
143
143
  }
@@ -7,14 +7,14 @@ import { config, Enum } from '../..';
7
7
  * @param size 尺寸属性的内容
8
8
  * @param placeholder 占位符的内容
9
9
  */
10
- export function genEnumSelectBlock(enumeration: Enum, vModel?: string, size?: string, placeholder?: string) {
10
+ export function genEnumSelectBlock(enumeration: Enum, vModel?: string, size?: string, placeholder?: string, hiddenAll?: boolean) {
11
11
  if (config.scope === 'h5')
12
12
  return `<van-cascader ${vModel ? ` v-model="${vModel}"` : ''}${placeholder ? ` title="${placeholder}" placeholder="${placeholder}"` : ''}
13
13
  :data-source="ID_ENUM_LIST_${enumeration.id}"></van-cascader>`;
14
14
 
15
15
  return `<u-select clearable${vModel ? ` v-model="${vModel}"` : ''}${size ? ` size="${size}"` : ''}${placeholder ? ` placeholder="${placeholder}"` : ''}
16
16
  :data-source="ID_ENUM_LIST_${enumeration.id}">
17
- <u-select-item text="全部"></u-select-item>
17
+ ${hiddenAll ? '' : '<u-select-item text="全部"></u-select-item>'}
18
18
  </u-select>`;
19
19
  }
20
20
 
@@ -31,8 +31,19 @@ export function genGridViewCardTemplate(property: EntityProperty) {
31
31
  } else
32
32
  expression = getExpression(property, `scope.item.${lowerEntityName}.${property.name}`);
33
33
 
34
+ const getText = (property: EntityProperty) => {
35
+ if (property.typeKey === '#/basicTypes/Boolean') {
36
+ return `
37
+ <u-text v-if="${expression}" text="是"></u-text>
38
+ <u-text v-if="!${expression}" text="否"></u-text>
39
+ `;
40
+ } else {
41
+ return `<u-text :text="${expression}"></u-text>`;
42
+ }
43
+ };
44
+
34
45
  return `<u-linear-layout gap="small">
35
- <u-text text="${title}:"></u-text><u-text :text="${expression}"></u-text>
46
+ <u-text text="${title}:"></u-text>${getText(property)}
36
47
  </u-linear-layout>`;
37
48
  }
38
49
 
@@ -11,7 +11,7 @@ export function genListViewTemplate(property: EntityProperty, nameGroup: NameGro
11
11
 
12
12
  return `<u-list-view ref="listView" :data-source="${nameGroup.load}" data-schema="${nameGroup.structure}"
13
13
  text-field="${nameGroup.lowerEntity}.${property.name}"
14
- value-field="${nameGroup.lowerEntity}.id" pageable remote-paging>
14
+ value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
15
15
  <template #item="scope">
16
16
  <u-linear-layout>
17
17
  <u-text :text="${expression}"></u-text>
@@ -25,7 +25,7 @@ export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameG
25
25
 
26
26
  return `<van-list-view ref="listView" :data-source="${nameGroup.load}" data-schema="${nameGroup.structure}"
27
27
  text-field="${nameGroup.lowerEntity}.${property.name}"
28
- value-field="${nameGroup.lowerEntity}.id" pageable="auto-more" remote-paging>
28
+ value-field="${nameGroup.lowerEntity}.id" pageable="auto-more" :remote-paging="true">
29
29
  <template #item="scope">
30
30
  <van-cell :value="${expression}" isLink></van-cell>
31
31
  </template>
@@ -8,14 +8,14 @@ import {
8
8
  export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
9
9
  return `<u-select clearable placeholder="请选择" ref="select" :data-source="${nameGroup.load}" data-schema="${nameGroup.structure}"
10
10
  text-field="${nameGroup.lowerEntity}.${property.name}"
11
- value-field="${nameGroup.lowerEntity}.id" pageable remote-paging>
11
+ value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
12
12
  </u-select>`;
13
13
  }
14
14
 
15
15
  export function genH5SelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
16
16
  return `<van-cascader title="请选择" placeholder="请选择" ref="select" :data-source="${nameGroup.load}" data-schema="${nameGroup.structure}"
17
17
  text-field="${nameGroup.lowerEntity}.${property.name}"
18
- value-field="${nameGroup.lowerEntity}.id" pageable remote-paging>
18
+ value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
19
19
  </van-cascader>`;
20
20
  }
21
21
 
@@ -34,10 +34,21 @@ export function genTableColumnTemplate(property: EntityProperty) {
34
34
  } else
35
35
  expression = getExpression(property, `scope.item.${lowerEntityName}.${property.name}`);
36
36
 
37
+ const getText = (property: EntityProperty) => {
38
+ if (property.typeKey === '#/basicTypes/Boolean') {
39
+ return `
40
+ <u-text v-if="${expression}" text="是"></u-text>
41
+ <u-text v-if="!${expression}" text="否"></u-text>
42
+ `;
43
+ } else {
44
+ return `<u-text :text="${expression}"></u-text>`;
45
+ }
46
+ };
47
+
37
48
  return `<u-table-view-column title="${title}">
38
49
  <template #cell="scope">
39
50
  <u-linear-layout gap="small">
40
- <u-text :text="${expression}"></u-text>
51
+ ${getText(property)}
41
52
  </u-linear-layout>
42
53
  </template>
43
54
  </u-table-view-column>`;
@@ -54,7 +65,7 @@ export function genTableTemplate(entity: Entity, nameGroup: NameGroup) {
54
65
 
55
66
  return `<u-table-view ref="tableView" :data-source="${nameGroup.load}" data-schema="${nameGroup.structure}"
56
67
  value-field="${nameGroup.lowerEntity}.id"
57
- pageable remote-paging>
68
+ :pageable="true" :remote-paging="true" :show-sizer="true">
58
69
  <u-table-view-column type="index" width="60" title="序号"></u-table-view-column>
59
70
 
60
71
  ${propertyList.map((property) => genTableColumnTemplate(property) + '\n').join('')}
@@ -281,7 +292,7 @@ export function genTableColumnBlock(property: EntityProperty, view: View) {
281
292
 
282
293
  return `
283
294
  <template>
284
- <u-table-view ref="tableView" :data-source="${nameGroup.load}" pageable remote-paging data-schema="${nameGroup.structure}">
295
+ <u-table-view ref="tableView" :data-source="${nameGroup.load}" :pageable="true" :remote-paging="true" :show-sizer="true" data-schema="${nameGroup.structure}">
285
296
  ${propertyList.map((property) => genTableColumnTemplate(property) + '\n').join('')}
286
297
  </u-table-view>
287
298
  </template>
@@ -40,7 +40,7 @@ export function genUpdateFormTemplate(
40
40
  const lowerEntityName = utils.firstLowerCase(relationEntity.name);
41
41
  formItem += `
42
42
  <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
43
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" pageable remote-paging v-model="${nameGroup.model}.${property.name}">
43
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="${nameGroup.model}.${property.name}">
44
44
  </u-select>
45
45
  `;
46
46
  } else
@@ -62,7 +62,7 @@ export function genUpdateFormTemplate(
62
62
  } else if (property.typeKey === '#/basicTypes/DateTime') {
63
63
  formItem += `<u-date-time-picker clearable :date.sync="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></u-date-time-picker>`;
64
64
  } else if (dataTypesMap[property.typeKey].type === 'enum') {
65
- formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${label}`);
65
+ formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${label}`, true);
66
66
  } else {
67
67
  formItem += `<u-input v-model="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></u-input>`;
68
68
  }
@@ -105,7 +105,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
105
105
  <template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
106
106
  v-model="${nameGroup.model}.${property.name}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
107
107
  text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
108
- pageable remote-paging></van-cascader></template>
108
+ :pageable="true" :remote-paging="true"></van-cascader></template>
109
109
  `;
110
110
  } else
111
111
  return '';
@@ -125,9 +125,9 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
125
125
  } else if (property.typeKey === '#/basicTypes/Date') {
126
126
  formItem += `<template #input><van-calendar clearable :date.sync="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></van-calendar></template>`;
127
127
  } else if (property.typeKey === '#/basicTypes/Time') {
128
- formItem += `<template #input><van-datetime-picker type="time" v-model="${nameGroup.model}.${property.name}" title="请输入${label}"></van-datetime-picker></template>`;
128
+ formItem += `<template #input><van-datetime-picker type="time" v-model="${nameGroup.model}.${property.name}" title="请选择${label}" label-field=""></van-datetime-picker></template>`;
129
129
  } else if (property.typeKey === '#/basicTypes/DateTime') {
130
- formItem += `<template #input><van-datetime-picker type="datetime" v-model="${nameGroup.model}.${property.name}" title="请输入${label}"></van-datetime-picker></template>`;
130
+ formItem += `<template #input><van-datetime-picker type="datetime" v-model="${nameGroup.model}.${property.name}" title="请选择${label}" label-field=""></van-datetime-picker></template>`;
131
131
  } else if (dataTypesMap[property.typeKey].type === 'enum') {
132
132
  formItem += '<template #input>' + genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${label}`) + '</template>';
133
133
  } else {
@@ -23,6 +23,7 @@ export const systemTypeList = [
23
23
  { kind: 'systemType', text: 'UploadEvent', value: '#/systemTypes/UploadEvent' },
24
24
  { kind: 'systemType', text: 'UploadErrorEvent', value: '#/systemTypes/UploadErrorEvent' },
25
25
  { kind: 'systemType', text: 'SortEvent', value: '#/systemTypes/SortEvent' },
26
+ { kind: 'systemType', text: 'PoiInfo', value: '#/systemTypes/PoiInfo' },
26
27
  ];
27
28
 
28
29
  export const systemTypeMap: { [name: string]: ObjectSchema } = {
@@ -1512,4 +1513,50 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
1512
1513
  },
1513
1514
  ],
1514
1515
  },
1516
+ '#/systemTypes/PoiInfo': {
1517
+ name: 'PoiInfo',
1518
+ type: 'object',
1519
+ propertyList: [
1520
+ {
1521
+ typeKey: '#/basicTypes/String',
1522
+ type: 'string',
1523
+ format: '',
1524
+ name: 'source',
1525
+ description: '信息来源',
1526
+ isLeaf: true,
1527
+ },
1528
+ {
1529
+ typeKey: '#/basicTypes/String',
1530
+ type: 'string',
1531
+ format: '',
1532
+ name: 'id',
1533
+ description: 'POI点的id',
1534
+ isLeaf: true,
1535
+ },
1536
+ {
1537
+ typeKey: '#/basicTypes/String',
1538
+ type: 'string',
1539
+ format: '',
1540
+ name: 'name',
1541
+ description: '名称',
1542
+ isLeaf: true,
1543
+ },
1544
+ {
1545
+ typeKey: '#/basicTypes/String',
1546
+ type: 'string',
1547
+ format: '',
1548
+ name: 'location',
1549
+ description: '经纬度',
1550
+ isLeaf: true,
1551
+ },
1552
+ {
1553
+ typeKey: '#/basicTypes/String',
1554
+ type: 'string',
1555
+ format: '',
1556
+ name: 'address',
1557
+ description: '地址',
1558
+ isLeaf: true,
1559
+ },
1560
+ ],
1561
+ },
1515
1562
  };
@@ -0,0 +1,6 @@
1
+ export enum BusinessCode {
2
+ ElementExist = 402002,
3
+ ElementNotExist = 402004,
4
+ ParentElementNotExist = 402006,
5
+ HasReferenced = 402005,
6
+ }
@@ -1,11 +1,21 @@
1
1
  import webFileService from '../../service/webFile';
2
2
 
3
+ let saveLastModifiedEnabled = true;
4
+ export function enableSaveLastModified() {
5
+ saveLastModifiedEnabled = true;
6
+ }
7
+ export function disableSaveLastModified() {
8
+ saveLastModifiedEnabled = false;
9
+ }
10
+
3
11
  /**
4
12
  * 生成上次修改的缓存
5
13
  * @param serviceId
6
14
  * @param path
7
15
  */
8
16
  export function saveLastModified(serviceId: string, path?: string) {
17
+ if(!saveLastModifiedEnabled) return;
18
+
9
19
  return webFileService.saveFile({
10
20
  body: {
11
21
  serviceId,
@@ -57,6 +57,7 @@ export { default as login } from './login';
57
57
  export * as utils from './utils';
58
58
  export * as genBlock from './data/genBlock';
59
59
  export * as generator from './generator';
60
+ export { Permission } from './permission/Permission';
60
61
 
61
62
  /**
62
63
  * 层级枚举
@@ -75,6 +76,7 @@ export enum LEVEL_ENUM {
75
76
 
76
77
  logic = 'logic',
77
78
  param = 'param',
79
+ timer = 'timer',
78
80
  variable = 'variable',
79
81
  return = 'return',
80
82
  interface = 'interface',
@@ -104,6 +106,7 @@ export enum LEVEL_ENUM {
104
106
  processComponent = 'processComponent',
105
107
  processParam = 'processParam',
106
108
  processReturn = 'processReturn',
109
+ processTimer = 'processTimer',
107
110
  processProperty = 'processProperty',
108
111
  processComponentReturn = 'processComponentReturn',
109
112
  processComponentVariable = 'processComponentVariable',
@@ -121,6 +124,7 @@ export const LEVEL_NAME_MAP = {
121
124
 
122
125
  logic: '逻辑',
123
126
  param: '输入参数',
127
+ timer: '定时任务',
124
128
  variable: '局部变量',
125
129
  return: '输出参数',
126
130
  interface: '接口',
@@ -5,6 +5,30 @@ import View from '../page/View';
5
5
  import { ExpressionNode, LogicItem, LogicNode } from './LogicItem';
6
6
  import { convert2SchemaType } from '../data/dataTypeUtils';
7
7
  import { isPlainObject, throttle } from 'lodash';
8
+ import { refreshInterfaces, refreshView, refreshPages } from '../cache';
9
+ import { BusinessCode } from '../enum';
10
+
11
+ export function catchFn(logic: Logic) {
12
+ return async (err: any) => {
13
+ const code = err?.code;
14
+ if([BusinessCode.ElementExist, BusinessCode.ElementNotExist].includes(code)) {
15
+ if(logic.interface) {
16
+ await refreshInterfaces();
17
+ } else if(logic.view) {
18
+ await refreshView(logic.view);
19
+ }
20
+ } else if(code === BusinessCode.ParentElementNotExist) { // 父节点不存在。视图添加逻辑,发现视图不存在
21
+ if(logic.view) {
22
+ await refreshPages();
23
+ }
24
+ } else
25
+ config.defaultApp?.emit('saved', err);
26
+
27
+ config.defaultApp?.history.load();
28
+
29
+ throw err;
30
+ }
31
+ }
8
32
 
9
33
  /**
10
34
  * 逻辑类
@@ -123,6 +147,19 @@ export class Logic extends Vertex {
123
147
  /**
124
148
  * @param source 需要合并的部分参数
125
149
  */
150
+ /**
151
+ * 逻辑配置的cron表达式
152
+ */
153
+ @immutable()
154
+ public cron: string = undefined;
155
+ /**
156
+ * 定时类型,当前只能是cronTrigger
157
+ */
158
+ @immutable()
159
+ public triggerType: string = undefined;
160
+ /**
161
+ * 定时任务
162
+ */
126
163
  constructor(source?: Partial<Logic>) {
127
164
  super();
128
165
  source && this.assign(source);
@@ -152,7 +189,7 @@ export class Logic extends Vertex {
152
189
  operationDesc: actionOptions?.actionDesc || `添加逻辑"${this.name}"`,
153
190
  },
154
191
  body,
155
- });
192
+ }).catch(catchFn(this));
156
193
  this.deepPick(result, ['id']);
157
194
  this.pick(result, ['playgroundId']);
158
195
  this.assign({ body: result.body.map((logicNode) => LogicNode.from(logicNode, this, null)) });
@@ -180,9 +217,8 @@ export class Logic extends Vertex {
180
217
  */
181
218
  @action('删除逻辑')
182
219
  async delete(none?: void, actionOptions?: ActionOptions) {
183
- config.defaultApp?.emit('saving');
184
-
185
220
  if (this.id) {
221
+ config.defaultApp?.emit('saving');
186
222
  const body = this.toPlainJSON();
187
223
  if (this.view) {
188
224
  body.moduleId = this.view.id;
@@ -191,19 +227,15 @@ export class Logic extends Vertex {
191
227
  body.moduleId = this.interface.service.id;
192
228
  body.moduleType = 'microService';
193
229
  }
194
- try {
195
- await logicService.delete({
196
- headers: {
197
- appId: config.defaultApp?.id,
198
- operationAction: actionOptions?.actionName || 'Logic.delete',
199
- operationDesc: actionOptions?.actionDesc || `删除逻辑"${this.name}"`,
200
- },
201
- body,
202
- });
203
- } catch (err) {
204
- await config.defaultApp?.history.load();
205
- throw err;
206
- }
230
+
231
+ await logicService.delete({
232
+ headers: {
233
+ appId: config.defaultApp?.id,
234
+ operationAction: actionOptions?.actionName || 'Logic.delete',
235
+ operationDesc: actionOptions?.actionDesc || `删除逻辑"${this.name}"`,
236
+ },
237
+ body,
238
+ }).catch(catchFn(this));
207
239
 
208
240
  if (this.view) {
209
241
  const { logics } = this.view.$def;
@@ -249,7 +281,7 @@ export class Logic extends Vertex {
249
281
  operationDesc: actionOptions?.actionDesc || `修改逻辑"${this.name}"`,
250
282
  },
251
283
  body,
252
- });
284
+ }).catch(catchFn(this));
253
285
 
254
286
  await then?.();
255
287
  await config.defaultApp?.history.load();
@@ -305,17 +337,16 @@ export class Logic extends Vertex {
305
337
  return this.contentPromise;
306
338
 
307
339
  return this.contentPromise = (async () => {
308
- try {
309
- const result = await logicService.loadDetail({
310
- query: {
311
- moduleId: this.moduleId,
312
- moduleType: this.moduleType,
313
- id: this.id,
314
- },
315
- });
316
- const newLogic = Logic.from(result, this.interface || this.view || this.processComponent, this);
317
- this.assign(newLogic);
318
- } catch (err) {}
340
+ const result = await logicService.loadDetail({
341
+ query: {
342
+ moduleId: this.moduleId,
343
+ moduleType: this.moduleType,
344
+ id: this.id,
345
+ },
346
+ config: { noErrorTip: true },
347
+ }).catch(catchFn(this));
348
+ const newLogic = Logic.from(result, this.interface || this.view || this.processComponent, this);
349
+ this.assign(newLogic);
319
350
  return this;
320
351
  })().finally(() => this.contentPromise = undefined);
321
352
  }
@@ -437,6 +468,56 @@ export class Logic extends Vertex {
437
468
 
438
469
  return logic;
439
470
  }
471
+ /**
472
+ * 更新定时任务
473
+ */
474
+ @action('更新定时任务')
475
+ async updateTimer(cron: string) {
476
+ this.assign({ cron });
477
+ this.triggerType = 'cronTrigger';
478
+ await this.update(undefined, {
479
+ actionDesc: `设置定时任务"为"${cron}"`,
480
+ });
481
+
482
+ if (this.view) {
483
+ this.view.page.service.emit('pageTreeChange');
484
+ this.emit('change');
485
+ }
486
+ return this;
487
+ }
488
+ /**
489
+ * 验证表达式正确与否
490
+ */
491
+ async validateTimer() {
492
+ const body = this.toPlainJSON();
493
+ const result = await logicService.validateTimer({
494
+ body,
495
+ config: {
496
+ noErrorTip: true,
497
+ },
498
+ });
499
+ return result;
500
+ }
501
+ /**
502
+ * 输出最近十次运行结果
503
+ */
504
+ async testTimer() {
505
+ const body = this.toPlainJSON();
506
+ const result = await logicService.testTimer({
507
+ body,
508
+ });
509
+ return result;
510
+ }
511
+ /**
512
+ * 更新接口缓存
513
+ */
514
+ async updateCronCache() {
515
+ const body = this.toPlainJSON();
516
+ const result = await logicService.updateCronCache({
517
+ body,
518
+ });
519
+ return result;
520
+ }
440
521
  }
441
522
 
442
523
  export default Logic;