Browse Source

项目档案 收款单 ico图标

chenc 4 years ago
parent
commit
a019b75d2d

+ 1 - 1
src/app/routes/down-payment-management/payment-slip/update/update.component.html

@@ -86,7 +86,7 @@
               </td>
               </td>
               <td style="width: 20%;">
               <td style="width: 20%;">
                 <nz-select style="width: 100%;" nzShowSearch [(ngModel)]="data.proArchivesId" nzPlaceHolder="请选择"
                 <nz-select style="width: 100%;" nzShowSearch [(ngModel)]="data.proArchivesId" nzPlaceHolder="请选择"
-                (ngModelChange)="proBusinessChange(data)">
+                (ngModelChange)="proBusinessChange(data,'1')">
                 <nz-option *ngFor="let i of data.proArchivesIdList" [nzValue]="i.mileId" [nzLabel]="i.mileName"></nz-option>
                 <nz-option *ngFor="let i of data.proArchivesIdList" [nzValue]="i.mileId" [nzLabel]="i.mileName"></nz-option>
               </nz-select>
               </nz-select>
               </td>
               </td>

+ 76 - 67
src/app/routes/down-payment-management/payment-slip/update/update.component.ts

@@ -30,12 +30,15 @@ import { ProjectManageArchives } from 'app/entity/project-manage-archives/projec
   ],
   ],
 })
 })
 export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
 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 {
   ngOnInit(): void {
     //初始化表单
     //初始化表单
@@ -44,23 +47,26 @@ export class DownPaymentManagementPaymentSlipUpdateComponent 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 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();
         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 DownPaymentManagementPaymentSlipUpdateComponent 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();
         }
         }
       });
       });
     }
     }
@@ -188,7 +194,7 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
       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);
         }
         }
       }
       }
@@ -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();
     this.getCoPrviceTotal();
   }
   }
@@ -249,19 +258,19 @@ export class DownPaymentManagementPaymentSlipUpdateComponent 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;
   }
   }
 
 
   /**
   /**
@@ -274,28 +283,28 @@ export class DownPaymentManagementPaymentSlipUpdateComponent 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="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 => {
           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.proName;
+                if (invoice.id === element.invoiceId) {
+                  element.invoice = invoice.proName;
                 }
                 }
               });
               });
             }
             }
           });
           });
-        }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;
@@ -307,7 +316,7 @@ export class DownPaymentManagementPaymentSlipUpdateComponent implements OnInit {
             this.isLoadingSave = false;
             this.isLoadingSave = false;
             this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
             this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
           }
           }
-        })
+        });
       }
       }
     });
     });
   }
   }

+ 1 - 1
src/app/routes/down-payment-management/receipt/update/update.component.html

@@ -86,7 +86,7 @@
               </td>
               </td>
               <td style="width: 20%;">
               <td style="width: 20%;">
                 <nz-select style="width: 100%;" nzShowSearch [(ngModel)]="data.proArchivesId" nzPlaceHolder="请选择"
                 <nz-select style="width: 100%;" nzShowSearch [(ngModel)]="data.proArchivesId" nzPlaceHolder="请选择"
-                (ngModelChange)="proBusinessChange(data)">
+                (ngModelChange)="proBusinessChange(data,'1')">
                 <nz-option *ngFor="let i of data.proArchivesIdList" [nzValue]="i.mileId" [nzLabel]="i.mileName"></nz-option>
                 <nz-option *ngFor="let i of data.proArchivesIdList" [nzValue]="i.mileId" [nzLabel]="i.mileName"></nz-option>
               </nz-select>
               </nz-select>
               </td>
               </td>

+ 77 - 69
src/app/routes/down-payment-management/receipt/update/update.component.ts

@@ -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'), '');
           }
           }
-        })
+        });
       }
       }
     });
     });
   }
   }

+ 80 - 8
src/app/routes/report-form/project-situation/project-situation.component.html

@@ -1,9 +1,81 @@
-<page-header [action]="phActionTpl">
-  <ng-template #phActionTpl>
-    <button (click)="add()" nz-button nzType="primary">新建</button>
-  </ng-template>
-</page-header>
+<!-- 项目情况统计表 -->
 <nz-card>
 <nz-card>
-  <sf mode="search" [schema]="searchSchema" (formSubmit)="st.reset($event)" (formReset)="st.reset($event)"></sf>
-  <st #st [data]="url" [columns]="columns"></st>
-</nz-card>
+  <form nz-form>
+    <div nz-row [nzGutter]="{ xs: 8, sm: 16, md: 24, lg: 32 }">
+      <div nz-col [nzSpan]="8">
+        <nz-form-item>
+          <nz-form-label [nzSm]="6" [nzXs]="24">项目编码</nz-form-label>
+          <nz-form-control [nzSm]="14" [nzXs]="24">
+            <input nz-input name="code" [(ngModel)]="projectStatisticsWhere.proCode" />
+          </nz-form-control>
+        </nz-form-item>
+      </div>
+      <div nz-col [nzSpan]="8">
+        <nz-form-item>
+          <nz-form-label [nzSm]="2" [nzXs]="24" [nzNoColon]=true></nz-form-label>
+          <nz-form-control [nzSm]="14" [nzXs]="24">
+            <button nzType="primary" (click)="query()" nz-button><span>查询</span></button>
+          </nz-form-control>
+        </nz-form-item>
+      </div>
+    </div>
+  </form>
+  <div nz-row [nzGutter]="{ xs: 8, sm: 16, md: 24, lg: 32 }">
+    <div nz-col [nzSpan]="24">
+      <nz-table  [nzScroll]="{ x: '1930px', y:'550px'}" #expandTable [nzData]="listOfMapData" nzTableLayout="fixed"
+        nzSize="small" [nzShowPagination]="false" [nzFrontPagination]="false" [nzLoading]="isSpinning">
+        <thead>
+          <tr>
+            <th nzWidth="180px" nzLeft="0px">项目编码</th>
+            <th nzWidth="150px" nzLeft="173px">项目名称</th>
+            <th nzWidth="150px">项目组成员</th>
+            <th nzWidth="100px">收付款条线编码</th>
+            <th nzWidth="100px">收付款条线名称</th>
+            <th nzWidth="100px">里程碑名称</th>
+            <th nzWidth="100px">里程碑计划开始时间</th>
+            <th nzWidth="100px">里程碑实际开始时间</th>
+            <th nzWidth="100px">里程碑计划结束时间</th>
+            <th nzWidth="100px">里程碑实际结束时间</th>
+            <th nzWidth="100px">里程碑计划工时</th>
+            <th nzWidth="100px">里程碑实际工时</th>
+            <th nzWidth="100px">里程碑计划收款</th>
+            <th nzWidth="100px">里程碑开票金额</th>
+            <th nzWidth="100px">里程碑实际收款</th>
+            <th nzWidth="100px">里程碑计划付款</th>
+            <th nzWidth="100px">里程碑收票金额</th>
+            <th nzWidth="100px">里程碑实际付款</th>
+          </tr>
+        </thead>
+        <tbody>
+          <ng-container *ngFor="let data of expandTable.data">
+            <ng-container *ngFor="let item of mapOfExpandedData[data.key]">
+              <tr *ngIf="(item.parent && item.parent.expand) || !item.parent">
+                <td nzLeft="0px" [nzIndentSize]="item.level! * 20" [nzShowExpand]="!!item.children"
+                  [(nzExpand)]="item.expand" (nzExpandChange)="collapse(mapOfExpandedData[data.key], item, $event)">
+                  {{ item.proCode }}
+                </td>
+                <td nzLeft="173px">{{ item.proName }}</td>
+                <td>{{ item.member }}</td>
+                <td>{{ item.coArchivesCode }}</td>
+                <td>{{ item.coArchivesName }}</td>
+                <td>{{ item.milesName }}</td>
+                <td>{{ item.mileStartDate }}</td>
+                <td>{{ item.mileRealStartDate }}</td>
+                <td>{{ item.mileEndDate }}</td>
+                <td>{{ item.mileRealEndtDate }}</td>
+                <td>{{ item.mileDuration }}</td>
+                <td>{{ item.mileRealDuration }}</td>
+                <td>{{ item.mileCoPlan }}</td>
+                <td>{{ item.mileInvoice }}</td>
+                <td>{{ item.mileRealCollecion }}</td>
+                <td>{{ item.milePayPlan }}</td>
+                <td>{{ item.mileTicket }}</td>
+                <td>{{ item.mileRealPayment }}</td>
+              </tr>
+            </ng-container>
+          </ng-container>
+        </tbody>
+      </nz-table>
+    </div>
+  </div>
+</nz-card>

+ 87 - 23
src/app/routes/report-form/project-situation/project-situation.component.ts

@@ -2,44 +2,108 @@ import { Component, OnInit, ViewChild } from '@angular/core';
 import { _HttpClient, ModalHelper } from '@delon/theme';
 import { _HttpClient, ModalHelper } from '@delon/theme';
 import { STColumn, STComponent } from '@delon/abc';
 import { STColumn, STComponent } from '@delon/abc';
 import { SFSchema } from '@delon/form';
 import { SFSchema } from '@delon/form';
+import { ProjectStatisticsService } from 'app/services/report-form/project-statistics.service';
 
 
+export interface TreeNodeInterface {
+  key: string;
+  name: string;
+  age?: number;
+  level?: number;
+  expand?: boolean;
+  address?: string;
+  children?: TreeNodeInterface[];
+  parent?: TreeNodeInterface;
+}
 @Component({
 @Component({
   selector: 'app-report-form-project-situation',
   selector: 'app-report-form-project-situation',
   templateUrl: './project-situation.component.html',
   templateUrl: './project-situation.component.html',
 })
 })
 export class ReportFormProjectSituationComponent implements OnInit {
 export class ReportFormProjectSituationComponent implements OnInit {
-  url = `/user`;
-  searchSchema: SFSchema = {
-    properties: {
-      no: {
-        type: 'string',
-        title: '编号'
+  constructor(private projectStatisticsService: ProjectStatisticsService) {}
+
+  ngOnInit() {
+    
+  }
+
+  isSpinning=false;
+
+  /**
+   * 树形初始化
+   */
+  getTreeLoading() {
+    this.listOfMapData.forEach(item => {
+      this.mapOfExpandedData[item.key] = this.convertTreeToList(item);
+    });
+  }
+
+  /**
+   * 获取树形数据
+   */
+  getProStatistics() {
+    this.isSpinning=true;
+    this.projectStatisticsService.getProStatistics(null).then(response => {
+      this.listOfMapData=response.result;
+      this.getTreeLoading();
+      this.isSpinning=false;
+    });
+  }
+
+  projectStatisticsWhere:any={};
+  /**
+   * 查询按钮
+   */
+  query(){
+    this.getProStatistics();
+  }
+
+  listOfMapData: TreeNodeInterface[] = [
+  ];
+
+  mapOfExpandedData: { [key: string]: TreeNodeInterface[] } = {};
+
+  collapse(array: TreeNodeInterface[], data: TreeNodeInterface, $event: boolean): void {
+    if (!$event) {
+      if (data.children) {
+        data.children.forEach(d => {
+          const target = array.find(a => a.key === d.key)!;
+          target.expand = false;
+          this.collapse(array, target, false);
+        });
+      } else {
+        return;
       }
       }
     }
     }
