make EditTableCellForm componente reusable
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
2de02723ba
commit
ddcbc5d8d7
|
@ -15,23 +15,19 @@ const $props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
fieldsOptions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
editUrl: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const fieldsOptions = [
|
|
||||||
{ field: 'packing', label: t('entry.latestBuys.packing') },
|
|
||||||
{ field: 'grouping', label: t('entry.latestBuys.grouping') },
|
|
||||||
{ field: 'packageValue', label: t('entry.latestBuys.packageValue') },
|
|
||||||
{ field: 'weight', label: t('entry.latestBuys.weight') },
|
|
||||||
{ field: 'description', label: t('entry.latestBuys.description') },
|
|
||||||
{ field: 'size', label: t('entry.latestBuys.size') },
|
|
||||||
{ field: 'weightByPiece', label: t('entry.latestBuys.weightByPiece') },
|
|
||||||
{ field: 'packingOut', label: t('entry.latestBuys.packingOut') },
|
|
||||||
{ field: 'landing', label: t('entry.latestBuys.landing') },
|
|
||||||
];
|
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
field: null,
|
field: null,
|
||||||
newValue: null,
|
newValue: null,
|
||||||
|
@ -56,7 +52,7 @@ const submitData = async () => {
|
||||||
lines: rowsToEdit,
|
lines: rowsToEdit,
|
||||||
};
|
};
|
||||||
|
|
||||||
await axios.post('Buys/editLatestBuys', payload);
|
await axios.post($props.editUrl, payload);
|
||||||
onDataSaved();
|
onDataSaved();
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -209,6 +209,18 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const editTableCellFormFieldsOptions = [
|
||||||
|
{ field: 'packing', label: t('entry.latestBuys.packing') },
|
||||||
|
{ field: 'grouping', label: t('entry.latestBuys.grouping') },
|
||||||
|
{ field: 'packageValue', label: t('entry.latestBuys.packageValue') },
|
||||||
|
{ field: 'weight', label: t('entry.latestBuys.weight') },
|
||||||
|
{ field: 'description', label: t('entry.latestBuys.description') },
|
||||||
|
{ field: 'size', label: t('entry.latestBuys.size') },
|
||||||
|
{ field: 'weightByPiece', label: t('entry.latestBuys.weightByPiece') },
|
||||||
|
{ field: 'packingOut', label: t('entry.latestBuys.packingOut') },
|
||||||
|
{ field: 'landing', label: t('entry.latestBuys.landing') },
|
||||||
|
];
|
||||||
|
|
||||||
const openEditTableCellDialog = () => {
|
const openEditTableCellDialog = () => {
|
||||||
editTableCellDialogRef.value.show();
|
editTableCellDialogRef.value.show();
|
||||||
};
|
};
|
||||||
|
@ -321,7 +333,9 @@ onMounted(async () => {
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
<QDialog ref="editTableCellDialogRef">
|
<QDialog ref="editTableCellDialogRef">
|
||||||
<EditTableCellValueForm
|
<EditTableCellValueForm
|
||||||
|
edit-url="Buys/editLatestBuys"
|
||||||
:rows="rowsSelected"
|
:rows="rowsSelected"
|
||||||
|
:fields-options="editTableCellFormFieldsOptions"
|
||||||
@on-data-saved="onEditCellDataSaved()"
|
@on-data-saved="onEditCellDataSaved()"
|
||||||
/>
|
/>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
|
|
Loading…
Reference in New Issue