ol-base-components 3.3.9 → 3.3.11

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.3.9",
3
+ "version": "3.3.11",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -30,6 +30,9 @@
30
30
  <template slot="ceshi" slot-scope="scope">
31
31
  <span>333433{{ scope.row.ceshi }}</span>
32
32
  </template>
33
+ <template slot="toolbox-before" slot-scope="scope">
34
+ <el-button type="primary" size="mini" @click="handlePrint1(scope)">打印</el-button>
35
+ </template>
33
36
  </ol-table>
34
37
  <!-- <el-button @click="handlePrint">接口</el-button>
35
38
  <el-button @click="onAdd">新建</el-button>
@@ -142,25 +145,25 @@ export default {
142
145
  // range: [10, 200],
143
146
  },
144
147
  tableSearch1: [
145
- // {
146
- // label: "数字区间",
147
- // value: "range",
148
- // inputType: "numberRange",
149
- // originalFields: {
150
- // begin: "begin123",
151
- // end: "end123",
152
- // },
153
- // listeners: {
154
- // change: e => {
155
- // const {
156
- // val: [start, end],
157
- // } = e;
158
- // this.formSearchData.value.rang1 = start;
159
- // this.formSearchData.value.rang2 = end;
160
- // console.log(this.formSearchData, e);
161
- // },
162
- // },
163
- // },
148
+ {
149
+ label: "数字区间",
150
+ value: "range",
151
+ inputType: "numberRange",
152
+ originalFields: {
153
+ begin: "begin123",
154
+ end: "end123",
155
+ },
156
+ listeners: {
157
+ change: e => {
158
+ const {
159
+ val: [start, end],
160
+ } = e;
161
+ this.formSearchData.value.rang1 = start;
162
+ this.formSearchData.value.rang2 = end;
163
+ console.log(this.formSearchData, e);
164
+ },
165
+ },
166
+ },
164
167
  // {
165
168
  // label: "标签号",
166
169
  // value: "carBodyTagNumber",
@@ -449,7 +452,6 @@ export default {
449
452
  mounted() {
450
453
  // const el = document.getElementById("ellipsis-container");
451
454
  // this.truncateMiddleByWidth(el)
452
- console.log(6666, this, this.$olBaseConfig);
453
455
  },
454
456
  methods: {
455
457
  SelectionChange(row) {
@@ -679,7 +681,7 @@ export default {
679
681
  ],
680
682
  },
681
683
  onSubmit: data => {
682
- console.log(6666, data);
684
+ // console.log(6666, data);
683
685
  },
684
686
  });
685
687
 
@@ -817,6 +819,9 @@ export default {
817
819
  saveHandler(configList) {
818
820
  console.log("保存配置", configList);
819
821
  },
822
+ handlePrint1(row) {
823
+ console.log(11122333, row);
824
+ },
820
825
  },
821
826
  };
822
827
  </script>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775034815280" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="119811" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M910.104609 248.342329h-56.346075v-145.061172q-2.397705-45.556401-35.96558-75.527718t-77.925423-27.573611H272.314993q-20.380495 0-39.562137 7.193116t-33.567875 21.579348q-14.386232 14.386232-22.178774 33.567874t-6.59369 40.760991v145.061172h-67.135749q-21.579348-1.198853-40.76099 6.593689t-33.567875 22.178774q-14.386232 14.386232-21.579348 33.567875t-7.193116 40.76099v389.627115q-2.397705 44.357548 27.573612 77.325997t75.527717 35.366153h67.135749v62.340339q0 44.357548 31.769596 76.127143t76.127144 31.769596h467.552537q44.357548 0 76.127144-31.769596t31.769596-76.127143v-62.340339h56.346075q45.556401-2.397705 78.524849-34.766727t35.366154-77.925423v-389.627115q-2.397705-45.556401-35.96558-75.527717t-77.925423-27.573611z m-677.351753-145.061172q-1.198853-17.98279 10.789673-29.971317t28.772464-10.789674h467.552538q19.181643 0 35.366153 10.789674t16.184511 29.971317v145.061172H232.752856z m558.665339 607.818299v205.003805q0 19.181643-13.187379 32.369021t-32.369022 13.18738H278.309257q-19.181643 0-32.369022-13.18738t-13.187379-32.369021v-205.003805q0-17.98279 13.187379-31.769596t32.369022-13.786806h467.552537q19.181643 0 32.369022 13.18738t13.187379 32.369022z m170.237078-359.655799v389.627115q-1.198853 20.380495-15.585084 34.766727t-35.96558 15.585085h-56.346075v-79.124276q0-44.357548-31.769596-75.527717t-76.127144-31.17017H278.309257q-44.357548 0-76.127144 31.17017t-31.769596 75.527717v79.124276h-67.135749q-19.181643-2.397705-31.170169-17.383364t-9.590821-34.167301v-388.428262q-1.198853-17.98279 10.789674-29.971316t29.971316-10.789674h806.827841q19.181643 0 35.366153 10.789674t16.184511 29.971316z m-766.06685 52.749518h-46.755254q-4.795411-1.198853-8.391968-5.994264t-3.596558-10.190247q0-5.394837 3.596558-10.190248t8.391968-4.795411h46.755254q10.789674-2.397705 16.783937 6.59369t0 17.383364q-5.994263 8.391969-16.783937 7.193116z m111.493298 0h-50.351812q-10.789674 1.198853-16.783937-7.193116t0-17.383364q5.994263-8.991395 16.783937-6.59369h50.351812q5.994263 0 9.590821 4.795411t3.596558 10.190248q0 5.394837-3.596558 10.190247t-9.590821 5.994264z m511.910086 139.066908H195.588423q-4.795411-1.198853-8.991395-5.394837t-4.195984-10.190247q0-5.994263 4.195984-10.190248t8.991395-5.394837h623.403384q5.994263 1.198853 9.590821 5.394837t3.596558 10.190248q0 5.994263-3.596558 10.190247t-9.590821 5.394837z" p-id="119812"></path></svg>