-  };
-  @ViewChild('st') st: STComponent;
-  columns: STColumn[] = [
-    { title: '编号', index: 'no' },
-    { title: '调用次数', type: 'number', index: 'callNo' },
-    { title: '头像', type: 'img', width: '50px', index: 'avatar' },
-    { title: '时间', type: 'date', index: 'updatedAt' },
-    {
-      title: '',
-      buttons: [
-        // { text: '查看', click: (item: any) => `/form/${item.id}` },
-        // { text: '编辑', type: 'static', component: FormEditComponent, click: 'reload' },
-      ]
+  }
+
+  convertTreeToList(root: TreeNodeInterface): TreeNodeInterface[] {
+    const stack: TreeNodeInterface[] = [];
+    const array: TreeNodeInterface[] = [];
+    const hashMap = {};
+    stack.push({ ...root, level: 0, expand: false });
+
+    while (stack.length !== 0) {
+      const node = stack.pop()!;
+      this.visitNode(node, hashMap, array);
+      if (node.children) {
+        for (let i = node.children.length - 1; i >= 0; i--) {
+          stack.push({ ...node.children[i], level: node.level! + 1, expand: false, parent: node });
+        }
+      }
     }
     }
-  ];
 
 
-  constructor(private http: _HttpClient, private modal: ModalHelper) { }
+    return array;
+  }
 
 
-  ngOnInit() { }
+  visitNode(node: TreeNodeInterface, hashMap: { [key: string]: boolean }, array: TreeNodeInterface[]): void {
+    if (!hashMap[node.key]) {
+      hashMap[node.key] = true;
+      array.push(node);
+    }
+  }
 
 
   add() {
   add() {
     // this.modal
     // this.modal
     //   .createStatic(FormEditComponent, { i: { id: 0 } })
     //   .createStatic(FormEditComponent, { i: { id: 0 } })
     //   .subscribe(() => this.st.reload());
     //   .subscribe(() => this.st.reload());
   }
   }
