feat: refs #8118 enhance VnDropdown component; simplify usage in Claim and Ticket summaries
This commit is contained in:
parent
b2b00d98c6
commit
bce7e2ad56
|
@ -11,14 +11,18 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
moduleName: {
|
|
||||||
type: String,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
optionLabel: {
|
||||||
|
type: String,
|
||||||
|
default: 'name',
|
||||||
|
},
|
||||||
|
optionValue: {
|
||||||
|
type: String,
|
||||||
|
default: 'id',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
async function changeState(value) {
|
async function changeState(value) {
|
||||||
|
@ -37,8 +41,9 @@ async function changeState(value) {
|
||||||
>
|
>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:options="$props.options"
|
:options="$props.options"
|
||||||
|
:option-label="$props.optionLabel"
|
||||||
|
:option-value="$props.optionValue"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-value="code"
|
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="changeState"
|
@update:model-value="changeState"
|
||||||
|
@ -46,11 +51,8 @@ async function changeState(value) {
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel v-if="$props.moduleName === 'Ticket'">
|
<QItemLabel>
|
||||||
{{ scope.opt?.name }}
|
{{ scope.opt?.name || scope.opt?.description }}
|
||||||
</QItemLabel>
|
|
||||||
<QItemLabel v-if="$props.moduleName === 'Claim'">
|
|
||||||
{{ scope.opt?.description }}
|
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
|
@ -173,9 +173,8 @@ function openDialog(dmsId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeState(value) {
|
async function changeState(value) {
|
||||||
const newState = claimStates.value.find((state) => state.code == value);
|
|
||||||
await axios.patch(`Claims/updateClaim/${entityId.value}`, {
|
await axios.patch(`Claims/updateClaim/${entityId.value}`, {
|
||||||
claimStateFk: newState.id,
|
claimStateFk: value,
|
||||||
});
|
});
|
||||||
router.go(route.fullPath);
|
router.go(route.fullPath);
|
||||||
}
|
}
|
||||||
|
@ -208,11 +207,7 @@ 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
|
<VnDropdown :options="claimStates" @change-state="changeState($event)" />
|
||||||
:moduleName="route.meta.moduleName"
|
|
||||||
:options="claimStates"
|
|
||||||
@change-state="changeState($event)"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template #menu="{ entity }">
|
<template #menu="{ entity }">
|
||||||
<ClaimDescriptorMenu :claim="entity.claim" />
|
<ClaimDescriptorMenu :claim="entity.claim" />
|
||||||
|
|
|
@ -114,7 +114,6 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
<template #header-right>
|
||||||
<VnDropdown
|
<VnDropdown
|
||||||
:moduleName="route.meta.moduleName"
|
|
||||||
:moduleId="entityId"
|
:moduleId="entityId"
|
||||||
:options="editableStates"
|
:options="editableStates"
|
||||||
:disable="!isEditable()"
|
:disable="!isEditable()"
|
||||||
|
|
Loading…
Reference in New Issue