cnhis-design-vue 3.3.3-beta.60 → 3.3.3-beta.62

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.
@@ -535,18 +535,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
535
535
  };
536
536
  const callLocalServicesErrorCb = (res) => {
537
537
  toggleExpandLoading(false);
538
+ let info = {
539
+ formatId: state.currentFormatId,
540
+ templateId: getTemplateIdByFormatId.value,
541
+ templateCode: getTemplateCodeByFormatId.value
542
+ };
538
543
  encapBrowserLog({
539
544
  type: "\u8FDB\u5165\u5931\u8D25\u7684\u56DE\u8C03",
540
545
  res
541
546
  }, "PRINT-SDK");
542
- emit("error", res);
547
+ emit("error", res, info);
543
548
  if (isObject(res) && res.type === "notInstalledApp") {
544
549
  $message.error(res.message);
545
550
  }
546
551
  };
547
552
  const callLocalServicesCancelCb = (res) => {
548
553
  toggleExpandLoading(false);
549
- emit("cancel", res);
554
+ let info = {
555
+ formatId: state.currentFormatId,
556
+ templateId: getTemplateIdByFormatId.value,
557
+ templateCode: getTemplateCodeByFormatId.value
558
+ };
559
+ emit("cancel", res, info);
550
560
  };
551
561
  const prevFnError = (type) => {
552
562
  const error = {
@@ -561,7 +571,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
561
571
  type,
562
572
  preExecution: true
563
573
  };
564
- emit("error", error);
574
+ let info = {
575
+ formatId: state.currentFormatId,
576
+ templateId: getTemplateIdByFormatId.value,
577
+ templateCode: getTemplateCodeByFormatId.value
578
+ };
579
+ emit("error", error, info);
565
580
  };
