|
@@ -10,29 +10,36 @@ import {
|
|
|
NzTreeNode,
|
|
|
} from 'ng-zorro-antd';
|
|
|
import { BasedataMaterialFileAddComponent } from './add/add.component';
|
|
|
-import { Page } from 'app/entity/page';
|
|
|
+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';
|
|
|
+import { BasedataMaterialFileProductAddComponent } from './product-add/product-add.component';
|
|
|
+import { BaseMaterialFileProduct } from 'app/entity/basedata/base-material-file-product';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-basedata-material-file',
|
|
|
templateUrl: './material-file.component.html',
|
|
|
})
|
|
|
export class BasedataMaterialFileComponent implements OnInit {
|
|
|
+ baseMaterialFileClassification: BaseMaterialFileClassification;
|
|
|
+ baseMaterialFileProduct: BaseMaterialFileProduct;
|
|
|
activedNode: NzTreeNode;
|
|
|
dropdown: NzDropdownContextComponent;
|
|
|
+ isSpinning = false;
|
|
|
+
|
|
|
searchValue = '';
|
|
|
materialNodes: any;
|
|
|
materialId = '';
|
|
|
- page: Page;
|
|
|
- baseMaterialFileClassification: BaseMaterialFileClassification;
|
|
|
- product: any;
|
|
|
- isSpinning = false;
|
|
|
- proListData = [];
|
|
|
+ page: Page;
|
|
|
+
|
|
|
+ proTable = [];
|
|
|
+ proObj: any;
|
|
|
+ proId = '';
|
|
|
+
|
|
|
productPage = {
|
|
|
total: 0,
|
|
|
current: 0,
|
|
@@ -48,85 +55,104 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
|
- this.getProductList();
|
|
|
- this.getMaterialTree();
|
|
|
-
|
|
|
|
|
|
this.baseMaterialFileClassification = {
|
|
|
id: '',
|
|
|
code: '',
|
|
|
name: '',
|
|
|
parentId: '',
|
|
|
+ pkOrg: '',
|
|
|
sort: 0,
|
|
|
key: '',
|
|
|
title: '',
|
|
|
isLeaf: false,
|
|
|
children: [],
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
- this.page = {
|
|
|
- pageNo: 0,
|
|
|
- pageSize: 6,
|
|
|
+ this.baseMaterialFileProduct = {
|
|
|
+ id: '',
|
|
|
+ code: '',
|
|
|
+ name: '',
|
|
|
+ pkOrg: '',
|
|
|
+ sort: 0,
|
|
|
+ status: '',
|
|
|
+ attribute: '',
|
|
|
+ baseMaterialFileClassificationId: '',
|
|
|
+
|
|
|
+
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
- this.product = {
|
|
|
+
|
|
|
+ this.proObj = {
|
|
|
+ id: '',
|
|
|
code: '',
|
|
|
name: '',
|
|
|
pkOrg: '',
|
|
|
- pageNo: 0,
|
|
|
+ sort: 0,
|
|
|
+ status: '',
|
|
|
+ attribute: '',
|
|
|
+ baseMaterialFileClassificationId: '',
|
|
|
+
|
|
|
};
|
|
|
+
|
|
|
+ this.page = {
|
|
|
+ pageNo: 0,
|
|
|
+ pageSize: 6,
|
|
|
+ };
|
|
|
+ this.getMaterialTree();
|
|
|
+ this.getProductList();
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
+ console.log('物料分类 树', this.materialNodes);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
query() {
|
|
|
- this.product.pageNo = 1;
|
|
|
- this.getProductList();
|
|
|
+ this.proObj.pageNo = 1;
|
|
|
+ this.getProductList();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
getProductList() {
|
|
|
- this.isSpinning = true;
|
|
|
- this.baseMaterialFileProductService.list(this.product).then(reponse => {
|
|
|
- this.proListData = reponse.result.records;
|
|
|
- this.productPage = reponse.result;
|
|
|
-
|
|
|
- this.isSpinning = false;
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.isSpinning = true;
|
|
|
+ let baseMaterialFileProduct = new BaseMaterialFileProduct();
|
|
|
+ baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg');
|
|
|
+ this.baseMaterialFileProductService.list(this.proObj).then(res => {
|
|
|
+ console.log('产品列表接口返回数据', res);
|
|
|
+ this.proTable = res.result.records;
|
|
|
+ this.productPage = res.result;
|
|
|
+ console.log('产品', this.proTable);
|
|
|
+ this.isSpinning = false;
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
addMaterial(isOne: number) {
|
|
|
var title = '';
|
|
|
if (isOne == 0) {
|
|
|
|
|
|
this.materialId = '';
|
|
|
- title = document.getElementById('materialTitAdd').textContent;
|
|
|
+ title = document.getElementById('titleAdd').textContent;
|
|
|
} else if (isOne == 1) {
|
|
|
|
|
|
- title = document.getElementById('materialTitAdd').textContent;
|
|
|
+ title = document.getElementById('titleAdd').textContent;
|
|
|
} else {
|
|
|
|
|
|
- title = document.getElementById('materialTitUpdate').textContent;
|
|
|
+ title = document.getElementById('titleUpdate').textContent;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const modalRef = this.modalService.create({
|
|
|
nzTitle: title,
|
|
|
nzContent: BasedataMaterialFileAddComponent,
|
|
|
nzWidth: 800,
|
|
|
|
|
|
nzComponentParams: {
|
|
|
- isOne: isOne,
|
|
|
+ isOne: isOne,
|
|
|
materialId: this.materialId,
|
|
|
},
|
|
|
nzFooter: [
|
|
@@ -149,21 +175,50 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
],
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ addProduct(id) {
|
|
|
+ var title = '';
|
|
|
+
|
|
|
+ if (id) {
|
|
|
+ title = document.getElementById('proTitUpdate').textContent;
|
|
|
+ } else {
|
|
|
+ this.proId = '';
|
|
|
+ title = document.getElementById('proTitAdd').textContent;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const drawerAddPro = this.drawerService.create<BasedataMaterialFileProductAddComponent, { proId: string }, string>({
|
|
|
+ nzTitle: title,
|
|
|
+ nzWidth: 1200,
|
|
|
+ nzContent: BasedataMaterialFileProductAddComponent,
|
|
|
+ nzContentParams: {
|
|
|
+ proId: this.proId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ drawerAddPro.afterClose.subscribe(clo => {
|
|
|
+ if (clo) {
|
|
|
+
|
|
|
+ this.getMaterialTree();
|
|
|
+ this.getProductList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
pageIndexChange(event) {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
- this.product.pageNo = event;
|
|
|
+ this.proObj.pageNo = event;
|
|
|
this.getProductList();
|
|
|
}
|
|
|
|
|
|
|
|
|
rest() {
|
|
|
- this.baseMaterialFileClassification = {};
|
|
|
+ this.proObj = {};
|
|
|
}
|
|
|
|
|
|
treeClick(event) {
|
|
@@ -190,8 +245,6 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
const node = data.node;
|
|
|
if (node) {
|
|
|
node.isExpanded = !node.isExpanded;
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -202,9 +255,6 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
this.dropdown = this.nzDropdownService.create($event, template);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- editProduct() {}
|
|
|
|
|
|
delMaterial() {
|
|
|
this.baseMaterialFileClassificationService.delete(this.materialId).then(response => {
|