liangyan0105 3 anni fa
parent
commit
e80014e0b7

+ 2 - 1
src/app/routes/basedata/basedata-routing.module.ts

@@ -31,6 +31,7 @@ import { BasedataCustomerModalTableComponent } from './customer/modal-table/moda
 import { BasedataMaterialFileComponent } from './material-file/material-file.component';
 import { BasedataMaterialFileAddComponent } from './material-file/add/add.component';
 import { BasedataMaterialFileProductAddComponent } from './material-file/product-add/product-add.component';
+import { BasedataMaterialFileDetailsComponent } from './material-file/details/details.component';
 
 const routes: Routes = [
   { path: 'customer', component: BasedataCustomerComponent },
@@ -63,7 +64,7 @@ const routes: Routes = [
   { path: 'material-file', component: BasedataMaterialFileComponent },
   { path: 'add', component: BasedataMaterialFileAddComponent },
   { path: 'productAdd', component: BasedataMaterialFileProductAddComponent },
-];
+  { path: 'details', component: BasedataMaterialFileDetailsComponent }];
 @NgModule({
   imports: [RouterModule.forChild(routes)],
   exports: [RouterModule],

+ 2 - 0
src/app/routes/basedata/basedata.module.ts

@@ -43,6 +43,7 @@ import { BasedataCustomerModalTableComponent } from './customer/modal-table/moda
 import { BasedataMaterialFileComponent } from './material-file/material-file.component';
 import { BasedataMaterialFileAddComponent } from './material-file/add/add.component';
 import { BasedataMaterialFileProductAddComponent } from './material-file/product-add/product-add.component';
+import { BasedataMaterialFileDetailsComponent } from './material-file/details/details.component';
 
 const COMPONENTS = [
   BasedataCustomerComponent,
@@ -75,6 +76,7 @@ const COMPONENTS = [
   BasedataMaterialFileComponent,
   BasedataMaterialFileAddComponent,
   BasedataMaterialFileProductAddComponent,
+  BasedataMaterialFileDetailsComponent,
 ];
 const COMPONENTS_NOROUNT = [
   BasedataCustomerEditComponent,

+ 81 - 0
src/app/routes/basedata/material-file/details/details.component.html

@@ -0,0 +1,81 @@
+<nz-spin [nzSpinning]="isLoading">
+  <form nz-form>
+    <!-- 产品编码 -->
+    <nz-form-item>
+      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">
+        {{ 'product' | translate }}{{ 'table.thead.code' | translate }}
+      </nz-form-label>
+      <nz-form-control [nzSm]="8" [nzXs]="12">
+        {{ baseMaterialFileProduct.code }}
+      </nz-form-control>
+      <!-- 名称 -->
+      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">{{ 'Name' | translate }}</nz-form-label>
+      <nz-form-control [nzSm]="8" [nzXs]="12">
+        {{ baseMaterialFileProduct.name }}
+      </nz-form-control>
+    </nz-form-item>
+
+    <!-- 排序   -->
+    <nz-form-item>
+      <nz-form-label [nzSm]="3" [nzXs]="24" nzRequired>{{ 'depart.sort' | translate }}</nz-form-label>
+      <nz-form-control [nzSm]="8" [nzXs]="12">
+        {{ baseMaterialFileProduct.sort }}
+      </nz-form-control>
+
+      <!--  状态   0未启用    1启用  -->
+      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">
+        {{ 'depart.Whether.to.enable' | translate }}
+      </nz-form-label>
+      <nz-form-control [nzSm]="8" [nzXs]="12" *ngIf="baseMaterialFileProduct.status == 0">
+        {{ 'enabled.not' | translate }}
+      </nz-form-control>
+      <nz-form-control [nzSm]="8" [nzXs]="12" *ngIf="baseMaterialFileProduct.status == 1">
+        {{ 'enabled' | translate }}
+      </nz-form-control>
+    </nz-form-item>
+
+    <!-- 产品属性  1采购    2销售 -->
+    <nz-form-item>
+      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">{{ 'property' | translate }}</nz-form-label>
+      <nz-form-control [nzSm]="8" [nzXs]="12" *ngIf="baseMaterialFileProduct.attribute == 1">
+        {{ 'procurement' | translate }}
+      </nz-form-control>
+      <nz-form-control [nzSm]="8" [nzXs]="12" *ngIf="baseMaterialFileProduct.attribute == 2">
+        {{ 'sales' | translate }}
+      </nz-form-control>
+    </nz-form-item>
+  </form>
+
+  <!-- 模块 表 -->
+  <div nz-row nzGutter="24">
+    <div nz-col nzMd="18" nzLg="24">
+      <nz-table nzSize="small" #basicTable [nzData]="modData" [nzFrontPagination]="false" [nzShowPagination]="false">
+        <thead>
+          <tr>
+            <th style="width:150px;">{{ 'module.code' | translate }}</th>
+            <th style="width:150px;">{{ 'module.name' | translate }}</th>
+            <th style="width:150px;">{{ 'standard.quotation' | translate }}</th>
+          </tr>
+        </thead>
+
+        <tbody>
+          <tr *ngFor="let data of basicTable.data">
+            <!-- 模块编码 -->
+            <td>{{ data.code }}</td>
+            <!-- 模块名称 -->
+            <td>{{ data.name }}</td>
+            <!-- 标准报价 -->
+            <td>{{ data.standardQuotation }}</td>
+          </tr>
+        </tbody>
+      </nz-table>
+    </div>
+  </div>
+</nz-spin>
+
+<!-- 底部 -->
+<div class="footer">
+  <button nz-button (click)="close()">
+    <span>{{ 'button.close' | translate }}</span>
+  </button>
+</div>

+ 24 - 0
src/app/routes/basedata/material-file/details/details.component.spec.ts

@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { BasedataMaterialFileDetailsComponent } from './details.component';
+
+describe('BasedataMaterialFileDetailsComponent', () => {
+  let component: BasedataMaterialFileDetailsComponent;
+  let fixture: ComponentFixture<BasedataMaterialFileDetailsComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ BasedataMaterialFileDetailsComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(BasedataMaterialFileDetailsComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 61 - 0
src/app/routes/basedata/material-file/details/details.component.ts

@@ -0,0 +1,61 @@
+import { Component, OnInit, ViewChild, Input } from '@angular/core';
+import { _HttpClient, ModalHelper } from '@delon/theme';
+import { NzDrawerRef } from 'ng-zorro-antd';
+import { BaseMaterialFileProduct } from 'app/entity/basedata/base-material-file-product';
+import { BaseMaterialFileProductService } from 'app/services/basedata/base-material-file-product.service';
+
+@Component({
+  selector: 'app-basedata-material-file-details',
+  templateUrl: './details.component.html',
+  styles: [
+    `
+      .footer {
+        position: absolute;
+        bottom: 0px;
+        width: 100%;
+        border-top: 1px solid rgb(232, 232, 232);
+        padding: 10px 16px;
+        text-align: right;
+        left: 0px;
+        background: #fff;
+      }
+    `,
+  ],
+})
+export class BasedataMaterialFileDetailsComponent implements OnInit {
+  constructor(private drawerRef: NzDrawerRef, private baseMaterialFileProductService: BaseMaterialFileProductService) {}
+
+  ngOnInit() {
+    this.getProById();
+  }
+
+  @Input() id; //点击抽屉的 ID
+  modData: any = []; //模块表
+  baseMaterialFileProduct: BaseMaterialFileProduct = {}; //产品对象
+  status = false; //是否启用
+  isLoading = true;
+
+  //根据 id  查询主子表数据
+  getProById() {
+    return new Promise(resolve => {
+      this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg');
+      this.baseMaterialFileProductService.queryMainAndChildById(this.id).then(res => {
+        this.baseMaterialFileProduct = res.result;
+        console.log('产品对象集合', this.baseMaterialFileProduct);
+        this.modData = res.result.baseMaterialFileModularList;
+        console.log('模块', this.modData);
+        if (this.modData) {
+          this.modData.forEach(e => {
+            // console.log('2222', e);
+          });
+        }
+        this.isLoading = false;
+        resolve();
+      });
+    });
+  }
+
+  close() {
+    this.drawerRef.close();
+  }
+}

+ 5 - 0
src/app/routes/basedata/material-file/material-file.component.html

@@ -173,7 +173,12 @@
                 </td>
 
                 <!-- 操作按钮 -->
+                <!-- 详情 -->
                 <td nzAlign="center" nzRight="0px" style="width: 20%;">
+                  <a href="javascript:void(0);" (click)="detailProduct(data.id)">
+                    {{ 'table.view' | translate }}
+                  </a>
+                  <nz-divider nzType="vertical"></nz-divider>
                   <!-- 修改 跟新增同一个抽屉-->
                   <a href="javascript:void(0);" (click)="addProduct(data.id)">
                     {{ 'table.update' | translate }}

+ 26 - 13
src/app/routes/basedata/material-file/material-file.component.ts

@@ -19,6 +19,7 @@ import { messageShared } from '@shared/utils/message';
 import { I18NService } from '@core';
 import { BasedataMaterialFileProductAddComponent } from './product-add/product-add.component';
 import { BaseMaterialFileProduct } from 'app/entity/basedata/base-material-file-product';
+import { BasedataMaterialFileDetailsComponent } from './details/details.component';
 
 @Component({
   selector: 'app-basedata-material-file',
@@ -35,10 +36,13 @@ export class BasedataMaterialFileComponent implements OnInit {
   materialNodes: any; //物料分类 数据
   materialId = ''; //物料分类 id
 
-  page: Page; //分页对象
+  //分页对象
+  page = {
+    total: 0,
+    current: 0,
+  };
 
   proTable = []; //产品数据
-
   clickProId = ''; //点击产品id
 
   constructor(
@@ -52,11 +56,6 @@ export class BasedataMaterialFileComponent implements OnInit {
   ) {}
 
   ngOnInit() {
-    // 修改初始化的信息
-    this.page = {
-      pageNo: 1, //当前页码
-      pageSize: 6, //当前页显示的条数
-    };
     this.getMaterialTree(); //物料分类树
     this.getProductList(); // 产品数据
   }
@@ -76,13 +75,14 @@ export class BasedataMaterialFileComponent implements OnInit {
 
   //查询产品 列表
   getProductList() {
+    this.isSpinning = true;
     return new Promise(resolve => {
-      var page = new Page();
-      page.pageSize = 500;
-      this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg'); //组织
+      this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg');
       // 根据页面绑定的查询条件进行查询
       this.baseMaterialFileProductService.list(this.baseMaterialFileProduct).then(res => {
+        this.page = res.result;
         this.proTable = res.result.records;
+        this.isSpinning = false;
         console.log('产品列表(无模块)', this.proTable);
         resolve();
       });
@@ -160,7 +160,7 @@ export class BasedataMaterialFileComponent implements OnInit {
       nzWidth: 1200,
       nzContent: BasedataMaterialFileProductAddComponent,
       nzContentParams: {
-        id: id, //页面点击的产品ID 传参给抽屉 
+        id: id, //页面点击的产品ID 传参给抽屉
         materialId: this.materialId, //物料分类id (给抽屉的回显树)
       },
     });
@@ -168,7 +168,8 @@ export class BasedataMaterialFileComponent implements OnInit {
     drawerAddPro.afterClose.subscribe(clo => {
       //不成功时 清空 物料分类ID
       this.materialId = '';
-      if (clo) { //成功
+      if (clo) {
+        //成功
         //判断是否刷新树列表数据
         this.getMaterialTree();
         this.getProductList();
@@ -185,7 +186,7 @@ export class BasedataMaterialFileComponent implements OnInit {
 
   //按页码查询
   pageIndexChange(event) {
-    console.log('当前页码', event);
+    // console.log('当前页码', event);
     this.baseMaterialFileProduct.pageNo = event;
     this.getProductList();
   }
@@ -229,6 +230,18 @@ export class BasedataMaterialFileComponent implements OnInit {
       }
     });
   }
+
+    //产品详情
+    detailProduct(id) {
+      this.drawerService.create({
+        nzTitle: this.i18NService.fanyi('product.details'),
+        nzWidth: 800,
+        nzContent: BasedataMaterialFileDetailsComponent,
+        nzContentParams: {
+          id: id,
+        },
+      });
+    }
   //删除产品
   delPro(id) {
     this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg'); //组织

+ 1 - 1
src/app/routes/basedata/material-file/product-add/product-add.component.html

@@ -129,7 +129,7 @@
       </div>
     </div>
 
-    <!-- 模块表 -->
+    <!-- 模块 表 -->
     <div nz-row nzGutter="24">
       <div nz-col nzMd="18" nzLg="24">
         <nz-table nzSize="small" #basicTable [nzData]="modData" [nzFrontPagination]="false" [nzShowPagination]="false">

+ 7 - 6
src/app/routes/basedata/material-file/product-add/product-add.component.ts

@@ -12,6 +12,7 @@ import { messageShared } from '@shared/utils/message';
 import { resolveComponentResources } from '@angular/core/src/metadata/resource_loading';
 import { BaseMaterialFileModularService } from 'app/services/basedata/base-material-file-modular.service';
 import { BaseMaterialFileModular } from 'app/entity/basedata/base-material-file-modular';
+import { resetFakeAsyncZone } from '@angular/core/testing';
 
 @Component({
   selector: 'app-basedata-material-file-product-add',
@@ -124,7 +125,6 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
     if (this.status) {
       //是否启用
       this.baseMaterialFileProduct.status = '1';
-      console.log('what');
     } else {
       this.baseMaterialFileProduct.status = '0';
     }
@@ -146,8 +146,8 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
           this.baseMaterialFileProductService.saveMainAndChild(this.baseMaterialFileProduct).then(res => {
             if (res.success) {
               // console.log('out', res);
-              this.baseMaterialFileProduct = res.result;
-              console.log('新增的产品对象>>', this.baseMaterialFileProduct);
+              this.proTable = res.result;
+              console.log('新增的产品对象proTable>>', this.proTable);
               this.getProductList();
               this.nzNotificationService.success(this.i18NService.fanyi('save.ok'), '');
               this.nzDrawerRef.close(true); //关闭抽屉是否刷新列表
@@ -200,9 +200,10 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
   getProductList() {
     return new Promise(resolve => {
       var page = new Page();
-      page.pageSize = 500;
-      this.baseMaterialFileProductService.list(page).then(response => {
-        this.proTable = response.result.records;
+      page.pageSize = 10; //当前页显示的条数
+      this.baseMaterialFileProductService.list(page).then(res => {
+        this.proTable = res.result.records;
+        console.log('查询到的产品数据proTable', this.proTable);
         resolve();
       });
     });

+ 2 - 1
src/assets/tmp/i18n/zh-CN.json

@@ -1920,7 +1920,8 @@
   "bonus":"奖金",
   "wage":"工资",
   "reserved":"预留",
-  "user.of.the.role":"角色下的用户"
+  "user.of.the.role":"角色下的用户",
+  "product.details":"产品详情"
 
 
 }