|
@@ -1,4 +1,4 @@
|
|
|
-import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
+import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
|
|
import { _HttpClient, ModalHelper } from '@delon/theme';
|
|
|
import {
|
|
|
NzDrawerService,
|
|
@@ -44,25 +44,34 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
private message: NzMessageService,
|
|
|
private i18NService: I18NService,
|
|
|
private modalService: NzModalService,
|
|
|
+ private nzDropdownService: NzDropdownService,
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
|
- this.getMaterialTree();
|
|
|
+ this.getProductList();
|
|
|
+
|
|
|
+ this.getMaterialTree();
|
|
|
+
|
|
|
+
|
|
|
this.baseMaterialFileClassification = {
|
|
|
- id: '',
|
|
|
- code: '',
|
|
|
- name: '',
|
|
|
+ id: '',
|
|
|
+ code: '',
|
|
|
+ name: '',
|
|
|
parentId: '',
|
|
|
- sort: 0,
|
|
|
+ sort: 0,
|
|
|
key: '',
|
|
|
title: '',
|
|
|
isLeaf: false,
|
|
|
children: [],
|
|
|
};
|
|
|
+
|
|
|
+
|
|
|
this.page = {
|
|
|
pageNo: 0,
|
|
|
pageSize: 6,
|
|
|
};
|
|
|
+
|
|
|
+
|
|
|
this.product = {
|
|
|
code: '',
|
|
|
name: '',
|
|
@@ -92,10 +101,55 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
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;
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ 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 modalRef = this.modalService.create({
|
|
|
+ nzTitle: title,
|
|
|
+ nzContent: BasedataMaterialFileAddComponent,
|
|
|
+ nzWidth: 800,
|
|
|
+
|
|
|
+ nzComponentParams: {
|
|
|
+ isOne: isOne,
|
|
|
+ materialId: this.materialId,
|
|
|
+ },
|
|
|
+ nzFooter: [
|
|
|
+ {
|
|
|
+ label: '关闭',
|
|
|
+ type: 'default',
|
|
|
+ onClick: addModel => {
|
|
|
+ addModel.close();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '确定',
|
|
|
+ type: 'primary',
|
|
|
+ onClick: addModel => {
|
|
|
+ addModel.submitForm();
|
|
|
+ this.getMaterialTree();
|
|
|
+ this.getProductList();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
pageIndexChange(event) {
|
|
|
|
|
@@ -114,19 +168,16 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
treeClick(event) {
|
|
|
- console.log('点击节点的内容', event);
|
|
|
- var getMaterialId = event.node.origin;
|
|
|
- console.log(getMaterialId.parentId);
|
|
|
-
|
|
|
+
|
|
|
+ var materialObj = event.node.origin;
|
|
|
+
|
|
|
|
|
|
this.baseMaterialFileClassification = {
|
|
|
- code: getMaterialId.code,
|
|
|
- name: getMaterialId.name,
|
|
|
-
|
|
|
- parentId: getMaterialId.parentId,
|
|
|
- sort: getMaterialId.sort,
|
|
|
+ code: materialObj.code,
|
|
|
+ name: materialObj.name,
|
|
|
+ parentId: materialObj.parentId,
|
|
|
+ sort: materialObj.sort,
|
|
|
};
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -140,128 +191,37 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
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');
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- ],
|
|
|
- });
|
|
|
+
|
|
|
+ contextMenu(Fid, $event: MouseEvent, template: TemplateRef<void>): void {
|
|
|
+ this.materialId = Fid;
|
|
|
+ this.dropdown = this.nzDropdownService.create($event, template);
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- deleteDepart() {
|
|
|
- this.baseMaterialFileClassificationService.delete(this.materialId).then(res => {
|
|
|
- if (res.success) {
|
|
|
+
|
|
|
+ editProduct() {}
|
|
|
+
|
|
|
+ delMaterial() {
|
|
|
+ this.baseMaterialFileClassificationService.delete(this.materialId).then(response => {
|
|
|
+ if (response.success) {
|
|
|
this.message.success(this.i18NService.fanyi('successful.deletion'));
|
|
|
this.getMaterialTree();
|
|
|
this.getProductList();
|
|
|
+ this.dropdown.close();
|
|
|
+
|
|
|
} else {
|
|
|
this.message.error(this.i18NService.fanyi('delete.failed'));
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
- editProduct() {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- updateMaterial() {}
|
|
|
-
|
|
|
- delMaterial() {}
|
|
|
|
|
|
cancel() {
|
|
|
this.dropdown.close();
|
|
|
}
|
|
|
- add() {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
}
|