-
 }
 }

+ 39 - 25
src/app/routes/report-form/project-statistics/project-statistics.component.html

@@ -1,4 +1,4 @@
-<!-- 项目情况统计表 -->
+<!-- 项目成本核算表 -->
 <nz-card>
 <nz-card>
   <form nz-form>
   <form nz-form>
     <div nz-row [nzGutter]="{ xs: 8, sm: 16, md: 24, lg: 32 }">
     <div nz-row [nzGutter]="{ xs: 8, sm: 16, md: 24, lg: 32 }">
@@ -15,44 +15,58 @@
           <nz-form-label [nzSm]="2" [nzXs]="24" [nzNoColon]=true></nz-form-label>
           <nz-form-label [nzSm]="2" [nzXs]="24" [nzNoColon]=true></nz-form-label>
           <nz-form-control [nzSm]="14" [nzXs]="24">
           <nz-form-control [nzSm]="14" [nzXs]="24">
             <button nzType="primary" (click)="query()" nz-button><span>查询</span></button>
             <button nzType="primary" (click)="query()" nz-button><span>查询</span></button>
+            <button nzType="primary" (click)="export()" nz-button><span>导出</span></button>
           </nz-form-control>
           </nz-form-control>
         </nz-form-item>
         </nz-form-item>
       </div>
       </div>
     </div>
     </div>
   </form>
   </form>
   <!-- 表格 -->
   <!-- 表格 -->
+  <!-- style="height:500px;overflow-y:scroll;" -->
   <div nz-row [nzGutter]="{ xs: 8, sm: 16, md: 24, lg: 32 }">
   <div nz-row [nzGutter]="{ xs: 8, sm: 16, md: 24, lg: 32 }">
     <div nz-col [nzSpan]="24">
     <div nz-col [nzSpan]="24">
-      <nz-table nzSize="small" class="tableTdPadding" [nzData]="listOfData" #basicTable nzBordered [nzFrontPagination]="false"
-        [nzLoading]="isSpinning">
+      <nz-table nzSize="small" [nzScroll]="{ x: '2220px', y:'550px'}" [nzData]="listOfData" #basicTable nzBordered
+        [nzShowPagination]="false" [nzFrontPagination]="false" [nzLoading]="isSpinning">
         <thead>
         <thead>
-          <tr>
-            <th rowSpan="2">项目编码</th>
-            <th rowSpan="2">项目名称</th>
+          <!-- <tr>
+            <th rowSpan="2" nzWidth="170px">项目编码</th>
+            <th rowSpan="2" nzWidth="150px">项目名称</th>
             <th colSpan="5">收入</th>
             <th colSpan="5">收入</th>
             <th colSpan="5">付款</th>
             <th colSpan="5">付款</th>
-            <th rowSpan="2">应税合计</th>
-            <th rowSpan="2">税后合计</th>
+            <th rowSpan="2" nzWidth="100px">应税合计</th>
+            <th rowSpan="2" nzWidth="100px">税后合计</th>
             <th colSpan="6">内部成本</th>
             <th colSpan="6">内部成本</th>
