@simitgroup/simpleapp-generator 1.5.1-alpha → 1.6.0-alpha
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/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +10 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
- package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
- package/dist/buildinschemas/keyvaluepair.js +28 -0
- package/dist/buildinschemas/keyvaluepair.js.map +1 -0
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +18 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/systemmessage.d.ts +3 -0
- package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
- package/dist/buildinschemas/systemmessage.js +43 -0
- package/dist/buildinschemas/systemmessage.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +37 -9
- package/dist/generate.js.map +1 -1
- package/dist/processors/bpmnbuilder.d.ts.map +1 -1
- package/dist/processors/bpmnbuilder.js +23 -32
- package/dist/processors/bpmnbuilder.js.map +1 -1
- package/dist/processors/jrxmlbuilder.d.ts +3 -0
- package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
- package/dist/processors/jrxmlbuilder.js +57 -0
- package/dist/processors/jrxmlbuilder.js.map +1 -0
- package/dist/type.d.ts +6 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +10 -0
- package/src/buildinschemas/index.ts +2 -0
- package/src/buildinschemas/keyvaluepair.ts +26 -0
- package/src/buildinschemas/organization.ts +18 -1
- package/src/buildinschemas/systemmessage.ts +42 -0
- package/src/framework.ts +3 -2
- package/src/generate.ts +41 -13
- package/src/processors/bpmnbuilder.ts +34 -38
- package/src/processors/jrxmlbuilder.ts +38 -0
- package/src/type.ts +7 -1
- package/templates/basic/nest/controller.ts.eta +34 -17
- package/templates/basic/nest/resolver.ts.eta +1 -1
- package/templates/basic/nest/service.ts.eta +22 -4
- package/templates/basic/nest/type.ts.eta +2 -2
- package/templates/basic/nuxt/pages.form.vue.eta +1 -1
- package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
- package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
- package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
- package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
- package/templates/nest/src/printapi/api/api.ts.eta +223 -0
- package/templates/nest/src/printapi/api/base.ts.eta +86 -0
- package/templates/nest/src/printapi/api/common.ts.eta +150 -0
- package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
- package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
- package/templates/nest/src/printapi/api/index.ts.eta +18 -0
- package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
- package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
- package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +11 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +9 -9
- package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
- package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
- package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +29 -9
- package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
- package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +10 -3
- package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
- package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +95 -26
- package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
- package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
- package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -2
- package/templates/nest/src/simpleapp/types/index.ts._eta +5 -0
- package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
- package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
- package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
- package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +93 -7
- package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +11 -2
- package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
- package/templates/nuxt/composables/pusher.ts._eta +13 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
- package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
- package/templates/nuxt/layouts/mobile.vue._eta +31 -42
- package/templates/nuxt/nuxt.config.ts._eta +2 -2
- package/templates/nuxt/othermodules.d.ts.eta +449 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
- package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +7 -1
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
- package/templates/nuxt/types/schema.ts.eta +8 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
- package/templates/printformats/template.jrxml._eta +27 -0
- package/templates/project/groups/admin.json.eta +6 -1
- package/templates/project/jsonschemas/branch.json._eta +113 -0
- package/templates/project/jsonschemas/invoice.json._eta +5 -1
- package/templates/project/jsonschemas/organization.json._eta +111 -0
- package/templates/project/lang/default._json +70 -150
- package/templates/workflow/next/listener.ts.eta +6 -3
- package/tsconfig.tsbuildinfo +1 -1
- /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
3
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-
|
|
4
|
+
* last change 2024-04-23
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import {
|
|
8
8
|
Injectable,
|
|
9
9
|
InternalServerErrorException,
|
|
10
10
|
Logger,
|
|
11
|
+
Inject,
|
|
11
12
|
} from '@nestjs/common';
|
|
12
13
|
import {
|
|
13
14
|
IExecution,
|
|
@@ -19,13 +20,17 @@ import {
|
|
|
19
20
|
BPMNServer,
|
|
20
21
|
Execution,
|
|
21
22
|
} from 'bpmn-server';
|
|
23
|
+
import { UserResolverService } from '../../services/userresolver.service';
|
|
22
24
|
import { moddleOptions } from 'bpmn-server/dist/elements/js-bpmn-moddle';
|
|
23
25
|
let mydelegate: WorkflowDelegate;
|
|
24
26
|
@Injectable()
|
|
25
27
|
export class WorkflowDelegate implements IAppDelegate {
|
|
26
28
|
protected logger = new Logger();
|
|
27
29
|
server: BPMNServer;
|
|
28
|
-
|
|
30
|
+
|
|
31
|
+
@Inject(UserResolverService)
|
|
32
|
+
servicesProvider: UserResolverService;
|
|
33
|
+
|
|
29
34
|
constructor() {}
|
|
30
35
|
getServicesProvider = (execution: Execution) => this.servicesProvider;
|
|
31
36
|
|
|
@@ -60,7 +65,7 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
60
65
|
|
|
61
66
|
async messageThrown(messageId, data, messageMatchingKey: any, item: Item) {
|
|
62
67
|
const msgId = item.node.messageId;
|
|
63
|
-
item.context.logger.log('Message Issued' + msgId);
|
|
68
|
+
// item.context.logger.log('Message Issued' + msgId);
|
|
64
69
|
// issue it back for others to receive
|
|
65
70
|
const resp = await item.context.engine.throwMessage(
|
|
66
71
|
msgId,
|
|
@@ -68,19 +73,19 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
68
73
|
messageMatchingKey,
|
|
69
74
|
);
|
|
70
75
|
if (resp && resp.instance) {
|
|
71
|
-
item.context.logger.log(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
76
|
+
// item.context.logger.log(
|
|
77
|
+
// ' invoked another process ' +
|
|
78
|
+
// resp.instance.id +
|
|
79
|
+
// ' for ' +
|
|
80
|
+
// resp.instance.name,
|
|
81
|
+
// );
|
|
77
82
|
} else await this.issueMessage(messageId, data);
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
async issueMessage(messageId, data) {}
|
|
81
86
|
async issueSignal(signalId, data) {}
|
|
82
87
|
async signalThrown(signalId, data, messageMatchingKey: any, item: Item) {
|
|
83
|
-
item.context.logger.log('Signal Issued' + signalId);
|
|
88
|
+
// item.context.logger.log('Signal Issued' + signalId);
|
|
84
89
|
|
|
85
90
|
const resp = await item.context.engine.throwSignal(
|
|
86
91
|
signalId,
|
|
@@ -88,27 +93,27 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
88
93
|
messageMatchingKey,
|
|
89
94
|
);
|
|
90
95
|
if (resp && resp.instance) {
|
|
91
|
-
item.context.logger.log(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
96
|
+
// item.context.logger.log(
|
|
97
|
+
// ' invoked another process ' +
|
|
98
|
+
// resp.instance.id +
|
|
99
|
+
// ' for ' +
|
|
100
|
+
// resp.instance.name,
|
|
101
|
+
// );
|
|
97
102
|
} else await this.issueSignal(signalId, data);
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
consoleKeyTypes = (obj1) => {
|
|
101
106
|
const keys = Object.getOwnPropertyNames(obj1);
|
|
102
|
-
console.log('consoleKeyTypesconsoleKeyTypesconsoleKeyTypes', keys);
|
|
107
|
+
// console.log('consoleKeyTypesconsoleKeyTypesconsoleKeyTypes', keys);
|
|
103
108
|
for (let k = 0; k < keys.length; k++) {
|
|
104
109
|
const key = keys[k];
|
|
105
110
|
|
|
106
111
|
if (!obj1[key]) {
|
|
107
|
-
console.log(key, 'empty ');
|
|
112
|
+
// console.log(key, 'empty ');
|
|
108
113
|
} else if (typeof obj1[key] == 'object') {
|
|
109
|
-
console.log(key, typeof obj1[key], Object.keys(obj1[key]));
|
|
114
|
+
// console.log(key, typeof obj1[key], Object.keys(obj1[key]));
|
|
110
115
|
} else {
|
|
111
|
-
console.log(key, typeof obj1[key], obj1[key]);
|
|
116
|
+
// console.log(key, typeof obj1[key], obj1[key]);
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
};
|
|
@@ -165,8 +170,8 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
165
170
|
return (${script});`;
|
|
166
171
|
result = Function(js).bind(scope)();
|
|
167
172
|
} catch (exc) {
|
|
168
|
-
console.log('error in script evaluation', js);
|
|
169
|
-
console.log(exc);
|
|
173
|
+
// console.log('error in script evaluation', js);
|
|
174
|
+
// console.log(exc);
|
|
170
175
|
}
|
|
171
176
|
return result;
|
|
172
177
|
}
|
|
@@ -183,13 +188,13 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
183
188
|
var output=this.output;
|
|
184
189
|
${script}`;
|
|
185
190
|
result = await new AsyncFunction(js).bind(scope)();
|
|
186
|
-
scope.token.log('..executing js is done ' + scope.id);
|
|
191
|
+
// scope.token.log('..executing js is done ' + scope.id);
|
|
187
192
|
} catch (exc) {
|
|
188
|
-
scope.token.log(
|
|
189
|
-
|
|
190
|
-
);
|
|
191
|
-
console.log('error in script execution', js);
|
|
192
|
-
console.log(exc);
|
|
193
|
+
// scope.token.log(
|
|
194
|
+
// 'ERROR in executing Script ' + exc.message + '\n' + script,
|
|
195
|
+
// );
|
|
196
|
+
// console.log('error in script execution', js);
|
|
197
|
+
// console.log(exc);
|
|
193
198
|
}
|
|
194
199
|
return result;
|
|
195
200
|
}
|
|
@@ -2,7 +2,7 @@ import { error } from 'console';
|
|
|
2
2
|
/**
|
|
3
3
|
* This file was automatically generated by simpleapp generator. Every
|
|
4
4
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
5
|
-
* last change 2024-04-
|
|
5
|
+
* last change 2024-04-21
|
|
6
6
|
* Author: Ks Tan
|
|
7
7
|
*/
|
|
8
8
|
import { WorkflowConfig } from './workflow.config';
|
|
@@ -36,12 +36,14 @@ import {
|
|
|
36
36
|
// import { configuration } from './configuration';
|
|
37
37
|
import { UserContext } from '../commons/user.context';
|
|
38
38
|
import { WorkflowName } from '../types';
|
|
39
|
+
// import { UserResolverService } from '../../services/userresolver.service';
|
|
40
|
+
|
|
39
41
|
//import * as formschemas from '../../workflow/formschema';
|
|
40
42
|
export {
|
|
41
43
|
WorkflowSettingApiSchema,
|
|
42
44
|
WorkflowDataApiSchema,
|
|
43
45
|
} from './workflow.type';
|
|
44
|
-
|
|
46
|
+
import { SimpleAppRobotUserService } from 'src/simpleapp/generate/commons/robotuser.service';
|
|
45
47
|
@Injectable()
|
|
46
48
|
export class WorkflowService {
|
|
47
49
|
protected bpmnServer: BPMNServer;
|
|
@@ -49,22 +51,27 @@ export class WorkflowService {
|
|
|
49
51
|
constructor(
|
|
50
52
|
private workflowconfig: WorkflowConfig,
|
|
51
53
|
private eventEmitter: EventEmitter2,
|
|
54
|
+
// private userResolverService: UserResolverService,
|
|
55
|
+
private robotUserService: SimpleAppRobotUserService,
|
|
52
56
|
) {
|
|
53
|
-
const config
|
|
54
|
-
class HiddenLogger implements
|
|
55
|
-
setOptions(){}
|
|
56
|
-
clear(){}
|
|
57
|
-
get(){
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
const config = this.workflowconfig.getConfig();
|
|
58
|
+
class HiddenLogger implements ILogger {
|
|
59
|
+
setOptions() {}
|
|
60
|
+
clear() {}
|
|
61
|
+
get() {
|
|
62
|
+
return [] as any[];
|
|
63
|
+
}
|
|
64
|
+
debug() {}
|
|
65
|
+
warn() {}
|
|
66
|
+
info() {}
|
|
67
|
+
reportError(err: any) {
|
|
68
|
+
// console.log('report Error:', err);
|
|
69
|
+
}
|
|
70
|
+
async save(filename: any) {}
|
|
71
|
+
log() {}
|
|
72
|
+
error(err: any) {
|
|
73
|
+
// console.log('Error:', err);
|
|
63
74
|
}
|
|
64
|
-
async save(filename:any){}
|
|
65
|
-
log(){}
|
|
66
|
-
error(err: any){console.log("Error:",err )
|
|
67
|
-
}
|
|
68
75
|
}
|
|
69
76
|
this.bpmnServer = new BPMNServer(config, new HiddenLogger());
|
|
70
77
|
this.bpmnServer.listener.on(
|
|
@@ -78,14 +85,14 @@ export class WorkflowService {
|
|
|
78
85
|
* @param appuser
|
|
79
86
|
* @returns array of usertask
|
|
80
87
|
*/
|
|
81
|
-
async getActorUserTask(appuser: UserContext
|
|
88
|
+
async getActorUserTask(appuser: UserContext) {
|
|
82
89
|
const tmp: any[] = await this.bpmnServer.dataStore.findItems({
|
|
83
90
|
'items.status': 'wait',
|
|
84
91
|
'data.tenantId': appuser.getTenantId(),
|
|
85
92
|
//filter uid properties base on function
|
|
86
93
|
$or: [
|
|
87
|
-
{ 'items.assignee': appuser.
|
|
88
|
-
{ 'items.candidateUsers': appuser.
|
|
94
|
+
{ 'items.assignee': appuser.getUid() },
|
|
95
|
+
{ 'items.candidateUsers': appuser.getId() },
|
|
89
96
|
{ 'items.candidateGroups': appuser.getGroups() },
|
|
90
97
|
],
|
|
91
98
|
});
|
|
@@ -119,7 +126,7 @@ export class WorkflowService {
|
|
|
119
126
|
* @returns array of usertask
|
|
120
127
|
*/
|
|
121
128
|
async getMyUserTask(appuser: UserContext) {
|
|
122
|
-
return await this.getActorUserTask(appuser
|
|
129
|
+
return await this.getActorUserTask(appuser);
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
/**
|
|
@@ -441,9 +448,14 @@ export class WorkflowService {
|
|
|
441
448
|
schema: schema,
|
|
442
449
|
};
|
|
443
450
|
} else {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
451
|
+
return {
|
|
452
|
+
processName: processName,
|
|
453
|
+
elementId: elementId,
|
|
454
|
+
schema: 'default',
|
|
455
|
+
};
|
|
456
|
+
//throw new InternalServerErrorException(
|
|
457
|
+
// `Cannot resolve schema from invalid formKey '${schema}', example: 'jsonschema://SimpleApproveReject' or 'custom://your-custom-key'`,
|
|
458
|
+
//);
|
|
447
459
|
}
|
|
448
460
|
} else {
|
|
449
461
|
throw new NotFoundException(
|
|
@@ -486,6 +498,8 @@ export class WorkflowService {
|
|
|
486
498
|
* @param event bpmn-server event instance
|
|
487
499
|
*/
|
|
488
500
|
async applyEventListener(event) {
|
|
501
|
+
// console.log("Workflow", event.context.instance.name,", ID:",event.context.item.element.id,
|
|
502
|
+
// ", Type: " ,event.context.item.element.type, ", name: ", event.context.item.element.name, ", event type: ", event.event)
|
|
489
503
|
if (event.context.item) {
|
|
490
504
|
const workflowName: string = event.context.instance.name;
|
|
491
505
|
const eventType: EXECUTION_EVENT = event.event;
|
|
@@ -495,6 +509,7 @@ export class WorkflowService {
|
|
|
495
509
|
const elementProps = event.context.item.element.def;
|
|
496
510
|
// const usertaskinput = event.context.item.input ?? null;
|
|
497
511
|
const data = event.context.instance.data;
|
|
512
|
+
const appuser = this.robotUserService.prepareAppUser(data);
|
|
498
513
|
const vars = {};
|
|
499
514
|
Object.assign(vars, event.context.item.input);
|
|
500
515
|
event.context.item.input = {};
|
|
@@ -513,7 +528,12 @@ export class WorkflowService {
|
|
|
513
528
|
else if (eventType == EXECUTION_EVENT.node_wait)
|
|
514
529
|
usertaskeventtype = 'wait';
|
|
515
530
|
// console.log("event-------=================================",eventType,usertaskeventtype)
|
|
531
|
+
const assignee = event.context.item.assignee;
|
|
532
|
+
const candidateUsers = event.context.item.candidateUsers;
|
|
533
|
+
const candidateGroups = event.context.item.candidateGroups;
|
|
534
|
+
|
|
516
535
|
if (usertaskeventtype) {
|
|
536
|
+
('');
|
|
517
537
|
const props: UserTaskData = {
|
|
518
538
|
workflowName: workflowName,
|
|
519
539
|
eventType: usertaskeventtype,
|
|
@@ -522,9 +542,9 @@ export class WorkflowService {
|
|
|
522
542
|
elementName: elementName,
|
|
523
543
|
elementProps: {
|
|
524
544
|
startedAt: event.context.item.startedAt,
|
|
525
|
-
assignee:
|
|
526
|
-
candidateGroups:
|
|
527
|
-
candidateUsers:
|
|
545
|
+
assignee: assignee,
|
|
546
|
+
candidateGroups: candidateGroups,
|
|
547
|
+
candidateUsers: candidateUsers,
|
|
528
548
|
dueDate: event.context.item.dueDate,
|
|
529
549
|
followUpDate: event.context.item.followUpDate,
|
|
530
550
|
priority: event.context.item.priority,
|
|
@@ -534,8 +554,12 @@ export class WorkflowService {
|
|
|
534
554
|
vars: vars,
|
|
535
555
|
options: options,
|
|
536
556
|
};
|
|
557
|
+
|
|
558
|
+
//send notification
|
|
537
559
|
this.eventEmitter.emit(
|
|
538
560
|
`${workflowName}.${elementId}.${usertaskeventtype}`,
|
|
561
|
+
appuser,
|
|
562
|
+
|
|
539
563
|
props,
|
|
540
564
|
);
|
|
541
565
|
}
|
|
@@ -560,6 +584,7 @@ export class WorkflowService {
|
|
|
560
584
|
};
|
|
561
585
|
this.eventEmitter.emit(
|
|
562
586
|
`${workflowName}.${elementId}.${servicetaskeventtype}`,
|
|
587
|
+
// appuser,
|
|
563
588
|
props,
|
|
564
589
|
);
|
|
565
590
|
}
|
|
@@ -569,4 +594,48 @@ export class WorkflowService {
|
|
|
569
594
|
}
|
|
570
595
|
}
|
|
571
596
|
}
|
|
597
|
+
|
|
598
|
+
// async userResolver(
|
|
599
|
+
// appuser: UserContext,
|
|
600
|
+
// userids: string | string[] | undefined,
|
|
601
|
+
// data: any,
|
|
602
|
+
// ) {
|
|
603
|
+
// if (!userids) return undefined;
|
|
604
|
+
// if (typeof userids == 'string') userids = [userids];
|
|
605
|
+
// if (!Array.isArray(userids)) return undefined;
|
|
606
|
+
// const newids: string[] = [];
|
|
607
|
+
// for (let i = 0; i < userids.length; i++) {
|
|
608
|
+
// let uid = userids[i].trim();
|
|
609
|
+
// if (
|
|
610
|
+
// uid.substring(0, 1) == '@' &&
|
|
611
|
+
// uid.includes('[') &&
|
|
612
|
+
// uid.includes(']')
|
|
613
|
+
// ) {
|
|
614
|
+
// const regextype = /(?<=\@)(.*?)(?=\[)/;
|
|
615
|
+
// const regexvalue = /(?<=\[)(.*?)(?=\])/;
|
|
616
|
+
|
|
617
|
+
// const usertype = uid.match(regextype)[0].trim();
|
|
618
|
+
// const typevalue = uid.match(regexvalue)[0].trim();
|
|
619
|
+
// let idvalue = '';
|
|
620
|
+
// if (typevalue.substring(0, 6) == '$data.') {
|
|
621
|
+
// const fieldpath = typevalue.replace('$data.', '');
|
|
622
|
+
// idvalue = this.readFieldFromData(fieldpath, data);
|
|
623
|
+
// }
|
|
624
|
+
|
|
625
|
+
// uid = await this.userResolverService.resolve(
|
|
626
|
+
// appuser,
|
|
627
|
+
// usertype,
|
|
628
|
+
// idvalue,
|
|
629
|
+
// data,
|
|
630
|
+
// );
|
|
631
|
+
// }
|
|
632
|
+
// if (uid) newids.push(uid);
|
|
633
|
+
// }
|
|
634
|
+
|
|
635
|
+
// return newids;
|
|
636
|
+
// }
|
|
637
|
+
|
|
638
|
+
// readFieldFromData(path: string, data: any) {
|
|
639
|
+
// return path.split('.').reduce((o, i) => o[i], data);
|
|
640
|
+
// }
|
|
572
641
|
}
|
|
@@ -9,9 +9,9 @@ import { UserContext } from '../commons/user.context';
|
|
|
9
9
|
export type WorkflowSettingApiSchema = {
|
|
10
10
|
userServiceUrl: string;
|
|
11
11
|
callBackUrl?: string;
|
|
12
|
-
assignee?: string;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
assignee?: string|string[];
|
|
13
|
+
candidateGroups?: string | string[];
|
|
14
|
+
candidateUsers?: string | string[];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export type WorkflowDataApiSchema = {
|
|
@@ -70,7 +70,7 @@ export type UserTaskData = {
|
|
|
70
70
|
vars:any
|
|
71
71
|
elementProps: {
|
|
72
72
|
startedAt: string;
|
|
73
|
-
assignee?: string;
|
|
73
|
+
assignee?: string|string[];
|
|
74
74
|
candidateGroups?: string | string[];
|
|
75
75
|
candidateUsers?: string | string[];
|
|
76
76
|
dueDate?: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. It is changable
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2024-04-24
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { InjectModel } from '@nestjs/mongoose';
|
|
9
|
+
import { Model } from 'mongoose';
|
|
10
|
+
import { Injectable } from '@nestjs/common';
|
|
11
|
+
import { UserContext } from '../generate/commons/user.context';
|
|
12
|
+
import { SystemmessageProcessor } from '../generate/processors/sysmsg.processor';
|
|
13
|
+
//import { Systemmessage,SystemmessageHooks} from '../generate/types';
|
|
14
|
+
import * as types from '../generate/types';
|
|
15
|
+
export { Systemmessage } from '../generate/types';
|
|
16
|
+
|
|
17
|
+
@Injectable()
|
|
18
|
+
export class SystemmessageService extends SystemmessageProcessor {
|
|
19
|
+
public hooks: types.SystemmessageHooks = {
|
|
20
|
+
afterCreate : async(appuser:UserContext,data:types.Systemmessage) =>
|
|
21
|
+
await this.afterCreate(appuser,data)
|
|
22
|
+
};
|
|
23
|
+
constructor(@InjectModel('Systemmessage') mydoc: Model<types.Systemmessage>) {
|
|
24
|
+
super(mydoc);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async runDefault(appuser: UserContext) {
|
|
28
|
+
return await this.search(appuser, { uid: appuser.getUid() });
|
|
29
|
+
}
|
|
30
|
+
async afterCreate(appuser:UserContext,data:types.Systemmessage){
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/***************************** begin x-document-api definitions *****************************************/
|
|
35
|
+
async runReadmsg(appuser:UserContext,id:string){
|
|
36
|
+
const data = await this.findById(appuser, id);
|
|
37
|
+
data.read=true
|
|
38
|
+
await await this.findIdThenUpdate(appuser,id,data)
|
|
39
|
+
return data
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/***************************** end x-document-api definitions *****************************************/
|
|
43
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. It is changable
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2024-04-24
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Injectable } from '@nestjs/common';
|
|
9
|
+
import { SimpleAppRobotUserService } from '../generate/commons/robotuser.service';
|
|
10
|
+
import { UserContext } from '../generate/commons/user.context';
|
|
11
|
+
import { UserService } from './user.service';
|
|
12
|
+
import { TeacherService } from './teacher.service';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@Injectable()
|
|
16
|
+
export class UserResolverService {
|
|
17
|
+
constructor(
|
|
18
|
+
private userService: UserService,
|
|
19
|
+
private teacherService: TeacherService,
|
|
20
|
+
private robotUserService: SimpleAppRobotUserService,
|
|
21
|
+
) {}
|
|
22
|
+
async teacher(assignvalue: string, data: any) {
|
|
23
|
+
console.log('assign value for teacher', assignvalue);
|
|
24
|
+
|
|
25
|
+
const appuser = this.robotUserService.prepareAppUser(data);
|
|
26
|
+
console.log('gettenant', appuser.getBranchFilter());
|
|
27
|
+
return this.resolve(appuser, 'teacher', assignvalue, data);
|
|
28
|
+
}
|
|
29
|
+
async resolve(appuser: UserContext, usertype: string, id: string, data: any) {
|
|
30
|
+
let result = '';
|
|
31
|
+
switch (usertype) {
|
|
32
|
+
case 'user':
|
|
33
|
+
result = await this.resolveUser(appuser, id, data);
|
|
34
|
+
break;
|
|
35
|
+
case 'teacher':
|
|
36
|
+
result = await this.resolveTeacher(appuser, id, data);
|
|
37
|
+
break;
|
|
38
|
+
|
|
39
|
+
case 'group':
|
|
40
|
+
// result = await this.resolveTeacher(appuser,id,data)
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getUser(appuser: UserContext, email: string) {
|
|
47
|
+
if (!email) return undefined;
|
|
48
|
+
console.log('get user from email ', email);
|
|
49
|
+
const user = await this.userService.search(appuser, { email: email });
|
|
50
|
+
console.log('user result', user);
|
|
51
|
+
if (user && user.length > 0) return user[0].uid;
|
|
52
|
+
else return undefined;
|
|
53
|
+
}
|
|
54
|
+
async resolveTeacher(
|
|
55
|
+
appuser: UserContext,
|
|
56
|
+
id: string | undefined,
|
|
57
|
+
data: any,
|
|
58
|
+
) {
|
|
59
|
+
if (!id) return undefined;
|
|
60
|
+
console.log('Find teacher::', id);
|
|
61
|
+
const teacher = await this.teacherService.findById(appuser, id);
|
|
62
|
+
console.log('teacher', teacher);
|
|
63
|
+
return this.getUser(appuser, teacher.email);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async resolveUser(appuser: UserContext, id: string | undefined, data: any) {
|
|
67
|
+
const user = await this.userService.findById(appuser, id);
|
|
68
|
+
return user.uid;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -9,6 +9,9 @@ import { MongooseModule } from '@nestjs/mongoose';
|
|
|
9
9
|
import {DocNumberFormatGenerator} from './generate/commons/docnogenerator.service'
|
|
10
10
|
import { AuditTrail } from './generate/commons/audittrail.service';
|
|
11
11
|
import { CloudApiModule } from 'src/cloudapi/cloudapi.module';
|
|
12
|
+
import { PrintApiModule } from 'src/printapi/printapi.module';
|
|
13
|
+
|
|
14
|
+
import { UserResolverService } from './services/userresolver.service';
|
|
12
15
|
// auto import modules
|
|
13
16
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
14
17
|
<% let obj = it.modules[i]%>
|
|
@@ -39,6 +42,7 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
|
|
|
39
42
|
@Module({
|
|
40
43
|
imports: [
|
|
41
44
|
CloudApiModule,
|
|
45
|
+
PrintApiModule,
|
|
42
46
|
MongooseModule.forFeature([
|
|
43
47
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
44
48
|
<% let obj = it.modules[i]%>
|
|
@@ -56,11 +60,11 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
|
|
|
56
60
|
<%for(let i=0; i<it.allbpmn.length;i++){%>
|
|
57
61
|
<%let bpmn = it.allbpmn[i]%>
|
|
58
62
|
<%=capitalizeFirstLetter(bpmn)%>ListenerService,
|
|
59
|
-
<%}%>
|
|
63
|
+
<%}%> UserResolverService,
|
|
60
64
|
],
|
|
61
65
|
exports:[SimpleAppRobotUserService,AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %>
|
|
62
66
|
<%= it.modules[i].docname %>Service,
|
|
63
67
|
<%= it.modules[i].docname %>Resolver,
|
|
64
|
-
<%}%> ProfileService,WorkflowDelegate,WorkflowConfig,WorkflowService,WorkflowUserService,]
|
|
68
|
+
<%}%> ProfileService,WorkflowDelegate,WorkflowConfig,WorkflowService,WorkflowUserService,UserResolverService,]
|
|
65
69
|
})
|
|
66
70
|
export class GenerateModule {}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ButtonDefault v-if="!actionName" :animate="animate"
|
|
3
|
-
|
|
2
|
+
<ButtonDefault v-if="!actionName" :animate="animate"
|
|
3
|
+
><slot></slot>def</ButtonDefault
|
|
4
|
+
>
|
|
5
|
+
<ButtonPrimary
|
|
6
|
+
v-else-if="['create', 'update','print'].includes(actionName)"
|
|
7
|
+
:animate="animate"
|
|
4
8
|
><slot></slot
|
|
5
9
|
></ButtonPrimary>
|
|
6
|
-
<ButtonDanger
|
|
10
|
+
<ButtonDanger
|
|
11
|
+
v-else-if="['delete', 'void'].includes(actionName)"
|
|
12
|
+
:animate="animate"
|
|
7
13
|
><slot></slot
|
|
8
14
|
></ButtonDanger>
|
|
9
|
-
<ButtonWarning v-else
|
|
15
|
+
<ButtonWarning v-else :animate="animate"><slot></slot></ButtonWarning>
|
|
10
16
|
</template>
|
|
11
17
|
<script setup lang="ts">
|
|
12
18
|
/**
|
|
@@ -15,5 +21,5 @@
|
|
|
15
21
|
* last change 2024-03-01
|
|
16
22
|
* author: Ks Tan
|
|
17
23
|
*/
|
|
18
|
-
const props = defineProps<{ actionName?: string; animate?:boolean }>();
|
|
24
|
+
const props = defineProps<{ actionName?: string; animate?: boolean }>();
|
|
19
25
|
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ImageToBase64Uploader
|
|
3
|
+
v-if="changable"
|
|
4
|
+
@image-uploaded="handleBase64"
|
|
5
|
+
#default
|
|
6
|
+
class="w-20 h-20"
|
|
7
|
+
>
|
|
8
|
+
<Avatar
|
|
9
|
+
:image="getAvatarLink(email ?? '', size)"
|
|
10
|
+
shape="circle"
|
|
11
|
+
size="xlarge"
|
|
12
|
+
/>
|
|
13
|
+
</ImageToBase64Uploader>
|
|
14
|
+
<div v-else class="inline-block border rounded-lg w-20 h-20">
|
|
15
|
+
<Avatar
|
|
16
|
+
:image="getAvatarLink(email ?? '', size)"
|
|
17
|
+
shape="circle"
|
|
18
|
+
size="xlarge"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
/**
|
|
24
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
25
|
+
* IT IS NOT CHANGABLE
|
|
26
|
+
* last change 2024-04-06
|
|
27
|
+
* author: Ks Tan
|
|
28
|
+
*/
|
|
29
|
+
const props = defineProps<{
|
|
30
|
+
email?: string;
|
|
31
|
+
size: number;
|
|
32
|
+
changable: boolean;
|
|
33
|
+
}>();
|
|
34
|
+
const imageData = ref("");
|
|
35
|
+
const handleBase64 = (data: string) => {
|
|
36
|
+
imageData.value = data;
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ImageToBase64Uploader
|
|
3
|
+
v-if="changable"
|
|
4
|
+
#default
|
|
5
|
+
class="w-20 h-20 place-content-center"
|
|
6
|
+
@image-uploaded="handleBase64"
|
|
7
|
+
>
|
|
8
|
+
<Image :src="imageData"></Image>
|
|
9
|
+
</ImageToBase64Uploader>
|
|
10
|
+
<div v-else class="inline-block border rounded-lg w-20 h-20">
|
|
11
|
+
<Image :src="imageData"></Image>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
// import {KeyValue} from ''
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
changable: boolean;
|
|
18
|
+
}>();
|
|
19
|
+
const imageData = ref("");
|
|
20
|
+
const handleBase64 = async (data: string) => {
|
|
21
|
+
const keyvalue = {
|
|
22
|
+
key: "organizationLogo",
|
|
23
|
+
value: data,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const uploadok = await useNuxtApp()
|
|
27
|
+
.$OrganizationDoc()
|
|
28
|
+
.getApi()
|
|
29
|
+
.runUploadlogo(keyvalue);
|
|
30
|
+
if (uploadok) {
|
|
31
|
+
await loadLogo();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const loadLogo = async () => {
|
|
35
|
+
await refreshOrgLogo();
|
|
36
|
+
imageData.value = getOrgLogo();
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
onMounted(async () => await loadLogo());
|
|
40
|
+
</script>
|