1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
import { Component, OnInit, Input } from '@angular/core';
import { DialogService } from 'ng-devui/modal';
import { AddHtmlFormComponent } from '../add-html-form/add-html-form.component';
import { FormConfig } from 'src/app/@shared/components/admin-form/admin-form.type';
@Component({
selector: 'app-pipeline-add',
templateUrl: './pipeline-add.component.html',
styleUrls: ['./pipeline-add.component.css']
})
export class PipelineAddComponent implements OnInit {
@Input() data: any;
constructor(
private dialogService: DialogService,
) { }
ngOnInit(): void {
}
addFormField: boolean = false;
storedItems: any[] = [];
formSelectOptions = ["input", "textarea", "select"]
HTMLFormJSON: FormConfig = {
labelSize: 'sm',
items: this.storedItems,
showSubmit: false,
};
formConfig: FormConfig = {
labelSize: 'sm',
showSubmit: true,
items: [
{
label: "label",
prop: "label",
type: "input",
},
{
label: "prop",
prop: "prop",
type: "input",
},
{
label: "fieldtype",
prop: "type",
type: "select",
options: this.formSelectOptions,
},
{
label: "补充字段",
prop: "others",
type: "textarea",
}
]
}
defaultRowData = {
label: '',
prop: '',
type: '',
extraInfo: '',
options: [],
};
openAddHtmlFormDialog(dialogtype?: string) {
const results = this.dialogService.open({
id: 'addHtmlFormService',
maxHeight: '800px',
title: '新增字段',
content: AddHtmlFormComponent,
backdropCloseable: true,
onClose: () => {
console.log('closed');
},
buttons: [
{
cssClass: 'stress',
text: '确认',
handler: ($event: Event) => {
const newData = results.modalContentInstance.defaultRowData;
if (newData.type == "select") {
newData.options = newData.options.split(",");
}
this.HTMLFormJSON.items.push(newData);
console.log(this.HTMLFormJSON);
results.modalInstance.hide();
},
},
{
id: 'btn-cancel',
cssClass: 'common',
text: '取消',
handler: ($event: Event) => {
results.modalInstance.hide();
},
},
],
data: {
},
});
}
quickRowAdded(e: any) {
const newData = { ...e };
this.HTMLFormJSON.items.push(newData);
this.addFormField = false;
console.log(this.HTMLFormJSON);
}
quickRowCancel() {
this.addFormField = false;
}
}
|