forked from verdnatura/salix-front
refs #6877 changes filter date
This commit is contained in:
parent
b9c6b01437
commit
a691644b9a
|
@ -2,7 +2,7 @@ export default function dateRange(value) {
|
|||
const minHour = new Date(value);
|
||||
minHour.setHours(0, 0, 0, 0);
|
||||
const maxHour = new Date(value);
|
||||
maxHour.setHours(23, 59, 59, 59);
|
||||
maxHour.setHours(22, 59, 59, 59);
|
||||
|
||||
return [minHour, maxHour];
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { dateRange } from 'src/filters';
|
||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
|
||||
|
@ -29,28 +29,19 @@ const exprBuilder = (param, value) => {
|
|||
case 'landed':
|
||||
return {
|
||||
'tr.landed': {
|
||||
between: getDateRange(value),
|
||||
between: dateRange(value),
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const dateRange = reactive({
|
||||
const datedRange = reactive({
|
||||
from: null,
|
||||
to: null,
|
||||
});
|
||||
|
||||
const getDateRange = (val) => {
|
||||
const minHour = new Date(val);
|
||||
minHour.setHours(0, 0, 0, 0);
|
||||
const maxHour = new Date(val);
|
||||
maxHour.setHours(23, 59, 59, 59);
|
||||
|
||||
return [minHour, maxHour];
|
||||
};
|
||||
|
||||
const from = computed({
|
||||
get: () => dateRange.from,
|
||||
get: () => datedRange.from,
|
||||
set: (val) => {
|
||||
updateFrom(val);
|
||||
updateFilter();
|
||||
|
@ -58,7 +49,7 @@ const from = computed({
|
|||
});
|
||||
|
||||
const to = computed({
|
||||
get: () => dateRange.to,
|
||||
get: () => datedRange.to,
|
||||
set: (val) => {
|
||||
updateTo(val);
|
||||
updateFilter();
|
||||
|
@ -173,17 +164,17 @@ const fetchItemLastEntries = async () => {
|
|||
|
||||
const updateFrom = async (date) => {
|
||||
date.setHours(0, 0, 0, 0);
|
||||
dateRange.from = date.toISOString();
|
||||
datedRange.from = date.toISOString();
|
||||
};
|
||||
|
||||
const updateTo = async (date) => {
|
||||
date.setHours(23, 59, 59, 59);
|
||||
dateRange.to = date.toISOString();
|
||||
datedRange.to = date.toISOString();
|
||||
};
|
||||
|
||||
const updateFilter = async () => {
|
||||
arrayData.store.userFilter.where.landed = {
|
||||
between: [dateRange.from, dateRange.to],
|
||||
between: [datedRange.from, datedRange.to],
|
||||
};
|
||||
await fetchItemLastEntries();
|
||||
};
|
||||
|
|
|
@ -147,6 +147,7 @@ const confirmRequest = async (request) => {
|
|||
const params = {
|
||||
itemFk: request.itemFk,
|
||||
quantity: request.saleQuantity,
|
||||
attenderFk: request.attenderFk,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(
|
||||
|
@ -293,7 +294,7 @@ onBeforeMount(() => {
|
|||
option-label="firstName"
|
||||
option-value="id"
|
||||
dense
|
||||
@update:model-value="row.attenderFk"
|
||||
@update:model-value="(event) => (row.attenderFk = event)"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { dateRange } from 'src/filters';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
@ -44,15 +44,6 @@ const exprBuilder = (param, value) => {
|
|||
}
|
||||
};
|
||||
|
||||
const dateRange = (value) => {
|
||||
const minHour = new Date(value);
|
||||
minHour.setHours(0, 0, 0, 0);
|
||||
const maxHour = new Date(value);
|
||||
maxHour.setHours(23, 59, 59, 59);
|
||||
|
||||
return [minHour, maxHour];
|
||||
};
|
||||
|
||||
const add = (paramsObj, key) => {
|
||||
if (paramsObj[key] === undefined) {
|
||||
paramsObj[key] = 1;
|
||||
|
|
Loading…
Reference in New Issue