feat: refs #7936 add number validation to VnInputNumber & new daysAgo filter in InvoiceInFilter
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
4037b31948
commit
44cbabfc7e
|
@ -4,6 +4,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
defineProps({
|
defineProps({
|
||||||
step: { type: Number, default: 0.01 },
|
step: { type: Number, default: 0.01 },
|
||||||
decimalPlaces: { type: Number, default: 2 },
|
decimalPlaces: { type: Number, default: 2 },
|
||||||
|
positive: { type: Boolean, default: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
const model = defineModel({ type: [Number, String] });
|
const model = defineModel({ type: [Number, String] });
|
||||||
|
@ -17,6 +18,7 @@ const model = defineModel({ type: [Number, String] });
|
||||||
@input="
|
@input="
|
||||||
(evt) => {
|
(evt) => {
|
||||||
const val = evt.target.value;
|
const val = evt.target.value;
|
||||||
|
if (positive && val < 0) return (model = 0);
|
||||||
const [, decimal] = val.split('.');
|
const [, decimal] = val.split('.');
|
||||||
if (val && decimal?.length > decimalPlaces)
|
if (val && decimal?.length > decimalPlaces)
|
||||||
model = parseFloat(val).toFixed(decimalPlaces);
|
model = parseFloat(val).toFixed(decimalPlaces);
|
||||||
|
|
|
@ -94,6 +94,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
isOutlined: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||||
|
@ -108,6 +112,15 @@ const noOneOpt = ref({
|
||||||
[optionValue.value]: false,
|
[optionValue.value]: false,
|
||||||
[optionLabel.value]: noOneText,
|
[optionLabel.value]: noOneText,
|
||||||
});
|
});
|
||||||
|
const styleAttrs = computed(() => {
|
||||||
|
return $props.isOutlined
|
||||||
|
? {
|
||||||
|
dense: true,
|
||||||
|
outlined: true,
|
||||||
|
rounded: true,
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
});
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const useURL = computed(() => $props.url);
|
const useURL = computed(() => $props.url);
|
||||||
const value = computed({
|
const value = computed({
|
||||||
|
@ -267,7 +280,7 @@ defineExpose({ opts: myOptions });
|
||||||
:options="myOptions"
|
:options="myOptions"
|
||||||
:option-label="optionLabel"
|
:option-label="optionLabel"
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
:map-options="nullishToTrue($attrs['map-options'])"
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
|
|
|
@ -341,6 +341,7 @@ globals:
|
||||||
awbCode: AWB
|
awbCode: AWB
|
||||||
correctedFk: Rectified
|
correctedFk: Rectified
|
||||||
correctingFk: Rectificative
|
correctingFk: Rectificative
|
||||||
|
daysOnward: Days onward
|
||||||
changePass: Change password
|
changePass: Change password
|
||||||
deleteConfirmTitle: Delete selected elements
|
deleteConfirmTitle: Delete selected elements
|
||||||
changeState: Change state
|
changeState: Change state
|
||||||
|
|
|
@ -343,6 +343,7 @@ globals:
|
||||||
serial: Serie
|
serial: Serie
|
||||||
amount: Importe
|
amount: Importe
|
||||||
awbCode: AWB
|
awbCode: AWB
|
||||||
|
daysOnward: Días adelante
|
||||||
changePass: Cambiar contraseña
|
changePass: Cambiar contraseña
|
||||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||||
changeState: Cambiar estado
|
changeState: Cambiar estado
|
||||||
|
|
|
@ -4,12 +4,28 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import { dateRange } from 'src/filters';
|
||||||
|
import { date } from 'quasar';
|
||||||
|
|
||||||
defineProps({ dataKey: { type: String, required: true } });
|
defineProps({ dataKey: { type: String, required: true } });
|
||||||
|
const dateFormat = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
|
||||||
|
|
||||||
|
function handleDaysAgo(params, daysAgo) {
|
||||||
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
|
if (!daysAgo && daysAgo !== 0) {
|
||||||
|
Object.assign(params, { from: undefined, to: undefined });
|
||||||
|
} else {
|
||||||
|
from.setDate(from.getDate() - daysAgo);
|
||||||
|
Object.assign(params, {
|
||||||
|
from: date.formatDate(from, dateFormat),
|
||||||
|
to: date.formatDate(to, dateFormat),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
<VnFilterPanel :data-key="dataKey" :search-button="true" :hidden-tags="['daysAgo']">
|
||||||
<template #tags="{ tag, formatFn, getLocale }">
|
<template #tags="{ tag, formatFn, getLocale }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ getLocale(tag.label) }}: </strong>
|
<strong>{{ getLocale(tag.label) }}: </strong>
|
||||||
|
@ -35,6 +51,18 @@ defineProps({ dataKey: { type: String, required: true } });
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInputNumber
|
||||||
|
:label="$t('globals.daysAgo')"
|
||||||
|
v-model="params.daysAgo"
|
||||||
|
is-outlined
|
||||||
|
:step="0"
|
||||||
|
@update:model-value="(val) => handleDaysAgo(params, val)"
|
||||||
|
@remove="(val) => handleDaysAgo(params, val)"
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -116,9 +144,7 @@ defineProps({ dataKey: { type: String, required: true } });
|
||||||
url="Companies"
|
url="Companies"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:fields="['id', 'code']"
|
:fields="['id', 'code']"
|
||||||
dense
|
is-outlined
|
||||||
outlined
|
|
||||||
rounded
|
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
Loading…
Reference in New Issue