Newer
Older
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
// 定义发射事件
}
ngOnInit() {
}
exists(list, parentId,myId){
for(let i=0; i<list.length; i++){
if(list[i][myId] == parentId){
return true;
}
}
return false;
}
listToTree(myId,pId,list){
const nodes = [];
for(let i=0; i<list.length; i++){
list[i].checked = false;
const row = list[i];
if ( !this.exists(list, row[pId],myId) ){
nodes.push(row);
}
}
const toDo = [];
for(let i=0; i<nodes.length; i++){
toDo.push(nodes[i]);
}
while(toDo.length){
const node = toDo.shift(); // the parent node
for(let i=0; i<list.length; i++){
const row = list[i];
if (row[pId] == node[myId]){
if (node.children){
node.children.push(row);
} else {
node.children = [row];
}
toDo.push(row);
}
}
}
return nodes;
}
if (data.hasOwnProperty(key)) {
const value = data[key];
str += key + '=' + value + '&';
}
}
str = str.substring(0, str.length - 1);
return str;
}
deleteThing(title,callback){
this.modalSer.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red;">title</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: callback,
nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel'),
})
}