...

html

huzh GetStandard: Single Select

ts

import {Component, OnInit} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {DValidateRules} from 'ng-devui/form';
import {of} from 'rxjs';
import {delay, map} from 'rxjs/operators';


interface Ihu {
  title: string;
  id: string;
}

interface IIhu extends Ihu {
  title: string;
  children: Ihu[];
  id: string;
}


interface IIIhu {
  data: {
    sections: [
      {
        sectionId: string,
        name: string,
        items: [
          {
            id: string,
            name: string,
          }
        ]
      }
    ]
  };
}


@Component({
  selector: 'app-huzh',
  templateUrl: './huzh.component.html',
  styleUrls: ['./huzh.component.scss']
})
export class HuzhComponent implements OnInit {
  ngOnInit() {
    console.log('huzh');     // 传入的数据
    this.HuGet();
  }

  Idd: Ihu = {title: '', id: ''};
  IIdd: IIhu = {title: '', children: [], id: ''};
  data2 = [];
  data1 = [];
  value1 = {
    'title': 'g1s1',
    'id': '1'
  };

  // 固定值,直接推给 data1, 没有问题,测试数据
  // data3 = {
  //   'data': {
  //     'projectId': '089ebe99-6360-41a6-bdfd-847ae77e6c0a',
  //     'appId': '7a519829-414d-47c7-82e8-ee3ae0be4690',
  //     'name': 'huzh-测试',
  //     'iconUrl': 'https://coop.xxx.com:443/file/mdpub/customIcon/0_lego.svg',
  //     'color': '#00bcd4',
  //     'desc': '',
  //     'sections': [
  //       {
  //         'sectionId': '11',
  //         'name': 'g1',
  //         'items': [
  //           {
  //             'id': '22',
  //             'name': 'g1s1',
  //             'type': 0,
  //             'iconUrl': 'https://coopera.xxx.com:443/file/mdpub/customIcon/hr_workbench.svg',
  //             'status': 1
  //           },
  //           {
  //             'id': '33',
  //             'name': 'g1s2',
  //             'type': 0,
  //             'iconUrl': 'https://cooper.xxx.com:443/file/mdpub/customIcon/1_0_home.svg',
  //             'status': 1
  //           }
  //         ]
  //       },
  //       {
  //         'sectionId': '44',
  //         'name': 'g2',
  //         'items': [
  //           {
  //             'id': '55',
  //             'name': 'g2s1',
  //             'type': 0,
  //             'iconUrl': 'https://coop.xxx.com:443/file/mdpub/customIcon/1_0_home.svg',
  //             'status': 1
  //           },
  //           {
  //             'id': 'hu66',
  //             'name': 'g2s2',
  //             'type': 0,
  //             'iconUrl': 'https://coop.xxx.com:443/file/mdpub/customIcon/1_0_home.svg',
  //             'status': 1
  //           }
  //         ]
  //       }
  //     ]
  //   },
  //   'success': true,
  //   'error_code': 1
  // };

  ddd: IIIhu = {
    data: {
      sections: [
        {
          sectionId: '',
          name: '',
          items: [
            {
              id: '',
              name: '',
            }
          ]
        }
      ]
    }
  };

  constructor(private http: HttpClient) {
  }


  HuGet(): void {
    // 先用变量接住http resp,再赋值
    // devui的接口需要传定值,http 直接获取的值如果push到 data1中,显示不了数据
    // this.http.get