hwh
2024-07-10 e9880d27955ffc17915c9125b11c9d8b12027c2d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var customElementTypeProvider = (function () {
    return function (options) {
 
        var addElementTypes = function (context) {
            context.addPrintElementTypes(
                "testModule",
                [
                    new hiprint.PrintElementTypeGroup("常规", [
                        { tid: 'testModule.text', text: '文本', data: '', type: 'text' },
                        { tid: 'testModule.image', text: '图片', data: '/Content/assets/hi.png', type: 'image' },
                        { tid: 'testModule.longText', text: '长文', data: '', type: 'longText' },
                        {
                            tid: 'testModule.table', field: 'table', text: '表格',
                            type: 'table',
                            groupFields: ['name'],
                            groupFooterFormatter: function (group, option) {
                                return '这里自定义统计脚信息';
                            },
                            columns: [
                                [{ title: '行号', fixed: true, rowspan: 2, field: 'id', width: 70 },
                                { title: '人员信息', colspan: 2 },
                                { title: '销售统计', colspan: 2 }
                                ],
                                [{ title: '姓名', align: 'left', field: 'name', width: 100 },
                                { title: '性别', field: 'gender', width: 100 },
                                { title: '销售数量', field: 'count', width: 100 },
                                { title: '销售金额', field: 'amount', width: 100 }
                                ]
                            ]
                        },
                        {
                            tid: 'testModule.tableCustom',
                            title: '表格',
                            type: 'tableCustom'
                        },
                        {
                            tid: 'testModule.html', title: 'html',
                            formatter: function (data, options) {
                                return $('<div style="height:50pt;width:50pt;background:red;border-radius: 50%;"></div>');
                            },
                            type: 'html'
                        },
                        { tid: 'testModule.customText', text: '自定义文本', customText: '自定义文本', custom: true, type: 'text' }
                    ]),
                    new hiprint.PrintElementTypeGroup("辅助", [
                        {
                            tid: 'testModule.hline',
                            text: '横线',
                            type: 'hline'
                        },
                        {
                            tid: 'testModule.vline',
                            text: '竖线',
                            type: 'vline'
                        },
                        {
                            tid: 'testModule.rect',
                            text: '矩形',
                            type: 'rect'
                        },
                        {
                            tid: 'testModule.oval',
                            text: '椭圆',
                            type: 'oval'
                        }
                    ])
                ]
            );
        };
 
        return {
            addElementTypes: addElementTypes
        };
 
    };
})();