浏览代码

物料档案 分类 雏形

liangyan0105 3 年之前
父节点
当前提交
12282a0afc

+ 25 - 20
src/app/entity/basedata/base-material-file-classification.ts

@@ -2,25 +2,30 @@ import { Page } from '../page';
 /**
  * 物料档案分类
  */
-export class BaseMaterialFileClassification extends Page{
-    /**主键*/
-	id?:string;
-	/**编码*/
-	code?:string;
-	/**名称*/
-	name?:string;
-	/**父级id*/
-	parentId?:string;
-	/**排序*/
-    sort?:number;
+export class BaseMaterialFileClassification extends Page {
+  /**主键*/
+  id?: string;
+  /**编码*/
+  code?: string;
+  /**名称*/
+  name?: string;
+  /**父级id*/
+  parentId?: string;
+  /**排序*/
+  sort?: number;
 
-    /**用于tree */
-    //id
-    key?:string;
-    //name
-    title?:string;
-    //是否尾端true/false
-    isLeaf?:boolean;
-    //子集
-    children?:any[];
+  /**用于tree */
+  //id
+  key?: string;
+
+  pkOrg?:string; //组织
+  
+  //name
+  title?: string;
+
+  //是否尾端true/false
+  isLeaf?: boolean;
+
+  //子集
+  children?: any[];
 }

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

@@ -27,7 +27,9 @@ import { BasedataPersonnelSizeComponent } from './personnel-size/personnel-size.
 import { BasedataRegisteredCapitalComponent } from './registered-capital/registered-capital.component';
 import { BasedataSalesStatusComponent } from './sales-status/sales-status.component';
 import { BasedataSalesStatusAddComponent } from './sales-status/add/add.component';
-import { BasedataCustomerModalTableComponent } from './customer/modal-table/modal-table.component';
+import { BasedataCustomerModalTableComponent } from './customer/modal-table/modal-table.component';
+import { BasedataMaterialFileComponent } from './material-file/material-file.component';
+import { BasedataMaterialFileAddComponent } from './material-file/add/add.component';
 
 
 const routes: Routes = [
@@ -56,7 +58,9 @@ const routes: Routes = [
   { path: 'registered-capital', component: BasedataRegisteredCapitalComponent },
   { path: 'sales-status', component: BasedataSalesStatusComponent },
   { path: 'add', component: BasedataSalesStatusAddComponent },
-  { path: 'modalTable', component: BasedataCustomerModalTableComponent }];
+  { path: 'modalTable', component: BasedataCustomerModalTableComponent },
+  { path: 'material-file', component: BasedataMaterialFileComponent },
+  { path: 'add', component: BasedataMaterialFileAddComponent }];
 @NgModule({
   imports: [RouterModule.forChild(routes)],
   exports: [RouterModule]

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

@@ -39,7 +39,9 @@ import { BasedataPersonnelSizeComponent } from './personnel-size/personnel-size.
 import { BasedataRegisteredCapitalComponent } from './registered-capital/registered-capital.component';
 import { BasedataSalesStatusComponent } from './sales-status/sales-status.component';
 import { BasedataSalesStatusAddComponent } from './sales-status/add/add.component';
-import { BasedataCustomerModalTableComponent } from './customer/modal-table/modal-table.component';
+import { BasedataCustomerModalTableComponent } from './customer/modal-table/modal-table.component';
+import { BasedataMaterialFileComponent } from './material-file/material-file.component';
+import { BasedataMaterialFileAddComponent } from './material-file/add/add.component';
 
 
 const COMPONENTS = [
@@ -69,7 +71,9 @@ const COMPONENTS = [
   BasedataRegisteredCapitalComponent,
   BasedataSalesStatusComponent,
   BasedataSalesStatusAddComponent,
-  BasedataCustomerModalTableComponent];
+  BasedataCustomerModalTableComponent,
+  BasedataMaterialFileComponent,
+  BasedataMaterialFileAddComponent];
 const COMPONENTS_NOROUNT = [BasedataCustomerEditComponent,
   BasedataCustomerIsAbbreviationComponent,
   BasedataPostAddComponent,

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

@@ -0,0 +1,66 @@
+<!-- 新增物料分类 -->
+<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
+  <!-- <table>
+    <th style="width: 600px;"></th>
+  </table> -->
+  <!-- 物料分类编码 -->
+  <nz-form-item>
+    <nz-form-label nzRequired [nzSm]="6" [nzXs]="24" nzRequired nzFor="code">
+      {{ 'material.classification.name' | translate }}
+    </nz-form-label>
+    <nz-form-control [nzSm]="14" [nzXs]="24">
+      <input
+        [(ngModel)]="baseMaterialFileClassification.code"
+        formControlName="code"
+        id="code"
+        nz-input
+        placeholder="{{ 'placeholder' | translate }}{{ 'material.classification' | translate }}{{
+          'table.thead.code' | translate
+        }}"
+      />
+    </nz-form-control>
+  </nz-form-item>
+
+  <!-- 物料分类名称 -->
+  <nz-form-item>
+    <nz-form-label nzRequired [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">
+      {{ 'material.classification.name' | translate }}
+    </nz-form-label>
+    <nz-form-control [nzSm]="14" [nzXs]="24">
+      <input
+        [(ngModel)]="baseMaterialFileClassification.name"
+        formControlName="name"
+        nz-input
+        placeholder="{{ 'placeholder' | translate }}{{ 'material.classification.name' | translate }}"
+      />
+    </nz-form-control>
+  </nz-form-item>
+
+  <!-- 物料分类排序 -->
+  <nz-form-item>
+    <nz-form-label nzRequired [nzSm]="6" [nzXs]="24" nzRequired nzFor="sort">
+      {{ 'material.classification' | translate }}{{ 'depart.sort' | translate }}
+    </nz-form-label>
+    <nz-form-control [nzSm]="14" [nzXs]="24">
+      <input
+        [(ngModel)]="baseMaterialFileClassification.sort"
+        formControlName="sort"
+        nz-input
+        placeholder="{{ 'placeholder' | translate }}{{ 'material.classification' | translate }}{{
+          'depart.sort' | translate
+        }}"
+        maxlength="100"
+      />
+    </nz-form-control>
+  </nz-form-item>
+
+  <!-- 底部 -->
+  <!-- <div class="footer">
+    <button type="button" (click)="close()" class="ant-btn" style="margin-right: 8px;">
+      <span>{{ 'button.close' | translate }}</span>
+    </button>
+    <button type="button" (click)="save()" class="ant-btn ant-btn-primary">
+      <span>{{ 'button.save' | translate }}</span>
+    </button>
+  </div> -->
+</form>

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

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

+ 96 - 0
src/app/routes/basedata/material-file/add/add.component.ts

@@ -0,0 +1,96 @@
+import { Component, OnInit, ViewChild, Input } from '@angular/core';
+import { _HttpClient, ModalHelper } from '@delon/theme';
+import { STColumn, STComponent } from '@delon/abc';
+import { SFSchema } from '@delon/form';
+import { NzDrawerRef, NzModalRef, NzNotificationService } from 'ng-zorro-antd';
+import { BaseMaterialFileClassification } from 'app/entity/basedata/base-material-file-classification';
+import { BaseMaterialFileClassificationService } from 'app/services/basedata/base-material-file-classification.service';
+import { I18NService } from '@core';
+import { messageShared } from '@shared/utils/message';
+import { FormBuilder, Validators, FormGroup } from '@angular/forms';
+
+@Component({
+  selector: 'app-basedata-material-file-add',
+  templateUrl: './add.component.html',
+})
+export class BasedataMaterialFileAddComponent implements OnInit {
+  @Input() isOne = 0; //标题
+  @Input() materialId = ''; //分类id
+  validateForm!: FormGroup;
+  parentId = ''; //父级id
+  //初始化 物料分类对象
+  baseMaterialFileClassification: BaseMaterialFileClassification = {
+    // id: '',
+    // code: '',
+    // name: '',
+    // parentId: '',
+    // sort:,
+  };
+
+  constructor(
+    private baseMaterialFileClassificationService: BaseMaterialFileClassificationService,
+    private notification: NzNotificationService,
+    private i18NService: I18NService,
+    private fb: FormBuilder,
+    private nzNotificationService: NzNotificationService,
+    private modal: NzModalRef,
+  ) {}
+
+  ngOnInit() {
+    //初始化表单
+    this.validateForm = this.fb.group({
+      code: [null, [Validators.required]], //物料分类编码
+      name: [null, [Validators.required]],
+      sort: ['number', [Validators.required]], //数字输入框 客商名称排序
+    });
+    //新增子集获取父节点id
+    this.baseMaterialFileClassification.parentId = this.parentId;
+  }
+  //弹框 确定按钮
+  submitForm() {
+    // if (this.isOne == 2) {
+    //   //修改
+    //   this.baseMaterialFileClassificationService.update(this.baseMaterialFileClassification).then(respon => {
+    //     if (respon.success) {
+    //       this.notification.success(this.i18NService.fanyi('successful.revision'), '');
+    //       // this.nzDrawerRef.close(true); //参数用于判断关闭抽屉是否刷新树列表
+    //     } else {
+    //       this.notification.error(
+    //         this.i18NService.fanyi('modification.failed'),
+    //         messageShared(this.i18NService, respon.message),
+    //       );
+    //     }
+    //   });
+    // } else {
+    //新增
+    return new Promise(resolve => {
+      for (const i in this.validateForm.controls) {
+        this.validateForm.controls[i].markAsDirty();
+        this.validateForm.controls[i].updateValueAndValidity();
+      }
+      let valid = this.validateForm.valid;
+      if (valid) {
+        console.log('valid有效--->', valid);
+        this.baseMaterialFileClassification.pkOrg = sessionStorage.getItem('pkOrg'); //组织
+        this.baseMaterialFileClassificationService.add(this.baseMaterialFileClassification).then(res => {
+          if (res.success) {
+            //保存成功
+            this.nzNotificationService.success(this.i18NService.fanyi('save.ok'), '');
+            console.log('>>>>', this.baseMaterialFileClassification);
+            // this.validateForm.controls = {}; //清空
+            this.modal.destroy();
+            resolve();
+          } else {
+            //保存失败
+            this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
+          }
+        });
+      }
+    });
+    // }
+  }
+  // 关闭
+  close() {
+    this.modal.destroy();
+  }
+}

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

@@ -0,0 +1,193 @@
+<!-- 头部导航 -->
+<page-header [action]="phActionTpl">
+  <ng-template #phActionTpl>
+    <span id="materialTitAdd" hidden="true">
+      {{ 'button.add' | translate }}{{ 'material.classification' | translate }}
+    </span>
+    <span id="materialTitUpdate" hidden="true">{{ 'table.update' | translate }}{{ 'personnel' | translate }}</span>
+    <button nz-button nzType="primary" (click)="editProduct('')">
+      {{ 'button.add' | translate }}{{ 'product' | translate }}
+    </button>
+  </ng-template>
+</page-header>
+
+<div nz-row [nzGutter]="24">
+  <!-- 左边 card -->
+  <div nz-col nzMd="24" nzLg="6">
+    <nz-card>
+      <!-- 添加一级 -->
+      <div nz-row [nzGutter]="24" style="margin-bottom: 10px;">
+        <div nz-col nzMd="24" nzLg="24">
+          <button nz-button nzType="primary" (click)="addMaterial(0)">{{ 'button.leve.one' | translate }}</button>
+        </div>
+      </div>
+      <!-- 搜索框 -->
+      <div nz-row [nzGutter]="24">
+        <div nz-col nzMd="24" nzLg="24">
+          <nz-input-group [nzSuffix]="suffixIcon" style="width:100%">
+            <input
+              type="text"
+              nz-input
+              placeholder="{{ 'placeholder' | translate }}{{ 'material.classification.name' | translate }}"
+              [(ngModel)]="searchValue"
+            />
+          </nz-input-group>
+          <ng-template #suffixIcon>
+            <i nz-icon type="search"></i>
+          </ng-template>
+        </div>
+      </div>
+      <!-- 物料 树 -->
+      <div nz-row [nzGutter]="24">
+        <div nz-col nzMd="24" nzLg="24">
+          <nz-tree
+            [nzData]="materialNodes"
+            [nzSearchValue]="searchValue"
+            (nzClick)="treeClick($event)"
+            (nzDblClick)="(openFolder)"
+          >
+            <!-- 树 动态数据 -->
+
+            <!-- 右击 树节点  下拉菜单 4个按钮 -->
+            <ng-template #contextTemplate>
+              <ul nz-menu nzInDropDown>
+                <li nz-menu-item (click)="addMaterial(1)">{{ 'button.add' | translate }}</li>
+                <li nz-menu-item (click)="addMaterial(2)">{{ 'table.update' | translate }}</li>
+                <li nz-menu-item (click)="delMaterial()">{{ 'table.delete' | translate }}</li>
+                <li nz-menu-item (click)="cancel()">{{ 'button.cancel' | translate }}</li>
+              </ul>
+            </ng-template>
+
+            <ng-template #nzTreeTemplate let-node>
+              <span class="custom-node">
+                <span *ngIf="!node.isLeaf" (contextmenu)="contextMenu(node.key, $event, contextTemplate)">
+                  <span class="folder-name">{{ node.name }}</span>
+                </span>
+                <span *ngIf="node.isLeaf" (contextmenu)="contextMenu(node.key, $event, contextTemplate)">
+                  <span class="file-name">{{ node.name }}</span>
+                </span>
+              </span>
+            </ng-template>
+          </nz-tree>
+        </div>
+      </div>
+    </nz-card>
+  </div>
+  <!-- 右边 列表 -->
+  <div nz-col nzMd="24" nzLg="18">
+    <nz-card>
+      <form >
+        <!--查询条件-->
+        <div nz-row nzGutter="24">
+          <div nz-col nzMd="24" nzLg="3">
+            <nz-form-label>产品编码</nz-form-label>
+          </div>
+          <div nz-col nzMd="24" nzLg="6">
+            <input nz-input [(ngModel)]="product.code" name="code" />
+          </div>
+          <div nz-col nzMd="24" nzLg="3">
+            <nz-form-label>产品名称</nz-form-label>
+          </div>
+          <div nz-col nzMd="24" nzLg="6">
+            <input nz-input [(ngModel)]="product.name" name="name" />
+          </div>
+          <!-- 列表查询重置 -->
+          <div nz-col nzMd="24" nzLg="6">
+            <button (click)="query()" nz-button nzType="primary">{{ 'button.query' | translate }}</button>
+            <button (click)="rest()" nz-button nzType="primary">{{ 'button.reset' | translate }}</button>
+          </div>
+        </div>
+      </form>
+      <!-- 产品数据 表 -->
+      <div nz-row nzGutter="24">
+        <div nz-col nzMd="24" nzLg="24">
+          <nz-table
+            class="tableTdPadding"
+            #basicTable
+            [nzData]="proListData"
+            [nzFrontPagination]="false"
+            [nzTotal]="page.total"
+            [nzPageIndex]="page.current"
+            (nzPageIndexChange)="pageIndexChange($event)"
+            [nzLoading]="isSpinning"
+            [nzScroll]="{ x: '70vw' }"
+          >
+            <thead>
+              <tr>
+                <th nzWidth="8vw" nzLeft="0px" nzAlign="center">编号</th>
+                <th nzAlign="center" nzLeft="8vw">名称</th>
+                <th nzAlign="center">组织</th>
+                <th nzAlign="center">排序</th>
+                <th nzAlign="center">状态</th>
+                <th nzAlign="center">属性</th>
+                <!-- <th nzAlign="center"></th>
+                <th nzAlign="center"></th> -->
+                <th nzAlign="center" nzRight="0px">操作</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr *ngFor="let data of basicTable.data">
+                <td style="width: 8vw" nzAlign="center" nzLeft="0px">{{ data.code }}</td>
+                <td nzAlign="center" nzLeft="8vw">{{ data.name }}</td>
+                <td nzAlign="center">{{ data.pkOrg }}</td>
+                <td nzAlign="center">{{ data.sort }}</td>
+                <td nzAlign="center">
+                  <ng-container *ngIf="data.status == 1">
+                    {{ 'state.stay' | translate }}
+                  </ng-container>
+                  <ng-container *ngIf="data.status == 2">
+                    {{ 'state.leave' | translate }}
+                  </ng-container>
+                  <ng-container *ngIf="data.status == 3">
+                    {{ 'state.vacation' | translate }}
+                  </ng-container>
+                </td>
+                <td nzAlign="center">{{ data.attribute }}</td>
+                <!-- 是否停用 -->
+                <td nzAlign="center">
+                  <!-- 否 -->
+                  <nz-tag *ngIf="data.enable === '0'" [nzColor]="'green'">{{ 'no' | translate }}</nz-tag>
+                  <!-- 是 -->
+                  <nz-tag *ngIf="data.enable === '1'" [nzColor]="'red'">{{ 'yes' | translate }}</nz-tag>
+                  <!-- <ng-container *ngIf="data.enable==0">
+                    {{'no'| translate}}
+                  </ng-container>
+                  <ng-container *ngIf="data.enable==1">
+                    {{'yes'| translate}}
+                  </ng-container> -->
+                </td>
+                <!-- 列表操作按钮内 -->
+                <td nzAlign="center" nzRight="0px" style="width: 10%;">
+                  <a href="javascript:void(0);" (click)="openDetailsComponent(data.id)">{{
+                    'table.view' | translate
+                  }}</a>
+                  <nz-divider nzType="vertical"></nz-divider>
+                  <nz-dropdown>
+                    <a nz-dropdown>&nbsp;{{ 'hospital.operation.more' | translate }}<i nz-icon type="down"></i> </a>
+                    <ul nz-menu nzSelectable>
+                      <li nz-menu-item>
+                        <a href="javascript:void(0);" (click)="editPersonnel(data.id)">{{
+                          'table.update' | translate
+                        }}</a>
+                      </li>
+                      <li nz-menu-item>
+                        <a
+                          nz-popconfirm
+                          nzTitle="{{ 'isdelete' | translate }}"
+                          nzOkText="{{ 'yes' | translate }}"
+                          nzCancelText="{{ 'no' | translate }}"
+                          (nzOnConfirm)="deletePersonnel(data.id)"
+                          >{{ 'table.delete' | translate }}</a
+                        >
+                      </li>
+                    </ul>
+                  </nz-dropdown>
+                </td>
+              </tr>
+            </tbody>
+          </nz-table>
+        </div>
+      </div>
+    </nz-card>
+  </div>
+</div>

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

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

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

@@ -0,0 +1,267 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { _HttpClient, ModalHelper } from '@delon/theme';
+import {
+  NzDrawerService,
+  NzDropdownContextComponent,
+  NzDropdownService,
+  NzFormatEmitEvent,
+  NzMessageService,
+  NzModalService,
+  NzTreeNode,
+} from 'ng-zorro-antd';
+import { BasedataMaterialFileAddComponent } from './add/add.component';
+import { Page } from 'app/entity/page';
+import { BaseMaterialFileClassification } from 'app/entity/basedata/base-material-file-classification';
+import { BaseMaterialFileClassificationService } from 'app/services/basedata/base-material-file-classification.service';
+import { BaseMaterialFileProductService } from 'app/services/basedata/base-material-file-product.service';
+import { SFSchema } from '@delon/form';
+import { messageShared } from '@shared/utils/message';
+import { I18NService } from '@core';
+
+@Component({
+  selector: 'app-basedata-material-file',
+  templateUrl: './material-file.component.html',
+})
+export class BasedataMaterialFileComponent implements OnInit {
+  activedNode: NzTreeNode;
+  dropdown: NzDropdownContextComponent;
+  searchValue = ''; //搜索框值
+  materialNodes: any; //物料分类 数据
+  materialId = ''; //物料分类 id
+  page: Page; //  物料档案分类 对象
+  baseMaterialFileClassification: BaseMaterialFileClassification;
+  product: any; //产品对象
+  isSpinning = false;
+  proListData = []; //产品数据
+  productPage = {
+    total: 0,
+    current: 0,
+  };
+  constructor(
+    private drawerService: NzDrawerService,
+    private baseMaterialFileClassificationService: BaseMaterialFileClassificationService,
+    private baseMaterialFileProductService: BaseMaterialFileProductService,
+    private message: NzMessageService,
+    private i18NService: I18NService,
+    private modalService: NzModalService,
+  ) {}
+
+  ngOnInit() {
+    this.getMaterialTree();
+    this.baseMaterialFileClassification = {
+      id: '', //编码
+      code: '', //名称
+      name: '', // 父级id
+      parentId: '',
+      sort: 0, //排序
+      key: '', //用于tree id
+      title: '', //name
+      isLeaf: false, //是否尾端true/false
+      children: [], //子集
+    };
+    this.page = {
+      pageNo: 0, //当前页码
+      pageSize: 6, //当前页显示的条数
+    };
+    this.product = {
+      code: '',
+      name: '',
+      pkOrg: '',
+      pageNo: 0,
+    };
+  }
+  //查询 物料分类 树
+  getMaterialTree() {
+    let baseMaterialFileClassification = new BaseMaterialFileClassification();
+    baseMaterialFileClassification.pkOrg = sessionStorage.getItem('pkOrg'); //组织
+    this.baseMaterialFileClassificationService.getTreeList(baseMaterialFileClassification).then(res => {
+      console.log('物料分类 树', res);
+      this.materialNodes = res.result;
+      console.log('materialNodes', this.materialNodes);
+    });
+  }
+
+  //查询按钮
+  query() {
+    this.product.pageNo = 1;
+    this.getProductList();
+  }
+  //查询全部产品
+  getProductList() {
+    this.isSpinning = true;
+    this.baseMaterialFileProductService.list(this.product).then(reponse => {
+      this.proListData = reponse.result.records;
+      this.productPage = reponse.result;
+      console.log(' this.productPage:', this.productPage);
+      this.isSpinning = false;
+    });
+  }
+  //按页码查询
+  pageIndexChange(event) {
+    // var page = new Page();
+    // page.pageNo = event;//当前页
+    // this.personnelService.getAllPersonnel(page).then((reponse) => {
+    //   this.proListData = reponse.result.records;
+    //   this.page = reponse.result
+    // })
+    this.product.pageNo = event;
+    this.getProductList();
+  }
+
+  //重置
+  rest() {
+    this.baseMaterialFileClassification = {}; //清空 物料对象
+  }
+  //树节点点击事件
+  treeClick(event) {
+    console.log('点击节点的内容', event);
+    var getMaterialId = event.node.origin; //当前点击的物料对象
+    console.log(getMaterialId.parentId);
+
+    //赋值给修改表单
+    this.baseMaterialFileClassification = {
+      code: getMaterialId.code,
+      name: getMaterialId.name,
+      // id: getMaterialId.key,
+      parentId: getMaterialId.parentId,
+      sort: getMaterialId.sort,
+    };
+    
+  }
+
+  //双击节点自动打开树分支
+  openFolder(data: NzTreeNode | Required<NzFormatEmitEvent>): void {
+    console.log(data);
+    // do something if u want
+    if (data instanceof NzTreeNode) {
+      data.isExpanded = !data.isExpanded;
+      console.log('00', data);
+    } else {
+      const node = data.node;
+      if (node) {
+        node.isExpanded = !node.isExpanded;
+        console.log('11', node);
+        console.log('22', node.isExpanded);
+      }
+    }
+  }
+
+  //添加一级 弹框
+  addMaterial() {
+    const modalRef = this.modalService.create({
+      nzTitle: '新增物料分类',
+      nzContent: BasedataMaterialFileAddComponent,
+      nzWidth: 800,
+      nzFooter: [
+        {
+          label: '关闭',
+          type: 'default',
+          onClick: addModel => {
+            addModel.close();
+          },
+        },
+        {
+          label: '确定',
+          type: 'primary',
+          onClick: addModel => {
+            addModel.submitForm().then(() => {
+              console.log('000');
+              this.getMaterialTree(); //新增后刷新 树
+              console.log('1111');
+            });
+          },
+        },
+      ],
+    });
+  }
+  //添加一级、右键添加分类分类、修改
+  // addMaterial(isOne: number) {
+  //   var title = '';
+  //   if (isOne == 0) {
+  //     //新增一级
+  //     this.materialId = '';
+  //     title = document.getElementById('materialTitAdd').textContent;
+  //   } else if (isOne == 1) {
+  //     //新增 某分级 下的产品
+  //     title = document.getElementById('materialTitAdd').textContent;
+  //   } else {
+  //     //修改
+  //     title = document.getElementById('materialTitUpdate').textContent;
+  //   }
+
+  //   //打开抽屉
+  //   const drawerAddMaterialy = this.drawerService.create<
+  //     BasedataMaterialFileAddComponent,
+  //     { isOne: number; materialId: string },
+  //     string
+  //   >({
+  //     nzTitle: title,
+  //     nzWidth: '800',
+  //     nzContent: BasedataMaterialFileAddComponent,
+  //     nzContentParams: {
+  //       isOne: isOne,
+  //       materialId: this.materialId, //产品id
+  //     },
+  //   });
+  //   //回调 添加完关闭抽屉
+  //   drawerAddMaterialy.afterClose.subscribe(clo => {
+  //     if (clo) {
+  //       //判断是否刷新树列表数据
+  //       this.getMaterialTree()
+  //       this.getProductList();
+  //     }
+  //   });
+  //   // this.dropdown.close();
+  // }
+  //右键删除
+  deleteDepart() {
+    this.baseMaterialFileClassificationService.delete(this.materialId).then(res => {
+      if (res.success) {
+        this.message.success(this.i18NService.fanyi('successful.deletion'));
+        this.getMaterialTree();
+        this.getProductList();
+      } else {
+        this.message.error(this.i18NService.fanyi('delete.failed'));
+      }
+    });
+    // this.dropdown.close();
+  }
+  editProduct() {
+    //抽屉title
+    // var title = '';
+    // if (id == '') {
+    //   title = document.getElementById('titleAdd').textContent;
+    // } else {
+    //   title = document.getElementById('titleUpdate').textContent;
+    // }
+    // //打开抽屉
+    // const drawerAddMaterialy = this.drawerService.create<BasedataMaterialFileAddComponent, { id: string }, string>({
+    //   nzTitle: title,
+    //   nzWidth: 1200,
+    //   nzContent: BasedataMaterialFileAddComponent,
+    //   nzContentParams: {
+    //     id: id,
+    //   },
+    // });
+    // //回调 添加完关闭抽屉
+    // drawerAddMaterialy.afterClose.subscribe(clo => {
+    //   if (clo) {
+    //     //判断是否刷新树列表数据
+    //     this.getProductList();
+    //   }
+    // });
+  }
+  //右击修改
+  updateMaterial() {}
+  //右击删除
+  delMaterial() {}
+  //右键取消
+  cancel() {
+    this.dropdown.close();
+  }
+  add() {
+    // this.modal
+    //   .createStatic(FormEditComponent, { i: { id: 0 } })
+    //   .subscribe(() => this.st.reload());
+  }
+}

+ 0 - 1
src/app/routes/basedata/sales-status/add/add.component.ts

@@ -15,7 +15,6 @@ export class BasedataSalesStatusAddComponent implements OnInit {
   constructor(
     private modal: NzModalRef,
     private fb: FormBuilder,
-
     private baseSalesStatusService: BaseSalesStatusService,
     private nzNotificationService: NzNotificationService,
     private i18NService: I18NService,

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

@@ -1857,5 +1857,9 @@
   "billing.address": "开票地址",
   "billing.telephone": "开票电话",
   "billing.bank": "开票银行",
-  "date": "时间"
+  "date": "时间",
+  "product": "产品",
+  "material.classification":"物料分类",
+  "material.classification.name":"物料分类名称"
+
 }