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']);
|
||||
defineExpose({ fetch });
|
||||
const fetchData = useFetchData({ ...$props });
|
||||
// const fetchData = useFetchData({ ...$props });
|
||||
onMounted(async () => {
|
||||
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 VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { useAxios } from 'src/composables/useAxios';
|
||||
|
||||
const { hasAny } = useRole();
|
||||
const { t } = useI18n();
|
||||
const fetchData = ref();
|
||||
const originaLockerId = ref();
|
||||
const lockers = ref([]);
|
||||
const { store } = useArrayData('Worker');
|
||||
|
@ -27,21 +26,14 @@ const save = async (data) => {
|
|||
const lockerId = data.id ?? originaLockerId.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) => {
|
||||
await fetchData.value.fetch();
|
||||
originaLockerId.value = data.id;
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
ref="fetchData"
|
||||
url="Lockers/codes"
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (lockers = data)"
|
||||
/>
|
||||
<FormModel
|
||||
:url="`Workers/${entityId}/locker`"
|
||||
model="worker"
|
||||
|
@ -51,6 +43,8 @@ const init = async (data) => {
|
|||
>
|
||||
<template #form="{ data }">
|
||||
<VnSelect
|
||||
url="Lockers/codes"
|
||||
:filter="filter"
|
||||
:label="t('Locker')"
|
||||
v-model="data.id"
|
||||
:options="lockers"
|
||||
|
|
Loading…
Reference in New Issue