|
@@ -12,7 +12,6 @@ import { messageShared } from '@shared/utils/message';
|
|
import { resolveComponentResources } from '@angular/core/src/metadata/resource_loading';
|
|
import { resolveComponentResources } from '@angular/core/src/metadata/resource_loading';
|
|
import { BaseMaterialFileModularService } from 'app/services/basedata/base-material-file-modular.service';
|
|
import { BaseMaterialFileModularService } from 'app/services/basedata/base-material-file-modular.service';
|
|
import { BaseMaterialFileModular } from 'app/entity/basedata/base-material-file-modular';
|
|
import { BaseMaterialFileModular } from 'app/entity/basedata/base-material-file-modular';
|
|
-import { log } from 'console';
|
|
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-basedata-material-file-product-add',
|
|
selector: 'app-basedata-material-file-product-add',
|
|
@@ -36,9 +35,10 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
materialTree: any = [];
|
|
materialTree: any = [];
|
|
validateForm!: FormGroup;
|
|
validateForm!: FormGroup;
|
|
modData: any = [];
|
|
modData: any = [];
|
|
- aa: [];
|
|
+
|
|
- id: string;
|
|
+ id: string = '';
|
|
-
|
|
+ clickProObj: {};
|
|
|
|
+ sort = 1;
|
|
|
|
|
|
formatterDollar = (value: number) => {
|
|
formatterDollar = (value: number) => {
|
|
if (value) {
|
|
if (value) {
|
|
@@ -71,13 +71,35 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
attribute: [null, [Validators.required]],
|
|
attribute: [null, [Validators.required]],
|
|
baseMaterialFileClassificationId: [null, [Validators.required]],
|
|
baseMaterialFileClassificationId: [null, [Validators.required]],
|
|
});
|
|
});
|
|
-
|
|
+
|
|
this.baseMaterialFileProduct.baseMaterialFileClassificationId = this.materialId;
|
|
this.baseMaterialFileProduct.baseMaterialFileClassificationId = this.materialId;
|
|
this.getMaterialTree();
|
|
this.getMaterialTree();
|
|
this.getProductList();
|
|
this.getProductList();
|
|
- this.getmodList();
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ this.baseMaterialFileProduct.id = this.id;
|
|
|
|
+
|
|
|
|
+ if (this.baseMaterialFileProduct.id == '') {
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ 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.status = this.baseMaterialFileProduct.status + '';
|
|
|
|
+ if (clickProObj.baseMaterialFileModularList) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.modData = clickProObj.baseMaterialFileModularList;
|
|
|
|
+ this.sort = this.modData.length + 1;
|
|
|
|
+ }
|
|
|
|
+ console.log('点击的产品对象', this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
|
|
+ });
|
|
|
|
+ resolve();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
getMaterialTree() {
|
|
getMaterialTree() {
|
|
return new Promise(resolve => {
|
|
return new Promise(resolve => {
|
|
@@ -101,79 +123,64 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
- getmodList() {
|
|
|
|
- return new Promise(resolve => {
|
|
|
|
- let baseMaterialFileModular = new BaseMaterialFileModular();
|
|
|
|
- baseMaterialFileModular.pkOrg = sessionStorage.getItem('pkOrg');
|
|
|
|
- this.baseMaterialFileModularService.list(baseMaterialFileModular).then(res => {
|
|
|
|
- this.aa = res.result.records;
|
|
|
|
- console.log('-->modList', this.aa);
|
|
|
|
- resolve();
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
proSubForm() {
|
|
proSubForm() {
|
|
|
|
|
|
-
|
|
+ if (this.id == '') {
|
|
-
|
|
+ console.log('空', this.baseMaterialFileProduct);
|
|
-
|
|
+
|
|
-
|
|
+ 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.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg');
|
|
-
|
|
+
|
|
-
|
|
+ this.baseMaterialFileProduct.baseMaterialFileModularList = this.modData;
|
|
-
|
|
+ console.log('----->', this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
-
|
|
+ this.baseMaterialFileProductService.saveMainAndChild(this.baseMaterialFileProduct).then(res => {
|
|
-
|
|
+ if (res.success) {
|
|
-
|
|
+ console.log('out', res);
|
|
-
|
|
+ this.baseMaterialFileProduct = res.result;
|
|
-
|
|
+ console.log('产品对象>>>>', this.baseMaterialFileProduct);
|
|
-
|
|
+ this.getProductList();
|
|
- return new Promise(resolve => {
|
|
+ this.nzNotificationService.success(this.i18NService.fanyi('save.ok'), '');
|
|
- for (const i in this.validateForm.controls) {
|
|
+ this.nzDrawerRef.close(true);
|
|
- this.validateForm.controls[i].markAsDirty();
|
|
+ } else {
|
|
- this.validateForm.controls[i].updateValueAndValidity();
|
|
+ this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
- }
|
|
+ }
|
|
- let valid = this.validateForm.valid;
|
|
+ });
|
|
- console.log('111');
|
|
+ resolve();
|
|
- if (valid) {
|
|
+ }
|
|
- console.log('222');
|
|
+ });
|
|
- console.log('valid有效--->', valid);
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ return new Promise(resolve => {
|
|
this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg');
|
|
this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg');
|
|
-
|
|
|
|
this.baseMaterialFileProduct.baseMaterialFileModularList = this.modData;
|
|
this.baseMaterialFileProduct.baseMaterialFileModularList = this.modData;
|
|
- console.log(this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
+ console.log('----->', this.baseMaterialFileProduct.baseMaterialFileModularList);
|
|
- console.log('走这没');
|
|
+ this.baseMaterialFileProductService.updateMainAndChild(this.baseMaterialFileProduct).then(res => {
|
|
-
|
|
|
|
- this.baseMaterialFileProductService.saveMainAndChild(this.baseMaterialFileProduct).then(res => {
|
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
- console.log('out', res);
|
|
+ this.clickProObj = res.result;
|
|
- this.baseMaterialFileProduct = res.result;
|
|
+ this.notification.success(this.i18NService.fanyi('successful.revision'), '');
|
|
- console.log('产品对象>>>>', this.baseMaterialFileProduct);
|
|
|
|
this.getProductList();
|
|
this.getProductList();
|
|
- this.nzNotificationService.success(this.i18NService.fanyi('save.ok'), '');
|
|
|
|
this.nzDrawerRef.close(true);
|
|
this.nzDrawerRef.close(true);
|
|
} else {
|
|
} else {
|
|
- this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
+ this.notification.error(
|
|
|
|
+ this.i18NService.fanyi('modification.failed'),
|
|
|
|
+ messageShared(this.i18NService, res.message),
|
|
|
|
+ );
|
|
}
|
|
}
|
|
});
|
|
});
|
|
resolve();
|
|
resolve();
|
|
- }
|
|
+ });
|
|
- });
|
|
+ }
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- sort = 1;
|
|
|
|
-
|
|
|
|
|
|
|
|
addRowMod() {
|
|
addRowMod() {
|
|
this.modData = [
|
|
this.modData = [
|
|
@@ -189,24 +196,11 @@ export class BasedataMaterialFileProductAddComponent implements OnInit {
|
|
this.sort++;
|
|
this.sort++;
|
|
}
|
|
}
|
|
|
|
|
|
- deleteMod(data): void {
|
|
+ deleteMod(data) {
|
|
- if (data.id == '') {
|
|
+ console.log('模块数据', this.modData);
|
|
-
|
|
+
|
|
- this.modData = this.modData.filter(d => d.sort !== data.sort);
|
|
+
|
|
- } else {
|
|
+ this.modData = this.modData.filter(d => d.sort !== data.sort);
|
|
-
|
|
|
|
- this.baseMaterialFileModularService.delete(data.id).then(response => {
|
|
|
|
- if (response.success) {
|
|
|
|
- this.notification.success(this.i18NService.fanyi('successful.deletion'), '');
|
|
|
|
- this.getmodList();
|
|
|
|
- } else {
|
|
|
|
- this.notification.error(
|
|
|
|
- this.i18NService.fanyi('delete.failed'),
|
|
|
|
- messageShared(this.i18NService, response.message),
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|