feat: refs #8277 add pre-account functionality and update daysAgo handling in EntryControl
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
b528bb4ed1
commit
dbb8d2a115
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed, markRaw, useTemplateRef, watch } from 'vue';
|
||||
import { ref, computed, markRaw, useTemplateRef, onBeforeMount } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate, toCurrency } from 'src/filters';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
@ -10,6 +10,7 @@ import EntryDescriptorProxy from './Card/EntryDescriptorProxy.vue';
|
|||
import SupplierDescriptorProxy from '../Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const { t } = useI18n();
|
||||
const MAXDAYS = 365;
|
||||
|
@ -24,6 +25,7 @@ const countries = ref([]);
|
|||
const entryTypes = ref([]);
|
||||
const entryAccounts = ref([]);
|
||||
const warehouses = ref([]);
|
||||
const selectedRows = ref([]);
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'id',
|
||||
|
@ -189,15 +191,7 @@ const columns = computed(() => [
|
|||
// },
|
||||
]);
|
||||
|
||||
watch(
|
||||
() => arrayData.store.userParams.daysAgo,
|
||||
(nVal, oVal) => {
|
||||
if (!oVal && !nVal) daysAgo.value = DEFAULTDAYS;
|
||||
else if (!nVal) daysAgo.value = MAXDAYS;
|
||||
else daysAgo.value = nVal;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
onBeforeMount(() => (daysAgo.value = arrayData.store.userParams.daysAgo || DEFAULTDAYS));
|
||||
|
||||
function filterByDaysAgo(val) {
|
||||
if (!val) val = DEFAULTDAYS;
|
||||
|
@ -206,6 +200,12 @@ function filterByDaysAgo(val) {
|
|||
arrayData.store.userParams.daysAgo = daysAgo.value;
|
||||
table.value.reload();
|
||||
}
|
||||
|
||||
async function preAccount() {
|
||||
await axios.post('Entries/preAccount', {
|
||||
ids: selectedRows.value.map((row) => row.id),
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -243,8 +243,10 @@ function filterByDaysAgo(val) {
|
|||
:url
|
||||
:label="t('entry.control.search')"
|
||||
:info="t('entry.control.searchInfo')"
|
||||
:search-remove-params="false"
|
||||
/>
|
||||
<VnTable
|
||||
v-model:selected="selectedRows"
|
||||
:data-key
|
||||
:columns
|
||||
:search-url="dataKey"
|
||||
|
@ -255,8 +257,19 @@ function filterByDaysAgo(val) {
|
|||
:order="['landed DESC']"
|
||||
:right-search="false"
|
||||
:user-params="{ daysAgo }"
|
||||
:row-click="false"
|
||||
:table="{ selection: 'multiple' }"
|
||||
>
|
||||
<template #top-left>
|
||||
<QBtn
|
||||
icon="account_balance"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows.length"
|
||||
@click="preAccount"
|
||||
>
|
||||
<QTooltip>{{ t('entry.control.preAccount') }}</QTooltip>
|
||||
</QBtn>
|
||||
<VnInputNumber
|
||||
v-model="daysAgo"
|
||||
:label="$t('globals.daysAgo')"
|
||||
|
|
|
@ -139,6 +139,7 @@ entry:
|
|||
daysAgo: Max 365 days
|
||||
search: Search
|
||||
searchInfo: You can search by supplier name or nickname
|
||||
preAccount: Pre-account
|
||||
entryFilter:
|
||||
params:
|
||||
isExcludedFromAvailable: Excluded from available
|
||||
|
|
|
@ -89,6 +89,7 @@ entry:
|
|||
daysAgo: Máximo 365 días
|
||||
search: Buscar
|
||||
searchInfo: Puedes buscar por nombre o alias de proveedor
|
||||
preAccount: Precontabilizar
|
||||
params:
|
||||
entryFk: Entrada
|
||||
observationTypeFk: Tipo de observación
|
||||
|
|
Loading…
Reference in New Issue