cui-print 1.0.28
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/README.md +29 -0
- package/dist/font/iconfont.css +151 -0
- package/dist/font/iconfont.js +1 -0
- package/dist/font/iconfont.json +247 -0
- package/dist/font/iconfont.ttf +0 -0
- package/dist/font/iconfont.woff +0 -0
- package/dist/font/iconfont.woff2 +0 -0
- package/dist/index.css +1 -0
- package/dist/index.es.js +51053 -0
- package/dist/index.umd.js +1030 -0
- package/dist/print-designer-api/create-style/create-base-component-style.js +116 -0
- package/dist/print-designer-api/create-style/create-complex-table-style.js +472 -0
- package/dist/print-designer-api/create-style/create-form-component-style.js +78 -0
- package/dist/print-designer-api/create-style/create-form-item-style.js +144 -0
- package/dist/print-designer-api/create-style/create-grid-style.js +49 -0
- package/dist/print-designer-api/create-style/create-table-layout-style.js +128 -0
- package/dist/print-designer-api/create-style/create-table-style.js +93 -0
- package/dist/print-designer-api/print-designer-helper.js +912 -0
- package/dist/print-designer-api/print-designer-style-helper.js +96 -0
- package/dist/print-designer-api/print-designer-utils.js +27 -0
- package/dist/print-designer-api/print-global-style/base.less +20 -0
- package/dist/print-designer-api/print-global-style/common.less +3 -0
- package/dist/print-designer-api/print-global-style/custom.less +4 -0
- package/dist/print-designer-api/print-global-style/index.css +812 -0
- package/dist/print-designer-api/print-global-style/index.js +813 -0
- package/dist/print-designer-api/print-global-style/index.less +9 -0
- package/dist/print-designer-api/print-global-style/print-base-component.less +123 -0
- package/dist/print-designer-api/print-global-style/print-container.less +57 -0
- package/dist/print-designer-api/print-global-style/print-continue/index.less +14 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/auto-continue-not-span.less +61 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/auto-continue-preview.less +12 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/auto-continue-span.less +88 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/fixed-continue.less +37 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/index.less +96 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/pagination-preview.less +12 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/pagination.less +61 -0
- package/dist/print-designer-api/print-global-style/print-form-component.less +161 -0
- package/dist/print-designer-api/print-global-style/print-form-item.less +162 -0
- package/dist/print-designer-api/print-global-style/printing.less +16 -0
- package/dist/print-designer-api/print-soket.js +31 -0
- package/dist/print-designer-api/use-create-html/create-html-utils.js +43 -0
- package/dist/print-designer-api/use-create-html/index.js +287 -0
- package/dist/print-designer-api/use-create-html/use-base-component-helper.js +129 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/complex-table-tools.js +129 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/create-table-header.js +111 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/index.js +87 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-auto-height-preview.js +84 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-auto-height.js +379 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-default.js +75 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-fixed-height.js +220 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-pagination-preview.js +84 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-pagination.js +272 -0
- package/dist/print-designer-api/use-create-html/use-form-component-helper.js +164 -0
- package/dist/print-designer-api/use-create-html/use-format/index.js +102 -0
- package/dist/print-designer-api/use-create-html/use-format/use-complex-table-auto.js +337 -0
- package/dist/print-designer-api/use-create-html/use-format/use-complex-table-fiexd.js +233 -0
- package/dist/print-designer-api/use-create-html/use-format/use-complex-table-pagination.js +286 -0
- package/dist/print-designer-api/use-create-html/use-grid-helper.js +35 -0
- package/dist/print-designer-api/use-create-html/use-table-layout-helper.js +213 -0
- package/dist/print-designer-api/use-create-print-js/index.js +147 -0
- package/dist/print-designer-api/use-create-print-js/use-base-component-helper.js +54 -0
- package/dist/print-designer-api/use-create-print-js/use-form-component-helper.js +4 -0
- package/dist/print-designer-api/use-create-print-js/use-table-layout-helper.js +5 -0
- package/dist/print-designer-images/demo.jpg +0 -0
- package/dist/print-designer-images/demo02.jpg +0 -0
- package/dist/style/default-style.css +137 -0
- package/dist/style/main.less +66 -0
- package/dist/test/base/designer-config.js +594 -0
- package/dist/test/base/index.js +3 -0
- package/dist/test/base/print-data.js +40 -0
- package/dist/test/complex-table/designer-config.js +1668 -0
- package/dist/test/complex-table/index.js +3 -0
- package/dist/test/complex-table/print-data.js +294 -0
- package/dist/test/form/designer-config.js +2057 -0
- package/dist/test/form/index.js +3 -0
- package/dist/test/form/print-data.js +38 -0
- package/dist/test/index.js +4 -0
- package/dist/wui-print-designer-plugins/JsBarcode.all.min.js +2 -0
- package/dist/wui-print-designer-plugins/qrcode.min.js +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// 输入框
|
|
2
|
+
.print-form_input {
|
|
3
|
+
.break;
|
|
4
|
+
position: relative;
|
|
5
|
+
}
|
|
6
|
+
// 多行输入框
|
|
7
|
+
.print-form_textarea {
|
|
8
|
+
.break;
|
|
9
|
+
position: relative;
|
|
10
|
+
line-height: 1.3;
|
|
11
|
+
}
|
|
12
|
+
// 单选框
|
|
13
|
+
.print-form_radio-group {
|
|
14
|
+
position: relative;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: auto;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-flow: row;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
--wui-printing-radio-border: 1px solid #969696;
|
|
21
|
+
&.print-form_radio-group--large {
|
|
22
|
+
--wui-printing-radio-font-size: 14px;
|
|
23
|
+
--wui-printing-radio-icon-width: 14px;
|
|
24
|
+
--wui-printing-radio-icon-height: 14px;
|
|
25
|
+
--wui-printing-radio-min-height: 40px;
|
|
26
|
+
}
|
|
27
|
+
&.print-form_radio-group--default {
|
|
28
|
+
--wui-printing-radio-font-size: 14px;
|
|
29
|
+
--wui-printing-radio-icon-width: 14px;
|
|
30
|
+
--wui-printing-radio-icon-height: 14px;
|
|
31
|
+
--wui-printing-radio-min-height: 32px;
|
|
32
|
+
}
|
|
33
|
+
&.print-form_radio-group--small {
|
|
34
|
+
--wui-printing-radio-font-size: 12px;
|
|
35
|
+
--wui-printing-radio-icon-width: 12px;
|
|
36
|
+
--wui-printing-radio-icon-height: 12px;
|
|
37
|
+
--wui-printing-radio-min-height: 24px;
|
|
38
|
+
}
|
|
39
|
+
.print-form_radio {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-flow: row;
|
|
42
|
+
align-items: center;
|
|
43
|
+
margin-right: 10px;
|
|
44
|
+
&:last-of-type {
|
|
45
|
+
margin-right: 0;
|
|
46
|
+
}
|
|
47
|
+
.print-form_radio-icon {
|
|
48
|
+
width: var(--wui-printing-radio-icon-width);
|
|
49
|
+
height: var(--wui-printing-radio-icon-height);
|
|
50
|
+
border: var(--wui-printing-radio-border);
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
flex-grow: 0;
|
|
54
|
+
}
|
|
55
|
+
.print-form_radio-label {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
padding-left: 8px;
|
|
59
|
+
line-height: 16px;
|
|
60
|
+
min-height: var(--wui-printing-radio-min-height);
|
|
61
|
+
font-size: var(--wui-printing-radio-font-size);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.print-form_radio.print-form_radio--active {
|
|
65
|
+
.print-form_radio-icon {
|
|
66
|
+
position: relative;
|
|
67
|
+
background: var(--wui-printing-color--primary);
|
|
68
|
+
border-color: var(--wui-printing-color--primary);
|
|
69
|
+
&::after {
|
|
70
|
+
content: "";
|
|
71
|
+
background-color: #fff;
|
|
72
|
+
width: 4px;
|
|
73
|
+
height: 4px;
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: 4px;
|
|
77
|
+
top: 4px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// 多选框
|
|
83
|
+
.print-form_checkbox-group {
|
|
84
|
+
position: relative;
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: auto;
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-flow: row;
|
|
89
|
+
flex-wrap: wrap;
|
|
90
|
+
--wui-printing-checkbox-border: 1px solid #969696;
|
|
91
|
+
&.print-form_checkbox-group--large {
|
|
92
|
+
--wui-printing-checkbox-font-size: 14px;
|
|
93
|
+
--wui-printing-checkbox-icon-width: 14px;
|
|
94
|
+
--wui-printing-checkbox-icon-height: 14px;
|
|
95
|
+
--wui-printing-checkbox-min-height: 40px;
|
|
96
|
+
}
|
|
97
|
+
&.print-form_checkbox-group--default {
|
|
98
|
+
--wui-printing-checkbox-font-size: 14px;
|
|
99
|
+
--wui-printing-checkbox-icon-width: 14px;
|
|
100
|
+
--wui-printing-checkbox-icon-height: 14px;
|
|
101
|
+
--wui-printing-checkbox-min-height: 32px;
|
|
102
|
+
}
|
|
103
|
+
&.print-form_checkbox-group--small {
|
|
104
|
+
--wui-printing-checkbox-font-size: 12px;
|
|
105
|
+
--wui-printing-checkbox-icon-width: 12px;
|
|
106
|
+
--wui-printing-checkbox-icon-height: 12px;
|
|
107
|
+
--wui-printing-checkbox-min-height: 24px;
|
|
108
|
+
}
|
|
109
|
+
.print-form_checkbox {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-flow: row;
|
|
112
|
+
align-items: center;
|
|
113
|
+
margin-right: 10px;
|
|
114
|
+
&:last-of-type {
|
|
115
|
+
margin-right: 0;
|
|
116
|
+
}
|
|
117
|
+
.print-form_checkbox-icon {
|
|
118
|
+
width: var(--wui-printing-checkbox-icon-width);
|
|
119
|
+
height: var(--wui-printing-checkbox-icon-height);
|
|
120
|
+
border: var(--wui-printing-checkbox-border);
|
|
121
|
+
border-radius: 2px;
|
|
122
|
+
flex-shrink: 0;
|
|
123
|
+
flex-grow: 0;
|
|
124
|
+
}
|
|
125
|
+
.print-form_checkbox-label {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
padding-left: 8px;
|
|
129
|
+
line-height: 16px;
|
|
130
|
+
min-height: var(--wui-printing-checkbox-min-height);
|
|
131
|
+
font-size: var(--wui-printing-checkbox-font-size);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
.print-form_checkbox.print-form_checkbox--active {
|
|
135
|
+
.print-form_checkbox-icon {
|
|
136
|
+
position: relative;
|
|
137
|
+
background: var(--wui-printing-color--primary);
|
|
138
|
+
border-color: var(--wui-printing-color--primary);
|
|
139
|
+
&::after {
|
|
140
|
+
content: "✔";
|
|
141
|
+
position: absolute;
|
|
142
|
+
top: 0;
|
|
143
|
+
bottom: 0;
|
|
144
|
+
left: 0;
|
|
145
|
+
right: 0;
|
|
146
|
+
text-align: center;
|
|
147
|
+
line-height: 12px;
|
|
148
|
+
font-size: 10px;
|
|
149
|
+
color: #fff;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// 选择器
|
|
155
|
+
.print-form_select {
|
|
156
|
+
position: relative;
|
|
157
|
+
}
|
|
158
|
+
// 日期时间
|
|
159
|
+
.print-form_datetime {
|
|
160
|
+
position: relative;
|
|
161
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
.print-form-item {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-flow: row;
|
|
5
|
+
& > .print-form-item_label {
|
|
6
|
+
padding-right: 12px;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
justify-content: flex-end;
|
|
9
|
+
}
|
|
10
|
+
& > .print-form-item_content {
|
|
11
|
+
width: 0;
|
|
12
|
+
flex: 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
// 表单全局配置 标签-左
|
|
16
|
+
.print-form_label-left {
|
|
17
|
+
.print-form-item {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-flow: row;
|
|
20
|
+
& > .print-form-item_label {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
justify-content: flex-start;
|
|
23
|
+
}
|
|
24
|
+
& > .print-form-item_content {
|
|
25
|
+
width: 0;
|
|
26
|
+
flex: 1;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// 表单全局配置 标签-右
|
|
31
|
+
.print-form_label-right {
|
|
32
|
+
.print-form-item {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-flow: row;
|
|
35
|
+
& > .print-form-item_label {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
justify-content: flex-end;
|
|
38
|
+
}
|
|
39
|
+
& > .print-form-item_content {
|
|
40
|
+
width: 0;
|
|
41
|
+
flex: 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// 表单全局配置 标签-上
|
|
46
|
+
.print-form_label-top {
|
|
47
|
+
.print-form-item {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-flow: column;
|
|
50
|
+
& > .print-form-item_label {
|
|
51
|
+
display: block;
|
|
52
|
+
text-align: left;
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
& > .print-form-item_content {
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// 表单全局配置 表单尺寸 大
|
|
61
|
+
.print-form-large {
|
|
62
|
+
&.print-form_label-top {
|
|
63
|
+
.print-form-item {
|
|
64
|
+
& > .print-form-item_label {
|
|
65
|
+
margin-bottom: 12px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
.print-form-item {
|
|
70
|
+
--wui-printing-font-size: 14px;
|
|
71
|
+
& > .print-form-item_label {
|
|
72
|
+
height: 40px;
|
|
73
|
+
line-height: 40px;
|
|
74
|
+
font-size: var(--wui-printing-font-size);
|
|
75
|
+
}
|
|
76
|
+
& > .print-form-item_content {
|
|
77
|
+
line-height: 40px;
|
|
78
|
+
min-height: 40px;
|
|
79
|
+
font-size: var(--wui-printing-font-size);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// 表单全局配置 表单尺寸 默认
|
|
84
|
+
.print-form-default {
|
|
85
|
+
.print-form-item {
|
|
86
|
+
--wui-printing-font-size: 14px;
|
|
87
|
+
& > .print-form-item_label {
|
|
88
|
+
height: 32px;
|
|
89
|
+
line-height: 32px;
|
|
90
|
+
font-size: var(--wui-printing-font-size);
|
|
91
|
+
}
|
|
92
|
+
& > .print-form-item_content {
|
|
93
|
+
line-height: 32px;
|
|
94
|
+
min-height: 32px;
|
|
95
|
+
font-size: var(--wui-printing-font-size);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// 表单全局配置 表单尺寸 小
|
|
100
|
+
.print-form-small {
|
|
101
|
+
.print-form-item {
|
|
102
|
+
--wui-printing-font-size: 12px;
|
|
103
|
+
& > .print-form-item_label {
|
|
104
|
+
height: 24px;
|
|
105
|
+
line-height: 24px;
|
|
106
|
+
font-size: var(--wui-printing-font-size);
|
|
107
|
+
}
|
|
108
|
+
& > .print-form-item_content {
|
|
109
|
+
line-height: 24px;
|
|
110
|
+
min-height: 24px;
|
|
111
|
+
font-size: var(--wui-printing-font-size);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// 表单项单独配置
|
|
116
|
+
.print-form-item {
|
|
117
|
+
// 标签-左
|
|
118
|
+
&.print-form-item_label-left {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-flow: row;
|
|
121
|
+
& > .print-form-item_label {
|
|
122
|
+
display: inline-flex;
|
|
123
|
+
justify-content: flex-start;
|
|
124
|
+
}
|
|
125
|
+
& > .print-form-item_content {
|
|
126
|
+
width: 0;
|
|
127
|
+
height: auto;
|
|
128
|
+
flex: 1;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// 标签-右
|
|
132
|
+
&.print-form-item_label-right {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-flow: row;
|
|
135
|
+
& > .print-form-item_label {
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
justify-content: flex-end;
|
|
138
|
+
}
|
|
139
|
+
& > .print-form-item_content {
|
|
140
|
+
width: 0;
|
|
141
|
+
height: auto;
|
|
142
|
+
flex: 1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// 标签-上
|
|
146
|
+
&.print-form-item_label-top {
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-flow: column;
|
|
149
|
+
& > .print-form-item_label {
|
|
150
|
+
height: auto;
|
|
151
|
+
line-height: 22px;
|
|
152
|
+
margin-bottom: 8px;
|
|
153
|
+
display: block;
|
|
154
|
+
text-align: left;
|
|
155
|
+
}
|
|
156
|
+
& > .print-form-item_content {
|
|
157
|
+
width: auto;
|
|
158
|
+
height: 0;
|
|
159
|
+
flex: 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@media print {
|
|
2
|
+
body {
|
|
3
|
+
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
}
|
|
6
|
+
* {
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
-moz-box-sizing: border-box;
|
|
11
|
+
-webkit-box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
@page {
|
|
14
|
+
margin: 0 !important;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { io } from "socket.io-client";
|
|
2
|
+
|
|
3
|
+
//连接
|
|
4
|
+
const PrintSocket = io("http://localhost:17521", {
|
|
5
|
+
transports: ["websocket"],
|
|
6
|
+
auth: {
|
|
7
|
+
token: "" // 在此处填入你 client 设置的 token,缺省可留空
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
//连接成功
|
|
11
|
+
PrintSocket.on("connect", () => {
|
|
12
|
+
console.log("PrintSocket-连接成功");
|
|
13
|
+
});
|
|
14
|
+
//连接断开
|
|
15
|
+
PrintSocket.on("disconnect", () => {
|
|
16
|
+
// console.log("disconnect");
|
|
17
|
+
});
|
|
18
|
+
//获取客户端信息
|
|
19
|
+
PrintSocket.on("clientInfo", (clientInfo) => {
|
|
20
|
+
// console.log("PrintSocket-客户端信息", clientInfo);
|
|
21
|
+
});
|
|
22
|
+
//获取打印机列表
|
|
23
|
+
PrintSocket.on("printerList", (printerList) => {
|
|
24
|
+
// console.log("PrintSocket-打印机列表", printerList);
|
|
25
|
+
});
|
|
26
|
+
//连接错误
|
|
27
|
+
PrintSocket.on("connect_error", (error) => {
|
|
28
|
+
// console.error("Connection error:", error);
|
|
29
|
+
});
|
|
30
|
+
window.WuiPrintSocket = PrintSocket;
|
|
31
|
+
export default PrintSocket;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const formatComponentClass = ({ componentItem, className }) => {
|
|
2
|
+
let classList = [];
|
|
3
|
+
if (!!className) {
|
|
4
|
+
classList.push(className);
|
|
5
|
+
}
|
|
6
|
+
let continueConfig = !!componentItem._continueConfig ? componentItem._continueConfig : false;
|
|
7
|
+
if (!!continueConfig) {
|
|
8
|
+
classList.push("print-continue-blank");
|
|
9
|
+
}
|
|
10
|
+
if (!!continueConfig && !!continueConfig.isBefore) {
|
|
11
|
+
classList.push("print-continue-blank--before");
|
|
12
|
+
}
|
|
13
|
+
if (!!continueConfig && !!continueConfig.isAfter) {
|
|
14
|
+
classList.push("print-continue-blank--after");
|
|
15
|
+
}
|
|
16
|
+
return classList.join(" ");
|
|
17
|
+
};
|
|
18
|
+
export const formatDate = ({ dateText, format } = {}) => {
|
|
19
|
+
if (!dateText) {
|
|
20
|
+
return dateText;
|
|
21
|
+
}
|
|
22
|
+
// 获取日期的各个部分
|
|
23
|
+
const dateInstance = new Date(dateText);
|
|
24
|
+
const year = dateInstance.getFullYear();
|
|
25
|
+
const month = String(dateInstance.getMonth() + 1).padStart(2, "0"); // 月份从0开始,所以要加1
|
|
26
|
+
const day = String(dateInstance.getDate()).padStart(2, "0");
|
|
27
|
+
const hours = String(dateInstance.getHours()).padStart(2, "0");
|
|
28
|
+
const minutes = String(dateInstance.getMinutes()).padStart(2, "0");
|
|
29
|
+
const seconds = String(dateInstance.getSeconds()).padStart(2, "0");
|
|
30
|
+
|
|
31
|
+
// 用格式化字符串中的占位符替换为具体的日期时间值
|
|
32
|
+
return format
|
|
33
|
+
.replace("YYYY", year)
|
|
34
|
+
.replace("MM", month)
|
|
35
|
+
.replace("DD", day)
|
|
36
|
+
.replace("HH", hours)
|
|
37
|
+
.replace("mm", minutes)
|
|
38
|
+
.replace("ss", seconds);
|
|
39
|
+
};
|
|
40
|
+
export default {
|
|
41
|
+
formatComponentClass,
|
|
42
|
+
formatDate
|
|
43
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import useBaseComponentHelper from "./use-base-component-helper";
|
|
2
|
+
import useFormComponentHelper from "./use-form-component-helper";
|
|
3
|
+
import useComplexTableHelper from "./use-complex-table-helper/index.js";
|
|
4
|
+
import useGridHelper from "./use-grid-helper";
|
|
5
|
+
import useTableLayoutHelper from "./use-table-layout-helper";
|
|
6
|
+
import useFormat from "./use-format/index.js";
|
|
7
|
+
import { deepCopy } from "../print-designer-utils";
|
|
8
|
+
export default ({
|
|
9
|
+
printData,
|
|
10
|
+
printConfig,
|
|
11
|
+
formConfig,
|
|
12
|
+
layoutConfig,
|
|
13
|
+
printedRowCount = 0,
|
|
14
|
+
printedRows = [],
|
|
15
|
+
continuePrintElements,
|
|
16
|
+
tablePaginationElements,
|
|
17
|
+
errorLogs
|
|
18
|
+
} = {}) => {
|
|
19
|
+
// formatInstance会修改print,需要先将printData与外部数据断开引用
|
|
20
|
+
printData = deepCopy(printData);
|
|
21
|
+
if (typeof printedRowCount != "number" || printedRowCount < 0) {
|
|
22
|
+
printedRowCount = 0;
|
|
23
|
+
}
|
|
24
|
+
const formatInstance = useFormat({
|
|
25
|
+
printData,
|
|
26
|
+
printConfig,
|
|
27
|
+
formConfig,
|
|
28
|
+
layoutConfig,
|
|
29
|
+
printedRowCount,
|
|
30
|
+
printedRows,
|
|
31
|
+
continuePrintElements,
|
|
32
|
+
tablePaginationElements
|
|
33
|
+
});
|
|
34
|
+
const newLayoutConfig = formatInstance.formatLayoutConfig();
|
|
35
|
+
console.log("格式化后的打印配置==>", {
|
|
36
|
+
printData,
|
|
37
|
+
printConfig,
|
|
38
|
+
formConfig,
|
|
39
|
+
layoutConfig: deepCopy(newLayoutConfig),
|
|
40
|
+
printedRowCount,
|
|
41
|
+
printedRows,
|
|
42
|
+
continuePrintElements
|
|
43
|
+
});
|
|
44
|
+
const baseComponentHelper = useBaseComponentHelper({
|
|
45
|
+
printData,
|
|
46
|
+
printConfig,
|
|
47
|
+
formConfig,
|
|
48
|
+
layoutConfig: newLayoutConfig,
|
|
49
|
+
errorLogs
|
|
50
|
+
});
|
|
51
|
+
const formComponentHelper = useFormComponentHelper({
|
|
52
|
+
printData,
|
|
53
|
+
printConfig,
|
|
54
|
+
formConfig,
|
|
55
|
+
layoutConfig: newLayoutConfig,
|
|
56
|
+
errorLogs
|
|
57
|
+
});
|
|
58
|
+
const complexTableHelper = useComplexTableHelper({
|
|
59
|
+
printData,
|
|
60
|
+
printConfig,
|
|
61
|
+
formConfig,
|
|
62
|
+
layoutConfig: newLayoutConfig,
|
|
63
|
+
errorLogs
|
|
64
|
+
});
|
|
65
|
+
const createHtmlByComponentItem = (componentItem) => {
|
|
66
|
+
let newHtml = "";
|
|
67
|
+
// 分页上边距
|
|
68
|
+
if (componentItem.type == "pageTop") {
|
|
69
|
+
newHtml = baseComponentHelper.createPageTopHtml(componentItem);
|
|
70
|
+
return newHtml;
|
|
71
|
+
}
|
|
72
|
+
// 分页下边距
|
|
73
|
+
if (componentItem.type == "pageBottom") {
|
|
74
|
+
newHtml = baseComponentHelper.createPageBottomHtml(componentItem);
|
|
75
|
+
return newHtml;
|
|
76
|
+
}
|
|
77
|
+
// 分页
|
|
78
|
+
if (componentItem.type == "pageBreak") {
|
|
79
|
+
newHtml = baseComponentHelper.createPageBreakHtml(componentItem);
|
|
80
|
+
return newHtml;
|
|
81
|
+
}
|
|
82
|
+
// 文本
|
|
83
|
+
if (componentItem.type == "text") {
|
|
84
|
+
let nowComponentProps = componentItem.props;
|
|
85
|
+
if (!nowComponentProps) {
|
|
86
|
+
errorLogs.push(`【文本】【${componentItem.id}】,缺少配置【props】`);
|
|
87
|
+
return newHtml;
|
|
88
|
+
}
|
|
89
|
+
newHtml = baseComponentHelper.createTextHtml(componentItem);
|
|
90
|
+
return newHtml;
|
|
91
|
+
}
|
|
92
|
+
// 动态文本
|
|
93
|
+
if (componentItem.type == "dynamicText") {
|
|
94
|
+
let nowComponentProps = componentItem.props;
|
|
95
|
+
if (!nowComponentProps) {
|
|
96
|
+
errorLogs.push(`【动态文本】【${nowComponentProps.label}】【${componentItem.id}】,缺少配置【props】`);
|
|
97
|
+
return newHtml;
|
|
98
|
+
}
|
|
99
|
+
if (!nowComponentProps.field) {
|
|
100
|
+
errorLogs.push(`【动态文本】【${nowComponentProps.label}】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
101
|
+
return newHtml;
|
|
102
|
+
}
|
|
103
|
+
newHtml = baseComponentHelper.createDynamicTextHtml(componentItem);
|
|
104
|
+
return newHtml;
|
|
105
|
+
}
|
|
106
|
+
// 表格
|
|
107
|
+
if (componentItem.type == "table") {
|
|
108
|
+
let nowComponentProps = componentItem.props;
|
|
109
|
+
if (!nowComponentProps) {
|
|
110
|
+
errorLogs.push(`【表格】【${componentItem.id}】,缺少配置【props】`);
|
|
111
|
+
return newHtml;
|
|
112
|
+
}
|
|
113
|
+
if (!nowComponentProps.field) {
|
|
114
|
+
errorLogs.push(`【表格】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
115
|
+
return newHtml;
|
|
116
|
+
}
|
|
117
|
+
newHtml = baseComponentHelper.createTableHtml(componentItem);
|
|
118
|
+
return newHtml;
|
|
119
|
+
}
|
|
120
|
+
// 复杂表格
|
|
121
|
+
if (componentItem.type == "complexTable") {
|
|
122
|
+
let nowComponentProps = componentItem.props;
|
|
123
|
+
if (!nowComponentProps) {
|
|
124
|
+
errorLogs.push(`【复杂表格】【${componentItem.id}】,缺少配置【props】`);
|
|
125
|
+
return newHtml;
|
|
126
|
+
}
|
|
127
|
+
if (!nowComponentProps.field) {
|
|
128
|
+
errorLogs.push(`【复杂表格】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
129
|
+
return newHtml;
|
|
130
|
+
}
|
|
131
|
+
newHtml = complexTableHelper.createComplexTableHtml(componentItem);
|
|
132
|
+
return newHtml;
|
|
133
|
+
}
|
|
134
|
+
// 条形码
|
|
135
|
+
if (componentItem.type == "barcode") {
|
|
136
|
+
let nowComponentProps = componentItem.props;
|
|
137
|
+
if (!nowComponentProps) {
|
|
138
|
+
errorLogs.push(`【条形码】【${componentItem.id}】,缺少配置【props】`);
|
|
139
|
+
return newHtml;
|
|
140
|
+
}
|
|
141
|
+
if (!nowComponentProps.field) {
|
|
142
|
+
errorLogs.push(`【条形码】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
143
|
+
return newHtml;
|
|
144
|
+
}
|
|
145
|
+
newHtml = baseComponentHelper.createBarcodeHtml(componentItem);
|
|
146
|
+
return newHtml;
|
|
147
|
+
}
|
|
148
|
+
// 二维码
|
|
149
|
+
if (componentItem.type == "qrcode") {
|
|
150
|
+
let nowComponentProps = componentItem.props;
|
|
151
|
+
if (!nowComponentProps) {
|
|
152
|
+
errorLogs.push(`【二维码】【${componentItem.id}】,缺少配置【props】`);
|
|
153
|
+
return newHtml;
|
|
154
|
+
}
|
|
155
|
+
if (!nowComponentProps.field) {
|
|
156
|
+
errorLogs.push(`【二维码】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
157
|
+
return newHtml;
|
|
158
|
+
}
|
|
159
|
+
newHtml = baseComponentHelper.createQrcodeHtml(componentItem);
|
|
160
|
+
return newHtml;
|
|
161
|
+
}
|
|
162
|
+
// 图片
|
|
163
|
+
if (componentItem.type == "image") {
|
|
164
|
+
let nowComponentProps = componentItem.props;
|
|
165
|
+
if (!nowComponentProps) {
|
|
166
|
+
errorLogs.push(`【图片】【${componentItem.id}】,缺少配置【props】`);
|
|
167
|
+
return newHtml;
|
|
168
|
+
}
|
|
169
|
+
newHtml = baseComponentHelper.createImageHtml(componentItem);
|
|
170
|
+
return newHtml;
|
|
171
|
+
}
|
|
172
|
+
// 输入框
|
|
173
|
+
if (componentItem.type == "input") {
|
|
174
|
+
let nowComponentProps = componentItem.props;
|
|
175
|
+
let nowFormItemProps = componentItem.formItemProps;
|
|
176
|
+
if (!nowComponentProps) {
|
|
177
|
+
errorLogs.push(`【输入框】【${nowFormItemProps.label}】【${componentItem.id}】,缺少配置【props】`);
|
|
178
|
+
return newHtml;
|
|
179
|
+
}
|
|
180
|
+
if (!nowComponentProps.field) {
|
|
181
|
+
errorLogs.push(`【输入框】【${nowFormItemProps.label}】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
182
|
+
return newHtml;
|
|
183
|
+
}
|
|
184
|
+
newHtml = formComponentHelper.createInputHtml(componentItem);
|
|
185
|
+
return newHtml;
|
|
186
|
+
}
|
|
187
|
+
// 多行输入框
|
|
188
|
+
if (componentItem.type == "textarea") {
|
|
189
|
+
let nowComponentProps = componentItem.props;
|
|
190
|
+
let nowFormItemProps = componentItem.formItemProps;
|
|
191
|
+
if (!nowComponentProps) {
|
|
192
|
+
errorLogs.push(`【多行输入框】【${nowFormItemProps.label}】【${componentItem.id}】,缺少配置【props】`);
|
|
193
|
+
return newHtml;
|
|
194
|
+
}
|
|
195
|
+
if (!nowComponentProps.field) {
|
|
196
|
+
errorLogs.push(`【多行输入框】【${nowFormItemProps.label}】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
197
|
+
return newHtml;
|
|
198
|
+
}
|
|
199
|
+
newHtml = formComponentHelper.createTextareaHtml(componentItem);
|
|
200
|
+
return newHtml;
|
|
201
|
+
}
|
|
202
|
+
// 单选框
|
|
203
|
+
if (componentItem.type == "radio") {
|
|
204
|
+
let nowComponentProps = componentItem.props;
|
|
205
|
+
let nowFormItemProps = componentItem.formItemProps;
|
|
206
|
+
if (!nowComponentProps) {
|
|
207
|
+
errorLogs.push(`【单选框】【${nowFormItemProps.label}】【${componentItem.id}】,缺少配置【props】`);
|
|
208
|
+
return newHtml;
|
|
209
|
+
}
|
|
210
|
+
if (!nowComponentProps.field) {
|
|
211
|
+
errorLogs.push(`【单选框】【${nowFormItemProps.label}】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
212
|
+
return newHtml;
|
|
213
|
+
}
|
|
214
|
+
newHtml = formComponentHelper.createRadioHtml(componentItem);
|
|
215
|
+
return newHtml;
|
|
216
|
+
}
|
|
217
|
+
// 多选框
|
|
218
|
+
if (componentItem.type == "checkbox") {
|
|
219
|
+
let nowComponentProps = componentItem.props;
|
|
220
|
+
let nowFormItemProps = componentItem.formItemProps;
|
|
221
|
+
if (!nowComponentProps) {
|
|
222
|
+
errorLogs.push(`【多选框】【${nowFormItemProps.label}】【${componentItem.id}】,缺少配置【props】`);
|
|
223
|
+
return newHtml;
|
|
224
|
+
}
|
|
225
|
+
if (!nowComponentProps.field) {
|
|
226
|
+
errorLogs.push(`【多选框】【${nowFormItemProps.label}】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
227
|
+
return newHtml;
|
|
228
|
+
}
|
|
229
|
+
newHtml = formComponentHelper.createCheckboxHtml(componentItem);
|
|
230
|
+
return newHtml;
|
|
231
|
+
}
|
|
232
|
+
// 选择器
|
|
233
|
+
if (componentItem.type == "select") {
|
|
234
|
+
let nowComponentProps = componentItem.props;
|
|
235
|
+
let nowFormItemProps = componentItem.formItemProps;
|
|
236
|
+
if (!nowComponentProps) {
|
|
237
|
+
errorLogs.push(`【选择器】【${nowFormItemProps.label}】【${componentItem.id}】,缺少配置【props】`);
|
|
238
|
+
return newHtml;
|
|
239
|
+
}
|
|
240
|
+
if (!nowComponentProps.field) {
|
|
241
|
+
errorLogs.push(`【选择器】【${nowFormItemProps.label}】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
242
|
+
return newHtml;
|
|
243
|
+
}
|
|
244
|
+
newHtml = formComponentHelper.createSelectHtml(componentItem);
|
|
245
|
+
return newHtml;
|
|
246
|
+
}
|
|
247
|
+
// 选择器
|
|
248
|
+
if (componentItem.type == "datetime") {
|
|
249
|
+
let nowComponentProps = componentItem.props;
|
|
250
|
+
let nowFormItemProps = componentItem.formItemProps;
|
|
251
|
+
if (!nowComponentProps) {
|
|
252
|
+
errorLogs.push(`【日期时间】【${nowFormItemProps.label}】【${componentItem.id}】,缺少配置【props】`);
|
|
253
|
+
return newHtml;
|
|
254
|
+
}
|
|
255
|
+
if (!nowComponentProps.field) {
|
|
256
|
+
errorLogs.push(`【日期时间】【${nowFormItemProps.label}】【${componentItem.id}】,【props】中缺少配置【field】`);
|
|
257
|
+
return newHtml;
|
|
258
|
+
}
|
|
259
|
+
newHtml = formComponentHelper.createDatetimeHtml(componentItem);
|
|
260
|
+
return newHtml;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const gridHelper = useGridHelper({
|
|
264
|
+
printData,
|
|
265
|
+
printConfig,
|
|
266
|
+
formConfig,
|
|
267
|
+
layoutConfig: newLayoutConfig,
|
|
268
|
+
createHtmlByComponentItem,
|
|
269
|
+
errorLogs
|
|
270
|
+
});
|
|
271
|
+
const tableLayoutHelper = useTableLayoutHelper({
|
|
272
|
+
printData,
|
|
273
|
+
printConfig,
|
|
274
|
+
formConfig,
|
|
275
|
+
layoutConfig: newLayoutConfig,
|
|
276
|
+
createHtmlByComponentItem,
|
|
277
|
+
errorLogs
|
|
278
|
+
});
|
|
279
|
+
const formatLayoutConfig = () => {};
|
|
280
|
+
return {
|
|
281
|
+
createHtmlByComponentItem,
|
|
282
|
+
formatLayoutConfig,
|
|
283
|
+
gridHelper: gridHelper,
|
|
284
|
+
tableLayoutHelper: tableLayoutHelper,
|
|
285
|
+
layoutConfig: newLayoutConfig
|
|
286
|
+
};
|
|
287
|
+
};
|