@ibiz-template/runtime 0.7.41-alpha.112 → 0.7.41-alpha.114
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.
- package/dist/index.esm.js +264 -44
- package/dist/index.system.min.js +1 -1
- package/out/config/global-config.d.ts.map +1 -1
- package/out/config/global-config.js +1 -0
- package/out/constant/predefined-attributes.d.ts +5 -1
- package/out/constant/predefined-attributes.d.ts.map +1 -1
- package/out/constant/predefined-attributes.js +4 -0
- package/out/controller/common/control/md-control.controller.js +1 -1
- package/out/controller/control/form/form/form.controller.d.ts +9 -1
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +54 -5
- package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.js +5 -0
- package/out/controller/control/grid/grid/grid.controller.d.ts +4 -0
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +45 -8
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts +2 -1
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts.map +1 -1
- package/out/controller/control/md-ctrl/md-ctrl.controller.js +37 -6
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts +16 -1
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts.map +1 -1
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.js +31 -0
- package/out/controller/utils/data-file-util/data-file-util.d.ts +2 -1
- package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -1
- package/out/controller/utils/data-file-util/data-file-util.js +11 -6
- package/out/interface/api/call/i-api-medit-view9.call.d.ts +20 -0
- package/out/interface/api/call/i-api-medit-view9.call.d.ts.map +1 -1
- package/out/interface/api/common/global-config/i-api-global-common-config.d.ts +9 -0
- package/out/interface/api/common/global-config/i-api-global-common-config.d.ts.map +1 -1
- package/out/interface/api/controller/control/i-api-medit-view-panel.controller.d.ts +9 -0
- package/out/interface/api/controller/control/i-api-medit-view-panel.controller.d.ts.map +1 -1
- package/out/interface/api/util/i-api-excel-util.d.ts +53 -1
- package/out/interface/api/util/i-api-excel-util.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree.state.d.ts +12 -0
- package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
- package/out/interface/provider/i-platform-provider.d.ts +54 -2
- package/out/interface/provider/i-platform-provider.d.ts.map +1 -1
- package/out/locale/en/index.d.ts +3 -0
- package/out/locale/en/index.d.ts.map +1 -1
- package/out/locale/en/index.js +3 -0
- package/out/locale/zh-CN/index.d.ts +3 -0
- package/out/locale/zh-CN/index.d.ts.map +1 -1
- package/out/locale/zh-CN/index.js +3 -0
- package/out/platform/provider/platform-provider-base.d.ts.map +1 -1
- package/out/platform/provider/platform-provider-base.js +1 -2
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.js +2 -0
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +14 -0
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.js +33 -0
- package/out/service/vo/tree-node-data/tree-node-data.d.ts +16 -0
- package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-node-data.js +25 -0
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-static-node-data.js +2 -0
- package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/front-ui-action-provider.js +3 -1
- package/package.json +3 -3
- package/src/config/global-config.ts +1 -0
- package/src/constant/predefined-attributes.ts +5 -0
- package/src/controller/common/control/md-control.controller.ts +1 -1
- package/src/controller/control/form/form/form.controller.ts +58 -11
- package/src/controller/control/form/form-detail/form-druipart/form-druipart.controller.ts +3 -0
- package/src/controller/control/grid/grid/grid.controller.ts +63 -11
- package/src/controller/control/md-ctrl/md-ctrl.controller.ts +52 -7
- package/src/controller/control/medit-view-panel/medit-view-panel.controller.ts +39 -1
- package/src/controller/utils/data-file-util/data-file-util.ts +21 -9
- package/src/interface/api/call/i-api-medit-view9.call.ts +21 -0
- package/src/interface/api/common/global-config/i-api-global-common-config.ts +10 -0
- package/src/interface/api/controller/control/i-api-medit-view-panel.controller.ts +10 -0
- package/src/interface/api/util/i-api-excel-util.ts +38 -1
- package/src/interface/controller/state/control/i-tree.state.ts +14 -0
- package/src/interface/provider/i-platform-provider.ts +43 -2
- package/src/locale/en/index.ts +4 -0
- package/src/locale/zh-CN/index.ts +3 -0
- package/src/platform/provider/platform-provider-base.ts +1 -2
- package/src/service/vo/tree-node-data/tree-code-list-node-data.ts +2 -0
- package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +35 -0
- package/src/service/vo/tree-node-data/tree-node-data.ts +33 -0
- package/src/service/vo/tree-node-data/tree-static-node-data.ts +2 -0
- package/src/ui-action/provider/front-ui-action-provider.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.7.41-alpha.
|
|
3
|
+
"version": "0.7.41-alpha.114",
|
|
4
4
|
"description": "运行时逻辑库",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"jsencrypt": "^3.3.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@ibiz-template/core": "^0.7.41-alpha.
|
|
42
|
+
"@ibiz-template/core": "^0.7.41-alpha.113",
|
|
43
43
|
"@ibiz/model-core": "^0.1.88",
|
|
44
44
|
"@types/animejs": "^3.1.12",
|
|
45
45
|
"@types/path-browserify": "^1.0.2",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"qx-util": "^0.4.8",
|
|
71
71
|
"ramda": "^0.29.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "bb921e3d86b25ee998088e744d6d47fb5fedc45c"
|
|
74
74
|
}
|
|
@@ -890,7 +890,7 @@ export class MDControlController<
|
|
|
890
890
|
// 'DataExport',
|
|
891
891
|
// {
|
|
892
892
|
// dismiss: (result: unknown) => popover.dismiss(result),
|
|
893
|
-
// maxRowCount: dataExport.maxRowCount ||
|
|
893
|
+
// maxRowCount: dataExport.maxRowCount || ibiz.config.common.maxExportRowsDefault,
|
|
894
894
|
// pageSize: this.state.size,
|
|
895
895
|
// },
|
|
896
896
|
// { autoClose: true, placement: 'bottom-end' },
|
|
@@ -562,12 +562,19 @@ export abstract class FormController<
|
|
|
562
562
|
* @returns {*} {Promise<boolean>}
|
|
563
563
|
*/
|
|
564
564
|
async validate(): Promise<boolean> {
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
565
|
+
const details = [
|
|
566
|
+
...this.formItems,
|
|
567
|
+
...this.formMDCtrls,
|
|
568
|
+
...this.formDruipart,
|
|
569
|
+
];
|
|
570
|
+
const values = await Promise.all(details.map(detail => detail.validate()));
|
|
571
|
+
const result = values.findIndex(value => !value) === -1;
|
|
572
|
+
if (!result) {
|
|
573
|
+
// 收集校验失败的成员并输出错误日志
|
|
574
|
+
const failedDetails = details.filter((_, index) => !values[index]);
|
|
575
|
+
this.logValidateFail(failedDetails);
|
|
576
|
+
}
|
|
577
|
+
return result;
|
|
571
578
|
}
|
|
572
579
|
|
|
573
580
|
/**
|
|
@@ -605,14 +612,47 @@ export abstract class FormController<
|
|
|
605
612
|
* @memberof FormController
|
|
606
613
|
*/
|
|
607
614
|
async silentValidate(): Promise<boolean> {
|
|
615
|
+
const details = [
|
|
616
|
+
...this.formItems,
|
|
617
|
+
...this.formMDCtrls,
|
|
618
|
+
...this.formDruipart,
|
|
619
|
+
];
|
|
608
620
|
const values = await Promise.all(
|
|
609
|
-
|
|
610
|
-
formItem => formItem.silentValidate(),
|
|
611
|
-
),
|
|
621
|
+
details.map(detail => detail.silentValidate()),
|
|
612
622
|
);
|
|
613
623
|
|
|
614
624
|
// 找不到value为false即全部是true
|
|
615
|
-
|
|
625
|
+
const result = values.findIndex(value => !value) === -1;
|
|
626
|
+
if (!result) {
|
|
627
|
+
// 收集校验失败的成员并输出错误日志
|
|
628
|
+
const failedDetails = details.filter((_, index) => !values[index]);
|
|
629
|
+
this.logValidateFail(failedDetails);
|
|
630
|
+
}
|
|
631
|
+
return result;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* 输出校验失败的错误日志
|
|
636
|
+
* @description 收集校验失败的表单成员名称,通过 ibiz.log.error 输出。名称使用表单成员标识
|
|
637
|
+
* @protected
|
|
638
|
+
* @param {FormDetailController[]} failedDetails 校验失败的表单成员集合
|
|
639
|
+
* @memberof FormController
|
|
640
|
+
*/
|
|
641
|
+
protected logValidateFail(failedDetails: FormDetailController[]): void {
|
|
642
|
+
const separator = ibiz.i18n.t(
|
|
643
|
+
'runtime.controller.control.form.validateFailSeparator',
|
|
644
|
+
);
|
|
645
|
+
const names = failedDetails
|
|
646
|
+
.map(detail => detail.model.id || '')
|
|
647
|
+
.filter(name => !!name);
|
|
648
|
+
if (names.length === 0) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
ibiz.log.error(
|
|
652
|
+
ibiz.i18n.t('runtime.controller.control.form.validateFail', {
|
|
653
|
+
names: names.join(separator),
|
|
654
|
+
}),
|
|
655
|
+
);
|
|
616
656
|
}
|
|
617
657
|
|
|
618
658
|
/**
|
|
@@ -710,7 +750,14 @@ export abstract class FormController<
|
|
|
710
750
|
* @memberof FormController
|
|
711
751
|
*/
|
|
712
752
|
setDetailError(name: string, message: string): void {
|
|
713
|
-
|
|
753
|
+
let detail: IFormDetailController | undefined = this.details[name];
|
|
754
|
+
// 界面表单项标识和属性标识可能不一致,尝试通过属性标识找下表单项,后台返回错误信息是以属性标识返回
|
|
755
|
+
if (!detail) {
|
|
756
|
+
detail = Object.values(this.details).find((item: IData) => {
|
|
757
|
+
const fieldId = item?.model?.appDEFieldId;
|
|
758
|
+
return !!fieldId && fieldId === name;
|
|
759
|
+
});
|
|
760
|
+
}
|
|
714
761
|
const state = detail?.state as FormItemState;
|
|
715
762
|
if (state) {
|
|
716
763
|
state.error = message;
|
|
@@ -129,6 +129,9 @@ export class FormDRUIPartController
|
|
|
129
129
|
if (this.isNeedSyncEmbed && this.embedView && this.embedDataService) {
|
|
130
130
|
await this.saveEmbedViewData();
|
|
131
131
|
await this.SyncEmbedDataToForm();
|
|
132
|
+
} else if (this.model.needSave && this.embedView) {
|
|
133
|
+
// 常规子视图保存
|
|
134
|
+
await this.embedView?.call(SysUIActionTag.SAVE);
|
|
132
135
|
}
|
|
133
136
|
});
|
|
134
137
|
}
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
IStorageColumnStates,
|
|
50
50
|
IApiGridColumnMapping,
|
|
51
51
|
IApiExportParams,
|
|
52
|
+
IFrontExportParams,
|
|
52
53
|
} from '../../../../interface';
|
|
53
54
|
import { calcDeCodeNameById, calcUIActionGroup } from '../../../../model';
|
|
54
55
|
import {
|
|
@@ -76,6 +77,7 @@ import {
|
|
|
76
77
|
switchRowEditDynamic,
|
|
77
78
|
initModelByEntitySchema,
|
|
78
79
|
} from './auto-grid.util';
|
|
80
|
+
import { PredefinedAttributes } from '../../../../constant';
|
|
79
81
|
|
|
80
82
|
/**
|
|
81
83
|
* 表格控制器
|
|
@@ -1649,16 +1651,29 @@ export class GridController<
|
|
|
1649
1651
|
* 获取数据导出模型
|
|
1650
1652
|
* @returns
|
|
1651
1653
|
*/
|
|
1652
|
-
getDataExcelModel(): {
|
|
1654
|
+
getDataExcelModel(): {
|
|
1655
|
+
header: string[];
|
|
1656
|
+
fields: string[];
|
|
1657
|
+
exportColumns: IData[];
|
|
1658
|
+
colWidths: { wpx: number }[];
|
|
1659
|
+
} {
|
|
1653
1660
|
const { dedataExportId, degridColumns = [] } = this.model;
|
|
1654
|
-
const excelModel: {
|
|
1661
|
+
const excelModel: {
|
|
1662
|
+
header: string[];
|
|
1663
|
+
fields: string[];
|
|
1664
|
+
exportColumns: IData[];
|
|
1665
|
+
colWidths: { wpx: number }[];
|
|
1666
|
+
} = {
|
|
1655
1667
|
header: [],
|
|
1656
1668
|
fields: [],
|
|
1669
|
+
exportColumns: [],
|
|
1670
|
+
colWidths: [],
|
|
1657
1671
|
};
|
|
1658
1672
|
if (dedataExportId) {
|
|
1659
1673
|
if (this.allExportColumns.length) {
|
|
1660
1674
|
excelModel.fields = this.allExportColumns.map(x => x.appDEFieldId!);
|
|
1661
1675
|
excelModel.header = this.allExportColumns.map(x => x.caption!);
|
|
1676
|
+
excelModel.exportColumns = this.allExportColumns;
|
|
1662
1677
|
}
|
|
1663
1678
|
} else {
|
|
1664
1679
|
const exportColumns = this.state.columnStates
|
|
@@ -1676,6 +1691,12 @@ export class GridController<
|
|
|
1676
1691
|
});
|
|
1677
1692
|
excelModel.fields = exportColumns.map(item => item.id!);
|
|
1678
1693
|
excelModel.header = exportColumns.map(item => item.caption!);
|
|
1694
|
+
excelModel.colWidths = exportColumns.map(item => {
|
|
1695
|
+
return {
|
|
1696
|
+
wpx: item.width || 150,
|
|
1697
|
+
};
|
|
1698
|
+
});
|
|
1699
|
+
excelModel.exportColumns = exportColumns;
|
|
1679
1700
|
}
|
|
1680
1701
|
return excelModel;
|
|
1681
1702
|
}
|
|
@@ -1759,7 +1780,12 @@ export class GridController<
|
|
|
1759
1780
|
offset: (startPage! - 1) * size,
|
|
1760
1781
|
size: (endPage! - startPage! + 1) * size,
|
|
1761
1782
|
}
|
|
1762
|
-
: {
|
|
1783
|
+
: {
|
|
1784
|
+
size:
|
|
1785
|
+
this.dataExport?.maxRowCount ||
|
|
1786
|
+
ibiz.config.common.maxExportRowsDefault,
|
|
1787
|
+
page: 0,
|
|
1788
|
+
};
|
|
1763
1789
|
data = await this.loadData({ viewParam });
|
|
1764
1790
|
} else if (type === 'selectedRows') {
|
|
1765
1791
|
data = this.getData();
|
|
@@ -1808,7 +1834,12 @@ export class GridController<
|
|
|
1808
1834
|
offset: (startPage! - 1) * size,
|
|
1809
1835
|
size: (endPage! - startPage! + 1) * size,
|
|
1810
1836
|
}
|
|
1811
|
-
: {
|
|
1837
|
+
: {
|
|
1838
|
+
size:
|
|
1839
|
+
this.dataExport?.maxRowCount ||
|
|
1840
|
+
ibiz.config.common.maxExportRowsDefault,
|
|
1841
|
+
page: 0,
|
|
1842
|
+
};
|
|
1812
1843
|
}
|
|
1813
1844
|
Object.assign(fetchParams, tempParams);
|
|
1814
1845
|
// 执行导出
|
|
@@ -1829,18 +1860,18 @@ export class GridController<
|
|
|
1829
1860
|
await this.excuteBackendExport(args.params);
|
|
1830
1861
|
return;
|
|
1831
1862
|
}
|
|
1832
|
-
|
|
1863
|
+
// 导出前先填充导出代码表数据
|
|
1864
|
+
await this.fillExportCodelistMap();
|
|
1865
|
+
const data = await this.getExportData(args.params);
|
|
1866
|
+
const { header, fields, exportColumns, colWidths } =
|
|
1867
|
+
this.getDataExcelModel();
|
|
1833
1868
|
if (!header) {
|
|
1834
1869
|
throw new RuntimeError(
|
|
1835
1870
|
ibiz.i18n.t('runtime.controller.control.grid.tabularColumns'),
|
|
1836
1871
|
);
|
|
1837
1872
|
}
|
|
1838
|
-
// 导出前先填充导出代码表数据
|
|
1839
|
-
await this.fillExportCodelistMap();
|
|
1840
|
-
const data = await this.getExportData(args.params);
|
|
1841
1873
|
const formatData = this.formatExcelData(data, fields);
|
|
1842
1874
|
const table = formatData.map(v => Object.values(v));
|
|
1843
|
-
|
|
1844
1875
|
// 获取导出文件名,如果有自定义文件名格式则使用自定义文件名格式
|
|
1845
1876
|
let fileName = this.model.logicName!;
|
|
1846
1877
|
if (this.dataExport?.fileNameFormat) {
|
|
@@ -1851,12 +1882,33 @@ export class GridController<
|
|
|
1851
1882
|
now: new Date(),
|
|
1852
1883
|
});
|
|
1853
1884
|
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1885
|
+
// 准备前台导出参数
|
|
1886
|
+
const frontExportParams: IFrontExportParams = {
|
|
1856
1887
|
header,
|
|
1857
1888
|
data: table,
|
|
1858
1889
|
fileName,
|
|
1890
|
+
colWidths: () => {
|
|
1891
|
+
return colWidths;
|
|
1892
|
+
},
|
|
1893
|
+
};
|
|
1894
|
+
// 前台导出注入属性识别
|
|
1895
|
+
const frontExportAttri = this.model.controlAttributes?.find(item => {
|
|
1896
|
+
return item.attrName === PredefinedAttributes.BEFORE_FRONT_EXPORT;
|
|
1859
1897
|
});
|
|
1898
|
+
if (frontExportAttri) {
|
|
1899
|
+
const { attrValue } = frontExportAttri;
|
|
1900
|
+
if (attrValue) {
|
|
1901
|
+
const frontExportResult = await ScriptFactory.asyncExecScriptFn(
|
|
1902
|
+
{ exportColumns, data },
|
|
1903
|
+
attrValue,
|
|
1904
|
+
);
|
|
1905
|
+
if (frontExportResult) {
|
|
1906
|
+
Object.assign(frontExportParams, frontExportResult);
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
// 导出数据
|
|
1911
|
+
await ibiz.platform.frontExport(frontExportParams);
|
|
1860
1912
|
}
|
|
1861
1913
|
|
|
1862
1914
|
/**
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ISearchGroupData,
|
|
21
21
|
IExportColumn,
|
|
22
22
|
IApiExportParams,
|
|
23
|
+
IFrontExportParams,
|
|
23
24
|
} from '../../../interface';
|
|
24
25
|
import { MDCtrlService } from './md-ctrl.service';
|
|
25
26
|
import { MobMDCtrlRowState } from './md-ctrl-row.state';
|
|
@@ -28,6 +29,8 @@ import { ControlVO } from '../../../service';
|
|
|
28
29
|
import { UIActionUtil } from '../../../ui-action';
|
|
29
30
|
import { ButtonContainerState, UIActionButtonState } from '../../utils';
|
|
30
31
|
import { calcUIActionGroup, getAllUIActionItems } from '../../../model';
|
|
32
|
+
import { ScriptFactory } from '../../../utils';
|
|
33
|
+
import { PredefinedAttributes } from '../../../constant';
|
|
31
34
|
|
|
32
35
|
export class MDCtrlController
|
|
33
36
|
extends MDControlController<IDEMobMDCtrl, IMobMdCtrlState, IMobMDCtrlEvent>
|
|
@@ -611,19 +614,29 @@ export class MDCtrlController
|
|
|
611
614
|
|
|
612
615
|
/**
|
|
613
616
|
* @description 获取数据导出模型
|
|
614
|
-
* @returns {*} {{ header: string[]
|
|
617
|
+
* @returns {*} {{ header: string[], fields: string[], exportColumns: IData[] }}
|
|
615
618
|
* @memberof MDCtrlController
|
|
616
619
|
*/
|
|
617
|
-
getDataExcelModel(): {
|
|
620
|
+
getDataExcelModel(): {
|
|
621
|
+
header: string[];
|
|
622
|
+
fields: string[];
|
|
623
|
+
exportColumns: IData[];
|
|
624
|
+
} {
|
|
618
625
|
const { dedataExportId } = this.model;
|
|
619
|
-
const excelModel: {
|
|
626
|
+
const excelModel: {
|
|
627
|
+
header: string[];
|
|
628
|
+
fields: string[];
|
|
629
|
+
exportColumns: IData[];
|
|
630
|
+
} = {
|
|
620
631
|
header: [],
|
|
621
632
|
fields: [],
|
|
633
|
+
exportColumns: [],
|
|
622
634
|
};
|
|
623
635
|
if (dedataExportId) {
|
|
624
636
|
if (this.allExportColumns.length) {
|
|
625
637
|
excelModel.fields = this.allExportColumns.map(x => x.appDEFieldId!);
|
|
626
638
|
excelModel.header = this.allExportColumns.map(x => x.caption!);
|
|
639
|
+
excelModel.exportColumns = this.allExportColumns;
|
|
627
640
|
}
|
|
628
641
|
}
|
|
629
642
|
return excelModel;
|
|
@@ -672,7 +685,12 @@ export class MDCtrlController
|
|
|
672
685
|
offset: (startPage - 1) * size,
|
|
673
686
|
size: (endPage - startPage + 1) * size,
|
|
674
687
|
}
|
|
675
|
-
: {
|
|
688
|
+
: {
|
|
689
|
+
size:
|
|
690
|
+
this.dataExport?.maxRowCount ||
|
|
691
|
+
ibiz.config.common.maxExportRowsDefault,
|
|
692
|
+
page: 0,
|
|
693
|
+
};
|
|
676
694
|
data = await this.loadData({ viewParam });
|
|
677
695
|
} else if (type === 'selectedRows') {
|
|
678
696
|
data = this.getData();
|
|
@@ -773,7 +791,12 @@ export class MDCtrlController
|
|
|
773
791
|
offset: (startPage - 1) * size,
|
|
774
792
|
size: (endPage - startPage + 1) * size,
|
|
775
793
|
}
|
|
776
|
-
: {
|
|
794
|
+
: {
|
|
795
|
+
size:
|
|
796
|
+
this.dataExport?.maxRowCount ||
|
|
797
|
+
ibiz.config.common.maxExportRowsDefault,
|
|
798
|
+
page: 0,
|
|
799
|
+
};
|
|
777
800
|
}
|
|
778
801
|
Object.assign(fetchParams, tempParams);
|
|
779
802
|
// 执行导出
|
|
@@ -799,7 +822,7 @@ export class MDCtrlController
|
|
|
799
822
|
await this.excuteBackendExport(args.params || {});
|
|
800
823
|
return;
|
|
801
824
|
}
|
|
802
|
-
const { header, fields } = this.getDataExcelModel();
|
|
825
|
+
const { header, fields, exportColumns } = this.getDataExcelModel();
|
|
803
826
|
if (!header) {
|
|
804
827
|
throw new RuntimeError(
|
|
805
828
|
ibiz.i18n.t('runtime.controller.common.md.tabularColumns'),
|
|
@@ -808,10 +831,32 @@ export class MDCtrlController
|
|
|
808
831
|
const data = await this.getExportData(args.params || {});
|
|
809
832
|
const formatData = this.formatExcelData(data, fields);
|
|
810
833
|
const table = formatData.map(v => Object.values(v));
|
|
811
|
-
|
|
834
|
+
// 准备前台导出参数
|
|
835
|
+
const frontExportParams: IFrontExportParams = {
|
|
812
836
|
header,
|
|
813
837
|
data: table,
|
|
814
838
|
fileName: this.model.logicName!,
|
|
839
|
+
colWidths: () => {
|
|
840
|
+
return [];
|
|
841
|
+
},
|
|
842
|
+
};
|
|
843
|
+
// 前台导出注入属性识别
|
|
844
|
+
const frontExportAttri = this.model.controlAttributes?.find(item => {
|
|
845
|
+
return item.attrName === PredefinedAttributes.BEFORE_FRONT_EXPORT;
|
|
815
846
|
});
|
|
847
|
+
if (frontExportAttri) {
|
|
848
|
+
const { attrValue } = frontExportAttri;
|
|
849
|
+
if (attrValue) {
|
|
850
|
+
const frontExportResult = await ScriptFactory.asyncExecScriptFn(
|
|
851
|
+
{ exportColumns, data },
|
|
852
|
+
attrValue,
|
|
853
|
+
);
|
|
854
|
+
if (frontExportResult) {
|
|
855
|
+
Object.assign(frontExportParams, frontExportResult);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
// 导出数据
|
|
860
|
+
await ibiz.platform.frontExport(frontExportParams);
|
|
816
861
|
}
|
|
817
862
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-shadow */
|
|
2
|
-
import { RuntimeError } from '@ibiz-template/core';
|
|
2
|
+
import { IApiData, IPortalMessage, RuntimeError } from '@ibiz-template/core';
|
|
3
3
|
import { IDEMultiEditViewPanel } from '@ibiz/model-core';
|
|
4
4
|
import { createUUID } from 'qx-util';
|
|
5
5
|
import {
|
|
@@ -11,10 +11,12 @@ import {
|
|
|
11
11
|
DataChangeEvent,
|
|
12
12
|
EventBase,
|
|
13
13
|
IViewController,
|
|
14
|
+
IApiFormSaveParams,
|
|
14
15
|
} from '../../../interface';
|
|
15
16
|
import { ControlVO } from '../../../service';
|
|
16
17
|
import { MDControlController } from '../../common';
|
|
17
18
|
import { MEditViewPanelService } from './medit-view-panel.service';
|
|
19
|
+
import { SysUIActionTag } from '../../../constant';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* 多编辑视图面板部件控制器
|
|
@@ -328,4 +330,40 @@ export class MEditViewPanelController
|
|
|
328
330
|
getActiveView(): IViewController | undefined {
|
|
329
331
|
return this.embedViews.get(this.state.activeTab);
|
|
330
332
|
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @description 检测实体数据变更,子视图数据变更不应该触发列表加载
|
|
336
|
+
* @protected
|
|
337
|
+
* @param {IPortalMessage} _msg
|
|
338
|
+
* @memberof MEditViewPanelController
|
|
339
|
+
*/
|
|
340
|
+
protected onDEDataChange(_msg: IPortalMessage): void {
|
|
341
|
+
ibiz.log.debug(
|
|
342
|
+
ibiz.i18n.t('runtime.controller.control.meditViewPanel.ignoreDataChange'),
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* @description 保存数据
|
|
348
|
+
* @param {IApiFormSaveParams} [args]
|
|
349
|
+
* @returns {*} {Promise<IApiData[]>}
|
|
350
|
+
* @memberof MEditViewPanelController
|
|
351
|
+
*/
|
|
352
|
+
async save(args: IApiFormSaveParams = { silent: true }): Promise<IApiData[]> {
|
|
353
|
+
if (this.state.panelUiItems.length === 0) {
|
|
354
|
+
return [];
|
|
355
|
+
}
|
|
356
|
+
const allViews = this.state.panelUiItems.map(item => {
|
|
357
|
+
return this.embedViews.get(item.id);
|
|
358
|
+
});
|
|
359
|
+
if (allViews.length === 0) {
|
|
360
|
+
return [];
|
|
361
|
+
}
|
|
362
|
+
const result = await Promise.all(
|
|
363
|
+
allViews.map(async view => {
|
|
364
|
+
return view?.call(SysUIActionTag.SAVE, args);
|
|
365
|
+
}),
|
|
366
|
+
);
|
|
367
|
+
return result.flatMap(r => r?.data ?? []);
|
|
368
|
+
}
|
|
331
369
|
}
|
|
@@ -10,7 +10,7 @@ import { IAppDEDataImport, IAppDataEntity } from '@ibiz/model-core';
|
|
|
10
10
|
import { mergeRight } from 'ramda';
|
|
11
11
|
import { calcResPath } from '../../../service';
|
|
12
12
|
import { OpenAppViewCommand } from '../../../command';
|
|
13
|
-
import { IViewConfig } from '../../../interface';
|
|
13
|
+
import { IViewConfig, IFrontExportParams } from '../../../interface';
|
|
14
14
|
|
|
15
15
|
// 异步导入URL
|
|
16
16
|
const asyncImportUrl = 'asyncimportdata2';
|
|
@@ -250,9 +250,7 @@ export async function importData2(opts: {
|
|
|
250
250
|
* @return {*} {Promise<IExportDataResult>}
|
|
251
251
|
*/
|
|
252
252
|
export async function exportData(
|
|
253
|
-
|
|
254
|
-
data: IData[][],
|
|
255
|
-
fileName: string,
|
|
253
|
+
args: IFrontExportParams,
|
|
256
254
|
): Promise<IExportDataResult> {
|
|
257
255
|
if (!ibiz.util.getExcelUtil) {
|
|
258
256
|
throw new RuntimeError(
|
|
@@ -266,11 +264,25 @@ export async function exportData(
|
|
|
266
264
|
);
|
|
267
265
|
}
|
|
268
266
|
try {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
267
|
+
const {
|
|
268
|
+
fileName,
|
|
269
|
+
header,
|
|
270
|
+
data,
|
|
271
|
+
rowHeights,
|
|
272
|
+
colWidths,
|
|
273
|
+
multiHeader,
|
|
274
|
+
merges,
|
|
275
|
+
cellStyle,
|
|
276
|
+
} = args;
|
|
277
|
+
exportExcel.exportJsonToExcelWithStyle({
|
|
278
|
+
fileName,
|
|
279
|
+
header,
|
|
280
|
+
data,
|
|
281
|
+
rowHeights,
|
|
282
|
+
colWidths,
|
|
283
|
+
multiHeader,
|
|
284
|
+
merges,
|
|
285
|
+
cellStyle,
|
|
274
286
|
});
|
|
275
287
|
return { ok: true };
|
|
276
288
|
} catch (error) {
|
|
@@ -27,4 +27,25 @@ export interface IApiMEditView9Call extends Omit<IApiMDViewCall, 'New'> {
|
|
|
27
27
|
Refresh: {
|
|
28
28
|
args: undefined;
|
|
29
29
|
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description 保存
|
|
33
|
+
* @type {{
|
|
34
|
+
* args: undefined;
|
|
35
|
+
* }}
|
|
36
|
+
* @memberof IApiMEditView9Call
|
|
37
|
+
*/
|
|
38
|
+
Save: {
|
|
39
|
+
args: undefined;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @description 保存并关闭
|
|
43
|
+
* @type {{
|
|
44
|
+
* args: undefined;
|
|
45
|
+
* }}
|
|
46
|
+
* @memberof IApiMEditView9Call
|
|
47
|
+
*/
|
|
48
|
+
SaveAndExit: {
|
|
49
|
+
args: undefined;
|
|
50
|
+
};
|
|
30
51
|
}
|
|
@@ -241,4 +241,14 @@ export interface IApiGlobalCommonConfig {
|
|
|
241
241
|
* @memberof IApiGlobalCommonConfig
|
|
242
242
|
*/
|
|
243
243
|
enhancedUI: boolean;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @description 导出最大行数默认值
|
|
247
|
+
* @type {number}
|
|
248
|
+
* @default 1000
|
|
249
|
+
* @platform web
|
|
250
|
+
* @platform mob
|
|
251
|
+
* @memberof IApiGlobalCommonConfig
|
|
252
|
+
*/
|
|
253
|
+
maxExportRowsDefault: number;
|
|
244
254
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IDEMultiEditViewPanel } from '@ibiz/model-core';
|
|
2
|
+
import { IApiData } from '@ibiz-template/core';
|
|
2
3
|
import { IApiMEditViewPanelState, IApiPanelUiItem } from '../../state';
|
|
3
4
|
import { IApiMDControlController } from './i-api-md-control.controller';
|
|
4
5
|
import { IApiViewController } from '../view';
|
|
6
|
+
import { IApiFormSaveParams } from './i-api-edit-form.controller';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* 多编辑视图面板
|
|
@@ -45,4 +47,12 @@ export interface IApiMEditViewPanelController<
|
|
|
45
47
|
* @memberof IApiMEditViewPanelController
|
|
46
48
|
*/
|
|
47
49
|
getActiveView(): IApiViewController | undefined;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @description 保存表单数据
|
|
53
|
+
* @param {IApiFormSaveParams} [args] 保存参数
|
|
54
|
+
* @returns {*} {Promise<IApiData[]>}
|
|
55
|
+
* @memberof IApiMEditViewPanelController
|
|
56
|
+
*/
|
|
57
|
+
save(args?: IApiFormSaveParams): Promise<IApiData[]>;
|
|
48
58
|
}
|
|
@@ -7,7 +7,7 @@ import { IApiData } from '@ibiz-template/core';
|
|
|
7
7
|
*/
|
|
8
8
|
export interface IApiExcelUtil {
|
|
9
9
|
/**
|
|
10
|
-
* @description
|
|
10
|
+
* @description 导出excel文件
|
|
11
11
|
* @param {{
|
|
12
12
|
* header: string[]; // 表头内容
|
|
13
13
|
* data: IApiData[]; // 数据内容
|
|
@@ -22,4 +22,41 @@ export interface IApiExcelUtil {
|
|
|
22
22
|
filename: string;
|
|
23
23
|
autoWidth: boolean;
|
|
24
24
|
}): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description 导出excel文件(附加样式处理)
|
|
28
|
+
* @param {({
|
|
29
|
+
* fileName: string; // 文件名
|
|
30
|
+
* header: string[]; // 表头内容
|
|
31
|
+
* data: string[][]; // 数据内容
|
|
32
|
+
* rowHeights?:(rows: string[][]) => { hpx: number }[] | { hpt: number }[]; // 行高,hpt(磅)/ hpx(像素)
|
|
33
|
+
* colWidths?:(rows: string[][]) => { wch: number }[] | { wpx: number }[]; // 列宽,wch(字符数)/ wpx(像素)
|
|
34
|
+
* multiHeader?: string[][]; // 多表头数据
|
|
35
|
+
* merges?: { s: { r: number; c: number }; e: { r: number; c: number } }[]; // 合并单元格,s: 起始坐标, e: 结束坐标
|
|
36
|
+
* cellStyle?: ( // 单元格样式
|
|
37
|
+
* rows:string[][],
|
|
38
|
+
* value: unknown,
|
|
39
|
+
* rowIndex: number,
|
|
40
|
+
* colIndex: number,
|
|
41
|
+
* isHeaderCell: boolean,
|
|
42
|
+
* ) => { fill?: IData; font?: IData; alignment?: IData; border?: IData };
|
|
43
|
+
* })} args
|
|
44
|
+
* @memberof IApiExcelUtil
|
|
45
|
+
*/
|
|
46
|
+
exportJsonToExcelWithStyle(args: {
|
|
47
|
+
fileName: string;
|
|
48
|
+
header: string[];
|
|
49
|
+
data: string[][];
|
|
50
|
+
rowHeights?: (rows: string[][]) => { hpx: number }[] | { hpt: number }[];
|
|
51
|
+
colWidths?: (rows: string[][]) => { wch: number }[] | { wpx: number }[];
|
|
52
|
+
multiHeader?: string[][];
|
|
53
|
+
merges?: { s: { r: number; c: number }; e: { r: number; c: number } }[];
|
|
54
|
+
cellStyle?: (
|
|
55
|
+
rows: string[][],
|
|
56
|
+
value: unknown,
|
|
57
|
+
rowIndex: number,
|
|
58
|
+
colIndex: number,
|
|
59
|
+
isHeaderCell: boolean,
|
|
60
|
+
) => { fill?: IData; font?: IData; alignment?: IData; border?: IData };
|
|
61
|
+
}): void;
|
|
25
62
|
}
|
|
@@ -101,6 +101,20 @@ export interface ITreeNodeData extends IApiTreeNodeData {
|
|
|
101
101
|
*/
|
|
102
102
|
_parentValue?: string | undefined;
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* @description 动态样式表
|
|
106
|
+
* @type {string[]}
|
|
107
|
+
* @memberof ITreeNodeData
|
|
108
|
+
*/
|
|
109
|
+
_dynaClass?: string[];
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @description 图形动态样式表
|
|
113
|
+
* @type {string[]}
|
|
114
|
+
* @memberof ITreeNodeData
|
|
115
|
+
*/
|
|
116
|
+
_shapeDynaClass?: string[];
|
|
117
|
+
|
|
104
118
|
/**
|
|
105
119
|
* @description 获取改变数据
|
|
106
120
|
* @returns {*} {(IData | undefined)}
|