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