feat: remove fetchData to nativeCmp
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
693e689f5e
commit
7292dca197
|
@ -36,10 +36,10 @@ const $props = defineProps({
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch']);
|
const emit = defineEmits(['onFetch']);
|
||||||
defineExpose({ fetch });
|
defineExpose({ fetch });
|
||||||
const fetchData = useFetchData({ ...$props });
|
// const fetchData = useFetchData({ ...$props });
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if ($props.autoLoad) {
|
if ($props.autoLoad) {
|
||||||
await fetchData.fetch();
|
await fetch();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,10 @@ import { useRole } from 'src/composables/useRole';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import { useAxios } from 'src/composables/useAxios';
|
||||||
|
|
||||||
const { hasAny } = useRole();
|
const { hasAny } = useRole();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const fetchData = ref();
|
|
||||||
const originaLockerId = ref();
|
const originaLockerId = ref();
|
||||||
const lockers = ref([]);
|
const lockers = ref([]);
|
||||||
const { store } = useArrayData('Worker');
|
const { store } = useArrayData('Worker');
|
||||||
|
@ -27,21 +26,14 @@ const save = async (data) => {
|
||||||
const lockerId = data.id ?? originaLockerId.value;
|
const lockerId = data.id ?? originaLockerId.value;
|
||||||
const workerFk = lockerId == originaLockerId.value ? null : entityId.value;
|
const workerFk = lockerId == originaLockerId.value ? null : entityId.value;
|
||||||
|
|
||||||
return axios.patch(`Lockers/${lockerId}`, { workerFk });
|
return useAxios(`Lockers/${lockerId}`).push('PATCH', { workerFk });
|
||||||
};
|
};
|
||||||
|
|
||||||
const init = async (data) => {
|
const init = async (data) => {
|
||||||
await fetchData.value.fetch();
|
|
||||||
originaLockerId.value = data.id;
|
originaLockerId.value = data.id;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="fetchData"
|
|
||||||
url="Lockers/codes"
|
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="(data) => (lockers = data)"
|
|
||||||
/>
|
|
||||||
<FormModel
|
<FormModel
|
||||||
:url="`Workers/${entityId}/locker`"
|
:url="`Workers/${entityId}/locker`"
|
||||||
model="worker"
|
model="worker"
|
||||||
|
@ -51,6 +43,8 @@ const init = async (data) => {
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
url="Lockers/codes"
|
||||||
|
:filter="filter"
|
||||||
:label="t('Locker')"
|
:label="t('Locker')"
|
||||||
v-model="data.id"
|
v-model="data.id"
|
||||||
:options="lockers"
|
:options="lockers"
|
||||||
|
|
Loading…
Reference in New Issue