import { Component, OnInit } from '@angular/core';
import {UploadFile} from 'ng-zorro-antd';
import {TopologyService} from '../../topology.service';

@Component({
  selector: 'smart-icon',
  templateUrl: './icon.component.html',
  styles: []
})
export class IconComponent implements OnInit {

    fileList: UploadFile[] = [];
    title = "添加图标";
    data = {
        iconType:"",
        defaultIcon:"0",
        firstTypeId:"",
        secondTypeId:"",
        name:"",
    }
  constructor(private topologySer:TopologyService) { }

  ngOnInit() {
        this.getList();
  }

    getList(){
        this.topologySer.findTreeWithWeb().subscribe(
            (res)=>{

            }
        )
    }

    handleUpload(): void {
        const formData = new FormData();
        // tslint:disable-next-line:no-any
        this.fileList.forEach((file: any) => {
            formData.append('files[]', file);
        });
        console.log(formData);
        // You can use any AJAX library you like
        // const req = new HttpRequest('POST', 'https://jsonplaceholder.typicode.com/posts/', formData, {
        //     // reportProgress: true
        // });
    }

}
