|
|
@ -1,5 +1,7 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk' |
|
|
|
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk' |
|
|
|
|
|
|
|
import { ref } from 'vue' |
|
|
|
|
|
|
|
import { StreamBarcodeReader } from 'vue-barcode-reader' |
|
|
|
import { useSharedFormStoreOrThrow } from '#imports' |
|
|
|
import { useSharedFormStoreOrThrow } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
const { sharedFormView, submitForm, v$, formState, notFound, formColumns, submitted, secondsRemain, isLoading } = |
|
|
|
const { sharedFormView, submitForm, v$, formState, notFound, formColumns, submitted, secondsRemain, isLoading } = |
|
|
@ -17,6 +19,28 @@ function isRequired(_columnObj: Record<string, any>, required = false) { |
|
|
|
|
|
|
|
|
|
|
|
return !!(required || (columnObj && columnObj.rqd && !columnObj.cdf)) |
|
|
|
return !!(required || (columnObj && columnObj.rqd && !columnObj.cdf)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const showCodeScannerOverlay = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const scannerIsReady = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onLoaded = async () => { |
|
|
|
|
|
|
|
scannerIsReady.value = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const showScannerIsLoadingMessage = computed(() => !scannerIsReady.value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onDecode = async (codeValue: string) => { |
|
|
|
|
|
|
|
if (!showScannerField.value) { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
showCodeScannerOverlay.value = false |
|
|
|
|
|
|
|
alert(`you scanned "${codeValue}"`) |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
console.error(error) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -109,16 +133,12 @@ function isRequired(_columnObj: Record<string, any>, required = false) { |
|
|
|
{{ field.description }} |
|
|
|
{{ field.description }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
<div> |
|
|
|
SCANNER PLACEHOLDER |
|
|
|
SCANNER PLACEHOLDER |
|
|
|
<a-button class="nc-btn-find-row-by-scan nc-toolbar-btn" @click="showCodeScannerOverlay = true"> |
|
|
|
<a-button class="nc-btn-find-row-by-scan nc-toolbar-btn" @click="showCodeScannerOverlay = true"> |
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
<QrCodeScan /> |
|
|
|
<QrCodeScan /> |
|
|
|
<span class="!text-xs font-weight-normal"> |
|
|
|
<span class="!text-xs font-weight-normal"> {{ $t('activity.findRowByCodeScan') }}</span> |
|
|
|
{{ $t('activity.findRowByCodeScan') }}</span |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-button> |
|
|
|
</a-button> |
|
|
|
<a-modal |
|
|
|
<a-modal |
|
|
@ -134,7 +154,7 @@ function isRequired(_columnObj: Record<string, any>, required = false) { |
|
|
|
<div class="relative flex flex-col h-full"> |
|
|
|
<div class="relative flex flex-col h-full"> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<StreamBarcodeReader |
|
|
|
<StreamBarcodeReader |
|
|
|
v-show="showScannerField" |
|
|
|
v-show="scannerIsReady" |
|
|
|
@decode="onDecode" |
|
|
|
@decode="onDecode" |
|
|
|
@loaded="onLoaded" |
|
|
|
@loaded="onLoaded" |
|
|
|
></StreamBarcodeReader> |
|
|
|
></StreamBarcodeReader> |
|
|
@ -145,9 +165,6 @@ function isRequired(_columnObj: Record<string, any>, required = false) { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-modal> |
|
|
|
</a-modal> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|