forked from verdnatura/salix-front
fet: updates
This commit is contained in:
parent
cfa5b84f4e
commit
970c8473a2
|
@ -278,6 +278,7 @@ function parseOrder(urlOrders) {
|
|||
|
||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||
defineExpose({
|
||||
create: createForm,
|
||||
reload,
|
||||
redirect: redirectFn,
|
||||
selected,
|
||||
|
|
|
@ -68,7 +68,6 @@ const columns = computed(() => [
|
|||
...defaultColumnAttrs,
|
||||
isId: true,
|
||||
cardVisible: true,
|
||||
columnClass: 'shrink',
|
||||
columnField: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
|
@ -77,7 +76,6 @@ const columns = computed(() => [
|
|||
{
|
||||
label: t('globals.name'),
|
||||
field: 'name',
|
||||
columnClass: 'shrink',
|
||||
name: 'description',
|
||||
...defaultColumnAttrs,
|
||||
create: true,
|
||||
|
@ -119,13 +117,14 @@ const columns = computed(() => [
|
|||
cardVisible: true,
|
||||
...defaultColumnAttrs,
|
||||
component: 'date',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.ended'),
|
||||
field: 'ended',
|
||||
name: 'ended',
|
||||
...defaultColumnAttrs,
|
||||
columnClass: 'expand',
|
||||
columnClass: 'shrink',
|
||||
cardVisible: true,
|
||||
component: 'date',
|
||||
format: (row) => toDate(row.ended),
|
||||
|
@ -254,22 +253,49 @@ const addRow = (fixedPrice = null) => {
|
|||
// fixedPrices.value.push({ ...newPrice });
|
||||
// return;
|
||||
// }
|
||||
if (fixedPrice) {
|
||||
lastItem.value = fixedPrice;
|
||||
if (!fixedPrice) {
|
||||
const today = Date.vnNew();
|
||||
const millisecsInDay = 86400000;
|
||||
const daysInWeek = 7;
|
||||
const nextWeek = new Date(today.getTime() + daysInWeek * millisecsInDay);
|
||||
|
||||
// lastItem.value = {
|
||||
lastItem.value = {
|
||||
started: today,
|
||||
ended: nextWeek,
|
||||
hasMinPrice: 0,
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const lastItemCopy = JSON.parse(
|
||||
JSON.stringify(fixedPrices.value[fixedPrices.value.length - 1])
|
||||
);
|
||||
lastItem.value = lastItemCopy;
|
||||
tableRef.value.create.formInitialData = lastItem;
|
||||
delete lastItemCopy.id;
|
||||
fixedPricesOriginalData.value.splice(lastvisible, 0, lastItemCopy);
|
||||
fixedPrices.value.unshift(lastItemCopy);
|
||||
nextTick(() => {
|
||||
highlightNewRow(lastvisible);
|
||||
});
|
||||
const lastItemCopy = {
|
||||
itemFk: fixedPrice.itemFk,
|
||||
name: fixedPrice.name,
|
||||
subName: fixedPrice.subName,
|
||||
value5: fixedPrice.value5,
|
||||
value6: fixedPrice.value6,
|
||||
value7: fixedPrice.value7,
|
||||
value8: fixedPrice.value8,
|
||||
value9: fixedPrice.value9,
|
||||
value10: fixedPrice.value10,
|
||||
warehouseFk: fixedPrice.warehouseFk,
|
||||
rate2: fixedPrice.rate2,
|
||||
rate3: fixedPrice.rate3,
|
||||
hasMinPrice: fixedPrice.hasMinPrice,
|
||||
minPrice: fixedPrice.minPrice,
|
||||
started: fixedPrice.started,
|
||||
ended: fixedPrice.ended,
|
||||
};
|
||||
// lastItem.value = lastItemCopy;
|
||||
// tableRef.value.create.onDataSaved(lastItem);
|
||||
return lastItemCopy;
|
||||
// delete lastItemCopy.id;
|
||||
// fixedPricesOriginalData.value.splice(lastvisible, 0, lastItemCopy);
|
||||
// fixedPrices.value.unshift(lastItemCopy);
|
||||
// nextTick(() => {
|
||||
// highlightNewRow(lastvisible);
|
||||
// });
|
||||
};
|
||||
const lastItem = ref(null);
|
||||
function highlightNewRow(index) {
|
||||
|
@ -338,11 +364,9 @@ onMounted(async () => {
|
|||
stateStore.rightDrawer = true;
|
||||
params.warehouseFk = user.value.warehouseFk;
|
||||
});
|
||||
function handleOnDataSave(CrudModelRef) {
|
||||
addRow(
|
||||
CrudModelRef.CrudModelRef.formData[CrudModelRef.CrudModelRef.formData.length - 1]
|
||||
);
|
||||
CrudModelRef.CrudModelRef.formData.unshift(lastItem);
|
||||
function handleOnDataSave({ CrudModelRef }) {
|
||||
const roww = addRow(CrudModelRef.formData[CrudModelRef.formData.length - 1]);
|
||||
CrudModelRef.formData.unshift(lastItem);
|
||||
nextTick(() => {
|
||||
highlightNewRow(checkLastVisibleRow());
|
||||
});
|
||||
|
@ -426,7 +450,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<template #column-itemId="props">
|
||||
<QTd>
|
||||
<VnSelect
|
||||
style="max-width: 125px"
|
||||
style="max-width: 100px"
|
||||
url="Items/withName"
|
||||
hide-selected
|
||||
option-label="id"
|
||||
|
@ -504,7 +528,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<template #column-started="props">
|
||||
<QTd class="col">
|
||||
<VnInputDate
|
||||
style="min-width: 147px"
|
||||
class="vnInputDate"
|
||||
:show-event="true"
|
||||
v-model="props.row.started"
|
||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
||||
|
@ -522,7 +546,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<template #column-ended="props">
|
||||
<QTd class="col">
|
||||
<VnInputDate
|
||||
style="min-width: 147px"
|
||||
class="vnInputDate"
|
||||
:show-event="true"
|
||||
v-model="props.row.ended"
|
||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
||||
|
@ -591,6 +615,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
max-width: none;
|
||||
|
||||
.q-td.col {
|
||||
& .vnInputDate {
|
||||
min-width: 130px;
|
||||
}
|
||||
& div.row {
|
||||
& .q-checkbox {
|
||||
& .q-checkbox__inner {
|
||||
|
|
Loading…
Reference in New Issue