This commit is contained in:
parent
0eb699bcbe
commit
3d5807463b
|
@ -24,15 +24,28 @@ const companiesOptions = ref([]);
|
|||
const printersOptions = ref([]);
|
||||
const clientsOptions = ref([]);
|
||||
const serialTypesOptions = ref([]);
|
||||
|
||||
const handleInvoiceOutSerialsFetch = (data) => {
|
||||
const uniqueTypes = new Set();
|
||||
serialTypesOptions.value = data.filter((item) => {
|
||||
if (item.type === null || uniqueTypes.has(item.type)) {
|
||||
return false;
|
||||
}
|
||||
uniqueTypes.add(item.type);
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
const formData = ref({});
|
||||
|
||||
const optionsInitialData = computed(() => {
|
||||
return (
|
||||
companiesOptions.value.length > 0 &&
|
||||
printersOptions.value.length > 0 &&
|
||||
clientsOptions.value.length > 0 &&
|
||||
serialTypesOptions.value.length > 0
|
||||
);
|
||||
const optionsArrays = [
|
||||
companiesOptions.value,
|
||||
printersOptions.value,
|
||||
clientsOptions.value,
|
||||
serialTypesOptions.value,
|
||||
];
|
||||
return optionsArrays.every((arr) => arr.length > 0);
|
||||
});
|
||||
|
||||
const getStatus = computed({
|
||||
|
@ -60,18 +73,7 @@ onMounted(async () => {
|
|||
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
|
||||
<FetchData
|
||||
url="invoiceOutSerials"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
const uniqueTypes = new Set();
|
||||
serialTypesOptions = data.filter((item) => {
|
||||
if (item.type === null || uniqueTypes.has(item.type)) {
|
||||
return false;
|
||||
}
|
||||
uniqueTypes.add(item.type);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
"
|
||||
@on-fetch="handleInvoiceOutSerialsFetch"
|
||||
auto-load
|
||||
/>
|
||||
<QForm
|
||||
|
|
|
@ -16,7 +16,6 @@ const route = useRoute();
|
|||
const { t } = useI18n();
|
||||
|
||||
const itemTypesOptions = ref([]);
|
||||
const itemsWithNameOptions = ref([]);
|
||||
const intrastatsOptions = ref([]);
|
||||
const expensesOptions = ref([]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue