forked from verdnatura/salix-front
fix: refs #7986 crudModel
This commit is contained in:
parent
af830591b3
commit
b4245d05fb
|
@ -743,6 +743,7 @@ worker:
|
|||
locker: Locker
|
||||
balance: Balance
|
||||
medical: Medical
|
||||
operator: Operator
|
||||
list:
|
||||
name: Name
|
||||
email: Email
|
||||
|
|
|
@ -750,6 +750,7 @@ worker:
|
|||
balance: Balance
|
||||
formation: Formación
|
||||
medical: Mutua
|
||||
operator: Operario
|
||||
list:
|
||||
name: Nombre
|
||||
email: Email
|
||||
|
|
|
@ -3,18 +3,23 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||
// import CrudModelPopup from 'src/components/CrudModelPopup.vue';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const formModelRef = ref();
|
||||
const test = ref({});
|
||||
const dialog = ref();
|
||||
const warehousesData = ref([]);
|
||||
const itemPackingTypesData = ref([]);
|
||||
const sectorsData = ref([]);
|
||||
const trainsData = ref([]);
|
||||
const machinesData = ref([]);
|
||||
const route = useRoute();
|
||||
const routeId = computed(() => route.params.id);
|
||||
|
||||
|
@ -34,10 +39,10 @@ const initialData = computed(() => {
|
|||
machineFk: null,
|
||||
};
|
||||
});
|
||||
watch(
|
||||
() => route.params.id,
|
||||
() => formModelRef.value.reset()
|
||||
);
|
||||
// watch(
|
||||
// () => route.params.id,
|
||||
// () => CrudModelRef.value.reset()
|
||||
// );
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -45,7 +50,7 @@ watch(
|
|||
<FetchData url="Trains" @on-fetch="(data) => (trainsData = data)" auto-load />
|
||||
<FetchData
|
||||
url="ItemPackingTypes"
|
||||
@on-fetch="(data) => (ItemPackingTypesData = data)"
|
||||
@on-fetch="(data) => (itemPackingTypesData = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
@ -53,42 +58,43 @@ watch(
|
|||
@on-fetch="(data) => (warehousesData = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData url="Sectors" @on-fetch="(data) => (shelvingsData = data)" auto-load />
|
||||
<FetchData url="Sectors" @on-fetch="(data) => (sectorsData = data)" auto-load />
|
||||
<FetchData url="Machines" @on-fetch="(data) => (machinesData = data)" auto-load />
|
||||
|
||||
<FormModel
|
||||
ref="formModelRef"
|
||||
:form-initial-data="initialData"
|
||||
<CrudModel
|
||||
data-key="workerOperator"
|
||||
url="Operators"
|
||||
:filter="{ where: { workerFk: routeId } }"
|
||||
model="workerOperator"
|
||||
:filter="{ where: { workerFk: route.params.id } }"
|
||||
ref="test"
|
||||
:data-required="{ workerFk: route.params.id }"
|
||||
:default-save="false"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<div v-if="rows.length">
|
||||
<QCard
|
||||
flat
|
||||
bordered
|
||||
:key="row.id"
|
||||
:key="row"
|
||||
v-for="row of rows"
|
||||
class="card q-px-md q-mb-sm container"
|
||||
>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.operator.numberOfWagons')"
|
||||
:model-value="row?.numberOfWagons"
|
||||
v-model="row.numberOfWagons"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.train')"
|
||||
:options="trainsData"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="row.trainFk"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.itemPackingType')"
|
||||
:options="ItemPackingTypesData"
|
||||
:options="itemPackingTypesData"
|
||||
hide-selected
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
|
@ -98,47 +104,44 @@ watch(
|
|||
:label="t('worker.operator.warehouse')"
|
||||
:options="warehousesData"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="row.warehouseFk"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.sector')"
|
||||
:options="shelvingsData"
|
||||
:options="sectorsData"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="row.sectorFk"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('worker.operator.labeler')"
|
||||
:model-value="row.labelerFk"
|
||||
v-model="row.labelerFk"
|
||||
lazy-rules
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.operator.linesLimit')"
|
||||
:model-value="row.linesLimit"
|
||||
v-model="row.linesLimit"
|
||||
lazy-rules
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('worker.operator.volumeLimit')"
|
||||
:model-value="row.volumeLimit"
|
||||
v-model="row.volumeLimit"
|
||||
lazy-rules
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.operator.sizeLimit')"
|
||||
:model-value="row.sizeLimit"
|
||||
v-model="row.sizeLimit"
|
||||
lazy-rules
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('worker.operator.isOnReservationMode')"
|
||||
:model-value="row.isOnReservationMode"
|
||||
v-model="row.isOnReservationMode"
|
||||
lazy-rules
|
||||
/>
|
||||
</VnRow>
|
||||
|
@ -148,10 +151,11 @@ watch(
|
|||
:options="machinesData"
|
||||
hide-selected
|
||||
option-label="plate"
|
||||
option-value="id"
|
||||
v-model="row.machineFk"
|
||||
/>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
</div>
|
||||
<!-- <QBtn
|
||||
flat
|
||||
icon="delete"
|
||||
|
@ -169,103 +173,14 @@ watch(
|
|||
{{ t('worker.pda.removePDA') }}
|
||||
</QTooltip>
|
||||
</QBtn>-->
|
||||
</QCard>
|
||||
</template>
|
||||
</FormModel>
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add" shortcut="+">
|
||||
<QDialog ref="dialog">
|
||||
<FormModelPopup
|
||||
:title="t('Add new device')"
|
||||
url-create="operators"
|
||||
model="operator"
|
||||
:form-initial-data="initialData"
|
||||
@on-data-saved="reloadData()"
|
||||
</CrudModel>
|
||||
<QPageSticky
|
||||
position="bottom-right"
|
||||
:offset="[25, 25]"
|
||||
v-if="!test.formData?.length"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.operator.numberOfWagons')"
|
||||
:model-value="data.numberOfWagons"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.train')"
|
||||
:options="trainsData"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="data.trainFk"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.itemPackingType')"
|
||||
:options="ItemPackingTypesData"
|
||||
hide-selected
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
v-model="data.itemPackingTypeFk"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.warehouse')"
|
||||
:options="warehousesData"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="data.warehouseFk"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.sector')"
|
||||
:options="shelvingsData"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="data.sectorFk"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('worker.operator.labeler')"
|
||||
:model-value="data?.labelerFk"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.operator.linesLimit')"
|
||||
:model-value="data?.linesLimit"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('worker.operator.volumeLimit')"
|
||||
:model-value="data?.volumeLimit"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.operator.sizeLimit')"
|
||||
:model-value="data?.sizeLimit"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.operator.isOnReservationMode')"
|
||||
:model-value="data?.isOnReservationMode"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('worker.operator.machine')"
|
||||
:options="machinesData"
|
||||
hide-selected
|
||||
option-label="plate"
|
||||
option-value="id"
|
||||
v-model="data.machineFk"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</QDialog>
|
||||
</QBtn>
|
||||
<QTooltip>
|
||||
{{ t('globals.new') }}
|
||||
</QTooltip>
|
||||
<QBtn fab color="primary" icon="add" @click="test.insert()" />
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue