|
@@ -30,12 +30,15 @@ import { InvoiceManagePurchaseService } from 'app/services/invoice-management/in
|
|
],
|
|
],
|
|
})
|
|
})
|
|
export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
export class DownPaymentManagementReceiptUpdateComponent 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 {
|
|
ngOnInit(): void {
|
|
//初始化表单
|
|
//初始化表单
|
|
@@ -44,23 +47,26 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
});
|
|
});
|
|
this.isLoadingSave = true;
|
|
this.isLoadingSave = true;
|
|
//项目查询
|
|
//项目查询
|
|
- this.getById().then(()=>{
|
|
|
|
- return this.getProList();//根据id查询修改数据
|
|
|
|
- }).then(()=>{
|
|
|
|
- return this.getInvoiceIdList();//获取销售下拉数据
|
|
|
|
- }).then(() => {
|
|
|
|
- this.isLoadingSave = false;
|
|
|
|
- });
|
|
|
|
|
|
+ this.getById()
|
|
|
|
+ .then(() => {
|
|
|
|
+ return this.getProList(); //根据id查询修改数据
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ return this.getInvoiceIdList(); //获取销售下拉数据
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.isLoadingSave = false;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
- id="";
|
|
|
|
|
|
+ id = '';
|
|
validateForm!: FormGroup;
|
|
validateForm!: FormGroup;
|
|
managerPaymentAndReceiptSlip: ManagerPaymentAndReceiptSlip = {}; //对象
|
|
managerPaymentAndReceiptSlip: ManagerPaymentAndReceiptSlip = {}; //对象
|
|
isLoadingSave = false;
|
|
isLoadingSave = false;
|
|
proList = []; //项目下拉数据
|
|
proList = []; //项目下拉数据
|
|
proArchivesList = []; //里程碑下拉数据
|
|
proArchivesList = []; //里程碑下拉数据
|
|
coArchivesList = []; //条线下拉数据
|
|
coArchivesList = []; //条线下拉数据
|
|
- invoiceIdList=[];//发票数据集合
|
|
|
|
|
|
+ invoiceIdList = []; //发票数据集合
|
|
//金额格式化
|
|
//金额格式化
|
|
formatterDollar = (value: number) => {
|
|
formatterDollar = (value: number) => {
|
|
if (value) {
|
|
if (value) {
|
|
@@ -74,42 +80,42 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
/**
|
|
/**
|
|
* 获取销售发票下拉数据
|
|
* 获取销售发票下拉数据
|
|
*/
|
|
*/
|
|
- getInvoiceIdList(){
|
|
|
|
- return new Promise((resolve)=>{
|
|
|
|
- let invoiceManagePurchase=new InvoiceManagePurchase();
|
|
|
|
- invoiceManagePurchase.pageSize=20000;
|
|
|
|
- invoiceManagePurchase.type="2";
|
|
|
|
- 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 = '2';
|
|
|
|
+ invoiceManagePurchase.pkOrg = sessionStorage.getItem('pkOrg');
|
|
|
|
+ this.invoiceManagePurchaseService.getList(invoiceManagePurchase).then(response => {
|
|
|
|
+ if (response.success) {
|
|
|
|
+ this.invoiceIdList = response.result.records;
|
|
}
|
|
}
|
|
resolve();
|
|
resolve();
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据id查询
|
|
* 根据id查询
|
|
*/
|
|
*/
|
|
- getById(){
|
|
|
|
|
|
+ getById() {
|
|
return new Promise(resolve => {
|
|
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.itemDataList.forEach(element => {
|
|
- this.getMilList(element)
|
|
|
|
|
|
+ this.getMilList(element);
|
|
});
|
|
});
|
|
//获取最大排序
|
|
//获取最大排序
|
|
- this.sort=this.itemDataList.length+1;
|
|
|
|
|
|
+ this.sort = this.itemDataList.length + 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
resolve();
|
|
resolve();
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -144,7 +150,7 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
this.managerPaymentAndReceiptSlip.cusCode = project.cusCode; //客户编码
|
|
this.managerPaymentAndReceiptSlip.cusCode = project.cusCode; //客户编码
|
|
this.managerPaymentAndReceiptSlip.cusName = project.cusName; //客户名称
|
|
this.managerPaymentAndReceiptSlip.cusName = project.cusName; //客户名称
|
|
//获取条线下拉数据
|
|
//获取条线下拉数据
|
|
- this.getLineList()
|
|
|
|
|
|
+ this.getLineList();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -182,34 +188,36 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
* 获取里程碑下拉数据
|
|
* 获取里程碑下拉数据
|
|
*/
|
|
*/
|
|
getMilList(data) {
|
|
getMilList(data) {
|
|
- console.log(data)
|
|
|
|
|
|
+ console.log(data);
|
|
//获取里程碑下拉数据
|
|
//获取里程碑下拉数据
|
|
let where = { businessId: data.coArchivesId };
|
|
let where = { businessId: data.coArchivesId };
|
|
this.projectManageArchivesService.getMileNameById(where).then(response => {
|
|
this.projectManageArchivesService.getMileNameById(where).then(response => {
|
|
if (response.success) {
|
|
if (response.success) {
|
|
data.proArchivesIdList = response.result;
|
|
data.proArchivesIdList = response.result;
|
|
//一般用于选择完里程碑又反过来选条线 则重新获取金额
|
|
//一般用于选择完里程碑又反过来选条线 则重新获取金额
|
|
- if(data.proArchivesId){
|
|
|
|
|
|
+ if (data.proArchivesId) {
|
|
this.proBusinessChange(data);
|
|
this.proBusinessChange(data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- console.log(data)
|
|
|
|
|
|
+ console.log(data);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 里程碑选择事件
|
|
* 里程碑选择事件
|
|
*/
|
|
*/
|
|
- 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();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -243,7 +251,7 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
/**
|
|
/**
|
|
* 金额填写事件
|
|
* 金额填写事件
|
|
*/
|
|
*/
|
|
- coPrviceKeyUp(){
|
|
|
|
|
|
+ coPrviceKeyUp() {
|
|
//计算总金额
|
|
//计算总金额
|
|
this.getCoPrviceTotal();
|
|
this.getCoPrviceTotal();
|
|
}
|
|
}
|
|
@@ -251,19 +259,19 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
/**
|
|
/**
|
|
* 获取收款金额合计
|
|
* 获取收款金额合计
|
|
*/
|
|
*/
|
|
- getCoPrviceTotal(){
|
|
|
|
|
|
+ getCoPrviceTotal() {
|
|
//判断是否有值
|
|
//判断是否有值
|
|
- if(!this.itemDataList){
|
|
|
|
|
|
+ if (!this.itemDataList) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
//获取所有金额总计
|
|
//获取所有金额总计
|
|
- let coPrviceTotal=0;
|
|
|
|
|
|
+ let coPrviceTotal = 0;
|
|
this.itemDataList.forEach(element => {
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -276,28 +284,28 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
this.validateForm.controls[i].updateValueAndValidity();
|
|
this.validateForm.controls[i].updateValueAndValidity();
|
|
}
|
|
}
|
|
let valid = this.validateForm.valid;
|
|
let valid = this.validateForm.valid;
|
|
- if(valid){
|
|
|
|
- this.managerPaymentAndReceiptSlip.type="1";//收款表
|
|
|
|
- this.managerPaymentAndReceiptSlip.pkOrg=sessionStorage.getItem("pkOrg");//公司组织
|
|
|
|
- this.managerPaymentAndReceiptSlip.detailList=this.itemDataList;
|
|
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.managerPaymentAndReceiptSlip.type = '1'; //收款表
|
|
|
|
+ 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 => {
|
|
this.itemDataList.forEach(element => {
|
|
//获取发票下拉中选中的名称
|
|
//获取发票下拉中选中的名称
|
|
- if(element.invoiceId){
|
|
|
|
|
|
+ if (element.invoiceId) {
|
|
this.invoiceIdList.forEach(invoice => {
|
|
this.invoiceIdList.forEach(invoice => {
|
|
- if(invoice.id===element.invoiceId){
|
|
|
|
- element.invoice=invoice.billcode;
|
|
|
|
|
|
+ if (invoice.id === element.invoiceId) {
|
|
|
|
+ element.invoice = invoice.billcode;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
this.nzNotificationService.warning('明细数据必填', '');
|
|
this.nzNotificationService.warning('明细数据必填', '');
|
|
- this.isLoadingSave=false;
|
|
|
|
|
|
+ this.isLoadingSave = false;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.managerPaymentAndReceiptSlipService.update(this.managerPaymentAndReceiptSlip).then((response)=>{
|
|
|
|
|
|
+ this.managerPaymentAndReceiptSlipService.update(this.managerPaymentAndReceiptSlip).then(response => {
|
|
if (response.success) {
|
|
if (response.success) {
|
|
//保存成功
|
|
//保存成功
|
|
this.isLoadingSave = false;
|
|
this.isLoadingSave = false;
|
|
@@ -309,7 +317,7 @@ export class DownPaymentManagementReceiptUpdateComponent implements OnInit {
|
|
this.isLoadingSave = false;
|
|
this.isLoadingSave = false;
|
|
this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|