-            <th rowSpan="2">毛利</th>
+            <th rowSpan="2" nzWidth="100px">毛利</th>
+          </tr> -->
+          <tr>
+            <th rowSpan="2" nzWidth="170px">项目编码</th>
+            <th rowSpan="2" nzWidth="150px">项目名称</th>
+            <th nzWidth="100px">产品</th>
+            <th nzWidth="100px">实施</th>
+            <th nzWidth="100px">开发</th>
+            <th nzWidth="100px">服务</th>
+            <th nzWidth="100px">其他</th>
+            <th nzWidth="100px">产品</th>
+            <th nzWidth="100px">实施</th>
+            <th nzWidth="100px">开发</th>
+            <th nzWidth="100px">服务</th>
+            <th nzWidth="100px">其他</th>
+            <th rowSpan="2" nzWidth="100px">应税合计</th>
+            <th rowSpan="2" nzWidth="100px">税后合计</th>
+            <th nzWidth="100px">预留</th>
+            <th nzWidth="100px">工资</th>
+            <th nzWidth="100px">奖金</th>
+            <th nzWidth="100px">费用</th>
+            <th nzWidth="100px">销售提成</th>
+            <th nzWidth="100px">公摊费用</th>
+            <th rowSpan="2" nzWidth="100px">毛利</th>
           </tr>
           </tr>
           <tr>
           <tr>
-            <th>产品</th>
-            <th>实施</th>
-            <th>开发</th>
-            <th>服务</th>
-            <th>其他</th>
-            <th>产品</th>
-            <th>实施</th>
-            <th>开发</th>
-            <th>服务</th>
-            <th>其他</th>
-            <th>预留</th>
-            <th>工资</th>
-            <th>奖金</th>
-            <th>费用</th>
-            <th>销售提成</th>
-            <th>公摊费用</th>
+            
+            <th colSpan="5">收入</th>
+            <th colSpan="5">付款</th>
+            <th colSpan="6">内部成本</th>
+            
           </tr>
           </tr>
         </thead>
         </thead>
         <tbody>
         <tbody>

+ 33 - 20
src/app/routes/report-form/project-statistics/project-statistics.component.ts

@@ -3,45 +3,58 @@ import { _HttpClient, ModalHelper } from '@delon/theme';
 import { STColumn, STComponent } from '@delon/abc';
 import { STColumn, STComponent } from '@delon/abc';
 import { SFSchema } from '@delon/form';
 import { SFSchema } from '@delon/form';
 import { ProjectStatisticsService } from 'app/services/report-form/project-statistics.service';
 import { ProjectStatisticsService } from 'app/services/report-form/project-statistics.service';
+import { ReportFormPrintService } from 'app/services/report-form-print.service';
 
 
 @Component({
 @Component({
   selector: 'app-report-form-project-statistics',
   selector: 'app-report-form-project-statistics',
   templateUrl: './project-statistics.component.html',
   templateUrl: './project-statistics.component.html',
+  styles: [
+    `
+      
+      th{
+        background-color:rgb(223, 223, 219) !important;
+        font-weight:bold !important;
+        border: solid#000 1px;
+      }
+      td {
+        border: solid#000 1px;
+      }
+    `,
+  ],
 })
 })
 export class ReportFormProjectStatisticsComponent implements OnInit {
 export class ReportFormProjectStatisticsComponent implements OnInit {
-  
-
   constructor(
   constructor(
-    private projectStatisticsService:ProjectStatisticsService
-  ) { }
+    private projectStatisticsService: ProjectStatisticsService,
+    private reportFormPrintService: ReportFormPrintService,
+  ) {}
 
 
-  ngOnInit() { }
-  isSpinning=false;
-  listOfData=[];
-  projectStatisticsWhere:any={}//查询条件参数
+  ngOnInit() {}
+  isSpinning = false;
+  listOfData = [];
+  projectStatisticsWhere: any = {}; //查询条件参数
 
 
   /**
   /**
    * 查询
    * 查询
    */
    */
-  getCostAccountingData(){
-     return new Promise((resolve)=>{
-      this.projectStatisticsService.getCostAccountingData(null).then((response)=>{
-        this.listOfData=response.result;
-      })
-     })
+  getCostAccountingData() {
+    return new Promise(resolve => {
+      this.projectStatisticsService.getCostAccountingData(null).then(response => {
+        this.listOfData = response.result;
+      });
+    });
   }
   }
 
 
   /**
   /**
    * 查询按钮
    * 查询按钮
    */
    */
-  query(){
+  query() {
     this.getCostAccountingData();
     this.getCostAccountingData();
   }
   }
 
 
-  add() {
-    // this.modal
-    //   .createStatic(FormEditComponent, { i: { id: 0 } })
-    //   .subscribe(() => this.st.reload());
+  /**
+   * 导出按钮
+   */
+  export() {
+    this.reportFormPrintService.getProjectStatistics(this.listOfData);
   }
   }
-
 }
 }

+ 95 - 0
src/app/services/report-form-print.service.ts

@@ -0,0 +1,95 @@
+import { Injectable } from '@angular/core';
+
+@Injectable({
+  providedIn: 'root'
+})
+/**
+ * 报表打印
+ */
+export class ReportFormPrintService {
+
+  constructor() { }
+
+  baseUrl = "http://103.40.192.17:10000/report/";  // 报表根路径
+  funcDown = "GetMultipleExcelFile";            // 下载文件函数
+
+  /**
+   * 项目成本核算导出
+   * @param listData 导出数据
+   */
+  getProjectStatistics(listData){
+    var url = this.baseUrl + this.funcDown;
+    let reqDataList = [];//模板json
+    let projectStatisticsJson={
+      mainList:[]//成本核算主数据
+    };//导出数据json
+    projectStatisticsJson.mainList=JSON.parse(JSON.stringify(listData));
+    //把json对象第一层null的属性变成[],后面null的属性变成""
+    this.formatJsonObject(projectStatisticsJson);
+    //添加模板json
+    reqDataList.push({
+      Template:"项目成本核算",
+      Title:"项目成本核算",
+      Wheres:"",
+      Datas:projectStatisticsJson,
+      OpenType:"filedown",
+      SubPath:"cd-project-management"
+  });
+    console.log(reqDataList)
+    var params = [{
+      name: "key",
+      value: JSON.stringify(reqDataList)
+    }];
+    this.formPost(url, params);
+  }
+
+  /**
+   * 当前页面添加form表单,把参数以post方式提交到url
+   *
+   * @param {SerialPattern} body 编号模式对象
+   * @return {Object} 保存结果
+   */
+  formPost(URL, PARAMTERS) {
+    var temp_form = document.createElement("form");
+    temp_form.action = URL;
+    //如需打开新窗口,form的target属性要设置为'_blank'
+    temp_form.target = "_blank";
+    temp_form.method = "post";
+    temp_form.style.display = "none";
+    //添加参数
+    for (var item in PARAMTERS) {
+      var opt = document.createElement("textarea");
+      opt.name = PARAMTERS[item].name;
+      opt.value = PARAMTERS[item].value;
+      temp_form.appendChild(opt);
+      console.log(opt.name);
+      console.log(opt.value);
+    }
+    document.body.appendChild(temp_form);
+    //提交数据
+    temp_form.submit();
+  }
+
+  /**
+   * 把json对象第一层null的属性变成[],后面null的属性变成""
+   *
+   * @param {SerialPattern} body 编号模式对象
+   * @return {Object} 保存结果
+   */
+  formatJsonObject(jsonObject) {
+    for (var p in jsonObject) {
+      if (jsonObject[p] == null)
+        jsonObject[p] = [];
+      else {
+        var jsonArray = jsonObject[p];
+        for (var i = 0, l = jsonArray.length; i < l; i++) {
+          for (var key in jsonArray[i]) {
+            if (jsonArray[i][key] == null)
+              jsonArray[i][key] = "";
+          }
+        }
+      }
+    }
+    return jsonObject;
+  }
+}

+ 5 - 0
src/app/services/report-form/project-statistics.service.ts

@@ -16,4 +16,9 @@ export class ProjectStatisticsService {
   async getCostAccountingData(body: any): Promise<BaseResponse<any>> {
   async getCostAccountingData(body: any): Promise<BaseResponse<any>> {
     return await this.http.get<BaseResponse<any>>("report/getCostAccountingData", { params: body }).toPromise();
     return await this.http.get<BaseResponse<any>>("report/getCostAccountingData", { params: body }).toPromise();
   }
   }
+
+  //项目情况统计表
+  async getProStatistics(body: any): Promise<BaseResponse<any>> {
+    return await this.http.get<BaseResponse<any>>("report/getProStatistics", { params: body }).toPromise();
+  }
 }
 }

BIN
src/favicon.ico


BIN
src/favicon2.ico