|
@@ -30,12 +30,15 @@ import { ProjectManageArchives } from 'app/entity/project-manage-archives/projec
|
|
|
],
|
|
|
})
|
|
|
export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
- constructor(private fb: FormBuilder, private projectManageArchivesService: ProjectManageArchivesService,
|
|
|
- private managerPaymentAndReceiptSlipService:ManagerPaymentAndReceiptSlipService,
|
|
|
- private nzNotificationService:NzNotificationService,
|
|
|
- private i18NService:I18NService,
|
|
|
- private drawerRef:NzDrawerRef,
|
|
|
- private invoiceManagePurchaseService:InvoiceManagePurchaseService) {}
|
|
|
+ constructor(
|
|
|
+ private fb: FormBuilder,
|
|
|
+ private projectManageArchivesService: ProjectManageArchivesService,
|
|
|
+ private managerPaymentAndReceiptSlipService: ManagerPaymentAndReceiptSlipService,
|
|
|
+ private nzNotificationService: NzNotificationService,
|
|
|
+ private i18NService: I18NService,
|
|
|
+ private drawerRef: NzDrawerRef,
|
|
|
+ private invoiceManagePurchaseService: InvoiceManagePurchaseService,
|
|
|
+ ) {}
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
@@ -44,23 +47,26 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
});
|
|
|
this.isLoadingSave = true;
|
|
|
|
|
|
- this.getById().then(()=>{
|
|
|
- return this.getProList();
|
|
|
- }).then(()=>{
|
|
|
- return this.getInvoiceIdList();
|
|
|
- }).then(() => {
|
|
|
- this.isLoadingSave = false;
|
|
|
- });
|
|
|
+ this.getById()
|
|
|
+ .then(() => {
|
|
|
+ return this.getProList();
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return this.getInvoiceIdList();
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.isLoadingSave = false;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- id="";
|
|
|
+ id = '';
|
|
|
validateForm!: FormGroup;
|
|
|
managerPaymentAndReceiptSlip: ManagerPaymentAndReceiptSlip = {};
|
|
|
isLoadingSave = false;
|
|
|
proList = [];
|
|
|
proArchivesList = [];
|
|
|
coArchivesList = [];
|
|
|
- invoiceIdList=[];
|
|
|
+ invoiceIdList = [];
|
|
|
|
|
|
formatterDollar = (value: number) => {
|
|
|
if (value) {
|
|
@@ -74,42 +80,42 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
|
|
|
* 获取采购发票下拉数据
|
|
|
*/
|
|
|
- getInvoiceIdList(){
|
|
|
- return new Promise((resolve)=>{
|
|
|
- let invoiceManagePurchase=new InvoiceManagePurchase();
|
|
|
- invoiceManagePurchase.pageSize=20000;
|
|
|
- invoiceManagePurchase.type="1";
|
|
|
- invoiceManagePurchase.pkOrg=sessionStorage.getItem("pkOrg");
|
|
|
- this.invoiceManagePurchaseService.getList(invoiceManagePurchase).then((response)=>{
|
|
|
- if(response.success){
|
|
|
- this.invoiceIdList=response.result.records
|
|
|
+ getInvoiceIdList() {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let invoiceManagePurchase = new InvoiceManagePurchase();
|
|
|
+ invoiceManagePurchase.pageSize = 20000;
|
|
|
+ invoiceManagePurchase.type = '1';
|
|
|
+ invoiceManagePurchase.pkOrg = sessionStorage.getItem('pkOrg');
|
|
|
+ this.invoiceManagePurchaseService.getList(invoiceManagePurchase).then(response => {
|
|
|
+ if (response.success) {
|
|
|
+ this.invoiceIdList = response.result.records;
|
|
|
}
|
|
|
resolve();
|
|
|
- })
|
|
|
- })
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
|
* 根据id查询
|
|
|
*/
|
|
|
- getById(){
|
|
|
+ getById() {
|
|
|
return new Promise(resolve => {
|
|
|
- this.managerPaymentAndReceiptSlipService.queryById(this.id).then((response)=>{
|
|
|
- if(response.success){
|
|
|
- this.managerPaymentAndReceiptSlip=response.result;
|
|
|
- this.itemDataList=response.result.detailList;
|
|
|
- if(this.itemDataList){
|
|
|
+ this.managerPaymentAndReceiptSlipService.queryById(this.id).then(response => {
|
|
|
+ if (response.success) {
|
|
|
+ this.managerPaymentAndReceiptSlip = response.result;
|
|
|
+ this.itemDataList = response.result.detailList;
|
|
|
+ if (this.itemDataList) {
|
|
|
|
|
|
this.itemDataList.forEach(element => {
|
|
|
- this.getMilList(element)
|
|
|
+ this.getMilList(element);
|
|
|
});
|
|
|
|
|
|
- this.sort=this.itemDataList.length+1;
|
|
|
+ this.sort = this.itemDataList.length + 1;
|
|
|
}
|
|
|
}
|
|
|
resolve();
|
|
|
- })
|
|
|
- })
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -144,7 +150,7 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
this.managerPaymentAndReceiptSlip.cusCode = project.cusCode;
|
|
|
this.managerPaymentAndReceiptSlip.cusName = project.cusName;
|
|
|
|
|
|
- this.getLineList()
|
|
|
+ this.getLineList();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -188,7 +194,7 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
if (response.success) {
|
|
|
data.proArchivesIdList = response.result;
|
|
|
|
|
|
- if(data.proArchivesId){
|
|
|
+ if (data.proArchivesId) {
|
|
|
this.proBusinessChange(data);
|
|
|
}
|
|
|
}
|
|
@@ -198,16 +204,19 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
|
|
|
* 里程碑选择事件
|
|
|
*/
|
|
|
- proBusinessChange(data) {
|
|
|
- if (data.proArchivesId) {
|
|
|
- data.proArchivesIdList.forEach(element => {
|
|
|
- if (element.mileId === data.proArchivesId) {
|
|
|
- data.proArchivesMilestone = element.mileName;
|
|
|
- data.coPrvice = element.price;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- this.getCoPrviceTotal();
|
|
|
+ proBusinessChange(data, isUpdate?: string) {
|
|
|
+ if (isUpdate) {
|
|
|
+
|
|
|
+ if (data.proArchivesId) {
|
|
|
+ data.proArchivesIdList.forEach(element => {
|
|
|
+ if (element.mileId === data.proArchivesId) {
|
|
|
+ data.proArchivesMilestone = element.mileName;
|
|
|
+ data.coPrvice = element.price;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.getCoPrviceTotal();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -241,7 +250,7 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
|
|
|
* 金额填写事件
|
|
|
*/
|
|
|
- coPrviceKeyUp(){
|
|
|
+ coPrviceKeyUp() {
|
|
|
|
|
|
this.getCoPrviceTotal();
|
|
|
}
|
|
@@ -249,19 +258,19 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
|
|
|
* 获取收款金额合计
|
|
|
*/
|
|
|
- getCoPrviceTotal(){
|
|
|
+ getCoPrviceTotal() {
|
|
|
|
|
|
- if(!this.itemDataList){
|
|
|
+ if (!this.itemDataList) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- let coPrviceTotal=0;
|
|
|
+ let coPrviceTotal = 0;
|
|
|
this.itemDataList.forEach(element => {
|
|
|
- if(element.coPrvice&&!isNaN(Number(element.coPrvice))){
|
|
|
- coPrviceTotal=coPrviceTotal+Number(element.coPrvice);
|
|
|
+ if (element.coPrvice && !isNaN(Number(element.coPrvice))) {
|
|
|
+ coPrviceTotal = coPrviceTotal + Number(element.coPrvice);
|
|
|
}
|
|
|
});
|
|
|
- this.managerPaymentAndReceiptSlip.totalPrice=coPrviceTotal;
|
|
|
+ this.managerPaymentAndReceiptSlip.totalPrice = coPrviceTotal;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -274,28 +283,28 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
this.validateForm.controls[i].updateValueAndValidity();
|
|
|
}
|
|
|
let valid = this.validateForm.valid;
|
|
|
- if(valid){
|
|
|
- this.managerPaymentAndReceiptSlip.type="2";
|
|
|
- this.managerPaymentAndReceiptSlip.pkOrg=sessionStorage.getItem("pkOrg");
|
|
|
- this.managerPaymentAndReceiptSlip.detailList=this.itemDataList;
|
|
|
+ if (valid) {
|
|
|
+ this.managerPaymentAndReceiptSlip.type = '2';
|
|
|
+ this.managerPaymentAndReceiptSlip.pkOrg = sessionStorage.getItem('pkOrg');
|
|
|
+ this.managerPaymentAndReceiptSlip.detailList = this.itemDataList;
|
|
|
|
|
|
- if(this.itemDataList&&this.itemDataList.length>0){
|
|
|
+ if (this.itemDataList && this.itemDataList.length > 0) {
|
|
|
this.itemDataList.forEach(element => {
|
|
|
|
|
|
- if(element.invoiceId){
|
|
|
+ if (element.invoiceId) {
|
|
|
this.invoiceIdList.forEach(invoice => {
|
|
|
- if(invoice.id===element.invoiceId){
|
|
|
- element.invoice=invoice.proName;
|
|
|
+ if (invoice.id === element.invoiceId) {
|
|
|
+ element.invoice = invoice.proName;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.nzNotificationService.warning('明细数据必填', '');
|
|
|
- this.isLoadingSave=false;
|
|
|
+ this.isLoadingSave = false;
|
|
|
return;
|
|
|
}
|
|
|
- this.managerPaymentAndReceiptSlipService.update(this.managerPaymentAndReceiptSlip).then((response)=>{
|
|
|
+ this.managerPaymentAndReceiptSlipService.update(this.managerPaymentAndReceiptSlip).then(response => {
|
|
|
if (response.success) {
|
|
|
|
|
|
this.isLoadingSave = false;
|
|
@@ -307,7 +316,7 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
|
|
|
this.isLoadingSave = false;
|
|
|
this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|