import { HttpClient } from '@angular/common/http'; import { Component, Input, OnInit } from '@angular/core'; import { NzModalRef } from 'ng-zorro-antd/modal'; @Component({ selector: 'app-gas-base-info', templateUrl: './gas-base-info.component.html', styleUrls: ['./gas-base-info.component.scss'] }) export class GasBaseInfoComponent implements OnInit { constructor(private modal: NzModalRef,private http: HttpClient) { } @Input() data?: any; isDetails: boolean = false; //是否是详情 ngOnInit(): void { if (this.data.id === undefined) { //详情 console.log(this.data,'gasInfo') this.isDetails = true } this.getBaseInfo() } baseInfo: any = { stationType: null, } getBaseInfo() { let params = { organizationUnitId: this.data.organizationId } this.http.get('/api/services/app/GasStation/Get',{params}).subscribe((data: any)=>{ data.result.govUnitDetail? data.result.govUnitDetail = JSON.parse(data.result.govUnitDetail) : null; this.baseInfo = data.result }) } }