mg-ocr-invoice 0.3.9 → 0.4.1

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.
@@ -22,6 +22,10 @@ declare const _default: import("vue").DefineComponent<{
22
22
  taxCode: {
23
23
  required: false;
24
24
  };
25
+ teleport: {
26
+ required: false;
27
+ type: StringConstructor;
28
+ };
25
29
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
30
  submit: (...args: any[]) => void;
27
31
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -48,6 +52,10 @@ declare const _default: import("vue").DefineComponent<{
48
52
  taxCode: {
49
53
  required: false;
50
54
  };
55
+ teleport: {
56
+ required: false;
57
+ type: StringConstructor;
58
+ };
51
59
  }>> & {
52
60
  onSubmit?: ((...args: any[]) => any) | undefined;
53
61
  }, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mg-ocr-invoice",
3
3
  "private": false,
4
- "version": "0.3.9",
4
+ "version": "0.4.1",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
@@ -278,6 +278,7 @@ import { RowAttribute } from './const'
278
278
  import { filterNumber } from '@/utils/number'
279
279
  import { computed } from 'vue'
280
280
  import Decimal from 'decimal.js'
281
+ import Cookies from 'js-cookie'
281
282
  const props = defineProps(['ids', 'invoiceData'])
282
283
  const formData = ref({
283
284
  codeReq: {
@@ -337,7 +338,7 @@ const submit = async () => {
337
338
  showToast({
338
339
  type: 'success',
339
340
  message: '保存成功',
340
- teleport:'#iDOCRInvoice'
341
+ teleport: Cookies.get('teleport') || null,
341
342
  })
342
343
  emit('saveSuccess')
343
344
  }
@@ -157,7 +157,7 @@
157
157
  </div>
158
158
  <Popup
159
159
  v-model:show="showPopup"
160
- teleport="#iDOCRInvoice"
160
+ :teleport="Cookies.get('teleport') || null"
161
161
  position="bottom"
162
162
  closeable>
163
163
  <div class="boxPopup">
@@ -200,6 +200,8 @@ import {
200
200
  setClass,
201
201
  VerificationOfTruth,
202
202
  } from './const'
203
+ import Cookies from 'js-cookie'
204
+ import { onUnmounted } from 'vue'
203
205
  const emit = defineEmits(['edit', 'ok'])
204
206
  const $props = defineProps({
205
207
  listId: {
@@ -247,7 +249,7 @@ const getList = async () => {
247
249
  // 保持选择状态
248
250
  return {
249
251
  ...item,
250
- selected: data.selected
252
+ selected: data.selected,
251
253
  // ...Object.assign(data, item),
252
254
  }
253
255
  })
@@ -271,7 +273,7 @@ const clickItem = (row: any) => {
271
273
  if (row.invoiceStatus !== 'unused') {
272
274
  return showToast({
273
275
  type: 'text',
274
- teleport: '#iDOCRInvoice',
276
+ teleport: Cookies.get('teleport') || null,
275
277
  message: '发票已被使用!',
276
278
  })
277
279
  }
@@ -312,7 +314,7 @@ const changeSelectAll = (v: any) => {
312
314
  showToast({
313
315
  type: 'text',
314
316
  message: '存在已使用或异常发票, 已自动过滤',
315
- teleport: '#iDOCRInvoice',
317
+ teleport: Cookies.get('teleport') || null,
316
318
  })
317
319
  }
318
320
  list.value.forEach((item: any) => {
@@ -330,14 +332,14 @@ const deleteSelectItem = () => {
330
332
  showToast({
331
333
  type: 'text',
332
334
  message: '请先选择发票',
333
- teleport: '#iDOCRInvoice',
335
+ teleport: Cookies.get('teleport') || null,
334
336
  })
335
337
  return
336
338
  }
337
339
  showConfirmDialog({
338
340
  title: '提醒',
339
341
  message: '请确认是否需要移除选中项,移除后不可恢复!',
340
- teleport: '#iDOCRInvoice',
342
+ teleport: Cookies.get('teleport') || null,
341
343
  })
342
344
  .then(async () => {
343
345
  var urlencoded = new URLSearchParams()
@@ -349,7 +351,7 @@ const deleteSelectItem = () => {
349
351
  showToast({
350
352
  type: 'success',
351
353
  message: '移除成功',
352
- teleport: '#iDOCRInvoice',
354
+ teleport: Cookies.get('teleport') || null,
353
355
  })
354
356
  getList()
355
357
  }
@@ -380,7 +382,7 @@ const selectImg = async (type: number) => {
380
382
  showToast({
381
383
  type: 'success',
382
384
  message: '上传成功',
383
- teleport: '#iDOCRInvoice',
385
+ teleport: Cookies.get('teleport') || null,
384
386
  })
385
387
  setTimeGetList()
386
388
  }
@@ -413,7 +415,7 @@ const ok = () => {
413
415
  showToast({
414
416
  type: 'text',
415
417
  message: '请先选择发票',
416
- teleport: '#iDOCRInvoice',
418
+ teleport: Cookies.get('teleport') || null,
417
419
  })
418
420
  return
419
421
  }
@@ -421,7 +423,7 @@ const ok = () => {
421
423
  showToast({
422
424
  type: 'text',
423
425
  message: '发票无效或已被使用,请进行确认',
424
- teleport: '#iDOCRInvoice',
426
+ teleport: Cookies.get('teleport') || null,
425
427
  })
426
428
  return
427
429
  }
@@ -436,12 +438,13 @@ const ok = () => {
436
438
  const filterTitleErr = selectData.some(
437
439
  (item) => item.invoiceCompanyType === '异常抬头'
438
440
  )
439
- console.log(filterTitleErr,'filterTitleErr')
441
+ console.log(filterTitleErr, 'filterTitleErr')
440
442
  if (filterTitleErr) {
443
+ console.log(Cookies.get('teleport'), 'teleport')
441
444
  showConfirmDialog({
442
445
  title: '提醒',
443
446
  message: '存在异常抬头发票,请确认是否继续提交?',
444
- teleport: '#iDOCRInvoice',
447
+ teleport: Cookies.get('teleport') || null,
445
448
  cancelButtonText: '返回修改',
446
449
  confirmButtonText: '继续提交',
447
450
  })
@@ -451,10 +454,12 @@ const ok = () => {
451
454
  .catch((error) => {
452
455
  console.log(error)
453
456
  })
457
+ return
454
458
  }
455
459
  emit('ok', selectData, batchId.value)
456
460
  }
457
461
  const timeID: any = ref(null)
462
+ const timeID2: any = ref(null)
458
463
  const setTimeGetList = () => {
459
464
  getList()
460
465
  .then((res: any) => {
@@ -463,17 +468,23 @@ const setTimeGetList = () => {
463
468
  item.taskStatus === 'ocr_doing' || item.taskStatus === 'ocr_success'
464
469
  )
465
470
  if (!flag) {
471
+ clearTimeout(timeID.value)
472
+ clearTimeout(timeID2.value)
466
473
  return
467
474
  }
468
- setTimeout(setTimeGetList, 2000)
475
+ timeID.value = setTimeout(setTimeGetList, 2000)
469
476
  })
470
477
  .catch((err) => {
471
- setTimeout(setTimeGetList, 2000)
478
+ timeID2.value = setTimeout(setTimeGetList, 2000)
472
479
  })
473
480
  }
474
481
  onMounted(() => {
475
482
  setTimeGetList()
476
483
  })
484
+ onUnmounted(() => {
485
+ clearTimeout(timeID.value)
486
+ clearTimeout(timeID2.value)
487
+ })
477
488
  </script>
478
489
  <style lang="scss" scoped>
479
490
  .disabledColor {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="OCRInvoice" id="iDOCRInvoice">
2
+ <div class="OCRInvoice">
3
3
  <div v-if="activePage === 1" class="box">
4
4
  <PaymentMode
5
5
  :batchId="$props.batchId"
@@ -32,7 +32,7 @@
32
32
  </div>
33
33
  </template>
34
34
  <script lang="ts" setup>
35
- import { ref, onMounted, computed } from 'vue'
35
+ import { ref, onMounted, computed, watch } from 'vue'
36
36
  import { PaymentMode, Invoice, InvoiceList } from '@/components/index'
37
37
  import { getUrlParams } from '@/utils/getUrlParams'
38
38
  import Cookies from 'js-cookie'
@@ -68,6 +68,10 @@ const $props = defineProps({
68
68
  taxCode: {
69
69
  required: false,
70
70
  },
71
+ teleport: {
72
+ required: false,
73
+ type: String,
74
+ },
71
75
  })
72
76
  const computed_params = computed(() => {
73
77
  return getUrlParams(window.location.href)
@@ -110,6 +114,8 @@ const submit = (data: any, id: string) => {
110
114
  emit('submit', data, id)
111
115
  }
112
116
  onMounted(() => {
117
+ console.log($props.teleport, 'teleport')
118
+ Cookies.set('teleport', $props.teleport || '')
113
119
  initToken()
114
120
  init_Base_URL()
115
121
  })
@@ -32,6 +32,7 @@ import '@/utils/disableZoom'
32
32
  import { selectPhoto, takePhoto } from '@/utils/upload'
33
33
  import { __uploadInvoice } from '@/api/invoice'
34
34
  import { showToast, Overlay, Loading, showFailToast } from 'vant'
35
+ import Cookies from 'js-cookie'
35
36
  const props = defineProps(['multiple', 'batchId', 'taxCode','businessLicense'])
36
37
  const emit = defineEmits(['uploadSuccess'])
37
38
  const payList: any = [
@@ -74,7 +75,7 @@ const handleClickText = async (text: any) => {
74
75
  showToast({
75
76
  type: 'success',
76
77
  message: '上传成功',
77
- teleport: '#iDOCRInvoice',
78
+ teleport: Cookies.get('teleport') || null,
78
79
  })
79
80
  emit('uploadSuccess', res.data)
80
81
  }