#1058 - start form process detail

This commit is contained in:
Vito Albano
2016-11-11 17:13:40 +00:00
parent 77358267c9
commit da94aebbc4
4 changed files with 37 additions and 37 deletions

View File

@@ -84,9 +84,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
static COMPLETE_OUTCOME_ID: string = '$complete';
static CUSTOM_OUTCOME_ID: string = '$custom';
@Input()
processId: string;
@Input()
taskId: string;
@@ -196,11 +193,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
}
ngOnInit() {
if (this.processId) {
this.loadStartForm(this.processId);
return;
}
if (this.nodeId) {
this.loadFormForEcmNode();
} else {
@@ -230,12 +222,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
this.getFormDefinitionByFormName(formName.currentValue);
return;
}
let processId = changes['processId'];
if (processId && processId.currentValue) {
this.loadStartForm(processId.currentValue);
return;
}
}
/**
@@ -330,21 +316,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
);
}
loadStartForm(processId: string) {
this.formService
.getStartFormInstance(processId)
.subscribe(
form => {
this.formName = form.name;
this.form = this.parseForm(form);
this.formLoaded.emit(this.form);
},
(error) => {
this.handleError(error);
}
);
}
getFormDefinitionByFormId(formId: string) {
this.formService
.getFormDefinitionById(formId)

View File

@@ -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)

View File

@@ -34,7 +34,7 @@ export class FormModel {
readonly name: string;
readonly taskId: string;
readonly taskName: string = FormModel.UNSET_TASK_NAME;
readonly processDefinitionId: string;
processDefinitionId: string;
private _isValid: boolean = true;
get isValid(): boolean {