mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#1058 - start form process detail
This commit is contained in:
@@ -57,6 +57,9 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView
|
||||
@Input()
|
||||
processDefinitionId: string;
|
||||
|
||||
@Input()
|
||||
processId: string;
|
||||
|
||||
@Input()
|
||||
showOutcomeButtons: boolean = false;
|
||||
|
||||
@@ -70,7 +73,11 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadForm();
|
||||
if (this.processId) {
|
||||
this.loadStartForm(this.processId);
|
||||
}else {
|
||||
this.loadForm();
|
||||
}
|
||||
|
||||
if (this.translate) {
|
||||
this.translate.addTranslationFolder('node_modules/ng2-activiti-form/src');
|
||||
@@ -78,9 +85,15 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let processId = changes['processDefinitionId'];
|
||||
if (processId && processId.currentValue) {
|
||||
this.getStartFormDefinition(processId.currentValue);
|
||||
let processDefinitionId = changes['processDefinitionId'];
|
||||
if (processDefinitionId && processDefinitionId.currentValue) {
|
||||
this.getStartFormDefinition(processDefinitionId.currentValue);
|
||||
return;
|
||||
}
|
||||
|
||||
let processId = changes['processId'];
|
||||
if (processId && processId.currentValue) {
|
||||
this.loadStartForm(processId.currentValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -92,6 +105,23 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView
|
||||
}
|
||||
}
|
||||
|
||||
loadStartForm(processId: string) {
|
||||
this.formService
|
||||
.getStartFormInstance(processId)
|
||||
.subscribe(
|
||||
form => {
|
||||
this.formName = form.name;
|
||||
form.processDefinitionId = this.processDefinitionId;
|
||||
this.form = this.parseForm(form);
|
||||
// this.form.processDefinitionId = this.processDefinitionId;
|
||||
this.formLoaded.emit(this.form);
|
||||
},
|
||||
(error) => {
|
||||
this.handleError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getStartFormDefinition(processId: string) {
|
||||
this.formService
|
||||
.getStartFormDefinition(processId)
|
||||
|
Reference in New Issue
Block a user