yh-hiprint 2.2.8 → 2.2.10

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 CHANGED
@@ -1,146 +1,146 @@
1
- ## yh-hiprint
2
-
3
- 力控远海技术中心封装的 hiprint
4
-
5
- 当前教程匹配 2+ 版本
6
-
7
- ## 安装
8
-
9
- 配置好[云效NPM私有仓库](https://packages.aliyun.com/npm/npm-registry/guide)后,直接执行如下命令安装
10
- ```shell
11
- npm install yh-hiprint
12
- ```
13
-
14
- ## 使用
15
-
16
- ### 安装并引入设计器
17
-
18
- `main.js(main.ts)` 中
19
-
20
- ```javascript
21
- import yhHiprint from "yh-hiprint";
22
- // ……
23
- const app = createApp(App);
24
- //……
25
- app.use(yhHiprint, {
26
- router,
27
- pinia,
28
- isAdmin,
29
- });
30
- //……
31
- app.use(pinia);
32
- app.use(router);
33
- app.use(ElementPlus);
34
- ```
35
-
36
- ### 预览页面配置
37
-
38
- ###### 新增预览页入口html
39
- `hiprint/index.html`
40
- ```html
41
- <!DOCTYPE html>
42
- <html lang="en">
43
- <head>
44
- <meta charset="UTF-8" />
45
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
46
- <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
47
- <link rel="stylesheet" href="/iconfont/iconfont.css">
48
- <title>力控元海</title>
49
- </head>
50
- <body>
51
- <div id="app"></div>
52
- <script type="module" src="/src/layout/hiprint/hiprint.js"></script>
53
- </body>
54
- </html>
55
- ```
56
-
57
- ###### 新增预览页入口js
58
- `src/layout/hiprint/hiprint.js`
59
- ```js
60
- import { createApp } from "vue";
61
- import { createRouter, createWebHashHistory } from "vue-router";
62
- import { setTitle } from "@/libs/util";
63
- import "element-plus/dist/index.css";
64
-
65
- import App from "yh-hiprint/hiprint.vue";
66
- const router = createRouter({
67
- history: createWebHashHistory(),
68
- routes: [
69
- {
70
- path: "/",
71
- redirect: "/preview",
72
- },
73
- {
74
- path: "/preview",
75
- name: "printView",
76
- meta: {
77
- title: "打印",
78
- },
79
- component: () => import("yh-hiprint/hiprintPreview.vue"),
80
- },
81
- ],
82
- });
83
-
84
- router.beforeEach((to, from, next) => {
85
- next();
86
- });
87
-
88
- router.afterEach((to) => {
89
- setTitle(to);
90
- window.scrollTo(0, 0);
91
- });
92
- const app = createApp(App);
93
- app.use(router);
94
- app.mount("#app");
95
- ```
96
-
97
- ###### 配置对应 的vite 入口
98
- `vite-.config.js`
99
- ```javascript
100
- // ……
101
- export default defineConfig({
102
- // ……
103
- build: {
104
- // ……
105
- rollupOptions: {
106
- // ……
107
- input: {
108
- // ……
109
- hiprint: path.resolve(__dirname, "hiprint/index.html"),
110
- },
111
- },
112
- },
113
- });
114
-
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.2.0
135
- - 修复 hiprint 方法升级后没有考虑到的问题。
136
- - 增加 自定义输入数据 时,能够将数据存入缓存中。
137
-
138
- ###### 2.1.1
139
- - 升级 hiprint 方法,兼容打印预览的 data、isCustom 参数
140
-
141
- ###### 2.1.0
142
- - 打印预览增加 data、isCustom 参数,并提供 isCustom 参数的GUI部分
143
- - 修复部分设计器的bug
144
-
145
- ###### 2.0.0
1
+ ## yh-hiprint
2
+
3
+ 力控远海技术中心封装的 hiprint
4
+
5
+ 当前教程匹配 2+ 版本
6
+
7
+ ## 安装
8
+
9
+ 配置好[云效NPM私有仓库](https://packages.aliyun.com/npm/npm-registry/guide)后,直接执行如下命令安装
10
+ ```shell
11
+ npm install yh-hiprint
12
+ ```
13
+
14
+ ## 使用
15
+
16
+ ### 安装并引入设计器
17
+
18
+ `main.js(main.ts)` 中
19
+
20
+ ```javascript
21
+ import yhHiprint from "yh-hiprint";
22
+ // ……
23
+ const app = createApp(App);
24
+ //……
25
+ app.use(yhHiprint, {
26
+ router,
27
+ pinia,
28
+ isAdmin,
29
+ });
30
+ //……
31
+ app.use(pinia);
32
+ app.use(router);
33
+ app.use(ElementPlus);
34
+ ```
35
+
36
+ ### 预览页面配置
37
+
38
+ ###### 新增预览页入口html
39
+ `hiprint/index.html`
40
+ ```html
41
+ <!DOCTYPE html>
42
+ <html lang="en">
43
+ <head>
44
+ <meta charset="UTF-8" />
45
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
46
+ <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
47
+ <link rel="stylesheet" href="/iconfont/iconfont.css">
48
+ <title>力控元海</title>
49
+ </head>
50
+ <body>
51
+ <div id="app"></div>
52
+ <script type="module" src="/src/layout/hiprint/hiprint.js"></script>
53
+ </body>
54
+ </html>
55
+ ```
56
+
57
+ ###### 新增预览页入口js
58
+ `src/layout/hiprint/hiprint.js`
59
+ ```js
60
+ import { createApp } from "vue";
61
+ import { createRouter, createWebHashHistory } from "vue-router";
62
+ import { setTitle } from "@/libs/util";
63
+ import "element-plus/dist/index.css";
64
+
65
+ import App from "yh-hiprint/hiprint.vue";
66
+ const router = createRouter({
67
+ history: createWebHashHistory(),
68
+ routes: [
69
+ {
70
+ path: "/",
71
+ redirect: "/preview",
72
+ },
73
+ {
74
+ path: "/preview",
75
+ name: "printView",
76
+ meta: {
77
+ title: "打印",
78
+ },
79
+ component: () => import("yh-hiprint/hiprintPreview.vue"),
80
+ },
81
+ ],
82
+ });
83
+
84
+ router.beforeEach((to, from, next) => {
85
+ next();
86
+ });
87
+
88
+ router.afterEach((to) => {
89
+ setTitle(to);
90
+ window.scrollTo(0, 0);
91
+ });
92
+ const app = createApp(App);
93
+ app.use(router);
94
+ app.mount("#app");
95
+ ```
96
+
97
+ ###### 配置对应 的vite 入口
98
+ `vite-.config.js`
99
+ ```javascript
100
+ // ……
101
+ export default defineConfig({
102
+ // ……
103
+ build: {
104
+ // ……
105
+ rollupOptions: {
106
+ // ……
107
+ input: {
108
+ // ……
109
+ hiprint: path.resolve(__dirname, "hiprint/index.html"),
110
+ },
111
+ },
112
+ },
113
+ });
114
+
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.2.0
135
+ - 修复 hiprint 方法升级后没有考虑到的问题。
136
+ - 增加 自定义输入数据 时,能够将数据存入缓存中。
137
+
138
+ ###### 2.1.1
139
+ - 升级 hiprint 方法,兼容打印预览的 data、isCustom 参数
140
+
141
+ ###### 2.1.0
142
+ - 打印预览增加 data、isCustom 参数,并提供 isCustom 参数的GUI部分
143
+ - 修复部分设计器的bug
144
+
145
+ ###### 2.0.0
146
146
  - 插件内聚,将能够内聚的代码都提取到包中。
package/column-field.js CHANGED
@@ -1,40 +1,40 @@
1
- import $ from "jquery";
2
-
3
- export default function (tableFields) {
4
- function t() {
5
- this.name = "field";
6
- }
7
-
8
- return (
9
- (t.prototype.createTarget = function (t, i, e) {
10
- // t: 元素对象,i: 元素options, e: 元素printElementType
11
- return (
12
- (this.target = $(
13
- `<div class="hiprint-option-item">
14
- <div class="hiprint-option-item-label">字段选择</div>
15
- <div class="hiprint-option-item-field">
16
- <select class="auto-submit">${tableFields.value.map((item) => {
17
- return `<option value="${item}">${item}</option>`;
18
- })}</select>
19
- </div>
20
- </div>`
21
- )),
22
- this.target
23
- );
24
- }),
25
- // 获取值
26
- (t.prototype.getValue = function () {
27
- var t = this.target.find("select").val();
28
- if (t) return t;
29
- }),
30
- // 设置值
31
- (t.prototype.setValue = function (t) {
32
- this.target.find("select").val(t);
33
- }),
34
- // 销毁 DOM
35
- (t.prototype.destroy = function () {
36
- this.target.remove();
37
- }),
38
- t
39
- );
40
- }
1
+ import $ from "jquery";
2
+
3
+ export default function (tableFields) {
4
+ function t() {
5
+ this.name = "field";
6
+ }
7
+
8
+ return (
9
+ (t.prototype.createTarget = function (t, i, e) {
10
+ // t: 元素对象,i: 元素options, e: 元素printElementType
11
+ return (
12
+ (this.target = $(
13
+ `<div class="hiprint-option-item">
14
+ <div class="hiprint-option-item-label">字段选择</div>
15
+ <div class="hiprint-option-item-field">
16
+ <select class="auto-submit">${tableFields.value.map((item) => {
17
+ return `<option value="${item}">${item}</option>`;
18
+ })}</select>
19
+ </div>
20
+ </div>`
21
+ )),
22
+ this.target
23
+ );
24
+ }),
25
+ // 获取值
26
+ (t.prototype.getValue = function () {
27
+ var t = this.target.find("select").val();
28
+ if (t) return t;
29
+ }),
30
+ // 设置值
31
+ (t.prototype.setValue = function (t) {
32
+ this.target.find("select").val(t);
33
+ }),
34
+ // 销毁 DOM
35
+ (t.prototype.destroy = function () {
36
+ this.target.remove();
37
+ }),
38
+ t
39
+ );
40
+ }