fix: refs #7936 rollback
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Jorge Penadés 2025-01-20 11:51:53 +01:00
parent 8843318b66
commit ff95882e42
1 changed files with 7 additions and 25 deletions

View File

@ -33,19 +33,15 @@ defineProps({
},
});
function test(row) {
console.log('test', row);
return `${row.id}: ${row.name}`;
}
const columns = computed(() => [
{
name: 'expense',
label: t('Expense'),
field: (row) => row.expenseFk,
options: expenses.value,
model: 'expenseFk',
optionValue: 'id',
optionLabel: (row) => test(row),
optionLabel: (row) => `${row.id}: ${row.name}`,
sortable: true,
align: 'left',
},
@ -123,8 +119,6 @@ function taxRate(invoiceInTax) {
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
}
const expensesRef = ref();
const exponseShow = ref(false);
function autocompleteExpense(evt, row, col) {
const val = evt.target.value;
if (!val) return;
@ -133,17 +127,9 @@ function autocompleteExpense(evt, row, col) {
const lookup = expenses.value.find(
({ id }) => id == useAccountShortToStandard(param)
);
if (lookup) {
row[col.model] = lookup?.id;
expensesRef.value.showItem = true;
}
}
const formatOpt = (row, { model, options }, prop) => {
const obj = row[model];
const option = options.find(({ id }) => id == obj);
return option ? `${obj}:${option[prop]}` : '';
};
if (lookup) row[col.model] = lookup;
}
</script>
<template>
<FetchData
@ -181,19 +167,15 @@ const formatOpt = (row, { model, options }, prop) => {
<template #body-cell-expense="{ row, col }">
<QTd>
<VnSelectDialog
ref="expensesRef"
v-model="row[col.model]"
:options="col.options"
:option-value="col.optionValue"
:option-label="col.optionLabel"
:filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
@keydown.tab="autocompleteExpense($event, row, col)"
@input-value="(data) => (row[col.model] = undefined)"
>
<template #selected-item="scope">
A{{ scope.opt.id }}B</template
>
<!-- <template #option="scope">
<template #option="scope">
<QItem v-bind="scope.itemProps">
{{ `${scope.opt.id}: ${scope.opt.name}` }}
</QItem>
@ -202,7 +184,7 @@ const formatOpt = (row, { model, options }, prop) => {
<CreateNewExpenseForm
@on-data-saved="$refs.expensesRef.fetch()"
/>
</template> -->
</template>
</VnSelectDialog>
</QTd>
</template>