ol-base-components 3.4.5 → 3.4.7
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/dist/index.mjs +7105 -0
- package/dist/index.umd.js +1 -0
- package/dist/style.css +1 -0
- package/package.json +18 -4
- package/.eslintrc +0 -59
- package/.github/deploy.yml +0 -81
- package/.prettierignore +0 -6
- package/.prettierrc +0 -13
- package/.trae/rules/project.md +0 -2
- package/babel.config.js +0 -5
- package/jsconfig.json +0 -19
- package/readme1.md +0 -164
- package/src/App.vue +0 -932
- package/src/assets/Snipaste_2025-09-03_14-30-49.png +0 -0
- package/src/assets/api.png +0 -0
- package/src/assets/css/iconfont.css +0 -342
- package/src/assets/duojibiaotou.png +0 -0
- package/src/assets/effectPicture.png +0 -0
- package/src/assets/generator0.png +0 -0
- package/src/assets/generator1.png +0 -0
- package/src/assets/generator2.png +0 -0
- package/src/assets/icon/printModel.svg +0 -1
- package/src/assets/init.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/olBaseComponentsLogo.svg +0 -100
- package/src/assets/print.svg +0 -1
- package/src/assets/run.png +0 -0
- package/src/assets/vscodecj.png +0 -0
- package/src/bin/initTemplate.js +0 -409
- package/src/bin/news.js +0 -171
- package/src/bin/openCloseloop.js +0 -154
- package/src/bin/openLoop.js +0 -154
- package/src/main.js +0 -13
- package/src/package/customSearch/index.js +0 -7
- package/src/package/customSearch/src/index.vue +0 -120
- package/src/package/dialog/index.js +0 -7
- package/src/package/dialog/src/index.vue +0 -419
- package/src/package/form/index.js +0 -7
- package/src/package/form/src/index.vue +0 -405
- package/src/package/formSearch/index.js +0 -7
- package/src/package/formSearch/src/components/SearchConfigDialog.vue +0 -957
- package/src/package/formSearch/src/index.js +0 -29
- package/src/package/formSearch/src/index.vue +0 -928
- package/src/package/index.js +0 -243
- package/src/package/numberRange/index.js +0 -7
- package/src/package/numberRange/src/index.vue +0 -351
- package/src/package/print/index.js +0 -76
- package/src/package/print/src/components/PaperSelector.vue +0 -109
- package/src/package/print/src/index.vue +0 -622
- package/src/package/print/src/provide/provider1.js +0 -215
- package/src/package/printModel/index.js +0 -7
- package/src/package/printModel/src/index.vue +0 -493
- package/src/package/table/index.js +0 -12
- package/src/package/table/src/TableColumn.vue +0 -77
- package/src/package/table/src/components/PrintTemplateSelector.vue +0 -210
- package/src/package/table/src/index.vue +0 -945
- package/src/package/table/src/nodata.jpg +0 -0
- package/src/package/table/src/printTable.vue +0 -196
- package/src/utils/getEnum.js +0 -8
- package/src/utils/initData.js +0 -138
- package/vue.config.js +0 -21
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/index.html +0 -0
- /package/{public → dist}/print-lock.css +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import OlTable from "./src/index.vue";
|
|
2
|
-
import OlDropdownPrint from "./src/components/PrintTemplateSelector.vue";
|
|
3
|
-
|
|
4
|
-
OlTable.install = function (Vue) {
|
|
5
|
-
Vue.component("ol-table", OlTable);
|
|
6
|
-
};
|
|
7
|
-
OlDropdownPrint.install = function (Vue) {
|
|
8
|
-
Vue.component("ol-dropdown-print", OlDropdownPrint);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default OlTable;
|
|
12
|
-
export { OlDropdownPrint };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<!-- src/package/table/src/TableColumn.vue -->
|
|
2
|
-
<template>
|
|
3
|
-
<el-table-column
|
|
4
|
-
:key="`${column.prop}-${column.show}`"
|
|
5
|
-
v-if="shouldShow"
|
|
6
|
-
:label="column.label"
|
|
7
|
-
:prop="column.prop"
|
|
8
|
-
:min-width="column.minWidth || '150px'"
|
|
9
|
-
:show-overflow-tooltip="column.overHidden || true"
|
|
10
|
-
:type="column.type || 'normal'"
|
|
11
|
-
v-bind="{
|
|
12
|
-
align: 'center',
|
|
13
|
-
width: column.width,
|
|
14
|
-
fixed: column.fixed || false,
|
|
15
|
-
sortable: column.sortable || false,
|
|
16
|
-
...column.attrs,
|
|
17
|
-
}"
|
|
18
|
-
>
|
|
19
|
-
<!-- 表头插槽 -->
|
|
20
|
-
<template v-slot:header>
|
|
21
|
-
<el-tooltip v-if="column.prop" :content="`${column.label} ${column.prop}`" placement="top">
|
|
22
|
-
<span>{{ column.label }}</span>
|
|
23
|
-
</el-tooltip>
|
|
24
|
-
<!-- 多级表头无prop无需提示 -->
|
|
25
|
-
<span v-else>{{ column.label }}</span>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<template v-for="(index, name) in $scopedSlots" v-slot:[name]="data">
|
|
29
|
-
<slot :name="name" v-bind="data"></slot>
|
|
30
|
-
</template>
|
|
31
|
-
<!-- 递归渲染子列 -->
|
|
32
|
-
<template v-if="column.children && column.children.length">
|
|
33
|
-
<TableColumn v-for="(child, idx) in column.children" :key="idx" :column="child">
|
|
34
|
-
<!-- 透传插槽 -->
|
|
35
|
-
<template v-for="(slotFn, name) in $scopedSlots" v-slot:[name]="slotProps">
|
|
36
|
-
<slot :name="name" v-bind="slotProps" />
|
|
37
|
-
</template>
|
|
38
|
-
</TableColumn>
|
|
39
|
-
</template>
|
|
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>
|
|
44
|
-
</template>
|
|
45
|
-
</el-table-column>
|
|
46
|
-
</template>
|
|
47
|
-
<script>
|
|
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>;
|
|
56
|
-
},
|
|
57
|
-
},
|
|
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;
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
</script>
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-dropdown @command="handleCommand" trigger="click">
|
|
3
|
-
<img
|
|
4
|
-
src="../../../../assets/icon/printModel.svg"
|
|
5
|
-
alt="print"
|
|
6
|
-
style="width: 14px; height: 14px; cursor: pointer"
|
|
7
|
-
/>
|
|
8
|
-
<el-dropdown-menu slot="dropdown">
|
|
9
|
-
<el-dropdown-item
|
|
10
|
-
v-for="(item, index) in templateList"
|
|
11
|
-
:key="index"
|
|
12
|
-
:command="item.id"
|
|
13
|
-
:disabled="item.disabled"
|
|
14
|
-
>
|
|
15
|
-
{{ item.templeteName || "-" }}
|
|
16
|
-
</el-dropdown-item>
|
|
17
|
-
</el-dropdown-menu>
|
|
18
|
-
</el-dropdown>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
export default {
|
|
23
|
-
name: "dropdown-print",
|
|
24
|
-
props: {
|
|
25
|
-
menuId: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: "",
|
|
28
|
-
},
|
|
29
|
-
printData: {
|
|
30
|
-
type: [Object, Array],
|
|
31
|
-
default: () => {},
|
|
32
|
-
},
|
|
33
|
-
// 自定义获取打印数据函数,没传递就是默认接口获取数据。return的数据就是打印数据
|
|
34
|
-
onPrintData: {
|
|
35
|
-
type: Function,
|
|
36
|
-
default: null,
|
|
37
|
-
},
|
|
38
|
-
multipleSelection: {
|
|
39
|
-
type: Array,
|
|
40
|
-
default: () => [],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
data() {
|
|
44
|
-
return {
|
|
45
|
-
templateList: [{ id: 1, templeteName: "暂无数据", disabled: true }],
|
|
46
|
-
// templateList: [
|
|
47
|
-
// {
|
|
48
|
-
// id: 1,
|
|
49
|
-
// templeteName: "自定义模式",
|
|
50
|
-
// remark: "",
|
|
51
|
-
// templeteJson:
|
|
52
|
-
// '{"panels":[{"index":0,"name":1,"paperType":"A4","height":297,"width":210,"paperHeader":0,"paperFooter":841.8897637795277,"printElements":[{"options":{"left":67.5,"top":165,"height":36,"width":550,"fields":[],"field":"table","qid":"table","columns":[[{"width":137.5,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"性别","field":"gender","checked":true,"columnId":"gender","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"数量","field":"count","checked":true,"columnId":"count","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"金额","field":"amount","checked":true,"columnId":"amount","fixed":false,"rowspan":1,"colspan":1,"align":"center"}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}},{"options":{"left":127.5,"top":301.5,"height":9.75,"width":120,"field":"name","testData":"内容","title":"文本","qid":"name"},"printElementType":{"title":"文本","type":"text"}}],"paperNumberContinue":true,"watermarkOptions":{},"panelLayoutOptions":{}}]}',
|
|
53
|
-
// sourceUrl: "api/app/aaa",
|
|
54
|
-
// },
|
|
55
|
-
// {
|
|
56
|
-
// id: 2,
|
|
57
|
-
// templeteName: "sourceUrl模式",
|
|
58
|
-
// remark: "",
|
|
59
|
-
// templeteJson:
|
|
60
|
-
// '{"panels":[{"index":0,"name":1,"paperType":"A4","height":297,"width":210,"paperHeader":0,"paperFooter":841.8897637795277,"printElements":[{"options":{"left":67.5,"top":229.5,"height":36,"width":550,"fields":[],"field":"table","qid":"table","columns":[[{"width":137.5,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"性别","field":"gender","checked":true,"columnId":"gender","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"数量","field":"count","checked":true,"columnId":"count","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"金额","field":"amount","checked":true,"columnId":"amount","fixed":false,"rowspan":1,"colspan":1,"align":"center"}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}},{"options":{"left":247.5,"top":304.5,"height":9.75,"width":120,"field":"name","testData":"内容","title":"文本","qid":"name"},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":79.5,"top":313.5,"height":32,"width":120,"field":"qrcode","testData":"XS888888888","fontSize":12,"lineHeight":18,"textType":"qrcode","title":"二维码","qid":"qrcode"},"printElementType":{"title":"二维码","type":"text"}}],"paperNumberContinue":true,"watermarkOptions":{},"panelLayoutOptions":{}}]}',
|
|
61
|
-
// sourceUrl: "api/app/bbb",
|
|
62
|
-
// },
|
|
63
|
-
// {
|
|
64
|
-
// id: 3,
|
|
65
|
-
// templeteName: "默认模式",
|
|
66
|
-
// remark: "",
|
|
67
|
-
// templeteJson:
|
|
68
|
-
// '{"panels":[{"index":0,"name":1,"paperType":"A4","height":297,"width":210,"paperHeader":0,"paperFooter":841.8897637795277,"printElements":[{"options":{"left":67.5,"top":229.5,"height":36,"width":550,"fields":[],"field":"table","qid":"table","columns":[[{"width":137.5,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"性别","field":"gender","checked":true,"columnId":"gender","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"数量","field":"count","checked":true,"columnId":"count","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"金额","field":"amount","checked":true,"columnId":"amount","fixed":false,"rowspan":1,"colspan":1,"align":"center"}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}},{"options":{"left":247.5,"top":304.5,"height":9.75,"width":120,"field":"name","testData":"内容","title":"文本","qid":"name"},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":79.5,"top":313.5,"height":32,"width":120,"field":"qrcode","testData":"XS888888888","fontSize":12,"lineHeight":18,"textType":"qrcode","title":"二维码","qid":"qrcode"},"printElementType":{"title":"二维码","type":"text"}}],"paperNumberContinue":true,"watermarkOptions":{},"panelLayoutOptions":{}}]}',
|
|
69
|
-
// sourceUrl: "",
|
|
70
|
-
// },
|
|
71
|
-
// ],
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
created() {
|
|
75
|
-
this.getPrintTemplateList();
|
|
76
|
-
},
|
|
77
|
-
methods: {
|
|
78
|
-
async getPrintTemplateList() {
|
|
79
|
-
const handleMenu = (arr, _this) => {
|
|
80
|
-
for (const item of arr) {
|
|
81
|
-
if (item.path === _this.$route.path) {
|
|
82
|
-
return item;
|
|
83
|
-
}
|
|
84
|
-
if (item.child && item.child.length > 0 && item.type !== 1) {
|
|
85
|
-
const found = handleMenu(item.child, _this);
|
|
86
|
-
if (found) return found;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
};
|
|
91
|
-
let wms = JSON.parse(localStorage.getItem("wms"));
|
|
92
|
-
let SET_MENUS = null;
|
|
93
|
-
if (wms) SET_MENUS = wms.SET_MENUS;
|
|
94
|
-
const menus = SET_MENUS;
|
|
95
|
-
this.currentPageItem = handleMenu(menus, this);
|
|
96
|
-
|
|
97
|
-
const targetMenuId = this.menuId || (this.currentPageItem && this.currentPageItem.id);
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
const res = await this.get({
|
|
101
|
-
url: "/api/app/print-templete/page-list",
|
|
102
|
-
data: {
|
|
103
|
-
MenuId: targetMenuId,
|
|
104
|
-
page: 1,
|
|
105
|
-
MaxResultCount: 1000,
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
if (Array.isArray(res.result?.items) && res.result.items.length > 0) {
|
|
109
|
-
this.templateList = res.result.items;
|
|
110
|
-
} else {
|
|
111
|
-
this.templateList = [{ id: 1, templeteName: "暂无数据", disabled: true }];
|
|
112
|
-
}
|
|
113
|
-
} catch (error) {
|
|
114
|
-
console.error("加载模板列表失败:", error);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
handleCommand(command) {
|
|
118
|
-
if (!Array.isArray(this.templateList)) return;
|
|
119
|
-
const tempItem = this.templateList.find(item => item.id === command);
|
|
120
|
-
if (!tempItem) return this.$message.error("未找到打印模板");
|
|
121
|
-
|
|
122
|
-
const options = {
|
|
123
|
-
printData: this.printData || {},
|
|
124
|
-
defaultTemplate: tempItem.templeteJson ? JSON.parse(tempItem.templeteJson) : {},
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
// 自定义打印 > 默认接口打印 > printData数据打印
|
|
128
|
-
if (this.onPrintData) {
|
|
129
|
-
// 自定义数据 - 类似 Element UI before-close 机制
|
|
130
|
-
let isCustomHandled = false;
|
|
131
|
-
// 定义 done 函数
|
|
132
|
-
const done = data => {
|
|
133
|
-
isCustomHandled = true;
|
|
134
|
-
if (data) {
|
|
135
|
-
options.printData = data;
|
|
136
|
-
this.$hiprint.print(options);
|
|
137
|
-
} else {
|
|
138
|
-
this.$message.error("打印数据不能为空");
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// 调用自定义回调,传入模板信息和 done 函数
|
|
143
|
-
this.onPrintData(tempItem, done);
|
|
144
|
-
|
|
145
|
-
// 如果自定义回调没有调用 done,则走默认逻辑
|
|
146
|
-
if (!isCustomHandled) {
|
|
147
|
-
if (tempItem.sourceUrl) {
|
|
148
|
-
this.printByApi(options, tempItem);
|
|
149
|
-
} else {
|
|
150
|
-
// 没有自定义回调,走默认逻辑
|
|
151
|
-
options.printData = this.printData || {};
|
|
152
|
-
this.$hiprint.print(options);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
} else if (tempItem.sourceUrl) {
|
|
156
|
-
this.printByApi(options, tempItem);
|
|
157
|
-
} else {
|
|
158
|
-
this.printDefault(options);
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
printByApi(options, tempItem) {
|
|
162
|
-
// 默认接口数据
|
|
163
|
-
options.printData = this.getPrintDataByApi(tempItem);
|
|
164
|
-
const isValidData =
|
|
165
|
-
options.printData &&
|
|
166
|
-
((Array.isArray(options.printData) && options.printData.length > 0) ||
|
|
167
|
-
(typeof options.printData === "object" && Object.keys(options.printData).length > 0));
|
|
168
|
-
|
|
169
|
-
if (!isValidData) {
|
|
170
|
-
return this.$message.error("打印数据不能为空");
|
|
171
|
-
}
|
|
172
|
-
this.$hiprint.print(options);
|
|
173
|
-
},
|
|
174
|
-
printDefault(options) {
|
|
175
|
-
// 默认接口数据
|
|
176
|
-
options.printData = this.printData || {};
|
|
177
|
-
this.$hiprint.print(options);
|
|
178
|
-
},
|
|
179
|
-
// 默认接口获取数据
|
|
180
|
-
async getPrintDataByApi(tempItem) {
|
|
181
|
-
try {
|
|
182
|
-
let ids = [];
|
|
183
|
-
if (this.multipleSelection && this.multipleSelection.length > 0) {
|
|
184
|
-
ids = this.multipleSelection.reduce((acc, item) => {
|
|
185
|
-
acc.push(item.id);
|
|
186
|
-
return acc;
|
|
187
|
-
}, []);
|
|
188
|
-
}
|
|
189
|
-
const res = await this.get({
|
|
190
|
-
url: `${tempItem.sourceUrl}`,
|
|
191
|
-
data: {
|
|
192
|
-
ids: ids,
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
if (res.code !== 200) return {};
|
|
196
|
-
if (Array.isArray(res.result) && res.result.length > 0) return res.result;
|
|
197
|
-
return {};
|
|
198
|
-
} catch (error) {
|
|
199
|
-
console.error(`获取打印数据失败: ${tempItem.sourceUrl}`, error);
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
</script>
|
|
205
|
-
|
|
206
|
-
<style scoped>
|
|
207
|
-
.print-template-selector {
|
|
208
|
-
display: inline-block;
|
|
209
|
-
}
|
|
210
|
-
</style>
|