yh-hiprint 2.1.0 → 2.1.2
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 +27 -0
- package/index.d.ts +9 -0
- package/index.js +14 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,3 +113,30 @@ export default defineConfig({
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
```
|
|
116
|
+
|
|
117
|
+
### 预览调用方法
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
// 如果是自己的组件中则需要自己引入,slw 脚本中是不需要自己引入的,slw已经处理
|
|
121
|
+
const hiprint = inject("$hiprint")
|
|
122
|
+
|
|
123
|
+
// 三个可选参数必须有一个
|
|
124
|
+
hirpint({
|
|
125
|
+
code: "xxxxxx", // 必选
|
|
126
|
+
params: {...}, // 可选
|
|
127
|
+
data: {...} | [{...},...], // 可选
|
|
128
|
+
isCustom: true | false, // 可选
|
|
129
|
+
})
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 更新日志
|
|
133
|
+
|
|
134
|
+
###### 2.1.1
|
|
135
|
+
- 升级 hiprint 方法,兼容打印预览的 data、isCustom 参数
|
|
136
|
+
|
|
137
|
+
###### 2.1.0
|
|
138
|
+
- 打印预览增加 data、isCustom 参数,并提供 isCustom 参数的GUI部分
|
|
139
|
+
- 修复部分设计器的bug
|
|
140
|
+
|
|
141
|
+
###### 2.0.0
|
|
142
|
+
- 插件内聚,将能够内聚的代码都提取到包中。
|
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
|
+
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 }) {
|