cnhis-design-vue 3.0.4 → 3.0.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.
package/es/index.js CHANGED
@@ -45158,14 +45158,12 @@ var script = /* @__PURE__ */ defineComponent({
45158
45158
  previewText: { type: String, required: false, default: "\u6253\u5370\u9884\u89C8" },
45159
45159
  formatEditText: { type: String, required: false, default: "\u683C\u5F0F\u7F16\u8F91" },
45160
45160
  identityVerificationTitle: { type: String, required: false, default: "\u6253\u5370\u670D\u52A1\u8EAB\u4EFD\u6821\u9A8C" },
45161
- params: { type: Array, required: true },
45162
- hisParams: { type: null, required: true },
45161
+ params: { type: Array, required: false, default: () => [] },
45163
45162
  prevFn: { type: Function, required: false, default: () => Promise.resolve() },
45164
45163
  verifyUser: { type: Function, required: false, default: () => Promise.resolve() },
45165
45164
  queryPrintFormatByNumber: { type: Function, required: true, default: () => Promise.resolve({}) },
45166
45165
  queryTemplateParams: { type: Function, required: false, default: () => Promise.resolve({}) },
45167
- strategy: { type: String, required: false, default: "MULTI" },
45168
- versionType: { type: [Number, String], required: false, default: "2" }
45166
+ strategy: { type: String, required: false, default: "MULTI" }
45169
45167
  },
45170
45168
  emits: ["success", "error"],
45171
45169
  setup(__props, { emit }) {
@@ -45206,7 +45204,7 @@ var script = /* @__PURE__ */ defineComponent({
45206
45204
  let id = state.currentFormatId;
45207
45205
  return state.formatList.find((item) => item.id === id);
45208
45206
  });
45209
- const formatTitle = computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
45207
+ computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
45210
45208
  const getTemplateIdByFormatId = (id) => {
45211
45209
  let find = state.formatList.find((item) => item.id === id);
45212
45210
  return find.templateId;
@@ -45228,34 +45226,6 @@ var script = /* @__PURE__ */ defineComponent({
45228
45226
  };
45229
45227
  emit("error", error);
45230
45228
  };
45231
- const getHisParams = (index = 0) => {
45232
- const { reportid = "280" } = props.hisParams;
45233
- const { id, name } = state.templateParams;
45234
- return {
45235
- reportid,
45236
- formatid: state.currentFormatId || id,
45237
- formatname: name,
45238
- param: props.params[index]
45239
- };
45240
- };
45241
- const getOnceHisParams = () => {
45242
- const { reportid = "280" } = props.hisParams;
45243
- const { id, name } = state.templateParams;
45244
- const obj = {};
45245
- Object.keys(props.params[0]).forEach((v) => {
45246
- obj[v] = [];
45247
- props.params.forEach((k) => {
45248
- obj[v].push(k[v]);
45249
- });
45250
- obj[v] = obj[v].join(",");
45251
- });
45252
- return {
45253
- reportid,
45254
- formatid: state.currentFormatId || id,
45255
- formatname: name,
45256
- param: obj
45257
- };
45258
- };
45259
45229
  const getPrintParams = (index = 0) => {
45260
45230
  const params = state.printParams[index];
45261
45231
  return JSON.stringify(params);
@@ -45299,49 +45269,26 @@ var script = /* @__PURE__ */ defineComponent({
45299
45269
  prevFnError();
45300
45270
  return Promise.reject();
45301
45271
  }).then(() => {
45302
- if (props.versionType == 1 || props.versionType == 3) {
45303
- const printFn = props.versionType == 1 ? "handleHisPrint" : "handleOldHisPrint";
45304
- if (props.strategy === "MULTI") {
45305
- for (let i = 0; i < props.params.length; i++) {
45306
- const params = getHisParams(i);
45307
- printInstance[printFn](7, params).then((res) => {
45308
- console.log(res, "777777777777");
45309
- }).catch((error) => {
45310
- console.log(error, "error777");
45311
- });
45312
- }
45313
- }
45314
- else {
45315
- const params = getOnceHisParams();
45316
- printInstance[printFn](7, params).then((res) => {
45317
- console.log(res, "777777777777");
45318
- }).catch((error) => {
45319
- console.log(error, "error777");
45320
- });
45321
- }
45322
- }
45323
- else {
45324
- if (props.strategy === "MULTI") {
45325
- for (let i = 0; i < state.printParams.length; i++) {
45326
- const queryParams = {
45327
- formatId: state.currentFormatId,
45328
- templateId: getTemplateIdByFormatId(state.currentFormatId),
45329
- params: getPrintParams(i)
45330
- };
45331
- printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
45332
- }
45333
- }
45334
- else {
45272
+ if (props.strategy === "MULTI") {
45273
+ for (let i = 0; i < state.printParams.length; i++) {
45335
45274
  const queryParams = {
45336
45275
  formatId: state.currentFormatId,
45337
45276
  templateId: getTemplateIdByFormatId(state.currentFormatId),
45338
- params: getOnceParams()
45277
+ params: getPrintParams(i)
45339
45278
  };
45340
- printInstance.printDirect(queryParams, (res) => {
45341
- callLocalServicesSuccessCb(res, "print");
45342
- }, callLocalServicesErrorCb);
45279
+ printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
45343
45280
  }
45344
45281
  }
45282
+ else {
45283
+ const queryParams = {
45284
+ formatId: state.currentFormatId,
45285
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
45286
+ params: getOnceParams()
45287
+ };
45288
+ printInstance.printDirect(queryParams, (res) => {
45289
+ callLocalServicesSuccessCb(res, "print");
45290
+ }, callLocalServicesErrorCb);
45291
+ }
45345
45292
  }).finally(() => {
45346
45293
  state.visible = false;
45347
45294
  });
@@ -45351,26 +45298,15 @@ var script = /* @__PURE__ */ defineComponent({
45351
45298
  prevFnError();
45352
45299
  return Promise.reject();
45353
45300
  }).then(() => {
45354
- if (props.versionType == 1 || props.versionType == 3) {
45355
- const params = props.strategy === "MULTI" ? getHisParams() : getOnceHisParams();
45356
- const printFn = props.versionType == 1 ? "handleHisPrint" : "handleOldHisPrint";
45357
- printInstance[printFn](8, params).then((res) => {
45358
- console.log(res, 88888888);
45359
- }).catch((error) => {
45360
- console.log(error, "error888");
45361
- });
45362
- }
45363
- else {
45364
- const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
45365
- const queryParams = {
45366
- formatId: state.currentFormatId,
45367
- templateId: getTemplateIdByFormatId(state.currentFormatId),
45368
- params
45369
- };
45370
- printInstance.preview(queryParams, (res) => {
45371
- callLocalServicesSuccessCb(res, "preview");
45372
- }, callLocalServicesErrorCb);
45373
- }
45301
+ const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
45302
+ const queryParams = {
45303
+ formatId: state.currentFormatId,
45304
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
45305
+ params
45306
+ };
45307
+ printInstance.preview(queryParams, (res) => {
45308
+ callLocalServicesSuccessCb(res, "preview");
45309
+ }, callLocalServicesErrorCb);
45374
45310
  }).finally(() => {
45375
45311
  state.visible = false;
45376
45312
  });
@@ -45380,18 +45316,7 @@ var script = /* @__PURE__ */ defineComponent({
45380
45316
  prevFnError();
45381
45317
  return Promise.reject();
45382
45318
  }).then(() => {
45383
- if (props.versionType == 1 || props.versionType == 3) {
45384
- const params = props.strategy === "MULTI" ? getHisParams() : getOnceHisParams();
45385
- const printFn = props.versionType == 1 ? "handleHisPrint" : "handleOldHisPrint";
45386
- printInstance[printFn](9, params).then((res) => {
45387
- console.log(res, 999999);
45388
- }).catch((error) => {
45389
- console.log(error, "error999");
45390
- });
45391
- }
45392
- else {
45393
- state.identityVerification.visible = true;
45394
- }
45319
+ state.identityVerification.visible = true;
45395
45320
  }).finally(() => {
45396
45321
  state.visible = false;
45397
45322
  });
@@ -45436,25 +45361,6 @@ var script = /* @__PURE__ */ defineComponent({
45436
45361
  let findDefault = list.find((item) => item[key] == 1);
45437
45362
  return findDefault?.id || list[0].id;
45438
45363
  };
45439
- const setOptions = () => {
45440
- const children = state.formatList.map((v) => {
45441
- return {
45442
- label: v.name,
45443
- key: v.id
45444
- };
45445
- });
45446
- options.unshift({
45447
- label: formatTitle.value,
45448
- key: "format",
45449
- children
45450
- });
45451
- };
45452
- const initHIS = (formatListResult) => {
45453
- state.formatList = formatListResult ? formatListResult.list.filter((item) => item.printmark == 1) : [];
45454
- setOptions();
45455
- state.currentFormatId = getDefaultFormatId(state.formatList, "printmark");
45456
- state.templateParams = state.formatList[0];
45457
- };
45458
45364
  const formatFormatList = (list) => {
45459
45365
  let formatList = [];
45460
45366
  list.forEach((item) => {
@@ -45518,7 +45424,7 @@ var script = /* @__PURE__ */ defineComponent({
45518
45424
  };
45519
45425
  const initCRM = async (formatListResult) => {
45520
45426
  state.formatList = formatListResult ? formatFormatList(formatListResult.obj) : [];
45521
- setOptions();
45427
+ console.log("formatListResult", formatListResult);
45522
45428
  state.currentFormatId = getDefaultFormatId(state.formatList, "defaultFlag");
45523
45429
  if (!state.currentFormatId) {
45524
45430
  window.$message.error("\u83B7\u53D6\u6253\u5370\u683C\u5F0F\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01");
@@ -45544,12 +45450,7 @@ var script = /* @__PURE__ */ defineComponent({
45544
45450
  setTimeoutSpin();
45545
45451
  instantiatePrintSDK();
45546
45452
  const formatListResult = await props.queryPrintFormatByNumber();
45547
- if (props.versionType == 1 || props.versionType == 3) {
45548
- initHIS(formatListResult);
45549
- }
45550
- else {
45551
- await initCRM(formatListResult);
45552
- }
45453
+ await initCRM(formatListResult);
45553
45454
  setLoaded();
45554
45455
  return true;
45555
45456
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.0.4",
4
+ "version": "3.0.5",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
7
7
  "scripts": {
@@ -58,17 +58,15 @@ interface Props {
58
58
  previewText?: string
59
59
  formatEditText?: string
60
60
  identityVerificationTitle?: string
61
- params: any[],
62
- hisParams: any
61
+ params?: any[],
63
62
  prevFn?: Function
64
63
  verifyUser?: Function
65
64
  queryPrintFormatByNumber: Function
66
65
  queryTemplateParams?: Function
67
66
  strategy?: string
68
- versionType?: number | string
69
67
  }
70
68
  const props = withDefaults(defineProps<Props>(), {
71
- // baseUrl: '',
69
+ params: () => ([]),
72
70
  btnText: '打印',
73
71
  printText: '直接打印',
74
72
  previewText: '打印预览',
@@ -79,7 +77,6 @@ const props = withDefaults(defineProps<Props>(), {
79
77
  queryPrintFormatByNumber: () => Promise.resolve({}),
80
78
  queryTemplateParams: () => Promise.resolve({}),
81
79
  strategy: 'MULTI',
82
- versionType: '2'
83
80
  });
84
81
  const emit = defineEmits(['success', 'error']);
85
82
 
@@ -140,34 +137,6 @@ const prevFnError = () => {
140
137
  };
141
138
  emit('error', error);
142
139
  }
143
- const getHisParams = (index: number = 0) => {
144
- const { reportid = '280' } = (props.hisParams as any);
145
- const { id, name } = (state.templateParams as any);
146
- return {
147
- reportid,
148
- formatid: state.currentFormatId || id,
149
- formatname: name,
150
- param: props.params[index]
151
- };
152
- }
153
- const getOnceHisParams = () => {
154
- const { reportid = '280' } = (props.hisParams as any);
155
- const { id, name } = (state.templateParams as any);
156
- const obj: any = {}
157
- Object.keys((props.params as any)[0]).forEach(v => {
158
- obj[v] = [];
159
- props.params.forEach((k: any) => {
160
- obj[v].push(k[v]);
161
- });
162
- obj[v] = obj[v].join(',');
163
- });
164
- return {
165
- reportid,
166
- formatid: state.currentFormatId || id,
167
- formatname: name,
168
- param: obj
169
- };
170
- }
171
140
  const getPrintParams = (index: number = 0) => {
172
141
  const params = state.printParams[index];
173
142
  return JSON.stringify(params);
@@ -215,55 +184,30 @@ const handleClickPrint = () => {
215
184
  return Promise.reject();
216
185
  })
217
186
  .then(() => {
218
- if (props.versionType == 1 || props.versionType == 3) {
219
- const printFn = props.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
220
- if (props.strategy === 'MULTI') {
221
- for (let i = 0; i < props.params.length; i++) {
222
- const params = getHisParams(i);
223
- printInstance[printFn](7, params)
224
- .then((res: any) => {
225
- console.log(res, '777777777777');
226
- })
227
- .catch((error:any) => {
228
- console.log(error, 'error777');
229
- });
230
- }
231
- } else {
232
- const params = getOnceHisParams();
233
- printInstance[printFn](7, params)
234
- .then((res: any) => {
235
- console.log(res, '777777777777');
236
- })
237
- .catch((error:any) => {
238
- console.log(error, 'error777');
239
- });
240
- }
241
- } else {
242
- if (props.strategy === 'MULTI') {
243
- // 循环多条
244
- for (let i = 0; i < state.printParams.length; i++) {
245
- const queryParams = {
246
- formatId: state.currentFormatId,
247
- templateId: getTemplateIdByFormatId(state.currentFormatId),
248
- params: getPrintParams(i)
249
- };
250
- printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
251
- }
252
- } else {
253
- // 聚合一条
187
+ if (props.strategy === 'MULTI') {
188
+ // 循环多条
189
+ for (let i = 0; i < state.printParams.length; i++) {
254
190
  const queryParams = {
255
191
  formatId: state.currentFormatId,
256
192
  templateId: getTemplateIdByFormatId(state.currentFormatId),
257
- params: getOnceParams()
193
+ params: getPrintParams(i)
258
194
  };
259
- printInstance.printDirect(
260
- queryParams,
261
- (res: any) => {
262
- callLocalServicesSuccessCb(res, 'print');
263
- },
264
- callLocalServicesErrorCb
265
- );
195
+ printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
266
196
  }
197
+ } else {
198
+ // 聚合一条
199
+ const queryParams = {
200
+ formatId: state.currentFormatId,
201
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
202
+ params: getOnceParams()
203
+ };
204
+ printInstance.printDirect(
205
+ queryParams,
206
+ (res: any) => {
207
+ callLocalServicesSuccessCb(res, 'print');
208
+ },
209
+ callLocalServicesErrorCb
210
+ );
267
211
  }
268
212
  })
269
213
  .finally(() => {
@@ -277,31 +221,19 @@ const handleClickPreview = async () => {
277
221
  return Promise.reject();
278
222
  })
279
223
  .then(() => {
280
- if (props.versionType == 1 || props.versionType == 3) {
281
- const params = props.strategy === 'MULTI' ? getHisParams() : getOnceHisParams();
282
- const printFn = props.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
283
- printInstance[printFn](8, params)
284
- .then((res: any) => {
285
- console.log(res, 88888888);
286
- })
287
- .catch((error: any) => {
288
- console.log(error, 'error888');
289
- });
290
- } else {
291
- const params = props.strategy === 'MULTI' ? getPrintParams() : getOnceParams();
292
- const queryParams = {
293
- formatId: state.currentFormatId,
294
- templateId: getTemplateIdByFormatId(state.currentFormatId),
295
- params
296
- };
297
- printInstance.preview(
298
- queryParams,
299
- (res: any) => {
300
- callLocalServicesSuccessCb(res, 'preview');
301
- },
302
- callLocalServicesErrorCb
303
- );
304
- }
224
+ const params = props.strategy === 'MULTI' ? getPrintParams() : getOnceParams();
225
+ const queryParams = {
226
+ formatId: state.currentFormatId,
227
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
228
+ params
229
+ };
230
+ printInstance.preview(
231
+ queryParams,
232
+ (res: any) => {
233
+ callLocalServicesSuccessCb(res, 'preview');
234
+ },
235
+ callLocalServicesErrorCb
236
+ );
305
237
  })
306
238
  .finally(() => {
307
239
  state.visible = false;
@@ -314,19 +246,7 @@ const handleClickEdit = () => {
314
246
  return Promise.reject();
315
247
  })
316
248
  .then(() => {
317
- if (props.versionType == 1 || props.versionType == 3) {
318
- const params = props.strategy === 'MULTI' ? getHisParams() : getOnceHisParams();
319
- const printFn = props.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
320
- printInstance[printFn](9, params)
321
- .then((res: any) => {
322
- console.log(res, 999999);
323
- })
324
- .catch((error: any) => {
325
- console.log(error, 'error999');
326
- });
327
- } else {
328
- state.identityVerification.visible = true;
329
- }
249
+ state.identityVerification.visible = true;
330
250
  })
331
251
  .finally(() => {
332
252
  state.visible = false;
@@ -383,12 +303,6 @@ const setOptions = () => {
383
303
  children
384
304
  })
385
305
  }
386
- const initHIS = (formatListResult: any) => {
387
- state.formatList = formatListResult ? formatListResult.list.filter((item: any) => item.printmark == 1) : [];
388
- setOptions();
389
- state.currentFormatId = getDefaultFormatId(state.formatList, 'printmark');
390
- state.templateParams = state.formatList[0];
391
- }
392
306
  const formatFormatList = (list: any[]): any => {
393
307
  let formatList: any[] = [];
394
308
 
@@ -459,7 +373,7 @@ const formatParams = ({ customizeDataset = [], param = [] }, params: any[] = [])
459
373
  }
460
374
  const initCRM = async (formatListResult: any) => {
461
375
  state.formatList = formatListResult ? formatFormatList(formatListResult.obj) : [];
462
- setOptions();
376
+ console.log('formatListResult', formatListResult)
463
377
  state.currentFormatId = getDefaultFormatId(state.formatList, 'defaultFlag');
464
378
 
465
379
  if (!state.currentFormatId) {
@@ -488,11 +402,7 @@ const init = async () => {
488
402
 
489
403
  instantiatePrintSDK();
490
404
  const formatListResult = await props.queryPrintFormatByNumber()
491
- if (props.versionType == 1 || props.versionType == 3) {
492
- initHIS(formatListResult);
493
- } else {
494
- await initCRM(formatListResult);
495
- }
405
+ await initCRM(formatListResult);
496
406
 
497
407
  setLoaded();
498
408