|
@@ -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 = ''; //物料分类 id
|
|
|
- page: Page; // 物料档案分类 对象
|
|
|
- baseMaterialFileClassification: BaseMaterialFileClassification;
|
|
|
- product: any; //产品对象
|
|
|
- isSpinning = false;
|
|
|
- proListData = []; //产品数据
|
|
|
+ page: Page; //分页对象
|
|
|
+
|
|
|
+ proTable = []; //产品数据
|
|
|
+ proObj: any; //产品对象
|
|
|
+ proId = ''; //点击产品id
|
|
|
+
|
|
|
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: '', //用于tree id
|
|
|
title: '', //name
|
|
|
isLeaf: false, //是否尾端true/false
|
|
|
children: [], //子集
|
|
|
};
|
|
|
-
|
|
|
- // 页码
|
|
|
- this.page = {
|
|
|
- pageNo: 0, //当前页码
|
|
|
- pageSize: 6, //当前页显示的条数
|
|
|
+ this.baseMaterialFileProduct = {
|
|
|
+ id: '',
|
|
|
+ code: '',
|
|
|
+ name: '',
|
|
|
+ pkOrg: '',
|
|
|
+ sort: 0,
|
|
|
+ status: '',
|
|
|
+ attribute: '',
|
|
|
+ baseMaterialFileClassificationId: '',
|
|
|
+ /**模块子表数据*/
|
|
|
+ // baseMaterialFileModularList?:BaseMaterialFileModular[];
|
|
|
};
|
|
|
-
|
|
|
- //产品
|
|
|
- this.product = {
|
|
|
+ //产品 对象
|
|
|
+ this.proObj = {
|
|
|
+ id: '',
|
|
|
code: '',
|
|
|
name: '',
|
|
|
pkOrg: '',
|
|
|
- pageNo: 0,
|
|
|
+ sort: 0,
|
|
|
+ status: '',
|
|
|
+ attribute: '',
|
|
|
+ baseMaterialFileClassificationId: '',
|
|
|
+ // baseMaterialFileModularList?:BaseMaterialFileModular[]; //模块子表数据
|
|
|
};
|
|
|
+ // 页码
|
|
|
+ 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;
|
|
|
- // console.log(' this.productPage:', this.productPage);
|
|
|
- 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;
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- //添加一级、右键添加分类分类、修改
|
|
|
+ //添加、修改一级(涵右键) ( 对话框 add )
|
|
|
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, //判断修改 or 新增
|
|
|
materialId: this.materialId, //物料分类id
|
|
|
},
|
|
|
nzFooter: [
|
|
@@ -149,21 +175,50 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
],
|
|
|
});
|
|
|
}
|
|
|
+ //新增产品 /修改 ( 抽屉 product-add)
|
|
|
+ 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, //物料分类id
|
|
|
+ },
|
|
|
+ });
|
|
|
+ //回调 添加完关闭抽屉
|
|
|
+ drawerAddPro.afterClose.subscribe(clo => {
|
|
|
+ if (clo) {
|
|
|
+ //判断是否刷新树列表数据
|
|
|
+ this.getMaterialTree();
|
|
|
+ this.getProductList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
//按页码查询
|
|
|
pageIndexChange(event) {
|
|
|
// var page = new Page();
|
|
|
// page.pageNo = event;//当前页
|
|
|
// this.personnelService.getAllPersonnel(page).then((reponse) => {
|
|
|
- // this.proListData = reponse.result.records;
|
|
|
+ // this.proTable = reponse.result.records;
|
|
|
// this.page = reponse.result
|
|
|
// })
|
|
|
- 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;
|
|
|
- // console.log('11', node);
|
|
|
- // console.log('22', node.isExpanded);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -202,9 +255,6 @@ export class BasedataMaterialFileComponent implements OnInit {
|
|
|
this.dropdown = this.nzDropdownService.create($event, template);
|
|
|
// console.log('右击对象', this.dropdown);
|
|
|
}
|
|
|
-
|
|
|
- //修改产品
|
|
|
- editProduct() {}
|
|
|
//右击删除
|
|
|
delMaterial() {
|
|
|
this.baseMaterialFileClassificationService.delete(this.materialId).then(response => {
|