@lcap/nasl 0.3.12-beta → 0.3.12-beta.3
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.
- package/out/service/logic/checktypeSocket.d.ts +5 -0
- package/out/service/logic/checktypeSocket.js +55 -0
- package/out/service/logic/checktypeSocket.js.map +1 -0
- package/out/service/logic/index.d.ts +3 -0
- package/out/service/logic/index.js +4 -1
- package/out/service/logic/index.js.map +1 -1
- package/out/types/app/App.d.ts +5 -2
- package/out/types/app/App.js +19 -1
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/Service.d.ts +1 -0
- package/out/types/app/Service.js +36 -3
- package/out/types/app/Service.js.map +1 -1
- package/out/types/data/Entity.d.ts +5 -0
- package/out/types/data/Entity.js +13 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/Enum.d.ts +4 -0
- package/out/types/data/Enum.js +7 -0
- package/out/types/data/Enum.js.map +1 -1
- package/out/types/data/Module.d.ts +34 -0
- package/out/types/data/Module.js +53 -0
- package/out/types/data/Module.js.map +1 -0
- package/out/types/data/Structure.d.ts +4 -0
- package/out/types/data/Structure.js +7 -0
- package/out/types/data/Structure.js.map +1 -1
- package/out/types/data/genBlock/genCurdEditMultipleKeyBlock.d.ts +7 -0
- package/out/types/data/genBlock/genCurdEditMultipleKeyBlock.js +470 -0
- package/out/types/data/genBlock/genCurdEditMultipleKeyBlock.js.map +1 -0
- package/out/types/data/genBlock/genCurdMultipleKeyBlock.d.ts +9 -0
- package/out/types/data/genBlock/genCurdMultipleKeyBlock.js +662 -0
- package/out/types/data/genBlock/genCurdMultipleKeyBlock.js.map +1 -0
- package/out/types/data/genBlock/index.d.ts +2 -2
- package/out/types/data/genBlock/index.js +2 -2
- package/out/types/data/genBlock/index.js.map +1 -1
- package/out/types/index.d.ts +2 -0
- package/out/types/index.js +5 -2
- package/out/types/index.js.map +1 -1
- package/out/types/logic/Logic.d.ts +4 -0
- package/out/types/logic/Logic.js +7 -0
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.js +17 -10
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.js +1 -1
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/translator.js +8 -1
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/page/View.d.ts +1 -1
- package/out/types/page/View.js +8 -1
- package/out/types/page/View.js.map +1 -1
- package/out/types/process/ProcessParam.js +1 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/package.json +2 -1
- package/src/service/logic/checktypeSocket.js +49 -0
- package/src/service/logic/index.js +3 -0
- package/src/service/modules/api.js +20 -0
- package/src/service/modules/index.js +6 -0
- package/src/types/app/App.ts +19 -3
- package/src/types/app/Service.ts +39 -4
- package/src/types/data/Entity.ts +17 -6
- package/src/types/data/Enum.ts +5 -0
- package/src/types/data/Module.ts +51 -0
- package/src/types/data/Structure.ts +5 -0
- package/src/types/data/genBlock/{genCurdEditTableBlock.ts → genCurdEditMultipleKeyBlock.ts} +38 -151
- package/src/types/data/genBlock/{genCurdBlock.ts → genCurdMultipleKeyBlock.ts} +81 -70
- package/src/types/data/genBlock/index.ts +2 -2
- package/src/types/index.ts +2 -0
- package/src/types/logic/Logic.ts +5 -0
- package/src/types/logic/LogicItem.ts +20 -13
- package/src/types/logic/Param.ts +1 -1
- package/src/types/logic/translator.js +8 -1
- package/src/types/page/View.ts +8 -1
- package/src/types/process/ProcessParam.ts +1 -1
package/src/types/data/Entity.ts
CHANGED
|
@@ -334,16 +334,27 @@ export class Entity extends Vertex implements ObjectSchema {
|
|
|
334
334
|
this.dataNode.service.emit('vertexIdToNameChange', this.id, this.name);
|
|
335
335
|
}
|
|
336
336
|
/**
|
|
337
|
-
*
|
|
338
|
-
* @param
|
|
337
|
+
* 设置实体表名
|
|
338
|
+
* @param tableName 表名
|
|
339
339
|
*/
|
|
340
|
-
|
|
341
|
-
async
|
|
342
|
-
this.assign({
|
|
340
|
+
@action('设置实体表名')
|
|
341
|
+
async setTableName(tableName: string) {
|
|
342
|
+
this.assign({ tableName });
|
|
343
343
|
await this.update(undefined, {
|
|
344
|
-
actionDesc: `设置实体"${this.name}"
|
|
344
|
+
actionDesc: `设置实体"${this.name}"的表名为"${tableName}"`,
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* 设置实体描述
|
|
349
|
+
* @param description 描述
|
|
350
|
+
*/
|
|
351
|
+
@action('设置实体描述')
|
|
352
|
+
async setDescription(description: string) {
|
|
353
|
+
this.assign({ description });
|
|
354
|
+
await this.update(undefined, {
|
|
355
|
+
actionDesc: `设置实体"${this.name}"的描述为"${description}"`,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
347
358
|
/**
|
|
348
359
|
* 同步interfaces
|
|
349
360
|
* interface、logic、params、returns、variabes采用plainAssign
|
package/src/types/data/Enum.ts
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { immutable, circular } from '../decorators';
|
|
2
|
+
import {
|
|
3
|
+
LEVEL_ENUM, Vertex,
|
|
4
|
+
Interface, Structure, Enum, App,
|
|
5
|
+
} from '..';
|
|
6
|
+
|
|
7
|
+
export interface Category {
|
|
8
|
+
level: LEVEL_ENUM.category;
|
|
9
|
+
name: string;
|
|
10
|
+
categoryInterfaces: Array<Interface>;
|
|
11
|
+
categoryStructures: Array<Structure>;
|
|
12
|
+
isLeaf: false;
|
|
13
|
+
structureExpanded: false;
|
|
14
|
+
interfaceExpanded: false;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 数据分类
|
|
18
|
+
*/
|
|
19
|
+
export class Module extends Vertex {
|
|
20
|
+
/**
|
|
21
|
+
* 模块名
|
|
22
|
+
*/
|
|
23
|
+
@immutable()
|
|
24
|
+
public readonly name: string = '';
|
|
25
|
+
@immutable()
|
|
26
|
+
public readonly level: LEVEL_ENUM = LEVEL_ENUM.module;
|
|
27
|
+
|
|
28
|
+
@immutable()
|
|
29
|
+
public globalLogics: Array<Interface> = [];
|
|
30
|
+
public structures: Array<Structure> = [];
|
|
31
|
+
public enums: Array<Enum> = [];
|
|
32
|
+
|
|
33
|
+
public structureExpanded: Boolean = false;
|
|
34
|
+
public enumExpanded: Boolean = false;
|
|
35
|
+
public globalLogicExpanded: Boolean = false;
|
|
36
|
+
public structureHidden: Boolean = false;
|
|
37
|
+
public enumHidden: Boolean = false;
|
|
38
|
+
|
|
39
|
+
@circular()
|
|
40
|
+
@immutable()
|
|
41
|
+
public readonly app: App = undefined;
|
|
42
|
+
/**
|
|
43
|
+
* @param source 需要合并的部分参数
|
|
44
|
+
*/
|
|
45
|
+
constructor(source?: Partial<Module>) {
|
|
46
|
+
super();
|
|
47
|
+
source && this.assign(source);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default Module;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1. 从genCurdEditTableBlock组件复制,算是工行的定制化需求多主键(联合主键的支持)
|
|
3
|
+
* 2. 改动了原来判断id的逻辑
|
|
4
|
+
* 3. 先简单做后续在看如何优化
|
|
5
|
+
*/
|
|
1
6
|
import { dataTypesMap, vertexsMap, utils, Entity, View, EntityProperty, Enum, LEVEL_ENUM } from '../..';
|
|
2
7
|
import {
|
|
3
|
-
filterProperty, NameGroup, genUniqueQueryNameGroup, getFirstDisplayedProperty, getParamFromResolver, genGenericTypeSchema, genVariable, genInterParam, genCallComponentLogic, genCallInterface, genQueryInterface,
|
|
8
|
+
filterProperty, NameGroup, genUniqueQueryNameGroup, getFirstDisplayedProperty, getParamFromResolver, genGenericTypeSchema, genVariable, genInterParam, genCallComponentLogic, genCallInterface, genQueryInterface,
|
|
4
9
|
genEnumSelectBlock, genEditTableTemplate, genEditTableLoadLogic, genTableRemoveLogic, genLoadSelectLogic,
|
|
5
10
|
genEditQueryStructure,
|
|
6
11
|
genBlurUpdateLogic,
|
|
@@ -77,13 +82,11 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
77
82
|
const propertyList = entity.propertyList
|
|
78
83
|
.filter(filterProperty('inForm'));
|
|
79
84
|
|
|
80
|
-
const idProperty = entity.propertyList.find((item) => item.primaryKey || item.name === 'id');
|
|
81
|
-
|
|
82
85
|
return `
|
|
83
86
|
<u-modal ref="saveModal">
|
|
84
87
|
<template #title>
|
|
85
|
-
<div v-if="
|
|
86
|
-
<div v-if="
|
|
88
|
+
<div v-if="isUpdate">修改</div>
|
|
89
|
+
<div v-if="!isUpdate">创建</div>
|
|
87
90
|
</template>
|
|
88
91
|
<template #body>
|
|
89
92
|
<u-form ref="form1">
|
|
@@ -152,8 +155,8 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
152
155
|
</template>
|
|
153
156
|
<template #foot>
|
|
154
157
|
<u-linear-layout>
|
|
155
|
-
<u-button color="primary" @click="${nameGroup.submit}()" v-if="
|
|
156
|
-
<u-button color="primary" @click="${nameGroup.submit}()" v-if="
|
|
158
|
+
<u-button color="primary" @click="${nameGroup.submit}()" v-if="isUpdate">提交修改</u-button>
|
|
159
|
+
<u-button color="primary" @click="${nameGroup.submit}()" v-if="!isUpdate">立即创建</u-button>
|
|
157
160
|
</u-linear-layout>
|
|
158
161
|
</template>
|
|
159
162
|
</u-modal>`;
|
|
@@ -228,74 +231,16 @@ function genCreateLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
228
231
|
left: {
|
|
229
232
|
level: 'expressionNode',
|
|
230
233
|
type: 'Identifier',
|
|
231
|
-
name: '
|
|
234
|
+
name: 'isUpdate',
|
|
232
235
|
},
|
|
233
236
|
right: {
|
|
234
|
-
|
|
237
|
+
folded: false,
|
|
235
238
|
level: 'expressionNode',
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
builtInFuncParams: [
|
|
240
|
-
{
|
|
241
|
-
parentAttr: 'builtInFuncParams',
|
|
242
|
-
level: 'expressionNode',
|
|
243
|
-
type: 'BuiltInFuncParam',
|
|
244
|
-
name: 'obj',
|
|
245
|
-
builtInFuncParamValue: {
|
|
246
|
-
parentAttr: 'builtInFuncParamValue',
|
|
247
|
-
level: 'expressionNode',
|
|
248
|
-
type: 'Identifier',
|
|
249
|
-
name: nameGroup.lowerEntity,
|
|
250
|
-
},
|
|
251
|
-
schema: builtInFunctions.Clone.params[0].schema,
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
genCallComponentLogic('saveModal', 'open'),
|
|
257
|
-
{
|
|
258
|
-
level: 'logicNode',
|
|
259
|
-
type: 'End',
|
|
260
|
-
label: '结束',
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
playground: [] as Array<any>,
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function genModifyLogic(entity: Entity, nameGroup: NameGroup) {
|
|
268
|
-
const scopeStructureSchema = genGenericTypeSchema('ScopeOf', { T: { $ref: nameGroup.structure } });
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
level: 'logic',
|
|
272
|
-
expanded: false,
|
|
273
|
-
name: nameGroup.modify,
|
|
274
|
-
description: '',
|
|
275
|
-
params: [
|
|
276
|
-
{
|
|
277
|
-
level: 'param',
|
|
278
|
-
type: 'Identifier',
|
|
279
|
-
name: 'event',
|
|
280
|
-
schema: {
|
|
281
|
-
type: 'string',
|
|
282
|
-
format: '',
|
|
239
|
+
parentAttr: 'right',
|
|
240
|
+
type: 'BooleanLiteral',
|
|
241
|
+
value: false,
|
|
283
242
|
},
|
|
284
243
|
},
|
|
285
|
-
{
|
|
286
|
-
level: 'param',
|
|
287
|
-
name: 'scope',
|
|
288
|
-
schema: scopeStructureSchema,
|
|
289
|
-
},
|
|
290
|
-
],
|
|
291
|
-
returns: [] as Array<any>,
|
|
292
|
-
variables: [] as Array<any>,
|
|
293
|
-
body: [
|
|
294
|
-
{
|
|
295
|
-
level: 'logicNode',
|
|
296
|
-
type: 'Start',
|
|
297
|
-
label: '开始',
|
|
298
|
-
},
|
|
299
244
|
{
|
|
300
245
|
level: 'logicNode',
|
|
301
246
|
type: 'AssignmentExpression',
|
|
@@ -321,36 +266,8 @@ function genModifyLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
321
266
|
builtInFuncParamValue: {
|
|
322
267
|
parentAttr: 'builtInFuncParamValue',
|
|
323
268
|
level: 'expressionNode',
|
|
324
|
-
type: '
|
|
325
|
-
|
|
326
|
-
parentAttr: 'builtInFuncParamValue',
|
|
327
|
-
level: 'expressionNode',
|
|
328
|
-
type: 'MemberExpression',
|
|
329
|
-
object: {
|
|
330
|
-
parentAttr: 'object',
|
|
331
|
-
level: 'expressionNode',
|
|
332
|
-
type: 'Identifier',
|
|
333
|
-
name: 'scope',
|
|
334
|
-
},
|
|
335
|
-
property: {
|
|
336
|
-
parentAttr: 'property',
|
|
337
|
-
level: 'expressionNode',
|
|
338
|
-
type: 'Identifier',
|
|
339
|
-
name: 'item',
|
|
340
|
-
schemaRef: '',
|
|
341
|
-
code: 'item',
|
|
342
|
-
},
|
|
343
|
-
code: '',
|
|
344
|
-
},
|
|
345
|
-
property: {
|
|
346
|
-
parentAttr: 'property',
|
|
347
|
-
level: 'expressionNode',
|
|
348
|
-
type: 'Identifier',
|
|
349
|
-
name: nameGroup.lowerEntity,
|
|
350
|
-
schemaRef: `${nameGroup.structure}.${nameGroup.lowerEntity}`,
|
|
351
|
-
code: '',
|
|
352
|
-
},
|
|
353
|
-
code: '',
|
|
269
|
+
type: 'Identifier',
|
|
270
|
+
name: nameGroup.lowerEntity,
|
|
354
271
|
},
|
|
355
272
|
schema: builtInFunctions.Clone.params[0].schema,
|
|
356
273
|
},
|
|
@@ -374,8 +291,6 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup, tableRefName = 'ta
|
|
|
374
291
|
const updateBodyParam = getParamFromResolver(updateResolver, 'body');
|
|
375
292
|
const createBodyparam = getParamFromResolver(createResolver, 'body');
|
|
376
293
|
|
|
377
|
-
const idProperty = entity.propertyList.find((item) => item.primaryKey || item.name === 'id');
|
|
378
|
-
|
|
379
294
|
return {
|
|
380
295
|
level: 'logic',
|
|
381
296
|
name: nameGroup.submit,
|
|
@@ -428,51 +343,25 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup, tableRefName = 'ta
|
|
|
428
343
|
type: 'IfStatement',
|
|
429
344
|
label: '条件分支',
|
|
430
345
|
test: {
|
|
431
|
-
parentAttr: 'test',
|
|
432
346
|
level: 'expressionNode',
|
|
433
|
-
|
|
434
|
-
label: '
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
level: 'expressionNode',
|
|
452
|
-
type: 'Identifier',
|
|
453
|
-
name: 'id',
|
|
454
|
-
schemaRef: idProperty.id,
|
|
455
|
-
code: `ID_${idProperty.id}`,
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
schema: builtInFunctions.Convert.params[0].schema,
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
parentAttr: 'builtInFuncParams',
|
|
462
|
-
level: 'expressionNode',
|
|
463
|
-
type: 'BuiltInFuncParam',
|
|
464
|
-
name: 'convertTo',
|
|
465
|
-
builtInFuncParamValue: {
|
|
466
|
-
level: 'expressionNode',
|
|
467
|
-
type: 'TypeNote',
|
|
468
|
-
schema: {
|
|
469
|
-
format: '',
|
|
470
|
-
type: 'boolean',
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
schema: builtInFunctions.Convert.params[1].schema,
|
|
474
|
-
},
|
|
475
|
-
],
|
|
347
|
+
parentAttr: 'test',
|
|
348
|
+
label: '比较运算',
|
|
349
|
+
type: 'BinaryExpression',
|
|
350
|
+
left: {
|
|
351
|
+
level: 'expressionNode',
|
|
352
|
+
parentAttr: 'left',
|
|
353
|
+
folded: false,
|
|
354
|
+
type: 'Identifier',
|
|
355
|
+
name: 'isUpdate',
|
|
356
|
+
},
|
|
357
|
+
right: {
|
|
358
|
+
level: 'expressionNode',
|
|
359
|
+
parentAttr: 'right',
|
|
360
|
+
folded: false,
|
|
361
|
+
type: 'BooleanLiteral',
|
|
362
|
+
value: true,
|
|
363
|
+
},
|
|
364
|
+
operator: '==',
|
|
476
365
|
},
|
|
477
366
|
consequent: [
|
|
478
367
|
genCallInterface(updateResolver.interface, [
|
|
@@ -501,7 +390,7 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup, tableRefName = 'ta
|
|
|
501
390
|
};
|
|
502
391
|
}
|
|
503
392
|
|
|
504
|
-
export function
|
|
393
|
+
export function genCurdEditMultipleKeyBlock(entity: Entity, view: View) {
|
|
505
394
|
const existingNameSets = {
|
|
506
395
|
viewLogic: new Set(view.$def.logics.map((logic) => logic.name)),
|
|
507
396
|
interface: new Set(entity.dataNode.service.interfaces.map((itface) => itface.name)),
|
|
@@ -512,7 +401,6 @@ export function genCurdEditTableBlock(entity: Entity, view: View) {
|
|
|
512
401
|
nameGroup.remove = utils.unique('remove', existingNameSets.viewLogic);
|
|
513
402
|
nameGroup.init = utils.unique('init', existingNameSets.viewLogic);
|
|
514
403
|
nameGroup.create = utils.unique('create', existingNameSets.viewLogic);
|
|
515
|
-
// nameGroup.modify = utils.unique('modify', existingNameSets.viewLogic);
|
|
516
404
|
nameGroup.submit = utils.unique('submit', existingNameSets.viewLogic);
|
|
517
405
|
nameGroup.lowerEntity = utils.firstLowerCase(entity.name);
|
|
518
406
|
nameGroup.blurUpdate = utils.unique('blurUpdate', existingNameSets.viewLogic);
|
|
@@ -553,7 +441,8 @@ export function genCurdEditTableBlock(entity: Entity, view: View) {
|
|
|
553
441
|
"variables": [
|
|
554
442
|
${JSON.stringify(genVariable(utils.firstLowerCase(entity.name), entity.schemaRef, LEVEL_ENUM.variable))},
|
|
555
443
|
${JSON.stringify(genVariable('input', entity.schemaRef, LEVEL_ENUM.variable))},
|
|
556
|
-
${JSON.stringify(genVariable('filter', entity.schemaRef, LEVEL_ENUM.variable))}
|
|
444
|
+
${JSON.stringify(genVariable('filter', entity.schemaRef, LEVEL_ENUM.variable))},
|
|
445
|
+
${JSON.stringify(genVariable('isUpdate', { type: 'boolean', format: '' }, LEVEL_ENUM.variable))}
|
|
557
446
|
],
|
|
558
447
|
"lifecycles": [
|
|
559
448
|
{
|
|
@@ -577,5 +466,3 @@ export function genCurdEditTableBlock(entity: Entity, view: View) {
|
|
|
577
466
|
</definition>
|
|
578
467
|
`;
|
|
579
468
|
}
|
|
580
|
-
|
|
581
|
-
export default genCurdEditTableBlock;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1. 从genCurdBlock组件复制,算是工行的定制化需求多主键(联合主键的支持)
|
|
3
|
+
* 2. 改动了原来判断id的逻辑
|
|
4
|
+
* 3. 先简单做后续在看如何优化,
|
|
5
|
+
* 4. 主键目前支持 Long String Double 类型接口所以只禁用了对应的三个类型
|
|
6
|
+
*/
|
|
1
7
|
import { dataTypesMap, vertexsMap, utils, Entity, View, EntityProperty, Enum, LEVEL_ENUM } from '../..';
|
|
2
8
|
import {
|
|
3
9
|
filterProperty, NameGroup, genUniqueQueryNameGroup, getFirstDisplayedProperty, getParamFromResolver, genGenericTypeSchema, genVariable, genInterParam, genCallComponentLogic, genCallInterface, genQueryInterface, genQueryStructure,
|
|
4
|
-
genEnumSelectBlock, genTableTemplate, genTableLoadLogic, genTableRemoveLogic, genLoadSelectLogic,
|
|
10
|
+
genEnumSelectBlock, genTableTemplate, genTableLoadLogic, genTableRemoveLogic, genLoadSelectLogic,
|
|
11
|
+
genGridViewTemplate, genGridViewLoadLogic, genGridViewRemoveLogic,
|
|
5
12
|
} from '.';
|
|
6
13
|
import builtInFunctions = require('./builtInFunctions.json');
|
|
7
14
|
|
|
@@ -75,13 +82,11 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
75
82
|
const propertyList = entity.propertyList
|
|
76
83
|
.filter(filterProperty('inForm'));
|
|
77
84
|
|
|
78
|
-
const idProperty = entity.propertyList.find((item) => item.primaryKey || item.name === 'id');
|
|
79
|
-
|
|
80
85
|
return `
|
|
81
86
|
<u-modal ref="saveModal">
|
|
82
87
|
<template #title>
|
|
83
|
-
<div v-if="
|
|
84
|
-
<div v-if="
|
|
88
|
+
<div v-if="isUpdate">修改</div>
|
|
89
|
+
<div v-if="!isUpdate">创建</div>
|
|
85
90
|
</template>
|
|
86
91
|
<template #body>
|
|
87
92
|
<u-form ref="form1">
|
|
@@ -95,11 +100,9 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
95
100
|
if (required)
|
|
96
101
|
rules.push('required');
|
|
97
102
|
const rulesStr = rules.join(' | ');
|
|
98
|
-
|
|
99
103
|
let formItem = `<u-form-item
|
|
100
104
|
label="${label}"
|
|
101
105
|
${required ? 'required' : ''}
|
|
102
|
-
${rulesStr.length ? `rules="${rulesStr}"` : ''}
|
|
103
106
|
>`;
|
|
104
107
|
|
|
105
108
|
if (property.$relationEntity) { // 有外键关联
|
|
@@ -111,7 +114,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
111
114
|
const lowerEntityName = utils.firstLowerCase(relationEntity.name);
|
|
112
115
|
formItem += `
|
|
113
116
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
|
|
114
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="input.${property.name}">
|
|
117
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="input.${property.name}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}>
|
|
115
118
|
</u-select>
|
|
116
119
|
`;
|
|
117
120
|
} else
|
|
@@ -120,26 +123,26 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
120
123
|
return '';
|
|
121
124
|
} else if (property.typeKey === '#/basicTypes/Boolean') {
|
|
122
125
|
formItem += `
|
|
123
|
-
<u-select clearable v-model="input.${property.name}" placeholder="请输入${label}">
|
|
126
|
+
<u-select clearable v-model="input.${property.name}" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}>
|
|
124
127
|
<u-select-item :value="true">是</u-select-item>
|
|
125
128
|
<u-select-item :value="false">否</u-select-item>
|
|
126
129
|
</u-select>`;
|
|
127
130
|
} else if (property.typeKey === '#/basicTypes/Integer' || property.typeKey === '#/basicTypes/Long') {
|
|
128
|
-
formItem += `<u-number-input v-model="input.${property.name}" placeholder="请输入${label}"></u-number-input>`;
|
|
131
|
+
formItem += `<u-number-input v-model="input.${property.name}" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}></u-number-input>`;
|
|
129
132
|
} else if (property.typeKey === '#/basicTypes/Decimal') {
|
|
130
|
-
formItem += `<u-number-input v-model="input.${property.name}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
133
|
+
formItem += `<u-number-input v-model="input.${property.name}" :precision="0" :step="0" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}></u-number-input>`;
|
|
131
134
|
} else if (property.typeKey === '#/basicTypes/Text') {
|
|
132
|
-
formItem += `<u-textarea v-model="input.${property.name}" placeholder="请输入${label}"></u-textarea>`;
|
|
135
|
+
formItem += `<u-textarea v-model="input.${property.name}" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}></u-textarea>`;
|
|
133
136
|
} else if (property.typeKey === '#/basicTypes/Date') {
|
|
134
|
-
formItem += `<u-date-picker clearable :date.sync="input.${property.name}" placeholder="请输入${label}"></u-date-picker>`;
|
|
137
|
+
formItem += `<u-date-picker clearable :date.sync="input.${property.name}" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}></u-date-picker>`;
|
|
135
138
|
} else if (property.typeKey === '#/basicTypes/Time') {
|
|
136
|
-
formItem += `<u-time-picker :time.sync="input.${property.name}" placeholder="请输入${label}"></u-time-picker>`;
|
|
139
|
+
formItem += `<u-time-picker :time.sync="input.${property.name}" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}></u-time-picker>`;
|
|
137
140
|
} else if (property.typeKey === '#/basicTypes/DateTime') {
|
|
138
|
-
formItem += `<u-date-time-picker clearable :date.sync="input.${property.name}" placeholder="请输入${label}"></u-date-time-picker>`;
|
|
141
|
+
formItem += `<u-date-time-picker clearable :date.sync="input.${property.name}" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}></u-date-time-picker>`;
|
|
139
142
|
} else if (dataTypesMap[property.typeKey].type === 'enum') {
|
|
140
143
|
formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `input.${property.name}`, '', `请选择${label}`, true);
|
|
141
144
|
} else {
|
|
142
|
-
formItem += `<u-input v-model="input.${property.name}" placeholder="请输入${label}"></u-input>`;
|
|
145
|
+
formItem += `<u-input v-model="input.${property.name}" placeholder="请输入${label}" ${property.primaryKey ? ':disabled="isUpdate"' : ''}></u-input>`;
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
formItem += `</u-form-item>\n`;
|
|
@@ -150,8 +153,8 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
150
153
|
</template>
|
|
151
154
|
<template #foot>
|
|
152
155
|
<u-linear-layout>
|
|
153
|
-
<u-button color="primary" @click="${nameGroup.submit}()" v-if="
|
|
154
|
-
<u-button color="primary" @click="${nameGroup.submit}()" v-if="
|
|
156
|
+
<u-button color="primary" @click="${nameGroup.submit}()" v-if="isUpdate">提交修改</u-button>
|
|
157
|
+
<u-button color="primary" @click="${nameGroup.submit}()" v-if="!isUpdate">立即创建</u-button>
|
|
155
158
|
</u-linear-layout>
|
|
156
159
|
</template>
|
|
157
160
|
</u-modal>`;
|
|
@@ -218,6 +221,24 @@ function genCreateLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
218
221
|
type: 'Start',
|
|
219
222
|
label: '开始',
|
|
220
223
|
},
|
|
224
|
+
{
|
|
225
|
+
level: 'logicNode',
|
|
226
|
+
type: 'AssignmentExpression',
|
|
227
|
+
label: '赋值',
|
|
228
|
+
operator: '=',
|
|
229
|
+
left: {
|
|
230
|
+
level: 'expressionNode',
|
|
231
|
+
type: 'Identifier',
|
|
232
|
+
name: 'isUpdate',
|
|
233
|
+
},
|
|
234
|
+
right: {
|
|
235
|
+
folded: false,
|
|
236
|
+
level: 'expressionNode',
|
|
237
|
+
parentAttr: 'right',
|
|
238
|
+
type: 'BooleanLiteral',
|
|
239
|
+
value: false,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
221
242
|
{
|
|
222
243
|
level: 'logicNode',
|
|
223
244
|
type: 'AssignmentExpression',
|
|
@@ -294,6 +315,24 @@ function genModifyLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
294
315
|
type: 'Start',
|
|
295
316
|
label: '开始',
|
|
296
317
|
},
|
|
318
|
+
{
|
|
319
|
+
level: 'logicNode',
|
|
320
|
+
type: 'AssignmentExpression',
|
|
321
|
+
label: '赋值',
|
|
322
|
+
operator: '=',
|
|
323
|
+
left: {
|
|
324
|
+
level: 'expressionNode',
|
|
325
|
+
type: 'Identifier',
|
|
326
|
+
name: 'isUpdate',
|
|
327
|
+
},
|
|
328
|
+
right: {
|
|
329
|
+
folded: false,
|
|
330
|
+
level: 'expressionNode',
|
|
331
|
+
parentAttr: 'right',
|
|
332
|
+
type: 'BooleanLiteral',
|
|
333
|
+
value: true,
|
|
334
|
+
},
|
|
335
|
+
},
|
|
297
336
|
{
|
|
298
337
|
level: 'logicNode',
|
|
299
338
|
type: 'AssignmentExpression',
|
|
@@ -372,8 +411,6 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup, tableRefName = 'ta
|
|
|
372
411
|
const updateBodyParam = getParamFromResolver(updateResolver, 'body');
|
|
373
412
|
const createBodyparam = getParamFromResolver(createResolver, 'body');
|
|
374
413
|
|
|
375
|
-
const idProperty = entity.propertyList.find((item) => item.primaryKey || item.name === 'id');
|
|
376
|
-
|
|
377
414
|
return {
|
|
378
415
|
level: 'logic',
|
|
379
416
|
name: nameGroup.submit,
|
|
@@ -426,51 +463,25 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup, tableRefName = 'ta
|
|
|
426
463
|
type: 'IfStatement',
|
|
427
464
|
label: '条件分支',
|
|
428
465
|
test: {
|
|
429
|
-
parentAttr: 'test',
|
|
430
466
|
level: 'expressionNode',
|
|
431
|
-
|
|
432
|
-
label: '
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
level: 'expressionNode',
|
|
450
|
-
type: 'Identifier',
|
|
451
|
-
name: 'id',
|
|
452
|
-
schemaRef: idProperty.id,
|
|
453
|
-
code: `ID_${idProperty.id}`,
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
schema: builtInFunctions.Convert.params[0].schema,
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
parentAttr: 'builtInFuncParams',
|
|
460
|
-
level: 'expressionNode',
|
|
461
|
-
type: 'BuiltInFuncParam',
|
|
462
|
-
name: 'convertTo',
|
|
463
|
-
builtInFuncParamValue: {
|
|
464
|
-
level: 'expressionNode',
|
|
465
|
-
type: 'TypeNote',
|
|
466
|
-
schema: {
|
|
467
|
-
format: '',
|
|
468
|
-
type: 'boolean',
|
|
469
|
-
},
|
|
470
|
-
},
|
|
471
|
-
schema: builtInFunctions.Convert.params[1].schema,
|
|
472
|
-
},
|
|
473
|
-
],
|
|
467
|
+
parentAttr: 'test',
|
|
468
|
+
label: '比较运算',
|
|
469
|
+
type: 'BinaryExpression',
|
|
470
|
+
left: {
|
|
471
|
+
level: 'expressionNode',
|
|
472
|
+
parentAttr: 'left',
|
|
473
|
+
folded: false,
|
|
474
|
+
type: 'Identifier',
|
|
475
|
+
name: 'isUpdate',
|
|
476
|
+
},
|
|
477
|
+
right: {
|
|
478
|
+
level: 'expressionNode',
|
|
479
|
+
parentAttr: 'right',
|
|
480
|
+
folded: false,
|
|
481
|
+
type: 'BooleanLiteral',
|
|
482
|
+
value: true,
|
|
483
|
+
},
|
|
484
|
+
operator: '==',
|
|
474
485
|
},
|
|
475
486
|
consequent: [
|
|
476
487
|
genCallInterface(updateResolver.interface, [
|
|
@@ -499,7 +510,7 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup, tableRefName = 'ta
|
|
|
499
510
|
};
|
|
500
511
|
}
|
|
501
512
|
|
|
502
|
-
export function
|
|
513
|
+
export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
503
514
|
const existingNameSets = {
|
|
504
515
|
viewLogic: new Set(view.$def.logics.map((logic) => logic.name)),
|
|
505
516
|
interface: new Set(entity.dataNode.service.interfaces.map((itface) => itface.name)),
|
|
@@ -550,7 +561,8 @@ export function genCurdBlock(entity: Entity, view: View) {
|
|
|
550
561
|
"variables": [
|
|
551
562
|
${JSON.stringify(genVariable(utils.firstLowerCase(entity.name), entity.schemaRef, LEVEL_ENUM.variable))},
|
|
552
563
|
${JSON.stringify(genVariable('input', entity.schemaRef, LEVEL_ENUM.variable))},
|
|
553
|
-
${JSON.stringify(genVariable('filter', entity.schemaRef, LEVEL_ENUM.variable))}
|
|
564
|
+
${JSON.stringify(genVariable('filter', entity.schemaRef, LEVEL_ENUM.variable))},
|
|
565
|
+
${JSON.stringify(genVariable('isUpdate', { type: 'boolean', format: '' }, LEVEL_ENUM.variable))}
|
|
554
566
|
],
|
|
555
567
|
"lifecycles": [
|
|
556
568
|
{
|
|
@@ -575,7 +587,7 @@ export function genCurdBlock(entity: Entity, view: View) {
|
|
|
575
587
|
`;
|
|
576
588
|
}
|
|
577
589
|
|
|
578
|
-
export function
|
|
590
|
+
export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
579
591
|
const existingNameSets = {
|
|
580
592
|
viewLogic: new Set(view.$def.logics.map((logic) => logic.name)),
|
|
581
593
|
interface: new Set(entity.dataNode.service.interfaces.map((itface) => itface.name)),
|
|
@@ -626,7 +638,8 @@ export function genCurdGridViewBlock(entity: Entity, view: View) {
|
|
|
626
638
|
"variables": [
|
|
627
639
|
${JSON.stringify(genVariable(utils.firstLowerCase(entity.name), entity.schemaRef, LEVEL_ENUM.variable))},
|
|
628
640
|
${JSON.stringify(genVariable('input', entity.schemaRef, LEVEL_ENUM.variable))},
|
|
629
|
-
${JSON.stringify(genVariable('filter', entity.schemaRef, LEVEL_ENUM.variable))}
|
|
641
|
+
${JSON.stringify(genVariable('filter', entity.schemaRef, LEVEL_ENUM.variable))},
|
|
642
|
+
${JSON.stringify(genVariable('isUpdate', { type: 'boolean', format: '' }, LEVEL_ENUM.variable))}
|
|
630
643
|
],
|
|
631
644
|
"lifecycles": [
|
|
632
645
|
{
|
|
@@ -650,5 +663,3 @@ export function genCurdGridViewBlock(entity: Entity, view: View) {
|
|
|
650
663
|
</definition>
|
|
651
664
|
`;
|
|
652
665
|
}
|
|
653
|
-
|
|
654
|
-
export default genCurdBlock;
|