refactor: add dialogWarning of ocr
This commit is contained in:
parent
a4c9ebfdec
commit
f4802b6991
2 changed files with 58 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ import ShowAttachent from 'src/components/ShowAttachent.vue';
|
|||
import DialogForm from 'components/DialogForm.vue';
|
||||
|
||||
const isEdit = ref(false);
|
||||
const allMeta = ref<Record<string, string>>();
|
||||
const { t } = useI18n();
|
||||
const obj = defineModel<
|
||||
{
|
||||
|
|
@ -125,6 +126,8 @@ async function change(e: Event) {
|
|||
return a;
|
||||
}, {});
|
||||
|
||||
allMeta.value = map;
|
||||
|
||||
if (resOcr.group === 'citizen') {
|
||||
obj.value[currentIndex.value]._meta = {
|
||||
citizenId: map['citizen_id'],
|
||||
|
|
@ -176,7 +179,7 @@ async function fileList() {
|
|||
}
|
||||
|
||||
defineEmits<{
|
||||
(e: 'submit', obj: any): void;
|
||||
(e: 'submit', obj: any, allMate: Record<string, string> | undefined): void;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
|
|
@ -362,6 +365,7 @@ defineEmits<{
|
|||
fileList();
|
||||
}
|
||||
}
|
||||
$emit('submit', obj[currentIndex].group, allMeta);
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import { storeToRefs } from 'pinia';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { nextTick, onBeforeMount, onMounted, reactive, ref, watch } from 'vue';
|
||||
import { dialog } from 'stores/utils';
|
||||
|
||||
// NOTE: Import stores
|
||||
import { setLocale, dateFormat, calculateAge } from 'src/utils/datetime';
|
||||
|
|
@ -77,7 +78,7 @@ const quotationForm = useQuotationForm();
|
|||
const employeeStore = useEmployeeStore();
|
||||
const optionStore = useOptionStore();
|
||||
const ocrStore = useOcrStore();
|
||||
const { locale } = useI18n();
|
||||
const { t, locale } = useI18n();
|
||||
const $q = useQuasar();
|
||||
|
||||
const {
|
||||
|
|
@ -203,6 +204,30 @@ const productServiceTableData = ref<
|
|||
}[]
|
||||
>([{ title: '', product: [] }]);
|
||||
|
||||
async function dialogWarning(
|
||||
callback: () => void,
|
||||
check: () => void | boolean,
|
||||
) {
|
||||
const status = check();
|
||||
|
||||
if (status) {
|
||||
dialog({
|
||||
color: 'warning',
|
||||
icon: 'mdi-alert',
|
||||
title: t('form.warning.title'),
|
||||
actionText: t('general.ok'),
|
||||
persistent: true,
|
||||
message: t('form.warning.message'),
|
||||
action: async () => {
|
||||
callback();
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
function convertDataToFormSubmit() {
|
||||
quotationFormData.value.productServiceList = JSON.parse(
|
||||
JSON.stringify(
|
||||
|
|
@ -1041,6 +1066,33 @@ watch(
|
|||
show-title
|
||||
v-model="formDataEmployee.attachment"
|
||||
hide-action
|
||||
@submit="
|
||||
async (group, allMeta) => {
|
||||
if (allMeta === undefined) return;
|
||||
|
||||
console.log(allMeta);
|
||||
|
||||
if (group === 'passport') {
|
||||
const fullName = allMeta['full_name'].split(' ');
|
||||
|
||||
await dialogWarning(
|
||||
() => {
|
||||
formDataEmployee.firstName = fullName[0];
|
||||
formDataEmployee.lastName = fullName[1];
|
||||
formDataEmployee.passportNo = allMeta['doc_number'];
|
||||
},
|
||||
() => {
|
||||
let status = false;
|
||||
if (formDataEmployee.firstName !== '') status = true;
|
||||
if (formDataEmployee.lastName !== '') status = true;
|
||||
if (formDataEmployee.passportNo !== '') status = true;
|
||||
|
||||
return status;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
"
|
||||
:menu="uploadFileListEmployee"
|
||||
:columns="columnsAttachment"
|
||||
:ocr="
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue