feat: refs #6919 use onMounted to fetch advanced summary in WorkerBasicData component
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
11b5a63fa1
commit
c2ade217e4
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { ref, nextTick } from 'vue';
|
||||
import { ref, nextTick, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -17,12 +18,12 @@ const maritalStatus = [
|
|||
{ code: 'M', name: t('Married') },
|
||||
{ code: 'S', name: t('Single') },
|
||||
];
|
||||
async function setAdvancedSummary(data) {
|
||||
const advanced = (await useAdvancedSummary('Workers', data.id)) ?? {};
|
||||
|
||||
onMounted(async () => {
|
||||
const advanced = await useAdvancedSummary('Workers', useRoute().params.id);
|
||||
Object.assign(form.value.formData, advanced);
|
||||
await nextTick();
|
||||
if (form.value) form.value.hasChanges = false;
|
||||
}
|
||||
nextTick(() => (form.value.hasChanges = false));
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -42,7 +43,6 @@ async function setAdvancedSummary(data) {
|
|||
:url-update="`Workers/${$route.params.id}`"
|
||||
auto-load
|
||||
model="Worker"
|
||||
@on-fetch="setAdvancedSummary"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
|
|
Loading…
Reference in New Issue