ol-base-components 3.1.0 → 3.1.3

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.1.0",
3
+ "version": "3.1.3",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -1,13 +1,14 @@
1
1
  <template>
2
2
  <div id="app">
3
- <!-- <div>table组件案例</div> -->
4
- <!-- <ol-search
3
+ <div>table组件案例</div>
4
+ <ol-search
5
5
  :form-search-data="formSearchData"
6
6
  @handleSearch="handleSearch"
7
7
  @handleReset="handleReset"
8
8
  url="/api/app/admission-info/paged-result"
9
- /> -->
10
- <button @click="aaa">123</button>
9
+ />
10
+ <!-- url="/api/app/admission-info/paged-result" -->
11
+
11
12
  <ol-table
12
13
  :paginations="paginations"
13
14
  :empty-img="tableData.emptyImg"
@@ -23,7 +24,8 @@
23
24
  <el-button @click="onAdd">新建</el-button>
24
25
  <el-button @click="onEdit">编辑</el-button>
25
26
 
26
- <!-- <el-dialog :title="`${this.form.title}`" :visible.sync="dialogVisible" width="80%">
27
+ <!-- 编辑,查看弹窗 -->
28
+ <el-dialog :title="`${this.form.title}`" :visible.sync="dialogVisible" width="80%">
27
29
  <ol-form
28
30
  v-if="dialogVisible"
29
31
  url="/api/app/admission-info/admission-info"
@@ -31,8 +33,32 @@
31
33
  @onCancel="dialogVisible = false"
32
34
  @onSubmit="onSubmit"
33
35
  />
34
- </el-dialog> -->
35
- <!-- <ol-print /> -->
36
+ </el-dialog>
37
+
38
+ <!-- <el-button @click="handlePrint">接口</el-button>
39
+
40
+ <div
41
+ class="ellipsis-container"
42
+ id="ellipsis-container"
43
+ v-for="item in 5"
44
+ :key="item"
45
+ >如何处理文本溢出如何实现单行文本溢出显示省略号</div>
46
+
47
+ <div class="triangle-up"></div>
48
+ <div class="grid-content">
49
+ <div>11</div>
50
+ <div>11</div>
51
+ </div>
52
+
53
+ <div class="container">
54
+ <div class="item">1</div>
55
+ <div class="item item2">2</div>
56
+ <div class="item">3</div>
57
+ </div>
58
+
59
+ <div class="square-container">
60
+ <div class="square"></div>
61
+ </div> -->
36
62
  </div>
37
63
  </template>
38
64
 
@@ -501,275 +527,6 @@ export default {
501
527
  });
502
528
  }
503
529
  },
