refactor: refs #8118 simplify VnDropdown usage and replace onMounted data fetching with FetchData component
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Benjamin Esteve 2025-03-20 10:04:27 +01:00
parent 6848758258
commit b7309298aa
3 changed files with 14 additions and 15 deletions

View File

@ -48,15 +48,6 @@ async function changeState(value) {
focus-on-mount focus-on-mount
@update:model-value="changeState" @update:model-value="changeState"
> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.name || scope.opt?.description }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect> </VnSelect>
</QBtnDropdown> </QBtnDropdown>
</template> </template>

View File

@ -183,14 +183,15 @@ async function changeState(value) {
function claimUrl(section) { function claimUrl(section) {
return '#/claim/' + entityId.value + '/' + section; return '#/claim/' + entityId.value + '/' + section;
} }
onMounted(async () => {
const { data } = await axios.get('ClaimStates');
claimStates.value = data;
});
</script> </script>
<template> <template>
<FetchData
url="ClaimStates"
:filter="{ fields: ['id', 'description'] }"
@on-fetch="(data) => (claimStates = data)"
auto-load
/>
<FetchData <FetchData
url="ClaimDms" url="ClaimDms"
:filter="claimDmsFilter" :filter="claimDmsFilter"
@ -208,7 +209,12 @@ onMounted(async () => {
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }}) {{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
</template> </template>
<template #header-right> <template #header-right>
<VnDropdown :options="claimStates" @change-state="changeState($event)" /> <VnDropdown
:options="claimStates"
option-value="id"
option-label="description"
@change-state="changeState($event)"
/>
</template> </template>
<template #menu="{ entity }"> <template #menu="{ entity }">
<ClaimDescriptorMenu :claim="entity.claim" /> <ClaimDescriptorMenu :claim="entity.claim" />

View File

@ -117,6 +117,8 @@ onMounted(async () => {
:moduleId="entityId" :moduleId="entityId"
:options="editableStates" :options="editableStates"
:disable="!isEditable()" :disable="!isEditable()"
:option-label="'name'"
:option-value="'code'"
@change-state="changeState($event)" @change-state="changeState($event)"
/> />
</template> </template>