refactor(workerBasicData): fix useAdvancedSummary
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ba2ab0f300
commit
312677964e
|
@ -1,6 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, nextTick, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { ref, nextTick } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -9,21 +8,25 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = useState();
|
||||
const form = ref();
|
||||
const educationLevels = ref([]);
|
||||
const countries = ref([]);
|
||||
const model = 'Worker';
|
||||
const maritalStatus = [
|
||||
{ code: 'M', name: t('Married') },
|
||||
{ code: 'S', name: t('Single') },
|
||||
];
|
||||
|
||||
onMounted(async () => {
|
||||
const advanced = await useAdvancedSummary('Workers', useRoute().params.id);
|
||||
Object.assign(form.value.formData, advanced);
|
||||
async function addAdvancedData(id) {
|
||||
const data = state.get(model);
|
||||
const advanced = await useAdvancedSummary('Workers', id);
|
||||
state.set(model, Object.assign(data, advanced));
|
||||
nextTick(() => (form.value.hasChanges = false));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -42,7 +45,8 @@ onMounted(async () => {
|
|||
ref="form"
|
||||
:url-update="`Workers/${$route.params.id}`"
|
||||
auto-load
|
||||
model="Worker"
|
||||
:model
|
||||
@on-fetch="() => addAdvancedData($route.params.id)"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
|
|
Loading…
Reference in New Issue