ol-base-components 3.3.2 → 3.3.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
package/src/package/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import OlTable from "./table";
|
|
1
|
+
import OlTable, { OlDropdownPrint } from "./table";
|
|
2
2
|
import OlSearch from "./formSearch";
|
|
3
3
|
import OlCustomSearch from "./customSearch";
|
|
4
4
|
import Dialog from "./dialog";
|
|
5
5
|
import OlForm from "./form";
|
|
6
6
|
import OlNumberRange from "./numberRange";
|
|
7
7
|
import OlPrintModel from "./printModel";
|
|
8
|
+
|
|
8
9
|
import OlPrint, { Hiprint } from "./print";
|
|
9
10
|
|
|
10
11
|
import SwaggerClient from "swagger-client";
|
|
@@ -209,6 +210,7 @@ function hideLoading() {
|
|
|
209
210
|
|
|
210
211
|
const components = [
|
|
211
212
|
OlTable,
|
|
213
|
+
OlDropdownPrint,
|
|
212
214
|
OlSearch,
|
|
213
215
|
OlCustomSearch,
|
|
214
216
|
Dialog,
|
|
@@ -226,5 +228,15 @@ const install = async function (Vue) {
|
|
|
226
228
|
};
|
|
227
229
|
|
|
228
230
|
export default install;
|
|
229
|
-
export {
|
|
231
|
+
export {
|
|
232
|
+
OlTable,
|
|
233
|
+
OlDropdownPrint,
|
|
234
|
+
OlSearch,
|
|
235
|
+
OlCustomSearch,
|
|
236
|
+
Dialog,
|
|
237
|
+
OlForm,
|
|
238
|
+
OlNumberRange,
|
|
239
|
+
OlPrint,
|
|
240
|
+
OlPrintModel,
|
|
241
|
+
};
|
|
230
242
|
export { swaggerInstall, swaggerUnload, Hiprint };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import OlTable from "./src/index.vue";
|
|
2
|
+
import OlDropdownPrint from "./src/components/PrintTemplateSelector.vue";
|
|
2
3
|
|
|
3
4
|
OlTable.install = function (Vue) {
|
|
4
|
-
Vue.component("
|
|
5
|
+
Vue.component("ol-table", OlTable);
|
|
6
|
+
};
|
|
7
|
+
OlDropdownPrint.install = function (Vue) {
|
|
8
|
+
Vue.component("ol-dropdown-print", OlDropdownPrint);
|
|
5
9
|
};
|
|
6
10
|
|
|
7
11
|
export default OlTable;
|
|
12
|
+
export { OlDropdownPrint };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dropdown @command="handleCommand" trigger="click">
|
|
3
|
+
<i class="el-icon-printer" />
|
|
4
|
+
<el-dropdown-menu slot="dropdown">
|
|
5
|
+
<el-dropdown-item
|
|
6
|
+
v-for="(item, index) in templateList"
|
|
7
|
+
:key="index"
|
|
8
|
+
:command="item.id"
|
|
9
|
+
:disabled="item.disabled"
|
|
10
|
+
>
|
|
11
|
+
{{ item.templeteName || "-" }}
|
|
12
|
+
</el-dropdown-item>
|
|
13
|
+
</el-dropdown-menu>
|
|
14
|
+
</el-dropdown>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: "dropdown-print",
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
templateList: [{ id: 1, templeteName: "暂无数据", disabled: true }],
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
created() {
|
|
26
|
+
this.getPrintTemplateList();
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
async getPrintTemplateList() {
|
|
30
|
+
const handleMenu = (arr, _this) => {
|
|
31
|
+
for (const item of arr) {
|
|
32
|
+
if (item.path === _this.$route.path) {
|
|
33
|
+
return item;
|
|
34
|
+
}
|
|
35
|
+
if (item.child && item.child.length > 0 && item.type !== 1) {
|
|
36
|
+
const found = handleMenu(item.child, _this);
|
|
37
|
+
if (found) return found;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
let wms = JSON.parse(localStorage.getItem("wms"));
|
|
43
|
+
let SET_MENUS = null;
|
|
44
|
+
if (wms) SET_MENUS = wms.SET_MENUS;
|
|
45
|
+
const menus = SET_MENUS;
|
|
46
|
+
this.currentPageItem = handleMenu(menus, this);
|
|
47
|
+
|
|
48
|
+
const targetMenuId = this.menuId || (this.currentPageItem && this.currentPageItem.id);
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const res = await this.get({
|
|
52
|
+
url: "/api/app/print-templete/page-list",
|
|
53
|
+
data: {
|
|
54
|
+
MenuId: targetMenuId,
|
|
55
|
+
page: 1,
|
|
56
|
+
MaxResultCount: 1000,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
this.printTemplateList = res.result?.items || [
|
|
60
|
+
{ id: 1, templeteName: "暂无数据", disabled: true },
|
|
61
|
+
];
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error("加载模板列表失败:", error);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
handleCommand(command) {
|
|
67
|
+
if (!Array.isArray(this.templateList)) return;
|
|
68
|
+
const tempItem = this.templateList.find(item => item.id === command);
|
|
69
|
+
this.$hiprint.print({
|
|
70
|
+
printData: this.tableData?.printData || {},
|
|
71
|
+
defaultTemplate: tempItem.templeteJson ? JSON.parse(tempItem.templeteJson) : {},
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style scoped>
|
|
79
|
+
.print-template-selector {
|
|
80
|
+
display: inline-block;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -63,21 +63,9 @@
|
|
|
63
63
|
v-if="tableData.options.downloadBtn"
|
|
64
64
|
class="avatar-container right-menu-item hover-effect el-dropdown"
|
|
65
65
|
>
|
|
66
|
-
<!-- @click="printTable" -->
|
|
67
66
|
<div class="avatar-wrapper">
|
|
68
67
|
<div class="layui-table-tool-self">
|
|
69
|
-
<
|
|
70
|
-
<i class="el-icon-printer" />
|
|
71
|
-
<el-dropdown-menu slot="dropdown">
|
|
72
|
-
<el-dropdown-item
|
|
73
|
-
v-for="(item, index) in printTemplateList"
|
|
74
|
-
:key="index"
|
|
75
|
-
:command="item.id"
|
|
76
|
-
:disabled="item.disabled"
|
|
77
|
-
>{{ item.templeteName || "-" }}</el-dropdown-item
|
|
78
|
-
>
|
|
79
|
-
</el-dropdown-menu>
|
|
80
|
-
</el-dropdown>
|
|
68
|
+
<print-template-selector />
|
|
81
69
|
</div>
|
|
82
70
|
</div>
|
|
83
71
|
</div>
|
|
@@ -260,11 +248,14 @@ import { getData } from "../../index.js";
|
|
|
260
248
|
import nodata from "./nodata.jpg";
|
|
261
249
|
import printTemplate from "./printTable.vue";
|
|
262
250
|
import TableColumn from "./TableColumn.vue";
|
|
251
|
+
import PrintTemplateSelector from "./components/PrintTemplateSelector.vue";
|
|
252
|
+
|
|
263
253
|
export default {
|
|
264
254
|
name: "table",
|
|
265
255
|
components: {
|
|
266
256
|
printTemplate,
|
|
267
257
|
TableColumn,
|
|
258
|
+
PrintTemplateSelector,
|
|
268
259
|
// 函数式组件注册
|
|
269
260
|
renderDom: {
|
|
270
261
|
functional: true,
|
|
@@ -463,7 +454,6 @@ export default {
|
|
|
463
454
|
twinPage: 1,
|
|
464
455
|
columnsWatcher: null,
|
|
465
456
|
key: 0,
|
|
466
|
-
printTemplateList: [{ id: 1, templeteName: "暂无数据", disabled: true }],
|
|
467
457
|
};
|
|
468
458
|
},
|
|
469
459
|
computed: {
|
|
@@ -496,50 +486,12 @@ export default {
|
|
|
496
486
|
created() {
|
|
497
487
|
// 通过swagger完善columns
|
|
498
488
|
this.init();
|
|
499
|
-
this.getPrintTemplateList();
|
|
500
489
|
},
|
|
501
490
|
// 组件销毁时清理监听器
|
|
502
491
|
beforeDestroy() {
|
|
503
492
|
this.stopColumnsWatching();
|
|
504
493
|
},
|
|
505
494
|
methods: {
|
|
506
|
-
async getPrintTemplateList() {
|
|
507
|
-
const handleMenu = (arr, _this) => {
|
|
508
|
-
for (const item of arr) {
|
|
509
|
-
if (item.path === _this.$route.path) {
|
|
510
|
-
return item;
|
|
511
|
-
}
|
|
512
|
-
if (item.child && item.child.length > 0 && item.type !== 1) {
|
|
513
|
-
const found = handleMenu(item.child, _this);
|
|
514
|
-
if (found) return found;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
return null;
|
|
518
|
-
};
|
|
519
|
-
let wms = JSON.parse(localStorage.getItem("wms"));
|
|
520
|
-
let SET_MENUS = null;
|
|
521
|
-
if (wms) SET_MENUS = wms.SET_MENUS;
|
|
522
|
-
const menus = SET_MENUS;
|
|
523
|
-
this.currentPageItem = handleMenu(menus, this);
|
|
524
|
-
|
|
525
|
-
const targetMenuId = this.menuId || (this.currentPageItem && this.currentPageItem.id);
|
|
526
|
-
|
|
527
|
-
try {
|
|
528
|
-
const res = await this.get({
|
|
529
|
-
url: "/api/app/print-templete/page-list",
|
|
530
|
-
data: {
|
|
531
|
-
MenuId: targetMenuId,
|
|
532
|
-
page: 1,
|
|
533
|
-
MaxResultCount: 1000,
|
|
534
|
-
},
|
|
535
|
-
});
|
|
536
|
-
this.printTemplateList = res.result?.items || [
|
|
537
|
-
{ id: 1, templeteName: "暂无数据", disabled: true },
|
|
538
|
-
];
|
|
539
|
-
} catch (error) {
|
|
540
|
-
console.error("加载模板列表失败:", error);
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
495
|
init() {
|
|
544
496
|
// 从 IndexedDB 中获取 Swagger 数据
|
|
545
497
|
getData()
|
|
@@ -692,14 +644,6 @@ export default {
|
|
|
692
644
|
// }, 50);
|
|
693
645
|
// this.$emit("printTable");
|
|
694
646
|
// },
|
|
695
|
-
handleCommand(command) {
|
|
696
|
-
if (!Array.isArray(this.printTemplateList)) return;
|
|
697
|
-
const tempItem = this.printTemplateList.find(item => item.id === command);
|
|
698
|
-
this.$hiprint.print({
|
|
699
|
-
printData: this.tableData?.printData || {},
|
|
700
|
-
defaultTemplate: tempItem.templeteJson ? JSON.parse(tempItem.templeteJson) : {},
|
|
701
|
-
});
|
|
702
|
-
},
|
|
703
647
|
selectAll(val) {
|
|
704
648
|
this.$emit("selectAll", val);
|
|
705
649
|
},
|