business-affairs.component.ts 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. import { Component, OnInit, Output, EventEmitter } from '@angular/core';
  2. import { NzModalRef, NzMessageService } from 'ng-zorro-antd';
  3. import { _HttpClient } from '@delon/theme';
  4. import { ProjectManageArchives } from 'app/entity/project-manage-archives/project-manage-archives';
  5. import { BaseArchivesMilestoneService } from 'app/services/basedata/base-archives-milestone.service';
  6. import { BaseArchivesMilestone } from 'app/entity/basedata/base-archives-milestone';
  7. @Component({
  8. selector: 'app-project-manage-archives-add-business-affairs',
  9. templateUrl: './business-affairs.component.html',
  10. })
  11. export class ProjectManageArchivesAddBusinessAffairsComponent implements OnInit {
  12. constructor(
  13. private baseArchivesMilestoneService:BaseArchivesMilestoneService
  14. ) {}
  15. ngOnInit(): void {
  16. }
  17. projectManageArchives: ProjectManageArchives = {}; //项目档案实体对象
  18. collectionPlanList = []; //收款计划数据
  19. paymentCollectionList = []; //回款情况数据
  20. paymentPlanList = []; //付款计划
  21. paymentStatusList = []; //付款情况
  22. planList = []; //计划下来集合数据
  23. formatterDollar = (value: number) => {
  24. if(value){
  25. return `$ ${value}`;
  26. }else{
  27. return `$ `;
  28. }
  29. };
  30. parserDollar = (value: string) => value.replace('$ ', '');
  31. milestoneList :any= []; //里程碑集合数据
  32. /**
  33. *
  34. 收款计划新增
  35. */
  36. collectionPlanSort = 0; //收款计划排序
  37. collectionPlanAdd() {
  38. this.collectionPlanList = [
  39. ...this.collectionPlanList,
  40. {
  41. price1: 0,
  42. price2: 0,
  43. price3: 0,
  44. price4: 0,
  45. price5: 0,
  46. sort: this.collectionPlanSort,
  47. planType: '1',
  48. },
  49. ];
  50. this.collectionPlanSort++;
  51. }
  52. /**
  53. * 收款删除按钮
  54. */
  55. collectionPlanDelete(sort) {
  56. this.collectionPlanList = this.collectionPlanList.filter(d => d.sort !== sort);
  57. }
  58. /**
  59. * 回款计划新增
  60. */
  61. paymentCollectionSort = 0; //回款情况排序
  62. paymentCollectionAdd() {
  63. this.paymentCollectionList = [
  64. ...this.paymentCollectionList,
  65. {
  66. price1: 0,
  67. price2: 0,
  68. price3: 0,
  69. price4: 0,
  70. price5: 0,
  71. sort: this.paymentCollectionSort,
  72. planType: '2',
  73. },
  74. ];
  75. this.paymentCollectionSort++;
  76. }
  77. /**
  78. * 回款删除按钮
  79. */
  80. paymentCollectionDelete(sort) {
  81. this.paymentCollectionList = this.paymentCollectionList.filter(d => d.sort !== sort);
  82. }
  83. /**
  84. * 付款计划新增
  85. */
  86. paymentPlanSort = 0;
  87. paymentPlanAdd() {
  88. this.paymentPlanList = [
  89. ...this.paymentPlanList,
  90. {
  91. price1: 0,
  92. price2: 0,
  93. price3: 0,
  94. price4: 0,
  95. price5: 0,
  96. sort: this.paymentPlanSort,
  97. planType: '3',
  98. },
  99. ];
  100. this.paymentPlanSort++;
  101. }
  102. /**
  103. * 付款计划删除按钮
  104. */
  105. paymentPlanDelete(sort) {
  106. this.paymentPlanList = this.paymentPlanList.filter(d => d.sort !== sort);
  107. }
  108. /**
  109. * 付款情况
  110. */
  111. paymentStatusSort = 0;
  112. paymentStatusAdd() {
  113. this.paymentStatusList = [
  114. ...this.paymentStatusList,
  115. {
  116. price1: 0,
  117. price2: 0,
  118. price3: 0,
  119. price4: 0,
  120. price5: 0,
  121. sort: this.paymentPlanSort,
  122. planType: '4',
  123. },
  124. ];
  125. this.paymentPlanSort++;
  126. }
  127. /**
  128. * 付款情况删除按钮
  129. */
  130. paymentStatusDelete(sort) {
  131. this.paymentStatusList = this.paymentStatusList.filter(d => d.sort !== sort);
  132. }
  133. /**
  134. * 类型触发事件
  135. */
  136. planIdChange(data, type) {
  137. //获取类型名称
  138. this.getPlanName(data);
  139. //如果是回款情况表格中下拉触发
  140. if (type === '2') {
  141. //获取收款计划的金额
  142. this.getCollectionPlanPrice(this.collectionPlanList,data);
  143. //回写数据到实施、开发、服务页签的回款信息
  144. this.getRemittanceInformationChange(data);
  145. }
  146. //如果是付款情况表格中下来触发
  147. if (type === '4') {
  148. //获取付款计划中的金额
  149. this.getCollectionPlanPrice(this.paymentPlanList,data);
  150. }
  151. }
  152. /**
  153. * 获取类型名称
  154. * @param data 计划对象
  155. */
  156. getPlanName(data) {
  157. this.planList.forEach(element => {
  158. if (element.value === data.planId) {
  159. data.planName = element.text;
  160. }
  161. });
  162. }
  163. /**
  164. * 根据回款情况类型获取对应的收款计划金额
  165. * @param list 表格数据
  166. * @param data 表格中的对象
  167. */
  168. getCollectionPlanPrice(list,data) {
  169. list.forEach(element => {
  170. if (data.planId === element.planId) {
  171. data.price1 = element.price1;
  172. data.price2 = element.price2;
  173. data.price3 = element.price3;
  174. data.price4 = element.price4;
  175. data.price5 = element.price5;
  176. }
  177. });
  178. }
  179. /**
  180. * 里程碑选择事件
  181. * @param data
  182. */
  183. mileChange(data) {
  184. //已汇款金额
  185. this.getReceived();
  186. //回写数据到实施、开发、服务页签的回款信息
  187. this.getRemittanceInformationChange(data);
  188. }
  189. /**
  190. * 获取回款情况中的回款金额累加(已汇款金额)
  191. */
  192. getReceived() {
  193. let received = 0;
  194. this.paymentCollectionList.forEach(element => {
  195. if (element.desc1 && !isNaN(Number(element.desc1))) {
  196. received += Number(element.desc1);
  197. }
  198. if (element.desc2 && !isNaN(Number(element.desc2))) {
  199. received += Number(element.desc2);
  200. }
  201. if (element.desc3 && !isNaN(Number(element.desc3))) {
  202. received += Number(element.desc3);
  203. }
  204. if (element.desc4 && !isNaN(Number(element.desc4))) {
  205. received += Number(element.desc4);
  206. }
  207. if (element.desc5 && !isNaN(Number(element.desc5))) {
  208. received += Number(element.desc5);
  209. }
  210. });
  211. this.projectManageArchives.received = received;
  212. }
  213. /**
  214. * 回写数据到实施、开发、服务页签的回款信息
  215. * @param 对象
  216. */
  217. @Output() remittanceInformationChange = new EventEmitter<{}>();
  218. getRemittanceInformationChange(data) {
  219. this.remittanceInformationChange.emit(data);
  220. }
  221. }