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({
|
||||
step: { type: Number, default: 0.01 },
|
||||
decimalPlaces: { type: Number, default: 2 },
|
||||
positive: { type: Boolean, default: true },
|
||||
});
|
||||
|
||||
const model = defineModel({ type: [Number, String] });
|
||||
|
@ -17,6 +18,7 @@ const model = defineModel({ type: [Number, String] });
|
|||
@input="
|
||||
(evt) => {
|
||||
const val = evt.target.value;
|
||||
if (positive && val < 0) return (model = 0);
|
||||
const [, decimal] = val.split('.');
|
||||
if (val && decimal?.length > decimalPlaces)
|
||||
model = parseFloat(val).toFixed(decimalPlaces);
|
||||
|
|
|
@ -94,6 +94,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: null,
|
||||
},
|
||||
isOutlined: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||
|
@ -108,6 +112,15 @@ const noOneOpt = ref({
|
|||
[optionValue.value]: false,
|
||||
[optionLabel.value]: noOneText,
|
||||
});
|
||||
const styleAttrs = computed(() => {
|
||||
return $props.isOutlined
|
||||
? {
|
||||
dense: true,
|
||||
outlined: true,
|
||||
rounded: true,
|
||||
}
|
||||
: {};
|
||||
});
|
||||
const isLoading = ref(false);
|
||||
const useURL = computed(() => $props.url);
|
||||
const value = computed({
|
||||
|
@ -267,7 +280,7 @@ defineExpose({ opts: myOptions });
|
|||
:options="myOptions"
|
||||
:option-label="optionLabel"
|
||||
:option-value="optionValue"
|
||||
v-bind="$attrs"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
@filter="filterHandler"
|
||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||
:map-options="nullishToTrue($attrs['map-options'])"
|
||||
|
|
|
@ -341,6 +341,7 @@ globals:
|
|||
awbCode: AWB
|
||||
correctedFk: Rectified
|
||||
correctingFk: Rectificative
|
||||
daysOnward: Days onward
|
||||
changePass: Change password
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
changeState: Change state
|
||||
|
|
|
@ -343,6 +343,7 @@ globals:
|
|||
serial: Serie
|
||||
amount: Importe
|
||||
awbCode: AWB
|
||||
daysOnward: Días adelante
|
||||
changePass: Cambiar contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
changeState: Cambiar estado
|
||||
|
|
|
@ -4,12 +4,28 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import { dateRange } from 'src/filters';
|
||||
import { date } from 'quasar';
|
||||
|
||||
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>
|
||||
|
||||
<template>
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true" :hidden-tags="['daysAgo']">
|
||||
<template #tags="{ tag, formatFn, getLocale }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ getLocale(tag.label) }}: </strong>
|
||||
|
@ -35,6 +51,18 @@ defineProps({ dataKey: { type: String, required: true } });
|
|||
/>
|
||||
</QItemSection>
|
||||
</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>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
|
@ -116,9 +144,7 @@ defineProps({ dataKey: { type: String, required: true } });
|
|||
url="Companies"
|
||||
option-label="code"
|
||||
:fields="['id', 'code']"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
Loading…
Reference in New Issue