import { Component, OnInit } from '@angular/core'; import { NzModalRef, NzMessageService, NzNotificationService } from 'ng-zorro-antd'; import { _HttpClient } from '@delon/theme'; import { ProjectQuotation } from 'app/entity/projectQuotation/project-quotation'; import { ProjectQuotationService } from 'app/services/projectQuotation/project-quotation.service'; import { SysAnnouncementSend } from 'app/entity/sys-announcement-send'; import { I18NService } from '@core'; @Component({ selector: 'app-pm-review-reminder-again', templateUrl: './review-reminder-again.component.html', }) export class PmReviewReminderAgainComponent implements OnInit { constructor( private modal: NzModalRef, private projectQuotationService: ProjectQuotationService, private notificationService: NzNotificationService, private i18NService: I18NService ) { } ngOnInit(): void { this.getQuotationById().then(() => { this.getIsDisplay(); }); } projectQuotation: ProjectQuotation = {}; quotationId: string = ""; isSpinning: boolean = false; //多选框 clinicalSection: boolean = false;//临床 centralPrice: boolean = false;//中心 dataStatistics: boolean = false;//数据 pkComputing: boolean = false;//PK bioanalysis: boolean = false;//生物分析 generalManager: boolean = false;//总经理 //是否显示 isClinicalSection: boolean = false;//临床 isCentralPrice: boolean = false;//中心 isDataStatistics: boolean = false;//数据 isPkComputing: boolean = false;//PK isBioanalysis: boolean = false;//生物分析 isGeneralManager: boolean = false;//总经理 /** * 获取报价对象 */ getQuotationById() { return new Promise((resolve) => { this.isSpinning = true; this.projectQuotationService.getQuotationById(this.quotationId).then((response) => { this.projectQuotation = response.result; this.isSpinning = false; resolve(); }) }) } /** * 判断需要显示的审核部分 */ getIsDisplay() { if (this.projectQuotation.isClinicalSectionExamine === '0' && this.projectQuotation.clinicalSectionMemo) { this.isClinicalSection = true; } if (this.projectQuotation.isCentralPriceExamine === '0' && this.projectQuotation.centralPriceMemo) { this.isCentralPrice = true; } if (this.projectQuotation.isDataStatisticsExamine === '0' && this.projectQuotation.dataStatisticsMemo) { this.isDataStatistics = true; } if (this.projectQuotation.isPkComputingExamine === '0' && this.projectQuotation.pkComputingMemo) { this.isPkComputing = true; } if (this.projectQuotation.isBioanalysisExamine === '0' && this.projectQuotation.bioanalysisMemo) { this.isBioanalysis = true; } if (this.projectQuotation.isGeneralExamine === '0' && this.projectQuotation.generalManagerMemo) { this.isGeneralManager = true; } } log(value: string[]): void { console.log(value); } /** * 保存 */ save() { return new Promise((resolve) => { let sysAnnouncementSends = new Array();//需要通知再次审核的人员 let projectQuotation = new ProjectQuotation();//不需要通知直接审核通过 //获取需要再次提醒的审核部分人员 //临床部分 if (this.isClinicalSection) { if (this.clinicalSection) {//选中则为需要通知id sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.clinicalSectionId, this.projectQuotation.clinicalSectionName)) } else {//没选中则需要直接变为审核状态 projectQuotation.isClinicalSectionExamine = "1"; } } //中心部分 if (this.isCentralPrice) { if (this.centralPrice) {//选中则为需要通知id sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.centralPriceId, this.projectQuotation.centralPriceName)) } else {//没选中则需要直接变为审核状态 projectQuotation.isCentralPriceExamine = "1"; } } //数据统计部分 if (this.isDataStatistics) { if (this.dataStatistics) {//选中则为需要通知id sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.dataStatisticsId, this.projectQuotation.dataStatisticsName)); } else {//没选中则需要直接变为审核状态 projectQuotation.isDataStatisticsExamine = "1"; } } //pk部分 if (this.isPkComputing) { if (this.pkComputing) {//选中则为需要通知id sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.pkComputingId, this.projectQuotation.pkComputingName)); } else {//没选中则需要直接变为审核状态 projectQuotation.isPkComputingExamine = "1"; } } //生物分析部分 if (this.isBioanalysis) { if (this.bioanalysis) {//选中则为需要通知id sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.bioanalysisId, this.projectQuotation.bioanalysisName)); } else {//没选中则需要直接变为审核状态 projectQuotation.isBioanalysisExamine = "1"; } } //总经理部分 if (this.isGeneralManager) { if (this.generalManager) {//选中则为需要通知id sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.generalManager, this.projectQuotation.generalManagerName)); } else {//没选中则需要直接变为审核状态 projectQuotation.isGeneralExamine = "1"; } } projectQuotation.id = this.projectQuotation.id;//报价id projectQuotation.code = this.projectQuotation.code;//报价编码 projectQuotation.sysAnnouncementSendList = sysAnnouncementSends;//需要审核的人员 this.projectQuotationService.reAuditSave(projectQuotation).then((response) => { if(response.success){ //操作成功 this.notificationService.success(this.i18NService.fanyi("Successful.operation"),""); this.modal.destroy(); resolve(); }else{ //操作失败 this.notificationService.error(this.i18NService.fanyi("operation.failed"),""); } }) }) } /** * 生成通知人对象 * @param id 通知人id * @param name 通知人名称 */ getSysAnnouncementSend(id, name): SysAnnouncementSend { let sysAnnouncementSend = new SysAnnouncementSend(); sysAnnouncementSend.userId = id; sysAnnouncementSend.userName = name return sysAnnouncementSend; } close() { console.log(this.clinicalSection) this.modal.destroy(); } }