Browse Source

合同档案

chenc 3 years ago
parent
commit
670c894a9c

+ 1 - 1
src/app/routes/contract-management/contract-file/add/product-module/product-module.component.html

@@ -71,7 +71,7 @@
             <td>
               <a nz-popconfirm nzTitle="{{ 'confirm.to.delete' | translate }}?" nzOkText="{{ 'yes' | translate }}"
                 nzCancelText="{{ 'no' | translate }}"
-                (nzOnConfirm)="productDeleteRow(data.id)">{{ 'table.delete' | translate }}</a>
+                (nzOnConfirm)="productDeleteRow(data)">{{ 'table.delete' | translate }}</a>
             </td>
           </tr>
         </tbody>

+ 8 - 2
src/app/routes/contract-management/contract-file/add/product-module/product-module.component.ts

@@ -54,8 +54,12 @@ export class ContractManagementContractFileAddProductModuleComponent implements
   /**
    * 产品删除行
    */
-  productDeleteRow(id) {
-    this.productList = this.productList.filter(d => d.id !== id);
+  productDeleteRow(data) {
+    this.productList = this.productList.filter(d => d.id !== data.id);
+    //计算折扣单价总和
+    this.getUnitPriceAfterDiscountTotal();
+    //计算标准报价
+    this.standardQuotationModuleKeyUp(data)
   }
 
   /**
@@ -81,6 +85,8 @@ export class ContractManagementContractFileAddProductModuleComponent implements
    */
   moduleDeleteRow(product, id) {
     product.contractFileModularList = product.contractFileModularList.filter(d => d.id !== id);
+    //计算标准报价
+    this.standardQuotationModuleKeyUp(product)
   }
 
   /**

+ 10 - 8
src/app/routes/contract-management/contract-file/contract-file.component.html

@@ -46,17 +46,19 @@
           <tr *ngFor="let data of basicTable.data">
             <td>{{ data.code }}</td>
             <td>{{ data.proName }}</td>
-            <td>{{ data.proName }}</td>
-            <td>{{ data.proName }}</td>
-            <td>{{ data.proName }}</td>
-            <td>{{ data.proName }}</td>
-            <td>{{ data.proName }}</td>
+            <td>{{ data.contractDate }}</td>
+            <td>{{ data.milestoneName }}</td>
+            <td>{{ data.fdCustomerName }}</td>
+            <td>{{ data.standardQuotation }}</td>
+            <td>{{ data.transactionAmount }}</td>
             <td>
-              <a (click)="view(data.id)" >详情</a>
-              <nz-divider nzType="vertical" ></nz-divider>
+              <!-- <a (click)="view(data.id)" >详情</a>
+              <nz-divider nzType="vertical" ></nz-divider> -->
               <a (click)="update(data.id)" >修改</a>
               <nz-divider nzType="vertical" ></nz-divider>
-              <a (click)="delete(data.id)" >删除</a>
+              <a nz-popconfirm nzTitle="{{ 'confirm.to.delete' | translate }}?" nzOkText="{{ 'yes' | translate }}"
+                nzCancelText="{{ 'no' | translate }}"
+                (nzOnConfirm)="delete(data.id)">{{ 'table.delete' | translate }}</a>
             </td>
           </tr>
         </tbody>

+ 19 - 29
src/app/routes/contract-management/contract-file/contract-file.component.ts

@@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
 import { _HttpClient, ModalHelper } from '@delon/theme';
 import { STColumn, STComponent } from '@delon/abc';
 import { SFSchema } from '@delon/form';
-import { NzDrawerService } from 'ng-zorro-antd';
+import { NzDrawerService, NzNotificationService } from 'ng-zorro-antd';
 import { ContractManagementContractFileAddComponent } from './add/add.component';
 import { I18NService } from '@core';
 import { ContractFile } from 'app/entity/contract-management/contract-file';
@@ -14,32 +14,11 @@ import { ContractManagementContractFileUpdateComponent } from './update/update.c
   templateUrl: './contract-file.component.html',
 })
 export class ContractManagementContractFileComponent implements OnInit {
-  url = `/user`;
-  searchSchema: SFSchema = {
-    properties: {
-      no: {
-        type: 'string',
-        title: '编号'
-      }
-    }
-  };
-  @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' },
-      ]
-    }
-  ];
+  
 
   constructor(private nzDrawerService:NzDrawerService,private i18NService:I18NService,
-    private contractFileService:ContractFileService) { }
+    private contractFileService:ContractFileService,
+    private nzNotificationService:NzNotificationService) { }
 
   ngOnInit() {
     this.getList()
@@ -74,7 +53,7 @@ export class ContractManagementContractFileComponent implements OnInit {
     return new Promise((resolve)=>{
       this.isSpinning=true;
       this.contractFile.pkOrg=sessionStorage.getItem("pkOrg");//组织
-      this.contractFileService.getList(this.contractFile).then((response)=>{
+      this.contractFileService.getPageList(this.contractFile).then((response)=>{
         if(response.success){
           this.listOfData=JSON.parse(JSON.stringify((response.result.records)));
           this.page=JSON.parse(JSON.stringify(response.result))
@@ -110,7 +89,7 @@ export class ContractManagementContractFileComponent implements OnInit {
     //关闭抽屉的回调
     drawerRef.afterClose.subscribe((isRefresh) => {
       if (isRefresh) {//刷新list列表
-        // this.getList();
+        this.getList();
       }
     });
   }
@@ -119,7 +98,18 @@ export class ContractManagementContractFileComponent implements OnInit {
    * 删除
    */
   delete(id){
-
+    return new Promise((resolve)=>{
+      this.contractFileService.deleteMainAndChild(id).then((response)=>{
+        if (response.success) {
+          //删除成功
+          this.nzNotificationService.success(this.i18NService.fanyi('successful.deletion'), '');
+          this.getList();
+        } else {
+          //删除失败
+          this.nzNotificationService.error(this.i18NService.fanyi('delete.failed'), '');
+        }
+      })
+    })
   }
 
   add() {
@@ -137,7 +127,7 @@ export class ContractManagementContractFileComponent implements OnInit {
     //关闭抽屉的回调
     drawerRef.afterClose.subscribe((isRefresh) => {
       if (isRefresh) {//刷新list列表
-        // this.getList();
+        this.getList();
       }
     });
   }

+ 1 - 1
src/app/routes/contract-management/contract-file/update/product-module/product-module.component.html

@@ -71,7 +71,7 @@
             <td>
               <a nz-popconfirm nzTitle="{{ 'confirm.to.delete' | translate }}?" nzOkText="{{ 'yes' | translate }}"
                 nzCancelText="{{ 'no' | translate }}"
-                (nzOnConfirm)="productDeleteRow(data.id)">{{ 'table.delete' | translate }}</a>
+                (nzOnConfirm)="productDeleteRow(data)">{{ 'table.delete' | translate }}</a>
             </td>
           </tr>
         </tbody>

+ 8 - 2
src/app/routes/contract-management/contract-file/update/product-module/product-module.component.ts

@@ -52,8 +52,12 @@ export class ContractManagementContractFileUpdateProductModuleComponent implemen
   /**
    * 产品删除行
    */
-  productDeleteRow(id) {
-    this.productList = this.productList.filter(d => d.id !== id);
+  productDeleteRow(data) {
+    this.productList = this.productList.filter(d => d.id !== data.id);
+    //计算折扣单价总和
+    this.getUnitPriceAfterDiscountTotal();
+    //计算标准报价
+    this.standardQuotationModuleKeyUp(data)
   }
 
   /**
@@ -79,6 +83,8 @@ export class ContractManagementContractFileUpdateProductModuleComponent implemen
    */
   moduleDeleteRow(product, id) {
     product.contractFileModularList = product.contractFileModularList.filter(d => d.id !== id);
+    //计算标准报价
+    this.standardQuotationModuleKeyUp(product)
   }
 
   /**

+ 14 - 9
src/app/routes/contract-management/contract-file/update/update.component.ts

@@ -90,21 +90,25 @@ export class ContractManagementContractFileUpdateComponent implements OnInit {
           let contractFile = JSON.parse(JSON.stringify(response.result));
           //合同基本信息
           this.essentialInformation.contractFile = contractFile;
+          //客户联系人下拉
+          this.essentialInformation.getLdCustomerPersonnelList();
           //产品数据
           if (contractFile.contractFileProductList) {
             this.productModule.productList = contractFile.contractFileProductList;
             //获取产品子表的最后排序
-            this.productModule.prouctI = contractFile.contractFileProductList.length + 1;
+            // this.productModule.prouctI = contractFile.contractFileProductList.length + 1;
             //获取模块子表的最后排序
-            let moduleI = 0;
+            // let moduleI = 0;
             contractFile.contractFileProductList.forEach(prod => {
-              if (prod.contractFileModularList) {
-                prod.contractFileModularList.forEach(element => {
-                  moduleI++;
-                });
-              }
+              // if (prod.contractFileModularList) {
+              //   prod.contractFileModularList.forEach(element => {
+              //     moduleI++;
+              //   });
+              // }
+              //获取模块下拉
+              this.productModule.getModuleListByPid(prod)
             });
-            this.productModule.moduleI = moduleI;
+            // this.productModule.moduleI = moduleI;
           }
           //收款计划数据
           if (contractFile.contractFileAndBusinessList) {
@@ -129,6 +133,7 @@ export class ContractManagementContractFileUpdateComponent implements OnInit {
             this.collectionPlan.collectionPlanSort=collectionPlanSort;
             this.collectionPlan.paymentCollectionSort=paymentCollectionSort;
           }
+          resolve();
         }
       });
     });
@@ -247,7 +252,7 @@ export class ContractManagementContractFileUpdateComponent implements OnInit {
           this.collectionPlan.paymentCollectionList,
         );
         contractFile.contractFileAndBusinessList = contractFileAndBusinessList;
-        this.contractFileService.saveMainAndChild(contractFile).then(response => {
+        this.contractFileService.updateMainAndChild(contractFile).then(response => {
           if (response.success) {
             //保存成功
             this.isLoadingSave = false;

+ 9 - 2
src/app/services/contract-management/contract-file.service.ts

@@ -21,6 +21,13 @@ export class ContractFileService {
       .toPromise();
   }
 
+  //分页查询
+  async getPageList(body: any): Promise<BaseResponse<Result<any>>> {
+    return await this.http
+      .get<BaseResponse<Result<any>>>('contract.file/contractFile/getPageList', { params: body })
+      .toPromise();
+  }
+
   //新增
   async add(body: ContractFile): Promise<BaseResponse<any>> {
     return await this.http.post<BaseResponse<any>>('contract.file/contractFile/add', body).toPromise();
@@ -51,8 +58,8 @@ export class ContractFileService {
   }
 
    //主表与子表一起删除
-   async deleteMainAndChild(body:any):Promise<BaseResponse<any>>{
-    return await this.http.delete<BaseResponse<any>>('contract.file/contractFile/deleteMainAndChild',{params:body}).toPromise();
+   async deleteMainAndChild(id:any):Promise<BaseResponse<any>>{
+    return await this.http.delete<BaseResponse<any>>('contract.file/contractFile/deleteMainAndChild',{params:{id:id}}).toPromise();
   }
 
   //修改