review-reminder-again.component.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import { Component, OnInit } from '@angular/core';
  2. import { NzModalRef, NzMessageService, NzNotificationService } from 'ng-zorro-antd';
  3. import { _HttpClient } from '@delon/theme';
  4. import { ProjectQuotation } from 'app/entity/projectQuotation/project-quotation';
  5. import { ProjectQuotationService } from 'app/services/projectQuotation/project-quotation.service';
  6. import { SysAnnouncementSend } from 'app/entity/sys-announcement-send';
  7. import { I18NService } from '@core';
  8. @Component({
  9. selector: 'app-pm-review-reminder-again',
  10. templateUrl: './review-reminder-again.component.html',
  11. })
  12. export class PmReviewReminderAgainComponent implements OnInit {
  13. constructor(
  14. private modal: NzModalRef,
  15. private projectQuotationService: ProjectQuotationService,
  16. private notificationService: NzNotificationService,
  17. private i18NService: I18NService
  18. ) { }
  19. ngOnInit(): void {
  20. this.getQuotationById().then(() => {
  21. this.getIsDisplay();
  22. });
  23. }
  24. projectQuotation: ProjectQuotation = {};
  25. quotationId: string = "";
  26. isSpinning: boolean = false;
  27. //多选框
  28. clinicalSection: boolean = false;//临床
  29. centralPrice: boolean = false;//中心
  30. dataStatistics: boolean = false;//数据
  31. pkComputing: boolean = false;//PK
  32. bioanalysis: boolean = false;//生物分析
  33. generalManager: boolean = false;//总经理
  34. //是否显示
  35. isClinicalSection: boolean = false;//临床
  36. isCentralPrice: boolean = false;//中心
  37. isDataStatistics: boolean = false;//数据
  38. isPkComputing: boolean = false;//PK
  39. isBioanalysis: boolean = false;//生物分析
  40. isGeneralManager: boolean = false;//总经理
  41. /**
  42. * 获取报价对象
  43. */
  44. getQuotationById() {
  45. return new Promise((resolve) => {
  46. this.isSpinning = true;
  47. this.projectQuotationService.getQuotationById(this.quotationId).then((response) => {
  48. this.projectQuotation = response.result;
  49. this.isSpinning = false;
  50. resolve();
  51. })
  52. })
  53. }
  54. /**
  55. * 判断需要显示的审核部分
  56. */
  57. getIsDisplay() {
  58. if (this.projectQuotation.isClinicalSectionExamine === '0' && this.projectQuotation.clinicalSectionMemo) {
  59. this.isClinicalSection = true;
  60. }
  61. if (this.projectQuotation.isCentralPriceExamine === '0' && this.projectQuotation.centralPriceMemo) {
  62. this.isCentralPrice = true;
  63. }
  64. if (this.projectQuotation.isDataStatisticsExamine === '0' && this.projectQuotation.dataStatisticsMemo) {
  65. this.isDataStatistics = true;
  66. }
  67. if (this.projectQuotation.isPkComputingExamine === '0' && this.projectQuotation.pkComputingMemo) {
  68. this.isPkComputing = true;
  69. }
  70. if (this.projectQuotation.isBioanalysisExamine === '0' && this.projectQuotation.bioanalysisMemo) {
  71. this.isBioanalysis = true;
  72. }
  73. if (this.projectQuotation.isGeneralExamine === '0' && this.projectQuotation.generalManagerMemo) {
  74. this.isGeneralManager = true;
  75. }
  76. }
  77. log(value: string[]): void {
  78. console.log(value);
  79. }
  80. /**
  81. * 保存
  82. */
  83. save() {
  84. return new Promise((resolve) => {
  85. let sysAnnouncementSends = new Array();//需要通知再次审核的人员
  86. let projectQuotation = new ProjectQuotation();//不需要通知直接审核通过
  87. //获取需要再次提醒的审核部分人员
  88. //临床部分
  89. if (this.isClinicalSection) {
  90. if (this.clinicalSection) {//选中则为需要通知id
  91. sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.clinicalSectionId, this.projectQuotation.clinicalSectionName))
  92. } else {//没选中则需要直接变为审核状态
  93. projectQuotation.isClinicalSectionExamine = "1";
  94. }
  95. }
  96. //中心部分
  97. if (this.isCentralPrice) {
  98. if (this.centralPrice) {//选中则为需要通知id
  99. sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.centralPriceId, this.projectQuotation.centralPriceName))
  100. } else {//没选中则需要直接变为审核状态
  101. projectQuotation.isCentralPriceExamine = "1";
  102. }
  103. }
  104. //数据统计部分
  105. if (this.isDataStatistics) {
  106. if (this.dataStatistics) {//选中则为需要通知id
  107. sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.dataStatisticsId, this.projectQuotation.dataStatisticsName));
  108. } else {//没选中则需要直接变为审核状态
  109. projectQuotation.isDataStatisticsExamine = "1";
  110. }
  111. }
  112. //pk部分
  113. if (this.isPkComputing) {
  114. if (this.pkComputing) {//选中则为需要通知id
  115. sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.pkComputingId, this.projectQuotation.pkComputingName));
  116. } else {//没选中则需要直接变为审核状态
  117. projectQuotation.isPkComputingExamine = "1";
  118. }
  119. }
  120. //生物分析部分
  121. if (this.isBioanalysis) {
  122. if (this.bioanalysis) {//选中则为需要通知id
  123. sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.bioanalysisId, this.projectQuotation.bioanalysisName));
  124. } else {//没选中则需要直接变为审核状态
  125. projectQuotation.isBioanalysisExamine = "1";
  126. }
  127. }
  128. //总经理部分
  129. if (this.isGeneralManager) {
  130. if (this.generalManager) {//选中则为需要通知id
  131. sysAnnouncementSends.push(this.getSysAnnouncementSend(this.projectQuotation.generalManager, this.projectQuotation.generalManagerName));
  132. } else {//没选中则需要直接变为审核状态
  133. projectQuotation.isGeneralExamine = "1";
  134. }
  135. }
  136. projectQuotation.id = this.projectQuotation.id;//报价id
  137. projectQuotation.code = this.projectQuotation.code;//报价编码
  138. projectQuotation.sysAnnouncementSendList = sysAnnouncementSends;//需要审核的人员
  139. this.projectQuotationService.reAuditSave(projectQuotation).then((response) => {
  140. if(response.success){
  141. //操作成功
  142. this.notificationService.success(this.i18NService.fanyi("Successful.operation"),"");
  143. this.modal.destroy();
  144. resolve();
  145. }else{
  146. //操作失败
  147. this.notificationService.error(this.i18NService.fanyi("operation.failed"),"");
  148. }
  149. })
  150. })
  151. }
  152. /**
  153. * 生成通知人对象
  154. * @param id 通知人id
  155. * @param name 通知人名称
  156. */
  157. getSysAnnouncementSend(id, name): SysAnnouncementSend {
  158. let sysAnnouncementSend = new SysAnnouncementSend();
  159. sysAnnouncementSend.userId = id;
  160. sysAnnouncementSend.userName = name
  161. return sysAnnouncementSend;
  162. }
  163. close() {
  164. console.log(this.clinicalSection)
  165. this.modal.destroy();
  166. }
  167. }