|
@@ -39,11 +39,11 @@ export class ExpenseReimbursementExpenseReimbursementFormAddComponent implements
|
|
|
private projectManageArchivesService: ProjectManageArchivesService,
|
|
|
private settingsService: SettingsService,
|
|
|
private baseArchivesCostService: BaseArchivesCostService,
|
|
|
- private nzNotificationService:NzNotificationService,
|
|
|
- private reExpenseSlipService:ReExpenseSlipService,
|
|
|
- private i18NService:I18NService,
|
|
|
- private drawerRef:NzDrawerRef,
|
|
|
- private datePipe:DatePipe
|
|
|
+ private nzNotificationService: NzNotificationService,
|
|
|
+ private reExpenseSlipService: ReExpenseSlipService,
|
|
|
+ private i18NService: I18NService,
|
|
|
+ private drawerRef: NzDrawerRef,
|
|
|
+ private datePipe: DatePipe,
|
|
|
) {}
|
|
|
|
|
|
ngOnInit(): void {
|
|
@@ -51,17 +51,20 @@ export class ExpenseReimbursementExpenseReimbursementFormAddComponent implements
|
|
|
this.validateForm = this.fb.group({
|
|
|
proId: [null, [Validators.required]],
|
|
|
date: [null, [Validators.required]],
|
|
|
- personId: [null, [Validators.required]],
|
|
|
+ personIds: [null, [Validators.required]],
|
|
|
});
|
|
|
- this.isLoadingSave=true;
|
|
|
+ this.isLoadingSave = true;
|
|
|
//人员
|
|
|
- this.getPersonnelList().then(() => {
|
|
|
- return this.getProList(); //项目下拉
|
|
|
- }).then(()=>{
|
|
|
- return this.getCostIdList();//费用项目数据
|
|
|
- }).then(()=>{
|
|
|
- this.isLoadingSave=false;
|
|
|
- });
|
|
|
+ this.getPersonnelList()
|
|
|
+ .then(() => {
|
|
|
+ return this.getProList(); //项目下拉
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return this.getCostIdList(); //费用项目数据
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.isLoadingSave = false;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
isLoadingSave = false;
|
|
@@ -71,6 +74,7 @@ export class ExpenseReimbursementExpenseReimbursementFormAddComponent implements
|
|
|
}; //对象
|
|
|
proList = []; //项目集合
|
|
|
personnelList = []; //人员集合
|
|
|
+ personIds = []; //多选人员数据绑定
|
|
|
|
|
|
/**
|
|
|
* 获取人员下拉数据到各个页签中
|
|
@@ -166,54 +170,66 @@ export class ExpenseReimbursementExpenseReimbursementFormAddComponent implements
|
|
|
this.validateForm.controls[i].updateValueAndValidity();
|
|
|
}
|
|
|
let valid = this.validateForm.valid;
|
|
|
- if(valid){
|
|
|
- this.isLoadingSave=true;
|
|
|
- this.reExpenseSlip.pkOrg=sessionStorage.getItem("pkOrg");//组织
|
|
|
+ if (valid) {
|
|
|
+ this.isLoadingSave = true;
|
|
|
+ this.reExpenseSlip.pkOrg = sessionStorage.getItem('pkOrg'); //组织
|
|
|
//日期
|
|
|
this.reExpenseSlip.date = this.datePipe.transform(this.reExpenseSlip.date, 'yyyy-MM-dd HH:mm:ss');
|
|
|
//人员名称
|
|
|
- if (this.reExpenseSlip.personId) {
|
|
|
+ if (this.personIds) {
|
|
|
//循环集合数据获取名称
|
|
|
+ let pids="";
|
|
|
+ let pNames="";
|
|
|
this.personnelList.forEach(pkOrg => {
|
|
|
pkOrg.children.forEach(depart => {
|
|
|
depart.children.forEach(personnel => {
|
|
|
- if (personnel.key === this.reExpenseSlip.personId) {
|
|
|
- this.reExpenseSlip.person = personnel.name;
|
|
|
- }
|
|
|
+ this.personIds.forEach(pid => {
|
|
|
+ if (personnel.key === pid) {
|
|
|
+ if(pids===""){
|
|
|
+ pids=personnel.key;
|
|
|
+ pNames=personnel.name;
|
|
|
+ }else{
|
|
|
+ pids=pids+"、"+personnel.key;
|
|
|
+ pNames=pNames+"、"+personnel.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
+ this.reExpenseSlip.personId=pids;
|
|
|
+ this.reExpenseSlip.person=pNames;
|
|
|
}
|
|
|
//项目名称
|
|
|
- if(this.reExpenseSlip.proId){
|
|
|
+ if (this.reExpenseSlip.proId) {
|
|
|
this.proList.forEach(element => {
|
|
|
- if(element.id===this.reExpenseSlip.proId){
|
|
|
- this.reExpenseSlip.proName=element.proName;
|
|
|
+ if (element.id === this.reExpenseSlip.proId) {
|
|
|
+ this.reExpenseSlip.proName = element.proName;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//明细
|
|
|
- if(this.itemDataList){
|
|
|
+ if (this.itemDataList) {
|
|
|
this.itemDataList.forEach(element => {
|
|
|
//获取明细中下拉选择的费用项目名称
|
|
|
- if(element.costId){
|
|
|
+ if (element.costId) {
|
|
|
this.costIdList.forEach(cost => {
|
|
|
- if(cost.id===element.costId){
|
|
|
- element.costName=cost.name;
|
|
|
+ if (cost.id === element.costId) {
|
|
|
+ element.costName = cost.name;
|
|
|
}
|
|
|
});
|
|
|
- }else{
|
|
|
- element.costName="";
|
|
|
+ } else {
|
|
|
+ element.costName = '';
|
|
|
}
|
|
|
});
|
|
|
//获取明细数据
|
|
|
- this.reExpenseSlip.detailList=this.itemDataList;
|
|
|
- }else{
|
|
|
+ this.reExpenseSlip.detailList = this.itemDataList;
|
|
|
+ } else {
|
|
|
this.nzNotificationService.warning('费用项目必填', '');
|
|
|
- this.isLoadingSave=false;
|
|
|
+ this.isLoadingSave = false;
|
|
|
return;
|
|
|
}
|
|
|
- this.reExpenseSlipService.add(this.reExpenseSlip).then((response)=>{
|
|
|
+ this.reExpenseSlipService.add(this.reExpenseSlip).then(response => {
|
|
|
if (response.success) {
|
|
|
//保存成功
|
|
|
this.isLoadingSave = false;
|
|
@@ -225,7 +241,7 @@ export class ExpenseReimbursementExpenseReimbursementFormAddComponent implements
|
|
|
this.isLoadingSave = false;
|
|
|
this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|