ol-base-components 2.9.3 → 3.0.0
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/package.json +5 -5
- package/public/index.html +1 -0
- package/public/print-lock.css +352 -0
- package/src/App.vue +26 -33
- package/src/assets/css/iconfont.css +342 -0
- package/src/main.js +4 -5
- package/src/package/formSearch/src/index.vue +4 -5
- package/src/package/index.js +4 -3
- package/src/package/print/index.js +56 -0
- package/src/package/print/src/index.vue +573 -0
- package/src/package/print/src/provide/aaa.json +110 -0
- package/src/package/print/src/provide/provider1.js +215 -0
- package/src/package/table/src/index.vue +26 -54
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { hiprint } from "vue-plugin-hiprint";
|
|
2
|
+
|
|
3
|
+
export const provider1 = function () {
|
|
4
|
+
const addElementTypes = context => {
|
|
5
|
+
context.removePrintElementTypes("providerModule1");
|
|
6
|
+
context.addPrintElementTypes("providerModule1", [
|
|
7
|
+
new hiprint.PrintElementTypeGroup("常规", [
|
|
8
|
+
{
|
|
9
|
+
tid: "providerModule2.customText",
|
|
10
|
+
title: "文本",
|
|
11
|
+
customText: "自定义文本",
|
|
12
|
+
custom: true,
|
|
13
|
+
type: "text",
|
|
14
|
+
options: {
|
|
15
|
+
field: "name",
|
|
16
|
+
testData: "内容",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
tid: "providerModule2.longText",
|
|
21
|
+
title: "长文本",
|
|
22
|
+
type: "longText",
|
|
23
|
+
options: {
|
|
24
|
+
field: "test.longText",
|
|
25
|
+
width: 200,
|
|
26
|
+
testData: "长文本分页/不分页测试",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
tid: "providerModule1.type",
|
|
31
|
+
title: "纯文本",
|
|
32
|
+
data: "纯文本",
|
|
33
|
+
type: "text",
|
|
34
|
+
options: {
|
|
35
|
+
testData: "纯文本",
|
|
36
|
+
height: 16,
|
|
37
|
+
fontSize: 15,
|
|
38
|
+
fontWeight: "700",
|
|
39
|
+
textAlign: "center",
|
|
40
|
+
hideTitle: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
tid: "providerModule1.platform",
|
|
45
|
+
title: "标题",
|
|
46
|
+
data: "标题",
|
|
47
|
+
type: "text",
|
|
48
|
+
options: {
|
|
49
|
+
field: "platform",
|
|
50
|
+
testData: "平台名称",
|
|
51
|
+
height: 17,
|
|
52
|
+
fontSize: 16.5,
|
|
53
|
+
fontWeight: "700",
|
|
54
|
+
textAlign: "center",
|
|
55
|
+
hideTitle: true,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
tid: "providerModule2.table",
|
|
60
|
+
title: "表格",
|
|
61
|
+
type: "table",
|
|
62
|
+
options: {
|
|
63
|
+
field: "table",
|
|
64
|
+
fields: [
|
|
65
|
+
// { text: "名称", field: "name1" },
|
|
66
|
+
// { text: "性别", field: "gender" },
|
|
67
|
+
// { text: "数量", field: "count" },
|
|
68
|
+
// { text: "金额", field: "amount" },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
columns: [
|
|
72
|
+
[
|
|
73
|
+
{ title: "名称", align: "center", field: "name" },
|
|
74
|
+
{ title: "性别", align: "center", field: "gender" },
|
|
75
|
+
{ title: "数量", align: "center", field: "count" },
|
|
76
|
+
{ title: "金额", align: "center", field: "amount" },
|
|
77
|
+
],
|
|
78
|
+
],
|
|
79
|
+
// footerFormatter: function (options, rows, data, currentPageGridRowsData) {
|
|
80
|
+
// console.log(currentPageGridRowsData);
|
|
81
|
+
// if (data && data["totalCap"]) {
|
|
82
|
+
// return `<td style="padding:0 10px" colspan="100">${
|
|
83
|
+
// "应收金额大写: " + data["totalCap"]
|
|
84
|
+
// }</td>`;
|
|
85
|
+
// }
|
|
86
|
+
// return '<td style="padding:0 10px" colspan="100">应收金额大写: </td>';
|
|
87
|
+
// },
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
tid: "providerModule1.barcode",
|
|
91
|
+
title: "条形码",
|
|
92
|
+
data: "XS888888888",
|
|
93
|
+
type: "text",
|
|
94
|
+
options: {
|
|
95
|
+
field: "barcode",
|
|
96
|
+
testData: "XS888888888",
|
|
97
|
+
height: 32,
|
|
98
|
+
fontSize: 12,
|
|
99
|
+
lineHeight: 18,
|
|
100
|
+
textAlign: "left",
|
|
101
|
+
textType: "barcode",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
tid: "providerModule1.qrcode",
|
|
106
|
+
title: "二维码",
|
|
107
|
+
data: "XS888888888",
|
|
108
|
+
type: "text",
|
|
109
|
+
options: {
|
|
110
|
+
field: "qrcode",
|
|
111
|
+
testData: "XS888888888",
|
|
112
|
+
height: 32,
|
|
113
|
+
fontSize: 12,
|
|
114
|
+
lineHeight: 18,
|
|
115
|
+
textType: "qrcode",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
{
|
|
120
|
+
tid: "providerModule1.image",
|
|
121
|
+
title: "图片",
|
|
122
|
+
data: "",
|
|
123
|
+
type: "image",
|
|
124
|
+
},
|
|
125
|
+
]),
|
|
126
|
+
new hiprint.PrintElementTypeGroup("定制", [
|
|
127
|
+
{
|
|
128
|
+
tid: "providerModule1.khname",
|
|
129
|
+
title: "客户名称",
|
|
130
|
+
data: "高级客户",
|
|
131
|
+
type: "text",
|
|
132
|
+
options: {
|
|
133
|
+
field: "name",
|
|
134
|
+
testData: "高级客户",
|
|
135
|
+
height: 16,
|
|
136
|
+
fontSize: 6.75,
|
|
137
|
+
fontWeight: "700",
|
|
138
|
+
textAlign: "left",
|
|
139
|
+
textContentVerticalAlign: "middle",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
tid: "providerModule1.tel",
|
|
144
|
+
title: "客户电话",
|
|
145
|
+
data: "18888888888",
|
|
146
|
+
type: "text",
|
|
147
|
+
options: {
|
|
148
|
+
field: "tel",
|
|
149
|
+
testData: "18888888888",
|
|
150
|
+
height: 16,
|
|
151
|
+
fontSize: 6.75,
|
|
152
|
+
fontWeight: "700",
|
|
153
|
+
textAlign: "left",
|
|
154
|
+
textContentVerticalAlign: "middle",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
tid: "providerModule1.order",
|
|
159
|
+
title: "订单编号",
|
|
160
|
+
data: "XS888888888",
|
|
161
|
+
type: "text",
|
|
162
|
+
options: {
|
|
163
|
+
field: "order",
|
|
164
|
+
testData: "XS888888888",
|
|
165
|
+
height: 16,
|
|
166
|
+
fontSize: 6.75,
|
|
167
|
+
fontWeight: "700",
|
|
168
|
+
textAlign: "left",
|
|
169
|
+
textContentVerticalAlign: "middle",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
tid: "providerModule1.date",
|
|
174
|
+
title: "业务日期",
|
|
175
|
+
data: "2020-01-01",
|
|
176
|
+
type: "text",
|
|
177
|
+
options: {
|
|
178
|
+
field: "date",
|
|
179
|
+
testData: "2020-01-01",
|
|
180
|
+
height: 16,
|
|
181
|
+
fontSize: 6.75,
|
|
182
|
+
fontWeight: "700",
|
|
183
|
+
textAlign: "left",
|
|
184
|
+
textContentVerticalAlign: "middle",
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
]),
|
|
188
|
+
new hiprint.PrintElementTypeGroup("辅助", [
|
|
189
|
+
{
|
|
190
|
+
tid: "providerModule2.hline",
|
|
191
|
+
title: "横线",
|
|
192
|
+
type: "hline",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
tid: "providerModule2.vline",
|
|
196
|
+
title: "竖线",
|
|
197
|
+
type: "vline",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
tid: "providerModule2.rect",
|
|
201
|
+
title: "矩形",
|
|
202
|
+
type: "rect",
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
tid: "providerModule2.oval",
|
|
206
|
+
title: "椭圆",
|
|
207
|
+
type: "oval",
|
|
208
|
+
},
|
|
209
|
+
]),
|
|
210
|
+
]);
|
|
211
|
+
};
|
|
212
|
+
return {
|
|
213
|
+
addElementTypes,
|
|
214
|
+
};
|
|
215
|
+
};
|
|
@@ -242,6 +242,9 @@
|
|
|
242
242
|
</el-row>
|
|
243
243
|
</div>
|
|
244
244
|
<printTemplate v-show="false" class="printTemplate" :print-list-obj="printListObj" />
|
|
245
|
+
<el-dialog title="打印" :visible.sync="showPrint" fullscreen>
|
|
246
|
+
<ol-print v-if="showPrint" />
|
|
247
|
+
</el-dialog>
|
|
245
248
|
</div>
|
|
246
249
|
</template>
|
|
247
250
|
<script>
|
|
@@ -423,12 +426,12 @@ export default {
|
|
|
423
426
|
default: true,
|
|
424
427
|
},
|
|
425
428
|
//获取swagger后的钩子,返回swagger结构数据。用于处理swagger数据
|
|
426
|
-
|
|
429
|
+
onSwagger: {
|
|
427
430
|
type: Function,
|
|
428
431
|
default: null,
|
|
429
432
|
},
|
|
430
433
|
// swagger与本地columns合并完成后的钩子,允许父组件二次处理columns,一般用于不影响顺序的属性修改。区别于直接column中添加
|
|
431
|
-
|
|
434
|
+
onMerged: {
|
|
432
435
|
type: Function,
|
|
433
436
|
default: null,
|
|
434
437
|
},
|
|
@@ -446,6 +449,7 @@ export default {
|
|
|
446
449
|
twinPage: 1,
|
|
447
450
|
columnsWatcher: null,
|
|
448
451
|
key: 0,
|
|
452
|
+
showPrint: false,
|
|
449
453
|
};
|
|
450
454
|
},
|
|
451
455
|
computed: {
|
|
@@ -484,42 +488,6 @@ export default {
|
|
|
484
488
|
this.stopColumnsWatching();
|
|
485
489
|
},
|
|
486
490
|
methods: {
|
|
487
|
-
// init() {
|
|
488
|
-
// // 从 IndexedDB 中获取 Swagger 数据
|
|
489
|
-
// getData().then((swaggerData) => {
|
|
490
|
-
// const swaggerColumns = swaggerData.paths[this.url].get.responses["200"].content['application/json'].schema.properties.items.items.properties;
|
|
491
|
-
|
|
492
|
-
// Object.keys(swaggerColumns).forEach(key => {
|
|
493
|
-
// const item = swaggerColumns[key];
|
|
494
|
-
// let tempItem = this.tableData.columns.find((e) => e.prop == key);
|
|
495
|
-
// if (tempItem) {
|
|
496
|
-
// tempItem = { ...item, ...tempItem };
|
|
497
|
-
// } else if (item.description) {
|
|
498
|
-
// this.tableData.columns.push({
|
|
499
|
-
// prop: key,
|
|
500
|
-
// label: item.description,
|
|
501
|
-
// show: true,
|
|
502
|
-
// sortable: false,
|
|
503
|
-
// attrs: {}
|
|
504
|
-
// });
|
|
505
|
-
// }
|
|
506
|
-
// });
|
|
507
|
-
// console.log(`\x1b[36m\x1b[4mol插件-表格`, this.tableData.columns)
|
|
508
|
-
// }).catch((error) => {
|
|
509
|
-
// console.error("获取 Swagger 数据失败:", error);
|
|
510
|
-
// });
|
|
511
|
-
// },
|
|
512
|
-
// 支持多级表头 useSlotHeader: true,且支持排序,通过columns中的顺序实现
|
|
513
|
-
// columns: [
|
|
514
|
-
// {
|
|
515
|
-
// label: '一级表头',
|
|
516
|
-
// children: [{ prop: 'bindStateEnum', label: '112' }, { prop: 'tagNumber' }]
|
|
517
|
-
// },
|
|
518
|
-
// {
|
|
519
|
-
// prop: "remark",
|
|
520
|
-
// label: "备注123",
|
|
521
|
-
// },
|
|
522
|
-
// ],
|
|
523
491
|
init() {
|
|
524
492
|
// 从 IndexedDB 中获取 Swagger 数据
|
|
525
493
|
getData()
|
|
@@ -527,10 +495,10 @@ export default {
|
|
|
527
495
|
let swaggerColumns =
|
|
528
496
|
swaggerData.paths[this.url].get.responses["200"].content["application/json"].schema
|
|
529
497
|
.properties.items.items.properties;
|
|
530
|
-
if (typeof this.
|
|
498
|
+
if (typeof this.onSwagger === "function") {
|
|
531
499
|
try {
|
|
532
|
-
const res = await this.
|
|
533
|
-
swaggerColumns = res;
|
|
500
|
+
const res = await this.onSwagger({ columns: swaggerColumns });
|
|
501
|
+
if (res) swaggerColumns = res;
|
|
534
502
|
} catch (err) {}
|
|
535
503
|
}
|
|
536
504
|
// 递归映射函数
|
|
@@ -596,11 +564,14 @@ export default {
|
|
|
596
564
|
console.log(`\x1b[36m\x1b[4mol插件-表格`, this.tableData.columns);
|
|
597
565
|
|
|
598
566
|
// 合并完成后,暴露处理钩子
|
|
599
|
-
if (typeof this.
|
|
567
|
+
if (typeof this.onMerged === "function") {
|
|
600
568
|
try {
|
|
601
|
-
await this.
|
|
569
|
+
const res = await this.onMerged({
|
|
602
570
|
columns: this.tableData.columns,
|
|
603
571
|
});
|
|
572
|
+
if (Array.isArray(res)) {
|
|
573
|
+
this.tableData.columns = res;
|
|
574
|
+
}
|
|
604
575
|
} catch (e) {}
|
|
605
576
|
}
|
|
606
577
|
|
|
@@ -656,17 +627,18 @@ export default {
|
|
|
656
627
|
this.$emit("refreshTable");
|
|
657
628
|
},
|
|
658
629
|
printTable() {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
this.printListObj.
|
|
663
|
-
this.printListObj.
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
630
|
+
this.showPrint = true;
|
|
631
|
+
// console.log("printTable");
|
|
632
|
+
// if (this.tableData.rows.length <= 0) return;
|
|
633
|
+
// this.printListObj.title = this.$router.history.current.name;
|
|
634
|
+
// this.printListObj.tableHeader = this.tableData.columns;
|
|
635
|
+
// this.printListObj.tableData = this.tableData.rows;
|
|
636
|
+
// console.log(this.printListObj);
|
|
637
|
+
// setTimeout(() => {
|
|
638
|
+
// $(".printTemplate").show();
|
|
639
|
+
// $(".printTemplate").jqprint();
|
|
640
|
+
// $(".printTemplate").hide();
|
|
641
|
+
// }, 50);
|
|
670
642
|
this.$emit("printTable");
|
|
671
643
|
},
|
|
672
644
|
selectAll(val) {
|