504
- aaa() {
505
- // const printEnpty = this.$hiprint({
506
- // printData: {
507
- // name: "CcSimple",
508
- // barcode: "33321323",
509
- // table: [
510
- // { id: "1", name: "王小可123", gender: "男", count: "120", amount: "9089元" },
511
- // { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
512
- // ],
513
- // table1: [
514
- // { id: "1", name: "王小可11", gender: "男", count: "120", amount: "9089元" },
515
- // { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
516
- // ],
517
- // },
518
- // onPrintData: data => {
519
- // return data;
520
- // },
521
- // onTemplate: data => {
522
- // return data;
523
- // },
524
- // defaultTemplate: {
525
- // panels: [
526
- // {
527
- // index: 0,
528
- // name: 1,
529
- // paperType: "A4",
530
- // height: 297,
531
- // width: 210,
532
- // paperHeader: 0,
533
- // paperFooter: 841.8897637795277,
534
- // printElements: [
535
- // {
536
- // options: {
537
- // left: 117,
538
- // top: 94.5,
539
- // height: 9.75,
540
- // width: 120,
541
- // field: "name",
542
- // testData: "内容",
543
- // title: "文本",
544
- // qid: "name",
545
- // },
546
- // printElementType: {
547
- // title: "文本",
548
- // type: "text",
549
- // },
550
- // },
551
- // {
552
- // options: {
553
- // left: 160.5,
554
- // top: 174,
555
- // height: 36,
556
- // width: 550,
557
- // fields: [],
558
- // field: "table",
559
- // qid: "table",
560
- // columns: [
561
- // [
562
- // {
563
- // width: 137.5,
564
- // title: "名称",
565
- // field: "name",
566
- // checked: true,
567
- // columnId: "name",
568
- // fixed: false,
569
- // rowspan: 1,
570
- // colspan: 1,
571
- // align: "center",
572
- // },
573
- // {
574
- // width: 137.5,
575
- // title: "性别",
576
- // field: "gender",
577
- // checked: true,
578
- // columnId: "gender",
579
- // fixed: false,
580
- // rowspan: 1,
581
- // colspan: 1,
582
- // align: "center",
583
- // },
584
- // {
585
- // width: 137.5,
586
- // title: "数量",
587
- // field: "count",
588
- // checked: true,
589
- // columnId: "count",
590
- // fixed: false,
591
- // rowspan: 1,
592
- // colspan: 1,
593
- // align: "center",
594
- // },
595
- // {
596
- // width: 137.5,
597
- // title: "金额",
598
- // field: "amount",
599
- // checked: true,
600
- // columnId: "amount",
601
- // fixed: false,
602
- // rowspan: 1,
603
- // colspan: 1,
604
- // align: "center",
605
- // },
606
- // ],
607
- // ],
608
- // },
609
- // printElementType: {
610
- // title: "表格",
611
- // type: "table",
612
- // editable: true,
613
- // columnDisplayEditable: true,
614
- // columnDisplayIndexEditable: true,
615
- // columnTitleEditable: true,
616
- // columnResizable: true,
617
- // columnAlignEditable: true,
618
- // isEnableEditField: true,
619
- // isEnableContextMenu: true,
620
- // isEnableInsertRow: true,
621
- // isEnableDeleteRow: true,
622
- // isEnableInsertColumn: true,
623
- // isEnableDeleteColumn: true,
624
- // isEnableMergeCell: true,
625
- // },
626
- // },
627
- // ],
628
- // paperNumberContinue: true,
629
- // watermarkOptions: {},
630
- // panelLayoutOptions: {},
631
- // },
632
- // ],
633
- // },
634
- // onSubmit: data => {
635
- // console.log(6666, data);
636
- // },
637
- // });
638
-
639
- this.$hiprint.print({
640
- printData: {
641
- name: "CcSimple",
642
- barcode: "33321323",
643
- table: [
644
- { id: "1", name: "王小可123", gender: "男", count: "120", amount: "9089元" },
645
- { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
646
- ],
647
- table1: [
648
- { id: "1", name: "王小可11", gender: "男", count: "120", amount: "9089元" },
649
- { id: "2", name: "梦之遥", gender: "女", count: "20", amount: "89元" },
650
- ],
651
- },
652
- onPrintData: data => {
653
- return data;
654
- },
655
- onTemplate: data => {
656
- return data;
657
- },
658
- defaultTemplate: {
659
- panels: [
660
- {
661
- index: 0,
662
- name: 1,
663
- paperType: "A4",
664
- height: 297,
665
- width: 210,
666
- paperHeader: 0,
667
- paperFooter: 841.8897637795277,
668
- printElements: [
669
- {
670
- options: {
671
- left: 117,
672
- top: 94.5,
673
- height: 9.75,
674
- width: 120,
675
- field: "name",
676
- testData: "内容",
677
- title: "文本",
678
- qid: "name",
679
- },
680
- printElementType: {
681
- title: "文本",
682
- type: "text",
683
- },
684
- },
685
- {
686
- options: {
687
- left: 160.5,
688
- top: 174,
689
- height: 36,
690
- width: 550,
691
- fields: [],
692
- field: "table",
693
- qid: "table",
694
- columns: [
695
- [
696
- {
697
- width: 137.5,
698
- title: "名称",
699
- field: "name",
700
- checked: true,
701
- columnId: "name",
702
- fixed: false,
703
- rowspan: 1,
704
- colspan: 1,
705
- align: "center",
706
- },
707
- {
708
- width: 137.5,
709
- title: "性别",
710
- field: "gender",
711
- checked: true,
712
- columnId: "gender",
713
- fixed: false,
714
- rowspan: 1,
715
- colspan: 1,
716
- align: "center",
717
- },
718
- {
719
- width: 137.5,
720
- title: "数量",
721
- field: "count",
722
- checked: true,
723
- columnId: "count",
724
- fixed: false,
725
- rowspan: 1,
726
- colspan: 1,
727
- align: "center",
728
- },
729
- {
730
- width: 137.5,
731
- title: "金额",
732
- field: "amount",
733
- checked: true,
734
- columnId: "amount",
735
- fixed: false,
736
- rowspan: 1,
737
- colspan: 1,
738
- align: "center",
739
- },
740
- ],
741
- ],
742
- },
743
- printElementType: {
744
- title: "表格",
745
- type: "table",
746
- editable: true,
747
- columnDisplayEditable: true,
748
- columnDisplayIndexEditable: true,
749
- columnTitleEditable: true,
750
- columnResizable: true,
751
- columnAlignEditable: true,
752
- isEnableEditField: true,
753
- isEnableContextMenu: true,
754
- isEnableInsertRow: true,
755
- isEnableDeleteRow: true,
756
- isEnableInsertColumn: true,
757
- isEnableDeleteColumn: true,
758
- isEnableMergeCell: true,
759
- },
760
- },
761
- ],
762
- paperNumberContinue: true,
763
- watermarkOptions: {},
764
- panelLayoutOptions: {},
765
- },
766
- ],
767
- },
768
- onSubmit: data => {
769
- console.log(6666, data);
770
- },
771
- });
772
- },
773
530
  },
