Browse Source

工艺导出

Administrator 3 years ago
parent
commit
110454c70e

+ 3 - 0
src/app/entity/fbs/fbs-technological-process.ts

@@ -12,6 +12,9 @@ export class FbsTechnologicalProcess extends Page{
   /**物料名称 */
   cinvCName?:string;
 
+  itemName?:string;//子表工艺名称
+  standardWorkingHours?:number;//标准工时
+
   //明细
   fbsTechnologicalProcessItemList?:any[];
 }

+ 1 - 0
src/app/routes/fbs-scan-code/list/list.component.ts

@@ -196,4 +196,5 @@ export class FbsScanCodeListComponent implements OnInit {
   }
 
   view() {}
+  
 }

+ 1 - 0
src/app/routes/fbs-technological-process/list/list.component.html

@@ -1,6 +1,7 @@
 <page-header [action]="phActionTpl">
   <ng-template #phActionTpl>
     <!-- <button (click)="add()" nz-button nzType="primary">新建</button> -->
+    <button (click)="getExport()" nz-button nzType="primary" [nzLoading]="exportLoading">导出</button>
   </ng-template>
 </page-header>
 <nz-card>

+ 51 - 2
src/app/routes/fbs-technological-process/list/list.component.ts

@@ -1,6 +1,6 @@
 import { Component, OnInit, ViewChild } from '@angular/core';
 import { _HttpClient, ModalHelper } from '@delon/theme';
-import { STColumn, STComponent } from '@delon/abc';
+import { STColumn, STComponent, XlsxService } from '@delon/abc';
 import { SFSchema } from '@delon/form';
 import { FbsTechnologicalProcess } from 'app/entity/fbs/fbs-technological-process';
 import { FbsTechnologicalProcessService } from 'app/services/fbs/fbs-technological-process.service';
@@ -17,7 +17,8 @@ export class FbsTechnologicalProcessListComponent implements OnInit {
   constructor(
     private fbsTechnologicalProcessService:FbsTechnologicalProcessService,
     private nzModalService:NzModalService,
-    private nzNotificationService:NzNotificationService
+    private nzNotificationService:NzNotificationService,
+    private xlsx: XlsxService
   ) { }
 
   ngOnInit() {
@@ -137,4 +138,52 @@ export class FbsTechnologicalProcessListComponent implements OnInit {
   }
 
 
+  /**
+   * 导出
+   */
+  exportLoading=false;
+  getExport(){
+    this.exportLoading = true;
+    let fbsTechnologicalProcess=JSON.parse(JSON.stringify(this.fbsTechnologicalProcess));
+    fbsTechnologicalProcess.pageNo=1
+    fbsTechnologicalProcess.pageSize=200000;
+    this.fbsTechnologicalProcessService.getExport(fbsTechnologicalProcess).then((response)=>{
+      if(response.success){//查询成功
+       let dataList=response.result;//表格数据
+       let data = [];
+        let title = [
+          ["工作中心"],
+          ["物料编码"],
+          ["物料名称"],
+          ["工艺"],
+          ["标准工时"]
+        ]
+        data.push(title);
+        if(dataList){
+          dataList.forEach(element => {
+            let row = [];
+            row.push(element.memo)
+            row.push(element.name)
+            row.push(element.cinvCName)
+            row.push(element.itemName)
+            row.push(element.standardWorkingHours)
+            data.push(row);
+          });
+        }
+        // 导出
+        this.xlsx.export({
+          sheets: [
+            {
+              data: data,
+              name: '工艺流程',
+            },
+          ],
+          filename: '工艺流程.xlsx',
+        });
+        this.exportLoading=false;
+      }
+    })
+  }
+
+
 }

+ 4 - 0
src/app/services/fbs/fbs-technological-process.service.ts

@@ -16,6 +16,10 @@ export class FbsTechnologicalProcessService {
   async list(body:any): Promise<BaseResponse<Result<FbsTechnologicalProcess[]>>> {
     return await this.http.get<BaseResponse<Result<FbsTechnologicalProcess[]>>>('/fbsBasedate/fbsTechnologicalProcess/list',{params:body}).toPromise();
   }
+  //导出
+  async getExport(body:any): Promise<BaseResponse<FbsTechnologicalProcess[]>> {
+    return await this.http.get<BaseResponse<FbsTechnologicalProcess[]>>('/fbsBasedate/fbsTechnologicalProcess/getExport',{params:body}).toPromise();
+  }
   // 子表明细查询
   async listItem(body:any): Promise<BaseResponse<Result<FbsTechnologicalProcessItem[]>>> {
     return await this.http.get<BaseResponse<Result<FbsTechnologicalProcessItem[]>>>('/fbsBasedate/fbsTechnologicalProcessItem/list',{params:body}).toPromise();