Merge branch '8118-createComponentVnDropdown' of https://gitea.verdnatura.es/verdnatura/salix-front into 8118-createComponentVnDropdown
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
13c547dd6a
|
@ -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,24 +41,13 @@ 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"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel v-if="$props.moduleName === 'Ticket'">
|
|
||||||
{{ scope.opt?.name }}
|
|
||||||
</QItemLabel>
|
|
||||||
<QItemLabel v-if="$props.moduleName === 'Claim'">
|
|
||||||
{{ scope.opt?.description }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -174,9 +174,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);
|
||||||
}
|
}
|
||||||
|
@ -184,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"
|
||||||
|
@ -210,8 +210,9 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
<template #header-right>
|
||||||
<VnDropdown
|
<VnDropdown
|
||||||
:moduleName="route.meta.moduleName"
|
|
||||||
:options="claimStates"
|
:options="claimStates"
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
@change-state="changeState($event)"
|
@change-state="changeState($event)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -114,10 +114,10 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
<template #header-right>
|
||||||
<VnDropdown
|
<VnDropdown
|
||||||
:moduleName="route.meta.moduleName"
|
|
||||||
:moduleId="entityId"
|
|
||||||
:options="editableStates"
|
|
||||||
:disable="!isEditable()"
|
:disable="!isEditable()"
|
||||||
|
:options="editableStates"
|
||||||
|
:option-label="'name'"
|
||||||
|
:option-value="'code'"
|
||||||
@change-state="changeState($event)"
|
@change-state="changeState($event)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue