/*
 * @Description  :
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-10 14:44:57
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-01-18 17:15:43
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\contract-management\\components\\contract-detail\\contract-detail.component.ts
 * Copyright (C) 2022 huzhenhong. All rights reserved.
 */
import { DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NzModalService } from 'ng-zorro-antd/modal';
import { ContractManagementService } from '../../services/contract-management.service';

@Component({
  selector: 'app-contract-management-detail-complaint',
  templateUrl: './contract-detail.component.html',
  styleUrls: ['./contract-detail.component.less'],
  providers: [DatePipe]
})
export class ContractManagementDetailComponent implements OnInit {
  constructor(
    private nzModalService: NzModalService,
    public service: ContractManagementService,
    public route: ActivatedRoute,
    private datePipe: DatePipe,
    private router: Router
  ) {}
  textStatus = '合同详情';
  name: any;
  code: any;
  templateHTML: any;
  detailList: any = {
    templateName: ''
  };
  ngOnInit() {
    this.initData(this.service.$api_contract_get);
  }
  goBack() {
    window.history.go(-1);
  }

  initData(url: string) {
    this.service.request(url, { id: this.route.snapshot.params.id }).subscribe(res => {
      if (res) {
        this.detailList = res;
        this.detailList = res;
        let value: any = JSON.parse(res.contractParameter);
        this.code = value['${code}'];
        this.name = value['${name}'];
      }
    });
  }
  cancel() {
    window.history.go(-1);
  }
}
