yh-hiprint 2.6.9 → 2.6.12

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.
@@ -999,11 +999,9 @@ onMounted(async () => {
999
999
  });
1000
1000
  </script>
1001
1001
  <style lang="scss">
1002
- @use './libs/css/hiprint.css';
1003
- @use './libs//css/print-lock.css';
1004
1002
  .hiprint-designer {
1005
1003
  width: calc(100% + 32px);
1006
- height: calc(100% - 30px);
1004
+ height: calc(100%);
1007
1005
  overflow: hidden;
1008
1006
  display: flex;
1009
1007
  flex-direction: column;
@@ -1141,13 +1139,20 @@ onMounted(async () => {
1141
1139
  }
1142
1140
  .hiprint-designer_title {
1143
1141
  padding: 0 10px;
1142
+ margin: 0;
1144
1143
  }
1145
1144
  #PrintElementOptionSetting {
1146
1145
  flex: 1;
1147
1146
  overflow: hidden;
1148
1147
  }
1149
1148
  .el-form {
1150
- padding: 10px;
1149
+ padding: 0 10px 10px;
1150
+ .el-form-item--small {
1151
+ margin-bottom: 5px;
1152
+ }
1153
+ .el-form-item__label {
1154
+ margin-bottom: 0;
1155
+ }
1151
1156
  .el-button {
1152
1157
  width: 100%;
1153
1158
  }
@@ -135,47 +135,27 @@ async function getData(query) {
135
135
  }
136
136
  }
137
137
 
138
- // 检查是否启用客户端打印
139
- const useClientPrint = localStorage.getItem('useClientPrint') === 'true';
140
-
141
- if (useClientPrint && hiprint.hiwebSocket.opened) {
142
- // 使用客户端打印
143
- loading.setText('正在连接打印客户端');
144
-
145
- // 获取打印机列表
146
- let printerList = hiprint.hiwebSocket.getPrinterList();
147
- if (!printerList || printerList.length === 0) {
148
- ElMessageBox.alert('未获取到打印机列表', '提示');
149
- return;
150
- }
151
-
152
- loading.close();
153
-
154
- // 显示打印机选择对话框
155
- showPrinterSelectionDialog(printerList, hiprintTemplate, list);
138
+ // 默认浏览器打印
139
+ let html = hiprintTemplate.getHtml(list);
140
+ if (opener && returnHtml && html[0]) {
141
+ opener.postMessage({
142
+ type: 'sendPrintHTML',
143
+ data: html[0].innerHTML,
144
+ });
145
+ ElMessageBox.alert('渲染完成!确认后返回系统').then(() => {
146
+ window.close();
147
+ });
156
148
  } else {
157
- // 默认浏览器打印
158
- let html = hiprintTemplate.getHtml(list);
159
- if (opener && returnHtml && html[0]) {
160
- opener.postMessage({
161
- type: 'sendPrintHTML',
162
- data: html[0].innerHTML,
163
- });
164
- ElMessageBox.alert('渲染完成!确认后返回系统').then(() => {
149
+ document.body.innerHTML = '';
150
+ document.body.appendChild(html[0]);
151
+ if (hasData) {
152
+ setTimeout(() => {
153
+ window.print();
154
+ }, 1000);
155
+ } else {
156
+ ElMessageBox.alert('数据源没有数据,打印将取消').then(() => {
165
157
  window.close();
166
158
  });
167
- } else {
168
- document.body.innerHTML = '';
169
- document.body.appendChild(html[0]);
170
- if (hasData) {
171
- setTimeout(() => {
172
- window.print();
173
- }, 1000);
174
- } else {
175
- ElMessageBox.alert('数据源没有数据,打印将取消').then(() => {
176
- window.close();
177
- });
178
- }
179
159
  }
180
160
  }
181
161
  success.value = false;
@@ -192,7 +172,4 @@ async function getData(query) {
192
172
  }
193
173
  }
194
174
  </script>
195
- <style lang="scss">
196
- @use './libs/css/hiprint.css';
197
- @use './libs//css/print-lock.css';
198
- </style>
175
+ <style lang="scss"></style>
@@ -1,16 +1,17 @@
1
- import {hiprint as h, defaultElementTypeProvider as p} from '../libs/hiprint.bundle.js';
1
+ import { hiprint as h, defaultElementTypeProvider as p } from '../libs/hiprint.bundle.js';
2
2
  // 调用浏览器打印js
3
3
  import '../libs/plugins/jquery.hiwprint.js';
4
4
  // 默认配置
5
5
  import '../libs/hiprint.config.js';
6
6
  // 样式
7
- import '../libs/css/hiprint.css';
8
- import {ref, computed, watch, reactive, nextTick} from 'vue';
7
+ import "../libs/css/hiprint.css";
8
+ import "../libs/css/print-lock.css";
9
+ import { ref, computed, watch, reactive, nextTick } from 'vue';
9
10
 
10
11
  export const hiprint = h;
11
12
  export const defaultElementTypeProvider = p;
12
13
 
13
- export function print(provider = defaultElementTypeProvider, template, ...args) {
14
+ export function print (provider = defaultElementTypeProvider, template, ...args) {
14
15
  hiprint.init({
15
16
  providers: [new provider()],
16
17
  });
@@ -21,7 +22,7 @@ export function print(provider = defaultElementTypeProvider, template, ...args)
21
22
  return hiprintTemplate;
22
23
  }
23
24
 
24
- export function print2(provider = defaultElementTypeProvider, template, ...args) {
25
+ export function print2 (provider = defaultElementTypeProvider, template, ...args) {
25
26
  hiprint.init({
26
27
  providers: [new provider()],
27
28
  });
@@ -32,7 +33,7 @@ export function print2(provider = defaultElementTypeProvider, template, ...args)
32
33
  return hiprintTemplate;
33
34
  }
34
35
 
35
- export function usePaper() {
36
+ export function usePaper () {
36
37
  const paperType = ref('A4');
37
38
  const paperTypeName = computed(() => {
38
39
  const paperTypeObj = paperTypesObj.find((item) => item.value === paperType.value);
@@ -46,12 +47,12 @@ export function usePaper() {
46
47
  const paperHeight = ref(296.6);
47
48
 
48
49
  const paperTypesObj = reactive([
49
- {label: 'A3', value: 'A3'},
50
- {label: 'A4', value: 'A4'},
51
- {label: 'A5', value: 'A5'},
52
- {label: 'B3', value: 'B3'},
53
- {label: 'B4', value: 'B4'},
54
- {label: 'B5', value: 'B5'},
50
+ { label: 'A3', value: 'A3' },
51
+ { label: 'A4', value: 'A4' },
52
+ { label: 'A5', value: 'A5' },
53
+ { label: 'B3', value: 'B3' },
54
+ { label: 'B4', value: 'B4' },
55
+ { label: 'B5', value: 'B5' },
55
56
  ]);
56
57
 
57
58
  const paperTypes = {
@@ -81,9 +82,9 @@ export function usePaper() {
81
82
  },
82
83
  };
83
84
 
84
- function setPaper(type, callback) {
85
+ function setPaper (type, callback) {
85
86
  if (type !== 'other') {
86
- let {width, height} = paperTypes[type];
87
+ let { width, height } = paperTypes[type];
87
88
  paperWidth.value = width;
88
89
  paperHeight.value = height;
89
90
  }
@@ -120,7 +121,7 @@ export function usePaper() {
120
121
  };
121
122
  }
122
123
 
123
- export function useScale(callback) {
124
+ export function useScale (callback) {
124
125
  const scaleValue = ref(1);
125
126
  const scalePercentage = computed(() => {
126
127
  return `${(scaleValue.value * 100).toFixed(0)}%`;
@@ -131,11 +132,11 @@ export function useScale(callback) {
131
132
  const canZoomOut = computed(() => {
132
133
  return scaleValue.value < 4;
133
134
  });
134
- function zoomIn() {
135
+ function zoomIn () {
135
136
  scaleValue.value = scaleValue.value - 0.1;
136
137
  callback();
137
138
  }
138
- function zoomOut() {
139
+ function zoomOut () {
139
140
  scaleValue.value = scaleValue.value + 0.1;
140
141
  callback();
141
142
  }
@@ -149,9 +150,9 @@ export function useScale(callback) {
149
150
  };
150
151
  }
151
152
 
152
- export function useDataSource(axios) {
153
+ export function useDataSource (axios) {
153
154
  const detailData = ref();
154
- function getDetail(id) {
155
+ function getDetail (id) {
155
156
  return axios
156
157
  .request({
157
158
  url: `/printTemplate/get/${id}`,
@@ -191,7 +192,7 @@ export function useDataSource(axios) {
191
192
  });
192
193
  const dataSourceForm = ref([]);
193
194
  const codeMapDataSource = ref({});
194
- function getDataSourceList() {
195
+ function getDataSourceList () {
195
196
  return axios
196
197
  .request({
197
198
  url: '/printTemplate/getDsList',
package/index.js CHANGED
@@ -7,7 +7,6 @@ export { default as scale } from './scale';
7
7
  export { default as zIndex } from './z-index';
8
8
  export { default as panel } from './panel';
9
9
  import { getPrintTemplate } from 'yh-hiprint/libs/index.js';
10
- import printCss from 'yh-hiprint/libs/css/print-lock.css?inline';
11
10
 
12
11
  export function guid () {
13
12
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (t) {