vue2-client 1.9.195 → 1.9.197
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/package.json +5 -5
- package/src/base-client/components/common/XPrint/Demo.vue +9 -0
- package/src/bootstrap.js +1 -1
- package/src/components/g2Charts/designer.vue +5 -1
- package/src/components/g2Charts/index.vue +3 -2
- package/src/plugins/HiPrintPlugin.js +63 -1
- package/src/router/async/router.map.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue2-client",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.197",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"test": "jest"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@afwenming123/vue-easy-tree": "^1.0.1",
|
|
22
|
+
"@afwenming123/vue-plugin-hiprint": "^0.0.65",
|
|
21
23
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
22
|
-
"@microsoft/fetch-event-source": "^2.0.1",
|
|
23
24
|
"@antv/data-set": "^0.11.8",
|
|
24
25
|
"@antv/g2plot": "^2.4.31",
|
|
25
26
|
"@hufe921/canvas-editor": "^0.9.49",
|
|
27
|
+
"@microsoft/fetch-event-source": "^2.0.1",
|
|
26
28
|
"@vue/babel-preset-jsx": "^1.4.0",
|
|
27
|
-
"@afwenming123/vue-easy-tree": "^1.0.1",
|
|
28
|
-
"@afwenming123/vue-plugin-hiprint": "^0.0.62",
|
|
29
29
|
"animate.css": "^4.1.1",
|
|
30
30
|
"ant-design-vue": "^1.7.8",
|
|
31
31
|
"axios": "^0.27.2",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"lodash.clonedeep": "^4.5.0",
|
|
48
48
|
"lodash.debounce": "^4",
|
|
49
49
|
"lodash.get": "^4.4.2",
|
|
50
|
-
"mockjs": "^1.1.0",
|
|
51
50
|
"marked": "^4",
|
|
51
|
+
"mockjs": "^1.1.0",
|
|
52
52
|
"nprogress": "^0.2.0",
|
|
53
53
|
"qs": "^6.11.2",
|
|
54
54
|
"regenerator-runtime": "^0.14.0",
|
|
@@ -15,6 +15,12 @@ export default {
|
|
|
15
15
|
},
|
|
16
16
|
printOk () {
|
|
17
17
|
console.log('打印成功')
|
|
18
|
+
},
|
|
19
|
+
test1 () {
|
|
20
|
+
this.$printB('DiagnosisCertificate', { title: '测试浏览器打印' })
|
|
21
|
+
},
|
|
22
|
+
test2 () {
|
|
23
|
+
this.$printC('DiagnosisCertificate', { title: 'DiagnosisCertificate' })
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
}
|
|
@@ -23,6 +29,9 @@ export default {
|
|
|
23
29
|
<template>
|
|
24
30
|
<div>
|
|
25
31
|
<a-button @click="print">打印</a-button>
|
|
32
|
+
<a-button @click="test1">测试打印1</a-button>
|
|
33
|
+
<a-button @click="test2">测试打印2</a-button>
|
|
34
|
+
|
|
26
35
|
<print-bill ref="print" @ok="printOk" :autoPrint="false"></print-bill>
|
|
27
36
|
</div>
|
|
28
37
|
</template>
|
package/src/bootstrap.js
CHANGED
|
@@ -15,6 +15,10 @@ defineProps({
|
|
|
15
15
|
height: {
|
|
16
16
|
type: String,
|
|
17
17
|
default: '500px'
|
|
18
|
+
},
|
|
19
|
+
isDev: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
18
22
|
}
|
|
19
23
|
})
|
|
20
24
|
|
|
@@ -169,7 +173,7 @@ defineExpose({ init, config, resetConfig })
|
|
|
169
173
|
:body-style="{maxHeight:height,height:height}">
|
|
170
174
|
<div class="custom-chart-title" v-if="config.title">{{ config.title }}</div>
|
|
171
175
|
<div class="custom-chart-desc" v-if="config.description">{{ config.description }}</div>
|
|
172
|
-
<g2Charts ref="g2ChartsRef"></g2Charts>
|
|
176
|
+
<g2Charts ref="g2ChartsRef" :isDev="isDev"></g2Charts>
|
|
173
177
|
</a-card>
|
|
174
178
|
</a-col>
|
|
175
179
|
<a-col :span="8">
|
|
@@ -137,8 +137,9 @@ const init = (config = {}, requestParameters = {}) => {
|
|
|
137
137
|
}))
|
|
138
138
|
|
|
139
139
|
const sanitizedParams = JSON.parse(JSON.stringify({
|
|
140
|
-
|
|
141
|
-
chartsConfigArray: undefined
|
|
140
|
+
conditionParams: {},
|
|
141
|
+
chartsConfigArray: undefined,
|
|
142
|
+
...requestParameters
|
|
142
143
|
}))
|
|
143
144
|
|
|
144
145
|
// 验证通过后进行数据请求和图表渲染
|
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
hiprint,
|
|
5
5
|
defaultElementTypeProvider,
|
|
6
6
|
} from '@afwenming123/vue-plugin-hiprint'
|
|
7
|
+
import { getConfigByNameAsync } from '@vue2-client/services/api/common'
|
|
8
|
+
import hiPrintCss from '@vue2-client/base-client/components/common/XPrint/css/hiPrintCss'
|
|
7
9
|
|
|
8
10
|
const hiPrintPlugin = {
|
|
9
11
|
disAutoConnect,
|
|
10
12
|
install: function (Vue, autoConnect = true, name = '$hiPrint') {
|
|
11
|
-
console.log('开始注册插件了')
|
|
12
13
|
if (!autoConnect) {
|
|
13
14
|
disAutoConnect()
|
|
14
15
|
}
|
|
@@ -48,6 +49,67 @@ const hiPrintPlugin = {
|
|
|
48
49
|
hiprintTemplate.print2(...args)
|
|
49
50
|
return hiprintTemplate
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* 通用打印方法
|
|
54
|
+
* @param {string} templateName 模板名称
|
|
55
|
+
* @param {object} printData 打印数据
|
|
56
|
+
* @param {boolean} isClient 是否客户端打印
|
|
57
|
+
*/
|
|
58
|
+
const _commonPrint = async function (templateName, printData, isClient = false) {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
try {
|
|
61
|
+
getConfigByNameAsync(templateName).then((template) => {
|
|
62
|
+
if (!template) {
|
|
63
|
+
this.$message.error(`${templateName} 打印模板不存在`)
|
|
64
|
+
reject(new Error(`${templateName} 打印模板不存在`))
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
hiprint.init({
|
|
68
|
+
// eslint-disable-next-line new-cap
|
|
69
|
+
providers: [new defaultElementTypeProvider()]
|
|
70
|
+
})
|
|
71
|
+
const hiprintTemplate = new hiprint.PrintTemplate({
|
|
72
|
+
template: template,
|
|
73
|
+
})
|
|
74
|
+
const printMethod = isClient ? 'print2' : 'print'
|
|
75
|
+
if (isClient) {
|
|
76
|
+
console.log(hiprintTemplate.getPrinterList())
|
|
77
|
+
}
|
|
78
|
+
hiprintTemplate[printMethod](printData, {}, {
|
|
79
|
+
callback: () => {
|
|
80
|
+
resolve(hiprintTemplate)
|
|
81
|
+
},
|
|
82
|
+
styleHandler: () => {
|
|
83
|
+
return hiPrintCss()
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}).catch((error) => {
|
|
87
|
+
reject(error)
|
|
88
|
+
})
|
|
89
|
+
} catch (error) {
|
|
90
|
+
reject(error)
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 浏览器打印
|
|
97
|
+
*/
|
|
98
|
+
globalVue.$printB = async function (templateName, printData) {
|
|
99
|
+
return _commonPrint(templateName, printData, false)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 客户端打印
|
|
104
|
+
*/
|
|
105
|
+
globalVue.$printC = async function (templateName, printData) {
|
|
106
|
+
if (window.hiwebSocket.opened) {
|
|
107
|
+
return _commonPrint(templateName, printData, true)
|
|
108
|
+
} else {
|
|
109
|
+
this.$message.error('请确保打印服务已经启动')
|
|
110
|
+
return Promise.reject(new Error('客户端打印失败,未连接打印服务'))
|
|
111
|
+
}
|
|
112
|
+
}
|
|
51
113
|
}
|
|
52
114
|
}
|
|
53
115
|
|
|
@@ -86,7 +86,7 @@ routerResource.example = {
|
|
|
86
86
|
// component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
|
|
87
87
|
// component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
|
|
88
88
|
// component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
|
|
89
|
-
component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
|
|
89
|
+
// component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
|
|
90
90
|
// component: () => import('@vue2-client/base-client/components/common/XDatePicker/demo.vue'),
|
|
91
91
|
// component: () => import('@vue2-client/base-client/components/common/XTab/XTabDemo.vue'),
|
|
92
92
|
// component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
|
|
@@ -95,7 +95,7 @@ routerResource.example = {
|
|
|
95
95
|
// component: () => import('@vue2-client/base-client/components/common/XButtons/XButtonDemo.vue'),
|
|
96
96
|
// component: () => import('@vue2-client/base-client/components/common/XLabelSelect/XLabelSelectDemo.vue'),
|
|
97
97
|
// component: () => import('@vue2-client/base-client/components/common/XCheckList/XCheckList.vue'),
|
|
98
|
-
|
|
98
|
+
component: () => import('@vue2-client/base-client/components/common/XPrint/Demo.vue'),
|
|
99
99
|
// component: () => import('@vue2-client/base-client/components/AI/demo.vue'),
|
|
100
100
|
// component: () => import('@vue2-client/components/g2Charts/demo.vue'),
|
|
101
101
|
meta: {
|