|
|
@ -32,10 +32,13 @@ const onLoaded = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showCodeScannerForFieldTitle = (fieldTitle: string) => { |
|
|
|
const showCodeScannerForFieldTitle = (fieldTitle: string) => { |
|
|
|
|
|
|
|
// findColumnByTitle(fieldTitle)?.enable_scanner |
|
|
|
showCodeScannerOverlay.value = true |
|
|
|
showCodeScannerOverlay.value = true |
|
|
|
fieldTitleForCurrentScan.value = fieldTitle |
|
|
|
fieldTitleForCurrentScan.value = fieldTitle |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const findColumnByTitle = (title: string) => formColumns.value?.find((el: ColumnType) => el.title === title) |
|
|
|
|
|
|
|
|
|
|
|
const getScannedValueTransformerByFieldType = (fieldType: UITypes) => { |
|
|
|
const getScannedValueTransformerByFieldType = (fieldType: UITypes) => { |
|
|
|
switch (fieldType) { |
|
|
|
switch (fieldType) { |
|
|
|
case UITypes.Number: |
|
|
|
case UITypes.Number: |
|
|
@ -50,7 +53,7 @@ const onDecode = async (scannedCodeValue: string) => { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
const fieldForCurrentScan = formColumns.value?.find((el: ColumnType) => el.title === fieldTitleForCurrentScan.value) |
|
|
|
const fieldForCurrentScan = findColumnByTitle(fieldTitleForCurrentScan.value) |
|
|
|
if (fieldForCurrentScan == null) { |
|
|
|
if (fieldForCurrentScan == null) { |
|
|
|
throw new Error(`Field with title ${fieldTitleForCurrentScan.value} not found`) |
|
|
|
throw new Error(`Field with title ${fieldTitleForCurrentScan.value} not found`) |
|
|
|
} |
|
|
|
} |
|
|
@ -170,7 +173,7 @@ const onDecode = async (scannedCodeValue: string) => { |
|
|
|
{{ field.description }} |
|
|
|
{{ field.description }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
<div v-if="field.enable_scanner"> |
|
|
|
<a-button class="nc-btn-find-row-by-scan nc-toolbar-btn" @click="showCodeScannerForFieldTitle(field.title)"> |
|
|
|
<a-button class="nc-btn-find-row-by-scan nc-toolbar-btn" @click="showCodeScannerForFieldTitle(field.title)"> |
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
<QrCodeScan /> |
|
|
|
<QrCodeScan /> |
|
|
|