fix: refs #7986 fix operator, fix crudmodel update
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-10-15 14:42:26 +02:00
parent b4245d05fb
commit a30915f99e
1 changed files with 39 additions and 18 deletions

View File

@ -10,10 +10,11 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import CrudModel from 'components/CrudModel.vue'; import CrudModel from 'components/CrudModel.vue';
import axios from 'axios';
const { t } = useI18n(); const { t } = useI18n();
const test = ref({}); const crudModelRef = ref();
const dialog = ref(); const dialog = ref();
const warehousesData = ref([]); const warehousesData = ref([]);
const itemPackingTypesData = ref([]); const itemPackingTypesData = ref([]);
@ -39,10 +40,11 @@ const initialData = computed(() => {
machineFk: null, machineFk: null,
}; };
}); });
// watch(
// () => route.params.id, async function insert() {
// () => CrudModelRef.value.reset() await axios.post('Operators', initialData.value);
// ); crudModelRef.value.reload();
}
</script> </script>
<template> <template>
@ -58,16 +60,17 @@ const initialData = computed(() => {
@on-fetch="(data) => (warehousesData = data)" @on-fetch="(data) => (warehousesData = data)"
auto-load auto-load
/> />
<FetchData url="Printers" @on-fetch="(data) => (PrintersData = data)" auto-load />
<FetchData url="Sectors" @on-fetch="(data) => (sectorsData = data)" auto-load /> <FetchData url="Sectors" @on-fetch="(data) => (sectorsData = data)" auto-load />
<FetchData url="Machines" @on-fetch="(data) => (machinesData = data)" auto-load /> <FetchData url="Machines" @on-fetch="(data) => (machinesData = data)" auto-load />
<CrudModel <CrudModel
data-key="workerOperator" data-key="workerOperator"
url="Operators" url="Operators"
model="workerOperator" primary-key="workerFk"
:filter="{ where: { workerFk: route.params.id } }" :filter="{ where: { workerFk: route.params.id } }"
ref="test"
:data-required="{ workerFk: route.params.id }" :data-required="{ workerFk: route.params.id }"
:default-save="false" ref="crudModelRef"
search-url="operator"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
@ -75,7 +78,7 @@ const initialData = computed(() => {
<QCard <QCard
flat flat
bordered bordered
:key="row" :key="row.$index"
v-for="row of rows" v-for="row of rows"
class="card q-px-md q-mb-sm container" class="card q-px-md q-mb-sm container"
> >
@ -115,11 +118,27 @@ const initialData = computed(() => {
option-label="description" option-label="description"
v-model="row.sectorFk" v-model="row.sectorFk"
/> />
<VnInput <VnSelect
:label="t('worker.operator.labeler')" :label="t('worker.operator.labeler')"
:options="PrintersData"
hide-selected
option-label="name"
v-model="row.labelerFk" v-model="row.labelerFk"
lazy-rules >
/> <template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
>ID: {{ scope.opt?.id }}</QItemLabel
>
<QItemLabel caption>
{{ scope.opt?.id }},
{{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput <VnInput
@ -175,12 +194,14 @@ const initialData = computed(() => {
</QBtn>--> </QBtn>-->
</template> </template>
</CrudModel> </CrudModel>
<QPageSticky <QPageSticky position="bottom-right" :offset="[25, 25]">
position="bottom-right" <QBtn
:offset="[25, 25]" fab
v-if="!test.formData?.length" color="primary"
> icon="add"
<QBtn fab color="primary" icon="add" @click="test.insert()" /> @click="insert()"
v-if="!crudModelRef?.formData?.length"
/>
</QPageSticky> </QPageSticky>
</QPage> </QPage>
</template> </template>