yh-hiprint 2.1.0 → 2.1.1
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/README.md +12 -0
- package/index.d.ts +9 -0
- package/index.js +14 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,3 +113,15 @@ export default defineConfig({
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
```
|
|
116
|
+
|
|
117
|
+
## 更新日志
|
|
118
|
+
|
|
119
|
+
###### 2.1.1
|
|
120
|
+
- 升级 hiprint 方法,兼容打印预览的 data、isCustom 参数
|
|
121
|
+
|
|
122
|
+
###### 2.1.0
|
|
123
|
+
- 打印预览增加 data、isCustom 参数,并提供 isCustom 参数的GUI部分
|
|
124
|
+
- 修复部分设计器的bug
|
|
125
|
+
|
|
126
|
+
###### 2.0.0
|
|
127
|
+
- 插件内聚,将能够内聚的代码都提取到包中。
|
package/index.d.ts
CHANGED
|
@@ -56,3 +56,12 @@ export declare const useDataSource: (axios) => {
|
|
|
56
56
|
getDataSourceList: () => void;
|
|
57
57
|
dataSource: Ref<string[]>;
|
|
58
58
|
};
|
|
59
|
+
|
|
60
|
+
export declare interface HiprintOption {
|
|
61
|
+
code: string;
|
|
62
|
+
params: Object;
|
|
63
|
+
data: Record<string, any> | Record<string, any>[];
|
|
64
|
+
isCustom: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export declare const hiprint: (HiprintOption) => void;
|
package/index.js
CHANGED
|
@@ -14,19 +14,25 @@ export function cLog(string, isError = false) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const hiprint = (code, params) => {
|
|
17
|
+
export const hiprint = ({ code, params, data, isCustom }) => {
|
|
18
18
|
let height = document.documentElement.clientHeight;
|
|
19
19
|
let width = (document.documentElement.clientWidth - 1200) / 2;
|
|
20
20
|
// 转换数组
|
|
21
|
-
let
|
|
21
|
+
let paramData = params;
|
|
22
22
|
if (typeof params !== "Array") {
|
|
23
|
-
|
|
23
|
+
paramData = [params];
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
url = "/hiprint/#/preview?code=" + code;
|
|
26
|
+
if (paramData) {
|
|
27
|
+
url += `¶ms=${JSON.stringify(paramData)}`;
|
|
28
|
+
}
|
|
29
|
+
if (data) {
|
|
30
|
+
url += `&data=${JSON.stringify(data)}`;
|
|
31
|
+
}
|
|
32
|
+
if (isCustom) {
|
|
33
|
+
url += `&isCustom=${isCustom ? "1" : "0"}`;
|
|
34
|
+
}
|
|
35
|
+
let windowOpen = window.open(url, "hiprintWindow", `height=${height}, width=1200, top=20, left=${width}, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no`);
|
|
30
36
|
};
|
|
31
37
|
export default {
|
|
32
38
|
install(app, { router, pinia, isAdmin }) {
|