|
@@ -39,6 +39,7 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
|
id: string = ''; //接收抽屉产品 id
|
|
|
clickProObj: {}; //点击的产品对象
|
|
|
sort = 1; //默认
|
|
|
+ status = false; //未启用
|
|
|
//金额格式化 (标准报价)
|
|
|
formatterDollar = (value: number) => {
|
|
|
if (value) {
|
|
@@ -67,7 +68,7 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
|
code: [null, [Validators.required]],
|
|
|
name: [null, [Validators.required]],
|
|
|
sort: ['number', [Validators.required]], //排序
|
|
|
- status: [null, [Validators.required]],
|
|
|
+ status: [], //不验证
|
|
|
attribute: [null, [Validators.required]],
|
|
|
baseMaterialFileClassificationId: [null, [Validators.required]], //物料分类id
|
|
|
});
|
|
@@ -78,23 +79,28 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
|
|
|
|
this.baseMaterialFileProduct.id = this.id;
|
|
|
//不是修改
|
|
|
- if (this.baseMaterialFileProduct.id == '') {
|
|
|
+ if (!this.id) {
|
|
|
} else {
|
|
|
//修改 查询对应id 产品 回显
|
|
|
return new Promise(resolve => {
|
|
|
this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg');
|
|
|
this.baseMaterialFileProductService.queryMainAndChildById(this.baseMaterialFileProduct.id).then(res => {
|
|
|
- console.log('所有产品数据', res);
|
|
|
- let clickProObj = res.result;
|
|
|
- this.baseMaterialFileProduct = clickProObj;
|
|
|
+ this.baseMaterialFileProduct = res.result;
|
|
|
+ console.log('点击的产品数据', this.baseMaterialFileProduct);
|
|
|
+ if (this.baseMaterialFileProduct.status == '0') {
|
|
|
+ this.status = false; //未启用
|
|
|
+ } else {
|
|
|
+ this.status = true;
|
|
|
+ }
|
|
|
+
|
|
|
this.baseMaterialFileProduct.status = this.baseMaterialFileProduct.status + '';
|
|
|
- if (clickProObj.baseMaterialFileModularList) {
|
|
|
+ if (this.baseMaterialFileProduct.baseMaterialFileModularList) {
|
|
|
// 以下这种写法,只在该方法中赋值,其他地方相互不影响
|
|
|
// this.modData =JSON.parse(JSON.stringify(clickProObj.baseMaterialFileModularList))
|
|
|
- this.modData = clickProObj.baseMaterialFileModularList;
|
|
|
+ this.modData = this.baseMaterialFileProduct.baseMaterialFileModularList;
|
|
|
this.sort = this.modData.length + 1;
|
|
|
}
|
|
|
- console.log('点击的产品对象', this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
|
+ console.log('模块列表', this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
|
});
|
|
|
resolve();
|
|
|
});
|
|
@@ -126,6 +132,11 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
|
|
|
|
// 产品 保存(新增/修改)
|
|
|
proSubForm() {
|
|
|
+ if (this.status) {
|
|
|
+ this.baseMaterialFileProduct.status = '0';
|
|
|
+ } else {
|
|
|
+ this.baseMaterialFileProduct.status = '1';
|
|
|
+ }
|
|
|
//根据标题判断 新增 or 修改
|
|
|
if (this.id == '') {
|
|
|
console.log('空', this.baseMaterialFileProduct);
|
|
@@ -162,9 +173,10 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
|
return new Promise(resolve => {
|
|
|
this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg'); //组织
|
|
|
this.baseMaterialFileProduct.baseMaterialFileModularList = this.modData;
|
|
|
- console.log('----->', this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
|
+ // console.log('点击项模块列表', this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
|
this.baseMaterialFileProductService.updateMainAndChild(this.baseMaterialFileProduct).then(res => {
|
|
|
if (res.success) {
|
|
|
+ // 修改返回数据赋值给 点击的产品对象
|
|
|
this.clickProObj = res.result;
|
|
|
this.notification.success(this.i18NService.fanyi('successful.revision'), '');
|
|
|
this.getProductList();
|