774
531
  };
775
532
  </script>
package/src/main.js CHANGED
@@ -2,12 +2,13 @@ import Vue from "vue";
2
2
  import ElementUI from "element-ui";
3
3
  import "element-ui/lib/theme-chalk/index.css";
4
4
  import App from "./App.vue";
5
- import OlCom, { swaggerInstall, Hiprint } from "@/package/index.js";
5
+ import OlCom, { swaggerInstall } from "@/package/index.js";
6
6
  Vue.use(ElementUI);
7
- Vue.use(Hiprint);
8
7
 
9
8
  Vue.use(OlCom);
10
- swaggerInstall("http://220.179.249.140:20025/swagger/v1/swagger.json").then(() => {});
9
+ swaggerInstall("http://220.179.249.140:20019/swagger/v1/swagger.json").then(
10
+ () => {}
11
+ );
11
12
  new Vue({
12
- render: h => h(App),
13
+ render: (h) => h(App),
13
14
  }).$mount("#app");
@@ -12,7 +12,7 @@ let container = null;
12
12
  const Hiprint = {
13
13
  install(Vue) {
14
14
  const hiprint = function (options) {
15
- const { printData, onPrintData, defaultTemplate, onTemplate, onSubmit } = options;
15
+ const { printData, onPrintData, defaultTemplate, onTemplate, onSubmit, grid } = options;
16
16
  // 销毁旧实例
17
17
  if (printInstance) {
18
18
  printInstance.$destroy();
@@ -28,7 +28,9 @@ const Hiprint = {
28
28
  document.body.appendChild(container);
29
29
 
30
30
  const PrintComponent = Vue.extend(OlPrint);
31
- const propsData = {};
31
+ const propsData = {
32
+ grid,
33
+ };
32
34
  if (printData) {
33
35
  propsData.printData = printData;
34
36
  }
@@ -24,6 +24,7 @@
24
24
  :visible.sync="paperPopVisible"
25
25
  width="400px"
26
26
  :append-to-body="true"
27
+ :z-index="3001"
27
28
  >
28
29
  <el-form label-width="80px">
29
30
  <el-form-item label="纸张宽度">
@@ -161,6 +161,7 @@ export default {
161
161
  this.hiprintTemplate.design("#hiprint-printTemplate", {
162
162
  grid: this.grid,
163
163
  });
164
+ console.log(6666, this.hiprintTemplate);
164
165
  },
165
166
  async print() {
166
167
  // 使用外部传入的打印数据
@@ -213,12 +214,13 @@ export default {
213
214
  close() {
214
215
  this.$destroy();
215
216
  this.$el.remove();
217
+ this.$emit("close");
216
218
  },
217
219
  },
218
220
  };
219
221
  </script>
220
222
 
221
- <style>
223
+ <style scoped>
222
224
  /* flex */
223
225
  .flex-row {
224
226
  display: flex;
@@ -441,6 +443,16 @@ button i {
441
443
  border-radius: 4px;
442
444
  box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.15);
443
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
+ }
444
456
  </style>
445
457
  <style scoped>
446
458
  /* api按钮 */
@@ -566,7 +578,7 @@ button i {
566
578
  display: flex;
567
579
  align-items: center;
568
580
  justify-content: center;
569
- z-index: 2000;
581
+ z-index: 3000;
570
582
  }
571
583
 
572
584
  .print-dialog {
@@ -18,17 +18,16 @@
18
18
  >
19
19
  <!-- 表头插槽 -->
20
20
  <template v-slot:header>
21
- <el-tooltip
22
- v-if="column.prop"
23
- :content="`${column.label} ${column.prop} ${column.show}`"
24
- placement="top"
25
- >
21
+ <el-tooltip v-if="column.prop" :content="`${column.label} ${column.prop}`" placement="top">
26
22
  <span>{{ column.label }}</span>
27
23
  </el-tooltip>
28
24
  <!-- 多级表头无prop无需提示 -->
29
25
  <span v-else>{{ column.label }}</span>
30
26
  </template>
31
27
 
28
+ <template v-for="(index, name) in $scopedSlots" v-slot:[name]="data">
29
+ <slot :name="name" v-bind="data"></slot>
30
+ </template>
32
31
  <!-- 递归渲染子列 -->
33
32
  <template v-if="column.children && column.children.length">
34
33
  <TableColumn v-for="(child, idx) in column.children" :key="idx" :column="child">
@@ -38,43 +37,41 @@
38
37
  </template>
39
38
  </TableColumn>
40
39
  </template>
41
- <!-- 内容插槽:自定义渲染 -->
42
- <template v-else-if="column.render" v-slot="scope">
43
- <render-dom :render="() => column.render(scope.row)" />
44
- </template>
45
- <template v-else-if="column.renderSlot" v-slot="scope">
46
- <slot :row="scope.row" :name="column.prop" />
40
+ <template v-slot="scope" v-if="!column.children">
41
+ <render-dom v-if="column.render" :render="() => column.render(scope.row)" />
42
+ <slot v-else-if="column.renderSlot" :row="scope.row" :name="column.prop" />
43
+ <span v-else>{{ scope.row[column.prop] }}</span>
47
44
  </template>
48
45
  </el-table-column>
49
46
  </template>
50
47
  <script>
51
- export default {
52
- name: "TableColumn",
53
- components: {
54
- renderDom: {
55
- functional: true,
56
- props: { render: Function },
57
- render(h, ctx) {
58
- return <div>{ctx.props.render()}</div>;
59
- },
48
+ export default {
49
+ name: "TableColumn",
50
+ components: {
51
+ renderDom: {
52
+ functional: true,
53
+ props: { render: Function },
54
+ render(h, ctx) {
55
+ return <div>{ctx.props.render()}</div>;
60
56
  },
61
- TableColumn: null, // 递归自身,见下方
62
- },
63
- props: {
64
- column: { type: Object, required: true },
65
57
  },
66
- data() {
67
- return {};
68
- },
69
- // beforeCreate() {
70
- // // 递归注册自身
71
- // this.$options.components.TableColumn = require("./TableColumn.vue").default;
72
- // },
73
- computed: {
74
- shouldShow() {
75
- if (this.column.hasOwnProperty("show")) return this.column.show;
76
- return true;
77
- },
58
+ TableColumn: null, // 递归自身,见下方
59
+ },
60
+ props: {
61
+ column: { type: Object, required: true },
62
+ },
63
+ data() {
64
+ return {};
65
+ },
66
+ // beforeCreate() {
67
+ // // 递归注册自身
68
+ // this.$options.components.TableColumn = require("./TableColumn.vue").default;
69
+ // },
70
+ computed: {
71
+ shouldShow() {
72
+ if (this.column.hasOwnProperty("show")) return this.column.show;
73
+ return true;
78
74
  },
79
- };
75
+ },
76
+ };
80
77
  </script>
@@ -242,9 +242,6 @@
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>
248
245
  </div>
249
246
  </template>
250
247
  <script>
@@ -449,7 +446,6 @@ export default {
449
446
  twinPage: 1,
450
447
  columnsWatcher: null,
451
448
  key: 0,
452
- showPrint: false,
453
449
  };
454
450
  },
455
451
  computed: {
@@ -627,18 +623,17 @@ export default {
627
623
  this.$emit("refreshTable");
628
624
  },
629
625
  printTable() {
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);
626
+ console.log("printTable");
627
+ if (this.tableData.rows.length <= 0) return;
628
+ this.printListObj.title = this.$router.history.current.name;
629
+ this.printListObj.tableHeader = this.tableData.columns;
630
+ this.printListObj.tableData = this.tableData.rows;
631
+ console.log(this.printListObj);
632
+ setTimeout(() => {
633
+ $(".printTemplate").show();
634
+ $(".printTemplate").jqprint();
635
+ $(".printTemplate").hide();
636
+ }, 50);
642
637
  this.$emit("printTable");
643
638
  },
644
639
  selectAll(val) {
@@ -1,110 +0,0 @@
1
- {
2
- "panels": [
3
- {
4
- "index": 0,
5
- "name": 1,
6
- "paperType": "A4",
7
- "height": 297,
8
- "width": 210,
9
- "paperHeader": 0,
10
- "paperFooter": 841.8897637795277,
11
- "printElements": [
12
- {
13
- "options": {
14
- "left": 117,
15
- "top": 94.5,
16
- "height": 9.75,
17
- "width": 120,
18
- "field": "name",
19
- "testData": "内容",
20
- "title": "文本",
21
- "qid": "name"
22
- },
23
- "printElementType": {
24
- "title": "文本",
25
- "type": "text"
26
- }
27
- },
28
- {
29
- "options": {
30
- "left": 160.5,
31
- "top": 174,
32
- "height": 36,
33
- "width": 550,
34
- "fields": [],
35
- "field": "table",
36
- "qid": "table",
37
- "columns": [
38
- [
39
- {
40
- "width": 137.5,
41
- "title": "名称",
42
- "field": "name",
43
- "checked": true,
44
- "columnId": "name",
45
- "fixed": false,
46
- "rowspan": 1,
47
- "colspan": 1,
48
- "align": "center"
49
- },
50
- {
51
- "width": 137.5,
52
- "title": "性别",
53
- "field": "gender",
54
- "checked": true,
55
- "columnId": "gender",
56
- "fixed": false,
57
- "rowspan": 1,
58
- "colspan": 1,
59
- "align": "center"
60
- },
61
- {
62
- "width": 137.5,
63
- "title": "数量",
64
- "field": "count",
65
- "checked": true,
66
- "columnId": "count",
67
- "fixed": false,
68
- "rowspan": 1,
69
- "colspan": 1,
70
- "align": "center"
71
- },
72
- {
73
- "width": 137.5,
74
- "title": "金额",
75
- "field": "amount",
76
- "checked": true,
77
- "columnId": "amount",
78
- "fixed": false,
79
- "rowspan": 1,
80
- "colspan": 1,
81
- "align": "center"
82
- }
83
- ]
84
- ]
85
- },
86
- "printElementType": {
87
- "title": "表格",
88
- "type": "table",
89
- "editable": true,
90
- "columnDisplayEditable": true,
91
- "columnDisplayIndexEditable": true,
92
- "columnTitleEditable": true,
93
- "columnResizable": true,
94
- "columnAlignEditable": true,
95
- "isEnableEditField": true,
96
- "isEnableContextMenu": true,
97
- "isEnableInsertRow": true,
98
- "isEnableDeleteRow": true,
99
- "isEnableInsertColumn": true,
100
- "isEnableDeleteColumn": true,
101
- "isEnableMergeCell": true
102
- }
103
- }
104
- ],
105
- "paperNumberContinue": true,
106
- "watermarkOptions": {},
107
- "panelLayoutOptions": {}
108
- }
109
- ]
110
- }