@ibiz-template/runtime 0.7.41-alpha.111 → 0.7.41-alpha.113
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 +386 -267
- 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/base.controller.js +2 -2
- package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
- package/out/controller/common/editor/editor.controller.js +10 -1
- package/out/controller/common/view/view.controller.js +2 -2
- package/out/controller/control/calendar/calendar.controller.d.ts.map +1 -1
- package/out/controller/control/calendar/calendar.controller.js +15 -11
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts +6 -0
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-item/form-item.controller.js +14 -1
- package/out/controller/control/form/form-detail/form-item/form-item.state.d.ts +7 -0
- package/out/controller/control/form/form-detail/form-item/form-item.state.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-item/form-item.state.js +7 -0
- package/out/controller/control/form/form-detail/form-rawitem/form-rawitem.controller.d.ts +7 -0
- package/out/controller/control/form/form-detail/form-rawitem/form-rawitem.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-rawitem/form-rawitem.controller.js +15 -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 +46 -7
- 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 +27 -4
- package/out/controller/control/report-panel/generator/bi-converter/base/grid-converter-base.js +9 -9
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +14 -10
- 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/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +22 -20
- 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/state/control/form-detail/i-api-form-item.state.d.ts +6 -0
- package/out/interface/api/state/control/form-detail/i-api-form-item.state.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/provider/i-platform-provider.d.ts +54 -2
- package/out/interface/provider/i-platform-provider.d.ts.map +1 -1
- package/out/logic-scheduler/executor/app-ui-action-executor.js +1 -1
- package/out/logic-scheduler/scheduler/view-logic-scheduler.d.ts +3 -4
- package/out/logic-scheduler/scheduler/view-logic-scheduler.d.ts.map +1 -1
- package/out/logic-scheduler/scheduler/view-logic-scheduler.js +7 -5
- package/out/platform/provider/platform-provider-base.d.ts.map +1 -1
- package/out/platform/provider/platform-provider-base.js +1 -2
- package/out/utils/handlebars/helpers/date-format/date-format.d.ts +14 -0
- package/out/utils/handlebars/helpers/date-format/date-format.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/date-format/date-format.js +18 -0
- package/out/utils/handlebars/helpers/index.d.ts.map +1 -1
- package/out/utils/handlebars/helpers/index.js +2 -0
- package/package.json +5 -5
- package/src/config/global-config.ts +1 -0
- package/src/constant/predefined-attributes.ts +5 -0
- package/src/controller/common/base.controller.ts +2 -2
- package/src/controller/common/editor/editor.controller.ts +13 -1
- package/src/controller/common/view/view.controller.ts +2 -2
- package/src/controller/control/calendar/calendar.controller.ts +15 -17
- package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +14 -1
- package/src/controller/control/form/form-detail/form-item/form-item.state.ts +8 -0
- package/src/controller/control/form/form-detail/form-rawitem/form-rawitem.controller.ts +15 -0
- package/src/controller/control/grid/grid/grid.controller.ts +62 -8
- package/src/controller/control/md-ctrl/md-ctrl.controller.ts +40 -5
- package/src/controller/control/report-panel/generator/bi-converter/base/grid-converter-base.ts +9 -9
- package/src/controller/control/tree/tree.controller.ts +14 -16
- package/src/controller/utils/data-file-util/data-file-util.ts +21 -9
- package/src/engine/md-view.engine.ts +22 -24
- package/src/interface/api/common/global-config/i-api-global-common-config.ts +10 -0
- package/src/interface/api/state/control/form-detail/i-api-form-item.state.ts +7 -0
- package/src/interface/api/util/i-api-excel-util.ts +38 -1
- package/src/interface/provider/i-platform-provider.ts +43 -2
- package/src/logic-scheduler/executor/app-ui-action-executor.ts +1 -1
- package/src/logic-scheduler/scheduler/view-logic-scheduler.ts +7 -5
- package/src/platform/provider/platform-provider-base.ts +1 -2
- package/src/utils/handlebars/helpers/date-format/date-format.ts +20 -0
- package/src/utils/handlebars/helpers/index.ts +2 -0
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
IEditor,
|
|
4
4
|
IEditorItem,
|
|
5
5
|
INavigateParamContainer,
|
|
6
|
+
IControlAttribute,
|
|
6
7
|
} from '@ibiz/model-core';
|
|
7
8
|
import { DataTypes } from '@ibiz-template/core';
|
|
8
9
|
import dayjs from 'dayjs';
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
} from '../../../interface/controller';
|
|
16
17
|
import { ValueExUtil } from '../../utils';
|
|
17
18
|
import { ControlController } from '../control';
|
|
19
|
+
import { PredefinedAttributes } from '../../../constant';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* 编辑器控制器基类
|
|
@@ -309,7 +311,17 @@ export class EditorController<T extends IEditor = IEditor>
|
|
|
309
311
|
(item: IEditorItem) => item.id !== this.model.id,
|
|
310
312
|
);
|
|
311
313
|
}
|
|
312
|
-
|
|
314
|
+
// 合并语义化埋点属性
|
|
315
|
+
const controlAttributes =
|
|
316
|
+
(this.parent as IData).model?.controlAttributes?.filter(
|
|
317
|
+
(item: IControlAttribute) =>
|
|
318
|
+
PredefinedAttributes.CLASSNAMES === item.attrName ||
|
|
319
|
+
PredefinedAttributes.STYLES === item.attrName,
|
|
320
|
+
) || [];
|
|
321
|
+
if (controlAttributes.length) {
|
|
322
|
+
if (!this.model.controlAttributes) this.model.controlAttributes = [];
|
|
323
|
+
this.model.controlAttributes.push(...controlAttributes);
|
|
324
|
+
}
|
|
313
325
|
this.initExtraParams();
|
|
314
326
|
}
|
|
315
327
|
|
|
@@ -483,8 +483,8 @@ export class ViewController<
|
|
|
483
483
|
};
|
|
484
484
|
if (this.scheduler.hasViewEventTrigger) {
|
|
485
485
|
// 监听视图事件触发视图事件触发器
|
|
486
|
-
this.evt.onAll((_eventName, event) => {
|
|
487
|
-
this.scheduler!.triggerViewEvent(event);
|
|
486
|
+
this.evt.onAll(async (_eventName, event) => {
|
|
487
|
+
await this.scheduler!.triggerViewEvent(event);
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-case-declarations */
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { ISysCalendar, ISysCalendarItem } from '@ibiz/model-core';
|
|
4
|
-
import { RuntimeError
|
|
4
|
+
import { RuntimeError } from '@ibiz-template/core';
|
|
5
5
|
import {
|
|
6
6
|
CodeListItem,
|
|
7
7
|
ICalendarState,
|
|
@@ -314,8 +314,8 @@ export class CalendarController
|
|
|
314
314
|
};
|
|
315
315
|
if (this.viewScheduler.hasViewEventTrigger) {
|
|
316
316
|
// 监听视图事件触发视图事件触发器
|
|
317
|
-
this.evt.onAll((_eventName, event) => {
|
|
318
|
-
this.viewScheduler!.triggerViewEvent(event);
|
|
317
|
+
this.evt.onAll(async (_eventName, event) => {
|
|
318
|
+
await this.viewScheduler!.triggerViewEvent(event);
|
|
319
319
|
});
|
|
320
320
|
}
|
|
321
321
|
}
|
|
@@ -379,13 +379,12 @@ export class CalendarController
|
|
|
379
379
|
ctrl: this,
|
|
380
380
|
},
|
|
381
381
|
);
|
|
382
|
-
if (result === -1)
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
);
|
|
382
|
+
if (result === -1) {
|
|
383
|
+
ibiz.log.error(ibiz.i18n.t('runtime.engine.logicOpendata'));
|
|
384
|
+
return {
|
|
385
|
+
cancel: true,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
389
388
|
return {
|
|
390
389
|
cancel: result ? result.ok : true,
|
|
391
390
|
};
|
|
@@ -415,13 +414,12 @@ export class CalendarController
|
|
|
415
414
|
ctrl: this,
|
|
416
415
|
},
|
|
417
416
|
);
|
|
418
|
-
if (result === -1)
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
);
|
|
417
|
+
if (result === -1) {
|
|
418
|
+
ibiz.log.error(ibiz.i18n.t('runtime.engine.logicNewdata'));
|
|
419
|
+
return {
|
|
420
|
+
cancel: true,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
425
423
|
return {
|
|
426
424
|
cancel: result ? result.ok : true,
|
|
427
425
|
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from '../../../../../interface';
|
|
18
18
|
import { getEditorProvider } from '../../../../../register';
|
|
19
19
|
import { Srfuf } from '../../../../../service';
|
|
20
|
-
import { calcDeCodeNameById } from '../../../../../model';
|
|
20
|
+
import { calcDeCodeNameById, calcDynaClass } from '../../../../../model';
|
|
21
21
|
import { filterValueRules } from '../../../../../utils';
|
|
22
22
|
import { FormNotifyState } from '../../../../constant';
|
|
23
23
|
import { generateEditorRules, generateRules } from '../../../../utils';
|
|
@@ -620,4 +620,17 @@ export class FormItemController
|
|
|
620
620
|
clearTipsCache(): void {
|
|
621
621
|
localStorage.removeItem(this.TIPS_CACHE);
|
|
622
622
|
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* @description 计算动态样式表
|
|
626
|
+
* @param {IData} data
|
|
627
|
+
* @memberof FormItemController
|
|
628
|
+
*/
|
|
629
|
+
protected calcDynaClass(data: IData): void {
|
|
630
|
+
super.calcDynaClass(data);
|
|
631
|
+
if (this.model.editor?.dynaClass) {
|
|
632
|
+
const dynaClass = calcDynaClass(this.model.editor.dynaClass, data);
|
|
633
|
+
this.state.editorClass = dynaClass;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
623
636
|
}
|
|
@@ -2,6 +2,7 @@ import { IDEFormRawItem } from '@ibiz/model-core';
|
|
|
2
2
|
import { FormDetailController } from '../form-detail';
|
|
3
3
|
import { FormRawItemState } from './form-rawitem.state';
|
|
4
4
|
import { IApiFormRawItemController } from '../../../../../interface';
|
|
5
|
+
import { calcDynaClass } from '../../../../../model';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @description 表单直接内容控制器
|
|
@@ -19,4 +20,18 @@ export class FormRawItemController
|
|
|
19
20
|
protected createState(): FormRawItemState {
|
|
20
21
|
return new FormRawItemState(this.parent?.state);
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @description 计算动态样式表
|
|
26
|
+
* @protected
|
|
27
|
+
* @param {IData} data
|
|
28
|
+
* @memberof FormRawItemController
|
|
29
|
+
*/
|
|
30
|
+
protected calcDynaClass(data: IData): void {
|
|
31
|
+
super.calcDynaClass(data);
|
|
32
|
+
if (this.model.rawItem?.dynaClass) {
|
|
33
|
+
const dynaClass = calcDynaClass(this.model.rawItem.dynaClass, data);
|
|
34
|
+
this.state.class.containerDyna = dynaClass;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
22
37
|
}
|
|
@@ -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
|
}
|
|
@@ -1829,22 +1850,55 @@ export class GridController<
|
|
|
1829
1850
|
await this.excuteBackendExport(args.params);
|
|
1830
1851
|
return;
|
|
1831
1852
|
}
|
|
1832
|
-
|
|
1853
|
+
// 导出前先填充导出代码表数据
|
|
1854
|
+
await this.fillExportCodelistMap();
|
|
1855
|
+
const data = await this.getExportData(args.params);
|
|
1856
|
+
const { header, fields, exportColumns, colWidths } =
|
|
1857
|
+
this.getDataExcelModel();
|
|
1833
1858
|
if (!header) {
|
|
1834
1859
|
throw new RuntimeError(
|
|
1835
1860
|
ibiz.i18n.t('runtime.controller.control.grid.tabularColumns'),
|
|
1836
1861
|
);
|
|
1837
1862
|
}
|
|
1838
|
-
// 导出前先填充导出代码表数据
|
|
1839
|
-
await this.fillExportCodelistMap();
|
|
1840
|
-
const data = await this.getExportData(args.params);
|
|
1841
1863
|
const formatData = this.formatExcelData(data, fields);
|
|
1842
1864
|
const table = formatData.map(v => Object.values(v));
|
|
1843
|
-
|
|
1865
|
+
// 获取导出文件名,如果有自定义文件名格式则使用自定义文件名格式
|
|
1866
|
+
let fileName = this.model.logicName!;
|
|
1867
|
+
if (this.dataExport?.fileNameFormat) {
|
|
1868
|
+
fileName = await ibiz.util.hbs.render(this.dataExport.fileNameFormat, {
|
|
1869
|
+
context: this.context,
|
|
1870
|
+
params: this.params,
|
|
1871
|
+
data: this.view.state.srfactiveviewdata,
|
|
1872
|
+
now: new Date(),
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
// 准备前台导出参数
|
|
1876
|
+
const frontExportParams: IFrontExportParams = {
|
|
1844
1877
|
header,
|
|
1845
1878
|
data: table,
|
|
1846
|
-
fileName
|
|
1879
|
+
fileName,
|
|
1880
|
+
colWidths: () => {
|
|
1881
|
+
return colWidths;
|
|
1882
|
+
},
|
|
1883
|
+
};
|
|
1884
|
+
// 前台导出注入属性识别
|
|
1885
|
+
const frontExportAttri = this.model.controlAttributes?.find(item => {
|
|
1886
|
+
return item.attrName === PredefinedAttributes.BEFORE_FRONT_EXPORT;
|
|
1847
1887
|
});
|
|
1888
|
+
if (frontExportAttri) {
|
|
1889
|
+
const { attrValue } = frontExportAttri;
|
|
1890
|
+
if (attrValue) {
|
|
1891
|
+
const frontExportResult = await ScriptFactory.asyncExecScriptFn(
|
|
1892
|
+
{ exportColumns, data },
|
|
1893
|
+
attrValue,
|
|
1894
|
+
);
|
|
1895
|
+
if (frontExportResult) {
|
|
1896
|
+
Object.assign(frontExportParams, frontExportResult);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
// 导出数据
|
|
1901
|
+
await ibiz.platform.frontExport(frontExportParams);
|
|
1848
1902
|
}
|
|
1849
1903
|
|
|
1850
1904
|
/**
|
|
@@ -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;
|
|
@@ -799,7 +812,7 @@ export class MDCtrlController
|
|
|
799
812
|
await this.excuteBackendExport(args.params || {});
|
|
800
813
|
return;
|
|
801
814
|
}
|
|
802
|
-
const { header, fields } = this.getDataExcelModel();
|
|
815
|
+
const { header, fields, exportColumns } = this.getDataExcelModel();
|
|
803
816
|
if (!header) {
|
|
804
817
|
throw new RuntimeError(
|
|
805
818
|
ibiz.i18n.t('runtime.controller.common.md.tabularColumns'),
|
|
@@ -808,10 +821,32 @@ export class MDCtrlController
|
|
|
808
821
|
const data = await this.getExportData(args.params || {});
|
|
809
822
|
const formatData = this.formatExcelData(data, fields);
|
|
810
823
|
const table = formatData.map(v => Object.values(v));
|
|
811
|
-
|
|
824
|
+
// 准备前台导出参数
|
|
825
|
+
const frontExportParams: IFrontExportParams = {
|
|
812
826
|
header,
|
|
813
827
|
data: table,
|
|
814
828
|
fileName: this.model.logicName!,
|
|
829
|
+
colWidths: () => {
|
|
830
|
+
return [];
|
|
831
|
+
},
|
|
832
|
+
};
|
|
833
|
+
// 前台导出注入属性识别
|
|
834
|
+
const frontExportAttri = this.model.controlAttributes?.find(item => {
|
|
835
|
+
return item.attrName === PredefinedAttributes.BEFORE_FRONT_EXPORT;
|
|
815
836
|
});
|
|
837
|
+
if (frontExportAttri) {
|
|
838
|
+
const { attrValue } = frontExportAttri;
|
|
839
|
+
if (attrValue) {
|
|
840
|
+
const frontExportResult = await ScriptFactory.asyncExecScriptFn(
|
|
841
|
+
{ exportColumns, data },
|
|
842
|
+
attrValue,
|
|
843
|
+
);
|
|
844
|
+
if (frontExportResult) {
|
|
845
|
+
Object.assign(frontExportParams, frontExportResult);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
// 导出数据
|
|
850
|
+
await ibiz.platform.frontExport(frontExportParams);
|
|
816
851
|
}
|
|
817
852
|
}
|
package/src/controller/control/report-panel/generator/bi-converter/base/grid-converter-base.ts
CHANGED
|
@@ -35,24 +35,24 @@ export abstract class GridConverterBase extends ConverterBase {
|
|
|
35
35
|
grid_function_setting,
|
|
36
36
|
} = this.reportUIModel;
|
|
37
37
|
result.vars = {
|
|
38
|
-
'--ibiz-control-grid-header-align': grid_header_position,
|
|
39
|
-
'--ibiz-control-grid-header-font-size': `${grid_header_fontsize}px`,
|
|
40
|
-
'--ibiz-control-grid-header-text-color': grid_header_fontcolor,
|
|
41
|
-
'--ibiz-control-grid-
|
|
42
|
-
'--ibiz-control-grid-
|
|
38
|
+
'--ibiz-control-grid-header-cell-align': grid_header_position,
|
|
39
|
+
'--ibiz-control-grid-header-cell-font-size': `${grid_header_fontsize}px`,
|
|
40
|
+
'--ibiz-control-grid-header-cell-text-color': grid_header_fontcolor,
|
|
41
|
+
'--ibiz-control-grid-body-cell-font-size': `${grid_body_fontsize}px`,
|
|
42
|
+
'--ibiz-control-grid-body-cell-text-color': grid_body_fontcolor,
|
|
43
43
|
};
|
|
44
44
|
if (grid_header_fontstyle) {
|
|
45
45
|
const key =
|
|
46
46
|
grid_header_fontstyle === 'bold'
|
|
47
|
-
? '--ibiz-control-grid-header-font-weight'
|
|
48
|
-
: '--ibiz-control-grid-header-font-style';
|
|
47
|
+
? '--ibiz-control-grid-header-cell-font-weight'
|
|
48
|
+
: '--ibiz-control-grid-header-cell-font-style';
|
|
49
49
|
result.vars[key] = grid_header_fontstyle;
|
|
50
50
|
}
|
|
51
51
|
if (grid_body_fontstyle) {
|
|
52
52
|
const key =
|
|
53
53
|
grid_body_fontstyle === 'bold'
|
|
54
|
-
? '--ibiz-control-grid-
|
|
55
|
-
: '--ibiz-control-grid-
|
|
54
|
+
? '--ibiz-control-grid-body-cell-font-weight'
|
|
55
|
+
: '--ibiz-control-grid-body-cell-font-style';
|
|
56
56
|
result.vars[key] = grid_body_fontstyle;
|
|
57
57
|
}
|
|
58
58
|
if (grid_show_agg == '1') {
|
|
@@ -255,8 +255,8 @@ export class TreeController<
|
|
|
255
255
|
};
|
|
256
256
|
if (this.viewScheduler.hasViewEventTrigger) {
|
|
257
257
|
// 监听视图事件触发视图事件触发器
|
|
258
|
-
this.evt.onAll((_eventName, event) => {
|
|
259
|
-
this.viewScheduler!.triggerViewEvent(event);
|
|
258
|
+
this.evt.onAll(async (_eventName, event) => {
|
|
259
|
+
await this.viewScheduler!.triggerViewEvent(event);
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
}
|
|
@@ -1493,13 +1493,12 @@ export class TreeController<
|
|
|
1493
1493
|
},
|
|
1494
1494
|
);
|
|
1495
1495
|
|
|
1496
|
-
if (result === -1)
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
);
|
|
1496
|
+
if (result === -1) {
|
|
1497
|
+
ibiz.log.error(ibiz.i18n.t('runtime.engine.logicOpendata'));
|
|
1498
|
+
return {
|
|
1499
|
+
cancel: true,
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1503
1502
|
|
|
1504
1503
|
return {
|
|
1505
1504
|
cancel: result ? !result.ok : true,
|
|
@@ -1537,13 +1536,12 @@ export class TreeController<
|
|
|
1537
1536
|
},
|
|
1538
1537
|
);
|
|
1539
1538
|
|
|
1540
|
-
if (result === -1)
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
);
|
|
1539
|
+
if (result === -1) {
|
|
1540
|
+
ibiz.log.error(ibiz.i18n.t('runtime.engine.logicNewdata'));
|
|
1541
|
+
return {
|
|
1542
|
+
cancel: true,
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1547
1545
|
|
|
1548
1546
|
return {
|
|
1549
1547
|
cancel: result ? !result.ok : true,
|
|
@@ -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) {
|
|
@@ -332,21 +332,20 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
332
332
|
});
|
|
333
333
|
|
|
334
334
|
if (result === -1) {
|
|
335
|
-
|
|
336
|
-
this.view.model,
|
|
337
|
-
ibiz.i18n.t('runtime.engine.logicOpendata'),
|
|
338
|
-
);
|
|
339
|
-
} else {
|
|
340
|
-
if (result && result.ok && result.data && result.data.length > 0) {
|
|
341
|
-
this.view.evt.emit('onDataChange', {
|
|
342
|
-
data: result.data,
|
|
343
|
-
actionType: 'EDIT',
|
|
344
|
-
});
|
|
345
|
-
}
|
|
335
|
+
ibiz.log.error(ibiz.i18n.t('runtime.engine.logicOpendata'));
|
|
346
336
|
return {
|
|
347
|
-
cancel:
|
|
337
|
+
cancel: true,
|
|
348
338
|
};
|
|
349
339
|
}
|
|
340
|
+
if (result && result.ok && result.data && result.data.length > 0) {
|
|
341
|
+
this.view.evt.emit('onDataChange', {
|
|
342
|
+
data: result.data,
|
|
343
|
+
actionType: 'EDIT',
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return {
|
|
347
|
+
cancel: result ? !result.ok : true,
|
|
348
|
+
};
|
|
350
349
|
}
|
|
351
350
|
|
|
352
351
|
/**
|
|
@@ -393,21 +392,20 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
393
392
|
});
|
|
394
393
|
|
|
395
394
|
if (result === -1) {
|
|
396
|
-
|
|
397
|
-
this.view.model,
|
|
398
|
-
ibiz.i18n.t('runtime.engine.logicNewdata'),
|
|
399
|
-
);
|
|
400
|
-
} else {
|
|
401
|
-
if (result.ok && result.data && result.data.length > 0) {
|
|
402
|
-
this.view.evt.emit('onDataChange', {
|
|
403
|
-
data: result.data,
|
|
404
|
-
actionType: 'NEW',
|
|
405
|
-
});
|
|
406
|
-
}
|
|
395
|
+
ibiz.log.error(ibiz.i18n.t('runtime.engine.logicNewdata'));
|
|
407
396
|
return {
|
|
408
|
-
cancel:
|
|
397
|
+
cancel: true,
|
|
409
398
|
};
|
|
410
399
|
}
|
|
400
|
+
if (result.ok && result.data && result.data.length > 0) {
|
|
401
|
+
this.view.evt.emit('onDataChange', {
|
|
402
|
+
data: result.data,
|
|
403
|
+
actionType: 'NEW',
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
cancel: result ? !result.ok : true,
|
|
408
|
+
};
|
|
411
409
|
}
|
|
412
410
|
|
|
413
411
|
/**
|
|
@@ -231,4 +231,14 @@ export interface IApiGlobalCommonConfig {
|
|
|
231
231
|
* @memberof IApiGlobalCommonConfig
|
|
232
232
|
*/
|
|
233
233
|
counterMaxValue: number;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @description 是否启用增强UI,非兼容性功能增强开关
|
|
237
|
+
* @type {boolean}
|
|
238
|
+
* @default false
|
|
239
|
+
* @platform web
|
|
240
|
+
* @platform mob
|
|
241
|
+
* @memberof IApiGlobalCommonConfig
|
|
242
|
+
*/
|
|
243
|
+
enhancedUI: boolean;
|
|
234
244
|
}
|
|
@@ -33,4 +33,11 @@ export interface IApiFormItemState extends IApiFormDetailState {
|
|
|
33
33
|
* @memberof IApiFormItemState
|
|
34
34
|
*/
|
|
35
35
|
inputTipUrl: string | undefined;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description 编辑器类名集合
|
|
39
|
+
* @type {(string[])}
|
|
40
|
+
* @memberof IApiFormItemState
|
|
41
|
+
*/
|
|
42
|
+
editorClass: string[];
|
|
36
43
|
}
|
|
@@ -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
|
}
|