ngx-rs-ant 0.10.5 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -822,10 +822,11 @@ class DataGridService {
822
822
  return response.data.list;
823
823
  }));
824
824
  }
825
- getColumnDataSource(className, view, field) {
825
+ getColumnDataSource(tenant, className, view, field) {
826
826
  return this.http.get('api/data/custom', {
827
827
  params: {
828
828
  executor: 'com.cs.system.data.grid.header.filter.GetColumnDataSource',
829
+ tenant,
829
830
  className,
830
831
  view: view || '',
831
832
  field
@@ -989,7 +990,7 @@ class DataGridComponent {
989
990
  }
990
991
  reload() {
991
992
  this.columns.length = 0;
992
- this.service.getMetadataByView(this.tenant, this.className, this.view || '').subscribe((response) => {
993
+ this.service.getMetadataByView(this.tenant, this.className, this.view || '').subscribe(response => {
993
994
  const columns = [];
994
995
  for (let field of response.data.columns) {
995
996
  switch (field.type) {
@@ -1270,7 +1271,7 @@ class DataGridComponent {
1270
1271
  if (loadOptions.dataField) {
1271
1272
  // 未重写headerFilter的dataSource时,headerFilter会调用load方法加载筛选树,重写该方法查询该表所有数据
1272
1273
  // 该方式存在风险,无法识别一定是通过headerFilter过滤才存在dataField参数
1273
- return lastValueFrom(this.service.getColumnDataSource(this.className, this.view, loadOptions.dataField));
1274
+ return lastValueFrom(this.service.getColumnDataSource(this.tenant, this.className, this.view, loadOptions.dataField));
1274
1275
  }
1275
1276
  let params = '?';
1276
1277
  if (loadOptions.skip || loadOptions.take) {
@@ -1462,6 +1463,16 @@ class FormService {
1462
1463
  }
1463
1464
  });
1464
1465
  }
1466
+ getInitModelByTemplate(tenant, className, template) {
1467
+ let api = 'api/data/' + className + '/new';
1468
+ return this.http.get(api, {
1469
+ params: {
1470
+ tenant,
1471
+ className,
1472
+ template: template || ''
1473
+ }
1474
+ });
1475
+ }
1465
1476
  createOrUpdate(tenant, className, model) {
1466
1477
  let api = 'api/data/' + className;
1467
1478
  if (model.oid) {
@@ -1490,12 +1501,12 @@ class FormComponent {
1490
1501
  this.loading = false;
1491
1502
  }
1492
1503
  ngOnInit() {
1493
- this.service.getFormTemplateConfig(this.tenant, this.className, this.template).subscribe((response) => {
1504
+ this.loading = true;
1505
+ this.service.getFormTemplateConfig(this.tenant, this.className, this.template).subscribe(response => {
1494
1506
  this.config = response.data.template;
1495
1507
  if (this.copyOid || this.oid) {
1496
- this.loading = true;
1497
1508
  this.service.getOne(this.tenant, this.className, this.copyOid || this.oid, this.template)
1498
- .subscribe((response) => {
1509
+ .subscribe(response => {
1499
1510
  if (this.copyOid) {
1500
1511
  delete response.data.oid;
1501
1512
  }
@@ -1505,8 +1516,11 @@ class FormComponent {
1505
1516
  });
1506
1517
  }
1507
1518
  else {
1508
- this.model = {};
1509
- this.loaded = true;
1519
+ this.service.getInitModelByTemplate(this.tenant, this.className, this.template).subscribe(response => {
1520
+ this.model = response.data;
1521
+ this.loaded = true;
1522
+ this.loading = false;
1523
+ });
1510
1524
  }
1511
1525
  });
1512
1526
  }
@@ -1525,7 +1539,7 @@ class FormComponent {
1525
1539
  this.service.createOrUpdate(this.tenant, this.className, {
1526
1540
  oid: this.oid,
1527
1541
  ...this.model
1528
- }).subscribe((response) => {
1542
+ }).subscribe(response => {
1529
1543
  this.submitCallback.emit(response);
1530
1544
  });
1531
1545
  }