package/src/main.js CHANGED
@@ -6,7 +6,7 @@ import OlCom, { swaggerInstall, Hiprint } from "@/package/index.js";
6
6
  Vue.use(ElementUI);
7
7
  Vue.use(Hiprint);
8
8
 
9
- Vue.use(OlCom, { method: "post" });
9
+ Vue.use(OlCom, { method: "post", isSmartPrint: true });
10
10
  swaggerInstall("http://220.179.249.140:20025/swagger/v1/swagger.json").then(() => {});
11
11
  new Vue({
12
12
  render: h => h(App),
@@ -2,10 +2,10 @@
2
2
  <ol-search
3
3
  :key="key"
4
4
  :form-search-data="formSearchData"
5
- isCustoms
5
+ isCustomSearch
6
6
  v-bind="$attrs"
7
7
  @onSave="onSave"
8
- method="post"
8
+ :method="finalMethod"
9
9
  v-on="$listeners"
10
10
  ref="customSearchRef"
11
11
  />
@@ -37,6 +37,10 @@ export default {
37
37
  };
38
38
  },
39
39
  },
40
+ // 请求方式 post get
41
+ method: {
42
+ type: String,
43
+ },
40
44
  },
41
45
  data() {
42
46
  return {
@@ -50,6 +54,12 @@ export default {
50
54
  this.init();
51
55
  });
52
56
  },