566
581
  const getPrintParams = () => {
567
582
  return JSON.stringify({
@@ -274,14 +274,22 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
274
274
  };
275
275
  const callLocalServicesErrorCb = (res) => {
276
276
  state.spinning = false;
277
- emit("error", res);
277
+ let info = {
278
+ formatId: state.currentFormatId,
279
+ templateId: getTemplateIdByFormatId.value
280
+ };
281
+ emit("error", res, info);
278
282
  if (isObject(res) && res.type === "notInstalledApp") {
279
283
  $message.error(res.message);
280
284
  }
281
285
  };
282
286
  const callLocalServicesCancelCb = (res) => {
283
287
  state.spinning = false;
284
- emit("cancel", res);
288
+ let info = {
289
+ formatId: state.currentFormatId,
290
+ templateId: getTemplateIdByFormatId.value
291
+ };
292
+ emit("cancel", res, info);
285
293
  };
286
294
  const prevFnError = (type) => {
287
295
  const error = {
@@ -296,7 +304,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
296
304
  type,
297
305
  preExecution: true
298
306
  };
299
- emit("error", error);
307
+ let info = {
308
+ formatId: state.currentFormatId,
309
+ templateId: getTemplateIdByFormatId.value
310
+ };
311
+ emit("error", error, info);
300
312
  };
301
313
  const getPrintParams = (index = 0) => {
302
314
  var _a2;
@@ -25,7 +25,7 @@ export declare class Print {
25
25
  private readonly messageHandlerQueue;
26
26
  private messageHandler;
27
27
  private _initDomesticSystem;
28
- private createQueueProgressNotifyCss;
28
+ private renderQueueProgressNotifyContent;
29
29
  getPicAndUpload(obj: any): Promise<void>;
30
30
  private postMessage;
31
31
  messageCollect(id: string, data: AnyObject): Promise<unknown>;
@@ -3,8 +3,8 @@ import { cloneDeep, isArray } from 'lodash-es';
3
3
  import { IdentityVerificationDialog, PreviewDialog } from './dialog.js';
4
4
  import { isIReport, getFileUrl, useBrowserPrint } from './browserPrint.js';
5
5
  import { h, getCurrentInstance } from 'vue';
6
- import { createDiscreteApi, NIcon, NProgress } from 'naive-ui';
7
- import { ReloadOutline } from '@vicons/ionicons5';
6
+ import { createDiscreteApi, NIcon, NProgress, NDivider } from 'naive-ui';
7
+ import { PrintOutline } from '@vicons/ionicons5';
8
8
  import { uuidGenerator } from '../../../../shared/utils/index.js';
9
9
  import { format } from 'date-fns';
10
10
  import { io } from 'socket.io-client';
@@ -73,7 +73,8 @@ class Print {
73
73
  this.CMonitor = _window.$CMonitor;
74
74
  this._notifyPrintQueueMap = {
75
75
  data: /* @__PURE__ */ new Map(),
76
- callback: /* @__PURE__ */ new Map()
76
+ callback: /* @__PURE__ */ new Map(),
77
+ dom: null
77
78
  };
78
79
  try {
79
80
  this.webview = _window.top ? (_a = _window.top.chrome) == null ? void 0 : _a.webview : (_b = _window.chrome) == null ? void 0 : _b.webview;
@@ -134,45 +135,14 @@ class Print {
134
135
  const currentV = (ext == null ? void 0 : ext.currentcount) || 0;
135
136
  const totalV = (ext == null ? void 0 : ext.totalcount) || 0;
136
137
  if (curUidDom) {
137
- const value = totalV ? parseInt((100 * currentV / totalV).toString()) : 0;
138
- curUidDom.content = () => h("div", {}, [h("div", {
139
- style: {
140
- display: "flex",
141
- alignItems: "center",
142
- fontSize: "12px",
143
- marginBottom: "8px"
144
- }
145
- }, [h(NIcon, {
146
- color: "#0e7a0d",
147
- size: 12,
148
- component: ReloadOutline,
149
- style: {
150
- animation: "rotateQueueProgressNotify 1s linear infinite",
151
- willChange: "transform",
152
- backfaceVisibility: "hidden"
153
- }
154
- }), h("span", {
155
- style: {
156
- color: "#0e7a0d",
157
- marginLeft: "4px",
158
- marginRight: "8px"
159
- }
160
- }, "\u6B63\u5728\u6253\u5370\u4E2D..."), h("span", {}, `${value}%`)]), h(NProgress, {
161
- type: "line",
162
- strokeWidth: 2,
163
- percentage: value,
164
- showIndicator: false,
165
- processing: value < 100 ? true : false
166
- }), h("div", {
167
- style: {
168
- marginTop: "6px",
169
- fontSize: "12px"
170
- }
171
- }, `\u5DF2\u5B8C\u6210${currentV}\u6761\uFF0C\u5171${totalV}\u6761`)]);
172
- if (value >= 100) {
138
+ curUidDom.currentV = currentV;
139
+ curUidDom.totalV = totalV;
140
+ curUidDom.progressValue = totalV ? parseInt((100 * currentV / totalV).toString()) : 0;
141
+ this.renderQueueProgressNotifyContent();
142
+ if (curUidDom.progressValue >= 100) {
173
143
  this._notifyPrintQueueMap.data.delete(ext == null ? void 0 : ext.uuid);
174
144
  setTimeout(() => {
175
- curUidDom == null ? void 0 : curUidDom.destroy();
145
+ this.renderQueueProgressNotifyContent();
176
146
  }, 800);
177
147
  }
178
148
  }
@@ -259,23 +229,95 @@ class Print {
259
229
  cb && cb(false);
260
230
  }
261
231
  }
262
- createQueueProgressNotifyCss() {
263
- const notifyStyleDom = document.getElementById("queueProgressNotifyCss");
264
- if (notifyStyleDom)
232
+ renderQueueProgressNotifyContent() {
233
+ const clearNotifyDom = () => {
234
+ this._notifyPrintQueueMap.dom.destroy();
235
+ this._notifyPrintQueueMap.data.clear();
236
+ this._notifyPrintQueueMap.dom = null;
237
+ };
238
+ if (!this._notifyPrintQueueMap.dom) {
239
+ this._notifyPrintQueueMap.dom = notification.create({
240
+ title: "\u6253\u5370\u5217\u8868",
241
+ onClose: () => {
242
+ clearNotifyDom();
243
+ }
244
+ });
245
+ }
246
+ if (this._notifyPrintQueueMap.data.size > 0) {
247
+ const childrens = [];
248
+ const keys = Array.from(this._notifyPrintQueueMap.data.keys());
249
+ const lastKey = keys[keys.length - 1];
250
+ for (const [key, value] of this._notifyPrintQueueMap.data) {
251
+ const dom = h("div", {
252
+ style: {
253
+ boxSizing: "border-box",
254
+ marginBottom: lastKey === key ? 0 : "12px",
255
+ display: "flex",
256
+ flexDirection: "column"
257
+ }
258
+ }, [h("div", {
259
+ style: {
260
+ display: "flex",
261
+ alignItems: "center",
262
+ justifyContent: "between-space",
263
+ overflow: "hidden",
264
+ marginBottom: "4px"
265
+ }
266
+ }, [h(NIcon, {
267
+ size: 16,
268
+ component: PrintOutline,
269
+ style: {
270
+ marginRight: "4px"
271
+ }
272
+ }), h("span", {
273
+ style: {
274
+ flex: 1,
275
+ fontSize: "14px",
276
+ fontWeight: 700,
277
+ marginRight: "6px",
278
+ overflow: "hidden",
279
+ whiteSpace: "noWrap",
280
+ textOverflow: "ellipsis"
281
+ }
282
+ }, value.printname), h("span", {
283
+ style: {
284
+ fontSize: "12px",
285
+ color: "rgba(30, 30, 30, 0.60)"
286
+ }
287
+ }, `${value.progressValue}%`)]), h(NProgress, {
288
+ type: "line",
289
+ strokeWidth: 2,
290
+ percentage: value.progressValue,
291
+ showIndicator: false,
292
+ processing: true
293
+ }), h("div", {
294
+ style: {
295
+ marginTop: "6px",
296
+ display: "flex",
297
+ alignItems: "center",
298
+ fontSize: "12px",
299
+ color: "rgba(30, 30, 30, 0.60)"
300
+ }
301
+ }, [h("span", {}, "\u7B2C"), h("span", {
302
+ style: {
303
+ color: "#FF0000"
304
+ }
305
+ }, value.currentV), h("span", {}, "\u4EFD/\u5171"), h("span", {
306
+ style: {
307
+ color: "#FF0000"
308
+ }
309
+ }, value.totalV), h("span", {}, "\u4EFD")]), lastKey === key ? null : h(NDivider, {
310
+ style: {
311
+ marginTop: "12px",
312
+ marginBottom: 0
313
+ }
314
+ })]);
315
+ childrens.push(dom);
316
+ }
317
+ this._notifyPrintQueueMap.dom.content = () => childrens;
265
318
  return;
266
- const style = document.createElement("style");
267
- style.textContent = `
268
- @keyframes rotateQueueProgressNotify {
269
- from {
270
- transform: rotate(0deg);
271
- }
272
- to {
273
- transform: rotate(360deg);
274
- }
275
- }
276
- `;
277
- style.id = "queueProgressNotifyCss";
278
- document.head.appendChild(style);
319
+ }
320
+ clearNotifyDom();
279
321
  }
280
322
  async getPicAndUpload(obj) {
281
323
  try {
@@ -1088,48 +1130,14 @@ class Print {
1088
1130
  }
1089
1131
  if (uuid && printname) {
1090
1132
  if (isShowQueueProgressNotify) {
1091
- this.createQueueProgressNotifyCss();
1092
- const notifyDom = notification.create({
1093
- title: `${printname}`,
1094
- content: () => h("div", {}, [h("div", {
1095
- style: {
1096
- display: "flex",
1097
- alignItems: "center",
1098
- fontSize: "12px",
1099
- marginBottom: "8px"
1100
- }
1101
- }, [h(NIcon, {
1102
- color: "#0e7a0d",
1103
- size: 12,
1104
- component: ReloadOutline,
1105
- style: {
1106
- animation: "rotateQueueProgressNotify 1s linear infinite",
1107
- willChange: "transform",
1108
- backfaceVisibility: "hidden"
1109
- }
1110
- }), h("span", {
1111
- style: {
1112
- color: "#0e7a0d",
1113
- marginLeft: "4px",
1114
- marginRight: "8px"
1115
- }
1116
- }, "\u6B63\u5728\u6253\u5370\u4E2D..."), h("span", {}, "0%")]), h(NProgress, {
1117
- type: "line",
1118
- strokeWidth: 2,
1119
- percentage: 0,
1120
- showIndicator: false,
1121
- processing: true
1122
- }), h("div", {
1123
- style: {
1124
- marginTop: "6px",
1125
- fontSize: "12px"
1126
- }
1127
- }, `\u5DF2\u5B8C\u62100\u6761\uFF0C\u5171${paramsArr.length}\u6761`)]),
1128
- onClose: () => {
1129
- this._notifyPrintQueueMap.data.delete(uuid);
1130
- }
1133
+ this._notifyPrintQueueMap.data.set(uuid, {
1134
+ printname,
1135
+ uuid,
1136
+ currentV: 0,
1137
+ totalV: paramsArr.length,
1138
+ progressValue: 0
1131
1139
  });
1132
- this._notifyPrintQueueMap.data.set(uuid, notifyDom);
1140
+ this.renderQueueProgressNotifyContent();
1133
1141
  }
1134
1142
  this._notifyPrintQueueMap.callback.set(uuid, printQueueCallbackFn);
1135
1143
  }
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.3.3-beta.60";
2
+ var version = "3.3.3-beta.62";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.3.3-beta.60",
3
+ "version": "3.3.3-beta.62",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -74,5 +74,5 @@
74
74
  "iOS 7",
75
75
  "last 3 iOS versions"
76
76
  ],
77
- "gitHead": "6265446918240d469c5c48024d404c3495d01429"
77
+ "gitHead": "5e472ae10b431508c5ae65ad1db0da928cdcc0d1"
78
78
  }