/*
 * @Author: your name
 * @Date: 2021-12-07 17:30:18
 * @LastEditTime : 2022-04-22 15:15:49
 * @LastEditors  : Shiming
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\vehicle\\components\\list\\img-view\\img-view.component.ts
 */
import { Component, OnInit } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import { NzImageService } from 'ng-zorro-antd/image';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { VehicleService } from '../../../services/vehicle.service';

@Component({
  selector: 'app-setting-components-info-img-view',
  templateUrl: './img-view.component.html',
})
export class VehicleImgViewComponent implements OnInit {
  record: any = {};
  i: any;

  constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public http: _HttpClient, public service: VehicleService, private nzImageService: NzImageService) {}

  ngOnInit(): void {
    console.log(this.i);
  }

  cancel() {
    this.modal.destroy(true);
  }
  // 驳回
  reject() {
    const params ={
      approvalStatus: 30,
      id: this.i.id
    }
    this.service.request(this.service.$api_get_auditCarProtocal_audit, params).subscribe((res) => {
      if(res) {
        this.modal.destroy(true);
        this.service.msgSrv.success('已驳回')
      }
    })
  }
  showImg(url: any) {
    const params = {
      imgList: [url],
      index: 0
    };
    this.nzImageService.preview([{ src: url }]);
  }
  // 通过
  okCancel() {
  const params ={
    approvalStatus: 20,
    id: this.i.id
    }
    this.service.request(this.service.$api_get_auditCarProtocal_audit, params).subscribe((res) => {
        if(res) {
          this.modal.destroy(true);
        this.service.msgSrv.success('已通过')
        }
    })
  }
}