57
+ computed: {
58
+ // 优先级:props > 全局配置 > 默认值
59
+ finalMethod() {
60
+ return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
61
+ },
62
+ },
53
63
  methods: {
54
64
  init() {
55
65
  const handleMenu = (arr, _this) => {
@@ -164,7 +164,7 @@
164
164
  {{ expend ? "收起" : "展开" }}</el-button
165
165
  >
166
166
  <el-button
167
- v-if="formSearchData.customs && formSearchData.customs.length"
167
+ v-if="isCustomSearch"
168
168
  plain
169
169
  size="small"
170
170
  icon="el-icon-setting"
@@ -281,7 +281,7 @@ export default {
281
281
  type: Function,
282
282
  default: null,
283
283
  },
284
- isCustoms: {
284
+ isCustomSearch: {
285
285
  type: Boolean,
286
286
  default: false,
287
287
  },
@@ -337,7 +337,7 @@ export default {
337
337
  },
338
338
  methods: {
339
339
  async init() {
340
- if (!this.isCustoms && this.url) {
340
+ if (!this.isCustomSearch && this.url) {
341
341
  const swaggerData = await getData();
342
342
  let swaggersearchColumns = swaggerData.paths[this.url][this.finalMethod].parameters || [];
343
343
  if (typeof this.onSwagger === "function") {
@@ -518,7 +518,7 @@ export default {
518
518
  },
519
519
  // 搜索查询按钮
520
520
  handleSearch(formName, item) {
521
- if (!this.isCustoms) {
521
+ if (!this.isCustomSearch) {
522
522
  if (this.formSearch.createdTime) {
523
523
  this.formSearch.BeginTime = this.formSearch.createdTime[0];
524
524
  this.formSearch.EndTime = this.formSearch.createdTime[1];
@@ -144,7 +144,7 @@ export default {
144
144
  this.hiprintTemplate.design("#hiprint-printTemplate", {
145
145
  grid: this.grid,
146
146
  });
147
- console.log(6666, this.hiprintTemplate);
147
+ // console.log(6666, this.hiprintTemplate);
148
148
  },
149
149
  async print() {
150
150
  // 使用外部传入的打印数据
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <el-dropdown @command="handleCommand" trigger="click">
3
- <i class="el-icon-printer" />
3
+ <img
4
+ src="../../../../assets/print.svg"
5
+ alt="print"
6
+ style="width: 14px; height: 14px; cursor: pointer"
7
+ />
4
8
  <el-dropdown-menu slot="dropdown">
5
9
  <el-dropdown-item
6
10
  v-for="(item, index) in templateList"
@@ -26,6 +26,14 @@
26
26
  </div>
27
27
  <!-- 右侧工具按钮 -->
28
28
  <div class="toolbox">
29
+ <!-- 工具按钮前插槽 -->
30
+ <slot
31
+ name="toolbox-before"
32
+ :tableData="tableData"
33
+ :multipleSelection="multipleSelection"
34
+ :paginations="paginations"
35
+ :loading="tableData.loading"
36
+ ></slot>
29
37
  <el-dropdown
30
38
  v-if="tableData.options.headTool"
31
39
  class="avatar-container right-menu-item hover-effect"
@@ -60,7 +68,18 @@
60
68
  </div>
61
69
  </div>
62
70
  <div
63
- v-if="tableData.options.downloadBtn"
71
+ v-if="tableData.options.downloadBtn && !isSmartPrintComputed"
72
+ class="avatar-container right-menu-item hover-effect el-dropdown"
73
+ @click="printTable"
74
+ >
75
+ <div class="avatar-wrapper">
76
+ <div class="layui-table-tool-self">
77
+ <i class="el-icon-printer" />
78
+ </div>
79
+ </div>
80
+ </div>
81
+ <div
82
+ v-if="isSmartPrintComputed"
64
83
  class="avatar-container right-menu-item hover-effect el-dropdown"
65
84
  >
66
85
  <div class="avatar-wrapper">
@@ -69,6 +88,14 @@
69
88
  </div>
70
89
  </div>
71
90
  </div>
91
+ <!-- 工具按钮后插槽 -->
92
+ <slot
93
+ name="toolbox-after"
94
+ :tableData="tableData"
95
+ :multipleSelection="multipleSelection"
96
+ :paginations="paginations"
97
+ :loading="tableData.loading"
98
+ ></slot>
72
99
  </div>
73
100
  </div>
74
101
  </template>
@@ -444,6 +471,11 @@ export default {
444
471
  method: {
445
472
  type: String,
446
473
  },
474
+ // 是否启用智能打印
475
+ isSmartPrint: {
476
+ type: Boolean,
477
+ default: null,
478
+ },
447
479
  },
448
480
 
449
481
  data() {
@@ -490,6 +522,12 @@ export default {
490
522
  finalMethod() {
491
523
  return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
492
524
  },
525
+ isSmartPrintComputed() {
526
+ if (this.isSmartPrint !== null) {
527
+ return this.isSmartPrint;
528
+ }
529
+ return (this.$olBaseConfig && this.$olBaseConfig.isSmartPrint) || false;
530
+ },
493
531
  },
494
532
  created() {
495
533
  // 通过swagger完善columns
@@ -533,8 +571,7 @@ export default {
533
571
 
534
572
  Object.keys(swaggerColumns).forEach(key => {
535
573
  const item = swaggerColumns[key];
536
- const existingColumn = this.findColumnByProp(this.tableData.columns, key);
537
- if (!existingColumn && item.description) {
574
+ if (item.description) {
538
575
  const obj = {
539
576
  prop: key,
540
577
  label: item.description,
@@ -551,7 +588,8 @@ export default {
551
588
  if (item.type === "boolean") {
552
589
  obj.prop = `${key}Text`;
553
590
  }
554
- this.tableData.columns.push(obj);
591
+ if (!this.findColumnByProp(this.tableData.columns, obj.prop))
592
+ this.tableData.columns.push(obj);
555
593
  }
556
594
  });
557
595
  // 根据beforeProp排序
@@ -639,20 +677,20 @@ export default {
639
677
  });
640
678
  this.$emit("refreshTable");
641
679
  },
642
- // printTable() {
643
- // console.log("printTable");
644
- // if (this.tableData.rows.length <= 0) return;
645
- // this.printListObj.title = this.$router.history.current.name;
646
- // this.printListObj.tableHeader = this.tableData.columns;
647
- // this.printListObj.tableData = this.tableData.rows;
648
- // console.log(this.printListObj);
649
- // setTimeout(() => {
650
- // $(".printTemplate").show();
651
- // $(".printTemplate").jqprint();
652
- // $(".printTemplate").hide();
653
- // }, 50);
654
- // this.$emit("printTable");
655
- // },
680
+ printTable() {
681
+ console.log("printTable");
682
+ if (this.tableData.rows.length <= 0) return;
683
+ this.printListObj.title = this.$router.history.current.name;
684
+ this.printListObj.tableHeader = this.tableData.columns;
685
+ this.printListObj.tableData = this.tableData.rows;
686
+ console.log(this.printListObj);
687
+ setTimeout(() => {
688
+ $(".printTemplate").show();
689
+ $(".printTemplate").jqprint();
690
+ $(".printTemplate").hide();
691
+ }, 50);
692
+ this.$emit("printTable");
693
+ },
656
694
  selectAll(val) {
657
695
  this.$emit("selectAll", val);
658
696
  },