yh-hiprint 2.6.3 → 2.6.5

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.
@@ -37,13 +37,13 @@
37
37
  v-model="paperWidth"
38
38
  type="number">
39
39
  <template #prepend>宽</template>
40
- <template #append>px</template>
40
+ <template #append>mm</template>
41
41
  </el-input>
42
42
  <el-input
43
43
  v-model="paperHeight"
44
44
  type="number">
45
45
  <template #prepend>高</template>
46
- <template #append>px</template>
46
+ <template #append>mm</template>
47
47
  </el-input>
48
48
  <el-button
49
49
  type="primary"
@@ -766,7 +766,6 @@ function tableColumnCancel() {
766
766
  function init() {
767
767
  try {
768
768
  hiprint.init({
769
- host: 'http://localhost:17521',
770
769
  providers: [new defaultElementTypeProvider()],
771
770
  });
772
771
  hiprint.setConfig();
@@ -917,7 +916,7 @@ async function updateTemplate(code) {
917
916
  let {width, height} = jsonObj.panels[0];
918
917
  paperWidth.value = width;
919
918
  paperHeight.value = height;
920
- hiprintTemplate.value?.setPaper(width, height);
919
+ setPaperHandler('other');
921
920
  scaleValue.value = 1;
922
921
  } else {
923
922
  hiprintTemplate.value?.update({
@@ -938,11 +937,22 @@ async function updateTemplate(code) {
938
937
  });
939
938
  paperWidth.value = 210;
940
939
  paperHeight.value = 297;
941
- hiprintTemplate.value?.setPaper(210, 297);
940
+ setPaperHandler('other');
942
941
  scaleValue.value = 1;
943
942
  }
944
943
  } else {
945
944
  await getDetail(code);
945
+ if (detailData.value && detailData.value.json) {
946
+ let jsonObj = JSON.parse(detailData.value.json);
947
+ let {width, height} = jsonObj.panels[0];
948
+ paperWidth.value = width;
949
+ paperHeight.value = height;
950
+ setPaperHandler('other');
951
+ } else {
952
+ paperWidth.value = 210;
953
+ paperHeight.value = 297;
954
+ setPaperHandler('other');
955
+ }
946
956
  init();
947
957
  }
948
958
  updateing = false;
@@ -989,6 +999,8 @@ onMounted(async () => {
989
999
  });
990
1000
  </script>
991
1001
  <style lang="scss">
1002
+ @use './libs/css/hiprint.css';
1003
+ @use './libs//css/print-lock.css';
992
1004
  .hiprint-designer {
993
1005
  width: calc(100% + 32px);
994
1006
  height: calc(100% - 30px);
@@ -1079,6 +1091,9 @@ onMounted(async () => {
1079
1091
  overflow: hidden;
1080
1092
  .el-scrollbar__view {
1081
1093
  padding: 20px 10px 40px 20px;
1094
+ #hiprint-printTemplate {
1095
+ position: relative;
1096
+ }
1082
1097
  }
1083
1098
  }
1084
1099
  &_right {
@@ -192,4 +192,7 @@ async function getData(query) {
192
192
  }
193
193
  }
194
194
  </script>
195
- <style lang="scss"></style>
195
+ <style lang="scss">
196
+ @use './libs/css/hiprint.css';
197
+ @use './libs//css/print-lock.css';
198
+ </style>
package/index.js CHANGED
@@ -309,7 +309,7 @@ const showPrinterSelectionDialog = (printerList, templateJson, templateData, tem
309
309
  // window.silentHiprint = silentHiprint;
310
310
 
311
311
  export default {
312
- install (app, { router, pinia, isAdmin, clientPrint = false, clientUrl = 'http://localhost:17521', clientApp = "https://gitee.com/CcSimple/electron-hiprint/releases" }) {
312
+ install (app, { router, pinia, isAdmin, clientPrint = false, clientUrl = 'http://localhost:17521', clientApp = "https://gitee.com/CcSimple/electron-hiprint/releases", clinetTip = false }) {
313
313
  app.provide('$hiprint', hiprintFun);
314
314
  app.provide('$silentHiprint', silentHiprint);
315
315
 
@@ -320,20 +320,21 @@ export default {
320
320
  if (hiprint.hiwebSocket && !hiprint.hiwebSocket.opened) {
321
321
  window.hiwebSocket.host = clientUrl;
322
322
  hiprint.hiwebSocket.start();
323
-
324
- // 添加连接状态检查和提示逻辑
325
- setTimeout(() => {
326
- if (!hiprint.hiwebSocket.opened) {
327
- ElMessageBox.alert(
328
- `连接【${clientUrl}】失败!<br>请确保已<a href="${clientApp}" target="_blank">下载</a>并<a href="hiprint://" target="_blank">运行</a>打印客户端!`,
329
- '客户端未连接',
330
- {
331
- dangerouslyUseHTMLString: true,
332
- confirmButtonText: '确定'
333
- }
334
- );
335
- }
336
- }, 3000);
323
+ if (clinetTip) {
324
+ // 添加连接状态检查和提示逻辑
325
+ setTimeout(() => {
326
+ if (!hiprint.hiwebSocket.opened) {
327
+ ElMessageBox.alert(
328
+ `连接【${clientUrl}】失败!<br>请确保已<a href="${clientApp}" target="_blank">下载</a>并<a href="hiprint://" target="_blank">运行</a>打印客户端!`,
329
+ '客户端未连接',
330
+ {
331
+ dangerouslyUseHTMLString: true,
332
+ confirmButtonText: '确定'
333
+ }
334
+ );
335
+ }
336
+ }, 3000);
337
+ }
337
338
  }
338
339
  };
339
340
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yh-hiprint",
3
- "version": "2.6.3",
3
+ "version": "2.6.5",
4
4
  "description": "Hiprint for Vue3 by NoahLiu in ForceCon in Hunan Changesha",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",