You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
1.8 KiB
90 lines
1.8 KiB
5 years ago
|
import { Component, OnInit } from '@angular/core';
|
||
|
import { HttpClient } from '@angular/common/http';
|
||
|
import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop';
|
||
|
@Component({
|
||
|
selector: 'app-button',
|
||
|
templateUrl: './button.component.html',
|
||
|
styleUrls: ['./button.component.scss']
|
||
|
})
|
||
|
export class ButtonComponent implements OnInit {
|
||
|
|
||
|
constructor(public http: HttpClient) { }
|
||
|
|
||
|
|
||
|
data =[
|
||
|
{
|
||
|
id:"1",
|
||
|
name:"广西总队",
|
||
|
order:0,
|
||
|
parentId:null,
|
||
|
children:[
|
||
|
{
|
||
|
id:"2",
|
||
|
name:"南宁支队",
|
||
|
order:2,
|
||
|
parentId:1,
|
||
|
children:[
|
||
|
{
|
||
|
id:"6",
|
||
|
name:"南宁特勤大队",
|
||
|
order:0,
|
||
|
parentId:2,
|
||
|
children:[
|
||
|
{
|
||
|
id:"6",
|
||
|
name:"南宁特勤3中队",
|
||
|
order:3,
|
||
|
parentId:6,
|
||
|
},
|
||
|
{
|
||
|
id:"6",
|
||
|
name:"南宁特勤2中队",
|
||
|
order:2,
|
||
|
parentId:6,
|
||
|
},
|
||
|
{
|
||
|
id:"6",
|
||
|
name:"南宁特勤1中队",
|
||
|
order:1,
|
||
|
parentId:6,
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
id:"3",
|
||
|
name:"北海支队",
|
||
|
order:1,
|
||
|
parentId:1
|
||
|
},
|
||
|
{
|
||
|
id:"4",
|
||
|
name:"梧州支队",
|
||
|
order:0,
|
||
|
parentId:1
|
||
|
},
|
||
|
{
|
||
|
id:"5",
|
||
|
name:"桂林支队",
|
||
|
order:3,
|
||
|
parentId:1
|
||
|
},
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
|
||
|
|
||
|
ngOnInit() {
|
||
|
var str = "xxxx.jjjj"
|
||
|
// console.log(2222,str.split('.')[1])
|
||
|
}
|
||
|
|
||
|
drop(event: CdkDragDrop<string[]>) {
|
||
|
moveItemInArray(this.data, event.previousIndex, event.currentIndex);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|