yh-hiprint 2.6.17 → 2.6.19

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.
Files changed (2) hide show
  1. package/index.ts +16 -4
  2. package/package.json +4 -2
package/index.ts CHANGED
@@ -25,9 +25,11 @@ export {default as scale} from './scale';
25
25
  export {default as zIndex} from './z-index';
26
26
  export {default as panel} from './panel';
27
27
  export {default as hiprintVue} from './hiprint.vue';
28
- import {getPrintTemplate} from './libs/index.js';
29
28
  export {default as defaultPrintElement} from './store/defaultPrintElement';
30
29
  export {getPrintTemplate};
30
+ import {getPrintTemplate} from './libs/index.js';
31
+ import printCss from './libs/css/hiprint.css?inline';
32
+ import axios from "@/api/libs/api.request.js"
31
33
 
32
34
  export function guid(): string {
33
35
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (t) {
@@ -202,7 +204,7 @@ interface InstallOptions {
202
204
 
203
205
  // 客户端打印处理函数
204
206
  const clientPrintHandler = async (code, params, data) => {
205
- let loading = null;
207
+ let loading:any = null;
206
208
  try {
207
209
  loading = ElLoading.service({
208
210
  text: '正在获取打印模板',
@@ -478,8 +480,17 @@ declare global {
478
480
  }
479
481
  }
480
482
 
481
- // 导入打印样式
482
- import printCss from './libs/css/hiprint.css?inline';
483
+ const serverPrint = (code, params) => {
484
+ // 转换数组
485
+ let data = params;
486
+ if (!Array.isArray(params)) {
487
+ data = [params];
488
+ }
489
+ axios.post("printTemplate/print/" + code, data, "json").then((res) => {
490
+ let responseData = res.data;
491
+ ElMessage.info(responseData.msg);
492
+ });
493
+ };
483
494
 
484
495
  export default {
485
496
  install(
@@ -490,6 +501,7 @@ export default {
490
501
  app.provide('$silentHiprint', silentHiprint);
491
502
 
492
503
  if(isNew) {
504
+ app.provide("$serverPrint",serverPrint)
493
505
  addInitTask(async () => {
494
506
  if (!router || !router.hasRoute('Index')) return;
495
507
  router.addRoute('Index', {
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "yh-hiprint",
3
- "version": "2.6.17",
3
+ "version": "2.6.19",
4
4
  "description": "Hiprint for Vue3 by NoahLiu in ForceCon in Hunan Changesha",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./index.ts",
9
9
  "types": "./index.ts"
10
- }
10
+ },
11
+ "./hiprint.vue": "./hiprint.vue",
12
+ "./hiprintPreview.vue": "hiprintPreview.vue"
11
13
  },
12
14
  "scripts": {
13
15
  "start": "npm run pub:aliyun && npm run pub:npm",