ol-base-components 3.0.0 → 3.1.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "3.0.0",
3
+ "version": "3.1.2",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -502,12 +502,13 @@ export default {
502
502
  }
503
503
  },
504
504
  aaa() {
505
- this.$hiprint(
506
- {
505
+ const printEnpty = this.$hiprint({
506
+ grid: true,
507
+ printData: {
507
508
  name: "CcSimple",
508
509
  barcode: "33321323",
509
510
  table: [
510
- { id: "1", name: "王小可", gender: "男", count: "120", amount: "9089元" },
511
+ { id: "1", name: "王小可123", gender: "男", count: "120", amount: "9089元" },
511
512
  { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
512
513
  ],
513
514
  table1: [
@@ -515,10 +516,260 @@ export default {
515
516
  { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
516
517
  ],
517
518
  },
518
- () => {
519
- console.log(123);
520
- }
521
- );
519
+ onPrintData: data => {
520
+ return data;
521
+ },
522
+ onTemplate: data => {
523
+ return data;
524
+ },
525
+ defaultTemplate: {
526
+ panels: [
527
+ {
528
+ index: 0,
529
+ name: 1,
530
+ paperType: "A4",
531
+ height: 297,
532
+ width: 210,
533
+ paperHeader: 0,
534
+ paperFooter: 841.8897637795277,
535
+ printElements: [
536
+ {
537
+ options: {
538
+ left: 117,
539
+ top: 94.5,
540
+ height: 9.75,
541
+ width: 120,
542
+ field: "name",
543
+ testData: "内容",
544
+ title: "文本",
545
+ qid: "name",
546
+ },
547
+ printElementType: {
548
+ title: "文本",
549
+ type: "text",
550
+ },
551
+ },
552
+ {
553
+ options: {
554
+ left: 160.5,
555
+ top: 174,
556
+ height: 36,
557
+ width: 550,
558
+ fields: [],
559
+ field: "table",
560
+ qid: "table",
561
+ columns: [
562
+ [
563
+ {
564
+ width: 137.5,
565
+ title: "名称",
566
+ field: "name",
567
+ checked: true,
568
+ columnId: "name",
569
+ fixed: false,
570
+ rowspan: 1,
571
+ colspan: 1,
572
+ align: "center",
573
+ },
574
+ {
575
+ width: 137.5,
576
+ title: "性别",
577
+ field: "gender",
578
+ checked: true,
579
+ columnId: "gender",
580
+ fixed: false,
581
+ rowspan: 1,
582
+ colspan: 1,
583
+ align: "center",
584
+ },
585
+ {
586
+ width: 137.5,
587
+ title: "数量",
588
+ field: "count",
589
+ checked: true,
590
+ columnId: "count",
591
+ fixed: false,
592
+ rowspan: 1,
593
+ colspan: 1,
594
+ align: "center",
595
+ },
596
+ {
597
+ width: 137.5,
598
+ title: "金额",
599
+ field: "amount",
600
+ checked: true,
601
+ columnId: "amount",
602
+ fixed: false,
603
+ rowspan: 1,
604
+ colspan: 1,
605
+ align: "center",
606
+ },
607
+ ],
608
+ ],
609
+ },
610
+ printElementType: {
611
+ title: "表格",
612
+ type: "table",
613
+ editable: true,
614
+ columnDisplayEditable: true,
615
+ columnDisplayIndexEditable: true,
616
+ columnTitleEditable: true,
617
+ columnResizable: true,
618
+ columnAlignEditable: true,
619
+ isEnableEditField: true,
620
+ isEnableContextMenu: true,
621
+ isEnableInsertRow: true,
622
+ isEnableDeleteRow: true,
623
+ isEnableInsertColumn: true,
624
+ isEnableDeleteColumn: true,
625
+ isEnableMergeCell: true,
626
+ },
627
+ },
628
+ ],
629
+ paperNumberContinue: true,
630
+ watermarkOptions: {},
631
+ panelLayoutOptions: {},
632
+ },
633
+ ],
634
+ },
635
+ onSubmit: data => {
636
+ console.log(6666, data);
637
+ },
638
+ });
639
+
640
+ // this.$hiprint.print({
641
+ // printData: {
642
+ // name: "CcSimple",
643
+ // barcode: "33321323",
644
+ // table: [
645
+ // { id: "1", name: "王小可123", gender: "男", count: "120", amount: "9089元" },
646
+ // { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
647
+ // ],
648
+ // table1: [
649
+ // { id: "1", name: "王小可11", gender: "男", count: "120", amount: "9089元" },
650
+ // { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
651
+ // ],
652
+ // },
653
+ // onPrintData: data => {
654
+ // return data;
655
+ // },
656
+ // onTemplate: data => {
657
+ // return data;
658
+ // },
659
+ // defaultTemplate: {
660
+ // panels: [
661
+ // {
662
+ // index: 0,
663
+ // name: 1,
664
+ // paperType: "A4",
665
+ // height: 297,
666
+ // width: 210,
667
+ // paperHeader: 0,
668
+ // paperFooter: 841.8897637795277,
669
+ // printElements: [
670
+ // {
671
+ // options: {
672
+ // left: 117,
673
+ // top: 94.5,
674
+ // height: 9.75,
675
+ // width: 120,
676
+ // field: "name",
677
+ // testData: "内容",
678
+ // title: "文本",
679
+ // qid: "name",
680
+ // },
681
+ // printElementType: {
682
+ // title: "文本",
683
+ // type: "text",
684
+ // },
685
+ // },
686
+ // {
687
+ // options: {
688
+ // left: 160.5,
689
+ // top: 174,
690
+ // height: 36,
691
+ // width: 550,
692
+ // fields: [],
693
+ // field: "table",
694
+ // qid: "table",
695
+ // columns: [
696
+ // [
697
+ // {
698
+ // width: 137.5,
699
+ // title: "名称",
700
+ // field: "name",
701
+ // checked: true,
702
+ // columnId: "name",
703
+ // fixed: false,
704
+ // rowspan: 1,
705
+ // colspan: 1,
706
+ // align: "center",
707
+ // },
708
+ // {
709
+ // width: 137.5,
710
+ // title: "性别",
711
+ // field: "gender",
712
+ // checked: true,
713
+ // columnId: "gender",
714
+ // fixed: false,
715
+ // rowspan: 1,
716
+ // colspan: 1,
717
+ // align: "center",
718
+ // },
719
+ // {
720
+ // width: 137.5,
721
+ // title: "数量",
722
+ // field: "count",
723
+ // checked: true,
724
+ // columnId: "count",
725
+ // fixed: false,
726
+ // rowspan: 1,
727
+ // colspan: 1,
728
+ // align: "center",
729
+ // },
730
+ // {
731
+ // width: 137.5,
732
+ // title: "金额",
733
+ // field: "amount",
734
+ // checked: true,
735
+ // columnId: "amount",
736
+ // fixed: false,
737
+ // rowspan: 1,
738
+ // colspan: 1,
739
+ // align: "center",
740
+ // },
741
+ // ],
742
+ // ],
743
+ // },
744
+ // printElementType: {
745
+ // title: "表格",
746
+ // type: "table",
747
+ // editable: true,
748
+ // columnDisplayEditable: true,
749
+ // columnDisplayIndexEditable: true,
750
+ // columnTitleEditable: true,
751
+ // columnResizable: true,
752
+ // columnAlignEditable: true,
753
+ // isEnableEditField: true,
754
+ // isEnableContextMenu: true,
755
+ // isEnableInsertRow: true,
756
+ // isEnableDeleteRow: true,
757
+ // isEnableInsertColumn: true,
758
+ // isEnableDeleteColumn: true,
759
+ // isEnableMergeCell: true,
760
+ // },
761
+ // },
762
+ // ],
763
+ // paperNumberContinue: true,
764
+ // watermarkOptions: {},
765
+ // panelLayoutOptions: {},
766
+ // },
767
+ // ],
768
+ // },
769
+ // onSubmit: data => {
770
+ // console.log(6666, data);
771
+ // },
772
+ // });
522
773
  },
523
774
  },
524
775
  };
@@ -11,7 +11,8 @@ let container = null;
11
11
 
12
12
  const Hiprint = {
13
13
  install(Vue) {
14
- Vue.prototype.$hiprint = function (data, template) {
14
+ const hiprint = function (options) {
15
+ const { printData, onPrintData, defaultTemplate, onTemplate, onSubmit, grid } = options;
15
16
  // 销毁旧实例
16
17
  if (printInstance) {
17
18
  printInstance.$destroy();
@@ -27,26 +28,49 @@ const Hiprint = {
27
28
  document.body.appendChild(container);
28
29
 
29
30
  const PrintComponent = Vue.extend(OlPrint);
31
+ const propsData = {
32
+ grid,
33
+ };
34
+ if (printData) {
35
+ propsData.printData = printData;
36
+ }
37
+ if (onPrintData) {
38
+ propsData.onPrintData = onPrintData;
39
+ }
40
+
41
+ if (onTemplate) {
42
+ propsData.onTemplate = onTemplate;
43
+ }
44
+
45
+ if (defaultTemplate) {
46
+ propsData.defaultTemplate = defaultTemplate;
47
+ }
48
+
30
49
  printInstance = new PrintComponent({
31
- propsData: {
32
- printData: data || {},
33
- onTemplate: template,
34
- },
50
+ propsData,
35
51
  });
36
52
 
53
+ // 监听 submit 事件
54
+ if (onSubmit && typeof onSubmit === "function") {
55
+ printInstance.$on("submit", json => {
56
+ onSubmit(json);
57
+ });
58
+ }
59
+
37
60
  printInstance.$mount(container);
61
+
62
+ // 返回实例,方便外部调用
63
+ return printInstance;
38
64
  };
65
+ Vue.prototype.$hiprint = hiprint;
39
66
 
40
- // 提供销毁方法(可选)
41
- Vue.prototype.$hiprint.destroy = function () {
42
- if (printInstance) {
43
- printInstance.$destroy();
44
- if (container && container.parentNode) {
45
- container.parentNode.removeChild(container);
46
- }
47
- printInstance = null;
48
- container = null;
49
- }
67
+ // 快捷方法:直接打印
68
+ Vue.prototype.$hiprint.print = function (options) {
69
+ const instance = hiprint(options);
70
+ instance.print();
71
+ instance.$nextTick(() => {
72
+ instance.close();
73
+ });
50
74
  };
51
75
  },
52
76
  };
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <div class="paper-selector">
3
+ <el-button-group>
4
+ <el-button
5
+ v-for="(value, type) in paperTypes"
6
+ :key="type"
7
+ :type="curPaperType === type ? 'primary' : 'default'"
8
+ size="small"
9
+ @click="setPaper(type, value)"
10
+ >
11
+ {{ type }}
12
+ </el-button>
13
+ <el-button
14
+ :type="curPaperType === 'other' ? 'primary' : 'default'"
15
+ size="small"
16
+ @click="showPaperPop"
17
+ >
18
+ 自定义纸张
19
+ </el-button>
20
+ </el-button-group>
21
+
22
+ <el-dialog
23
+ title="设置纸张宽高(mm)"
24
+ :visible.sync="paperPopVisible"
25
+ width="400px"
26
+ :append-to-body="true"
27
+ :z-index="3001"
28
+ >
29
+ <el-form label-width="80px">
30
+ <el-form-item label="纸张宽度">
31
+ <el-input v-model="paperWidth" type="number" placeholder="宽(mm)" />
32
+ </el-form-item>
33
+ <el-form-item label="纸张高度">
34
+ <el-input v-model="paperHeight" type="number" placeholder="高(mm)" />
35
+ </el-form-item>
36
+ </el-form>
37
+ <span slot="footer">
38
+ <el-button @click="hidePaperPop">取消</el-button>
39
+ <el-button type="primary" @click="setPaperOther">确定</el-button>
40
+ </span>
41
+ </el-dialog>
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ export default {
47
+ name: "PaperSelector",
48
+ props: {
49
+ hiprintTemplate: {
50
+ type: Object,
51
+ required: true,
52
+ },
53
+ },
54
+ data() {
55
+ return {
56
+ curPaper: {
57
+ type: "A4",
58
+ width: 210,
59
+ height: 296.6,
60
+ },
61
+ paperTypes: {
62
+ A3: { width: 420, height: 296.6 },
63
+ A4: { width: 210, height: 296.6 },
64
+ A5: { width: 210, height: 147.6 },
65
+ B3: { width: 500, height: 352.6 },
66
+ B4: { width: 250, height: 352.6 },
67
+ B5: { width: 250, height: 175.6 },
68
+ },
69
+ paperPopVisible: false,
70
+ paperWidth: "220",
71
+ paperHeight: "80",
72
+ };
73
+ },
74
+ computed: {
75
+ curPaperType() {
76
+ let type = "other";
77
+ let types = this.paperTypes;
78
+ for (const key in types) {
79
+ let item = types[key];
80
+ let { width, height } = this.curPaper;
81
+ if (item.width === width && item.height === height) {
82
+ type = key;
83
+ }
84
+ }
85
+ return type;
86
+ },
87
+ },
88
+ methods: {
89
+ showPaperPop() {
90
+ this.paperPopVisible = true;
91
+ },
92
+ hidePaperPop() {
93
+ this.paperPopVisible = false;
94
+ },
95
+ setPaper(type, value) {
96
+ try {
97
+ if (Object.keys(this.paperTypes).includes(type)) {
98
+ this.curPaper = { type: type, width: value.width, height: value.height };
99
+ this.hiprintTemplate.setPaper(value.width, value.height);
100
+ } else {
101
+ this.curPaper = { type: "other", width: value.width, height: value.height };
102
+ this.hiprintTemplate.setPaper(value.width, value.height);
103
+ }
104
+ this.$emit("change", this.curPaper);
105
+ } catch (error) {
106
+ this.$message.error(`操作失败: ${error}`);
107
+ }
108
+ },
109
+ setPaperOther() {
110
+ let value = {};
111
+ value.width = Number(this.paperWidth);
112
+ value.height = Number(this.paperHeight);
113
+ this.paperPopVisible = false;
114
+ this.setPaper("other", value);
115
+ },
116
+ },
117
+ };
118
+ </script>
119
+
120
+ <style scoped>
121
+ .paper-selector {
122
+ display: inline-block;
123
+ }
124
+ </style>
@@ -14,21 +14,31 @@
14
14
  <i class="iconfont close-btn" @click="close">x</i>
15
15
  </div>
16
16
  <div class="print-dialog-body">
17
- <div class="flex-row justify-center" style="margin-bottom: 10px">
18
- <button class="secondary circle-10 button-item" @click.stop="print">
19
- <i class="iconfont sv-printer" />
20
- 浏览器打印
21
- </button>
22
- <button class="api circle-10 ml-10" @click.stop="clearPaper">
23
- <i class="iconfont sv-clear" />
24
- 清空纸张
25
- </button>
26
- <button class="api circle-10 ml-10 button-item" @click.stop="exportJson">
27
- <i class="iconfont sv-export" />
28
- 导出模板 json
29
- </button>
17
+ <div class="header-box" style="margin-bottom: 10px">
18
+ <paper-selector :hiprint-template="hiprintTemplate" ref="paperSelector" />
19
+ <div>
20
+ <slot
21
+ :hiprint-template="hiprintTemplate"
22
+ :print="print"
23
+ :clear-paper="clearPaper"
24
+ :export-json="exportJson"
25
+ >
26
+ </slot>
27
+ <el-button type="primary" size="small" @click="print">
28
+ <i class="iconfont sv-printer" />
29
+ 浏览器预览
30
+ </el-button>
31
+ <el-button type="danger" size="small" @click="clearPaper" style="margin-left: 10px">
32
+ <i class="iconfont sv-clear" />
33
+ 清空纸张
34
+ </el-button>
35
+ <el-button type="success" size="small" @click="exportJson" style="margin-left: 10px">
36
+ <i class="iconfont sv-export" />
37
+ 保存
38
+ </el-button>
39
+ </div>
30
40
  </div>
31
- <div class="flex-row" style="height: 87vh">
41
+ <div class="main flex-row" style="height: 87vh">
32
42
  <div class="flex-2 left flex-col">
33
43
  <!-- provider1 的容器; 加上 class "rect-printElement-types" 使用默认样式 -->
34
44
  <!-- 当然可以 重写 或者 自定义样式 -->
@@ -52,39 +62,56 @@
52
62
  // import { onMounted } from "vue";
53
63
  import { hiprint } from "vue-plugin-hiprint";
54
64
  import { provider1 } from "./provide/provider1.js";
65
+ import PaperSelector from "./components/PaperSelector.vue";
66
+
55
67
  export default {
56
68
  name: "print",
69
+ components: {
70
+ PaperSelector,
71
+ },
57
72
  props: {
58
73
  // 打印数据
59
74
  printData: {
60
75
  type: Object,
61
- default: () => ({
62
- name: "CcSimple",
63
- barcode: "33321323",
64
- table: [
65
- { id: "1", name: "王小可", gender: "男", count: "120", amount: "9089元" },
66
- { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
67
- ],
68
- table1: [
69
- { id: "1", name: "王小可11", gender: "男", count: "120", amount: "9089元" },
70
- { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
71
- ],
72
- }),
76
+ default: () => {},
73
77
  },
74
- // 模板加载前回调函数
75
- onTemplate: {
78
+ // {
79
+ // name: "CcSimple",
80
+ // barcode: "33321323",
81
+ // table: [
82
+ // { id: "1", name: "王小可", gender: "男", count: "120", amount: "9089元" },
83
+ // { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
84
+ // ],
85
+ // table1: [
86
+ // { id: "1", name: "王小可11", gender: "男", count: "120", amount: "9089元" },
87
+ // { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
88
+ // ],
89
+ // }
90
+ onPrintData: {
76
91
  type: Function,
92
+ default: null,
93
+ },
94
+ // {panels:[]}
95
+ defaultTemplate: {
96
+ type: Object,
77
97
  default: () => {},
78
98
  },
99
+ // 模板数据前置钩子
100
+ onTemplate: {
101
+ type: Function,
102
+ default: null,
103
+ },
104
+ grid: {
105
+ type: Boolean,
106
+ default: false,
107
+ },
79
108
  },
80
109
  data() {
81
110
  return {
82
- hiprintTemplate: null,
111
+ hiprintTemplate: {},
83
112
  };
84
113
  },
85
114
  created() {
86
- console.log("初始化打印弹框");
87
-
88
115
  hiprint.init({
89
116
  // providers: [defaultElementTypeProvider()],
90
117
  providers: [provider1()],
@@ -102,52 +129,64 @@ export default {
102
129
  // eslint-disable-next-line no-undef
103
130
  // hiprint.PrintElementTypeManager.buildByHtml($(".ep-draggable-item"));
104
131
  },
105
- buildDesigner() {
132
+ async buildDesigner() {
106
133
  // eslint-disable-next-line no-undef
107
134
  $("#hiprint-printTemplate").empty(); // 先清空, 避免重复构建
108
- // 判断用户是否传了onTemplate
109
- if (this.onTemplate) {
110
- console.log(123123);
111
135
 
112
- // this.onTemplate(this.hiprintTemplate);
136
+ let template = this.defaultTemplate;
137
+ if (this.onTemplate) {
138
+ try {
139
+ const result = await this.onTemplate(this.defaultTemplate);
140
+ if (result) {
141
+ template = result;
142
+ }
143
+ } catch (error) {
144
+ console.error("onTemplate 执行失败:", error);
145
+ }
113
146
  }
147
+
114
148
  this.hiprintTemplate = new hiprint.PrintTemplate({
149
+ template,
115
150
  settingContainer: "#PrintElementOptionSetting", // 元素参数容器
116
151
  // paginationContainer: ".hiprint-printPagination", //多页打印
117
152
  history: true,
118
153
  onDataChanged: (type, json) => {
119
- // 模板发生改变回调
120
154
  console.log(type); // 新增、移动、删除、修改(参数调整)、大小、旋转
121
155
  console.log(json); // 返回 template
122
156
  },
123
- // fontList: [
124
- // { title: "微软雅黑", value: "Microsoft YaHei" },
125
- // { title: "黑体", value: "STHeitiSC-Light" },
126
- // { title: "思源黑体", value: "SourceHanSansCN-Normal" },
127
- // { title: "王羲之书法体", value: "王羲之书法体" },
128
- // { title: "宋体", value: "SimSun" },
129
- // { title: "华为楷体", value: "STKaiti" },
130
- // { title: "cursive", value: "cursive" },
131
- // ],
132
157
  });
158
+ this.$refs.paperSelector.curPaper = { width: 210, height: 296.6 };
133
159
  // 构建 并填充到 容器中
134
160
  // 可以先 console.log($("#hiprint-printTemplate")) 看看是否有该 dom
135
- this.hiprintTemplate.design("#hiprint-printTemplate");
161
+ this.hiprintTemplate.design("#hiprint-printTemplate", {
162
+ grid: this.grid,
163
+ });
164
+ console.log(6666, this.hiprintTemplate);
136
165
  },
137
- print() {
166
+ async print() {
138
167
  // 使用外部传入的打印数据
139
168
  let data = this.printData;
169
+ if (this.onPrintData) {
170
+ try {
171
+ const result = await this.onPrintData(this.printData);
172
+ if (result) {
173
+ data = result;
174
+ }
175
+ } catch (error) {
176
+ console.error("onPrintData 执行失败:", error);
177
+ }
178
+ }
140
179
  // 参数: 打印时设置 左偏移量,上偏移量
141
180
  let options = { leftOffset: -1, topOffset: -1 };
142
181
  // 扩展
143
182
  let ext = {
144
- callback: () => {
145
- console.log("浏览器打印窗口已打开");
146
- },
147
- styleHandler: () => {
148
- // 重写 文本 打印样式
149
- return "<style>.hiprint-printElement-text{color:red !important;}</style>";
150
- },
183
+ // callback: () => {
184
+ // console.log("浏览器打印窗口已打开");
185
+ // },
186
+ // styleHandler: () => {
187
+ // // 重写 文本 打印样式
188
+ // return "<style>.hiprint-printElement-text{color:red !important;}</style>";
189
+ // },
151
190
  };
152
191
  // 调用浏览器打印
153
192
  this.hiprintTemplate.print(data, options, ext);
@@ -156,15 +195,18 @@ export default {
156
195
  const json = this.hiprintTemplate.getJson();
157
196
  const dataStr = JSON.stringify(json, null, 2);
158
197
  const blob = new Blob([dataStr], { type: "application/json" });
159
- const url = URL.createObjectURL(blob);
160
- const link = document.createElement("a");
161
- link.href = url;
162
- link.download = `print-template-${Date.now()}.json`;
163
- document.body.appendChild(link);
164
- link.click();
165
- document.body.removeChild(link);
166
- URL.revokeObjectURL(url);
167
- alert("导出成功!");
198
+ console.log("保存", JSON.parse(dataStr));
199
+ this.$emit("submit", JSON.parse(dataStr));
200
+ this.close();
201
+ // const url = URL.createObjectURL(blob);
202
+ // const link = document.createElement("a");
203
+ // link.href = url;
204
+ // link.download = `print-template-${Date.now()}.json`;
205
+ // document.body.appendChild(link);
206
+ // link.click();
207
+ // document.body.removeChild(link);
208
+ // URL.revokeObjectURL(url);
209
+ // alert("导出成功!");
168
210
  },
169
211
  clearPaper() {
170
212
  this.hiprintTemplate.clear();
@@ -172,12 +214,13 @@ export default {
172
214
  close() {
173
215
  this.$destroy();
174
216
  this.$el.remove();
217
+ this.$emit("close");
175
218
  },
176
219
  },
177
220
  };
178
221
  </script>
179
222
 
180
- <style>
223
+ <style scoped>
181
224
  /* flex */
182
225
  .flex-row {
183
226
  display: flex;
@@ -400,6 +443,16 @@ button i {
400
443
  border-radius: 4px;
401
444
  box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.15);
402
445
  }
446
+ /* 隐藏 hiprint 打印 iframe,避免影响页面布局 */
447
+ #hiwprint_iframe {
448
+ position: fixed !important;
449
+ top: -9999px !important;
450
+ left: -9999px !important;
451
+ width: 0 !important;
452
+ height: 0 !important;
453
+ visibility: hidden !important;
454
+ opacity: 0 !important;
455
+ }
403
456
  </style>
404
457
  <style scoped>
405
458
  /* api按钮 */
@@ -525,7 +578,7 @@ button i {
525
578
  display: flex;
526
579
  align-items: center;
527
580
  justify-content: center;
528
- z-index: 9999;
581
+ z-index: 3000;
529
582
  }
530
583
 
531
584
  .print-dialog {
@@ -563,6 +616,12 @@ button i {
563
616
  flex: 1;
564
617
  overflow: hidden;
565
618
  padding: 10px;
619
+ display: flex;
620
+ flex-direction: column;
621
+ }
622
+ .print-dialog-body .main {
623
+ flex: 1;
624
+ overflow: hidden;
566
625
  }
567
626
  </style>
568
627
 
@@ -570,4 +629,9 @@ button i {
570
629
  .button-item {
571
630
  height: 40px;
572
631
  }
632
+ .header-box {
633
+ display: flex;
634
+ align-items: center;
635
+ justify-content: space-between;
636
+ }
573
637
  </style>
@@ -242,8 +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" />
245
+ <el-dialog title="打印" :visible.sync="showPrint">
246
+ <div>123</div>
247
+ <!-- <ol-print v-if="showPrint" /> -->
247
248
  </el-dialog>
248
249
  </div>
249
250
  </template>
@@ -435,6 +436,10 @@ export default {
435
436
  type: Function,
436
437
  default: null,
437
438
  },
439
+ printUrl: {
440
+ type: String,
441
+ default: "",
442
+ },
438
443
  },
439
444
 
440
445
  data() {
@@ -627,6 +632,8 @@ export default {
627
632
  this.$emit("refreshTable");
628
633
  },
629
634
  printTable() {
635
+ // 获取当前带单路由
636
+ const url = this.printUrl;
630
637
  this.showPrint = true;
631
638
  // console.log("printTable");
632
639
  // if (this.tableData.rows.length <= 0) return;