feat(Shelving): add DescriptorMenu
This commit is contained in:
parent
b93633fc77
commit
ed3ad310c5
|
@ -48,7 +48,6 @@ let store;
|
||||||
let entity;
|
let entity;
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
||||||
const menuRef = ref();
|
|
||||||
defineExpose({ getData });
|
defineExpose({ getData });
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
@ -161,7 +160,7 @@ const toModule = computed(() =>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<VnMoreOptions v-if="$slots.menu">
|
<VnMoreOptions v-if="$slots.menu">
|
||||||
<template #menu>
|
<template #menu="{ menuRef }">
|
||||||
<slot name="menu" :entity="entity" :menu-ref="menuRef" />
|
<slot name="menu" :entity="entity" :menu-ref="menuRef" />
|
||||||
</template>
|
</template>
|
||||||
</VnMoreOptions>
|
</VnMoreOptions>
|
||||||
|
|
|
@ -87,8 +87,8 @@ async function fetch() {
|
||||||
<span class="row no-wrap">
|
<span class="row no-wrap">
|
||||||
<slot name="header-right" :entity="entity" />
|
<slot name="header-right" :entity="entity" />
|
||||||
<VnMoreOptions v-if="$slots.menu && isDialogOpened()">
|
<VnMoreOptions v-if="$slots.menu && isDialogOpened()">
|
||||||
<template #menu>
|
<template #menu="{ menuRef }">
|
||||||
<slot name="menu" :entity="entity" />
|
<slot name="menu" :entity="entity" :menu-ref="menuRef" />
|
||||||
</template>
|
</template>
|
||||||
</VnMoreOptions>
|
</VnMoreOptions>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
<QMenu ref="menuRef">
|
<QMenu ref="menuRef">
|
||||||
<QList>
|
<QList>
|
||||||
<slot name="menu" />
|
<slot name="menu" :menu-ref="$refs.menuRef" />
|
||||||
</QList>
|
</QList>
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
shelving: {
|
shelving: {
|
||||||
|
@ -14,8 +15,11 @@ const $props = defineProps({
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const emit = defineEmits(['onRemove']);
|
||||||
|
|
||||||
function confirmRemove() {
|
function confirmRemove() {
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: VnConfirm,
|
component: VnConfirm,
|
||||||
|
@ -32,11 +36,12 @@ async function remove() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await axios.delete(`Shelvings/${$props.shelving.id}`);
|
await axios.delete(`Shelvings/${$props.shelving.id}`);
|
||||||
await router.push({ name: 'ShelvingList' });
|
if (route.name != 'ShelvingList') await router.push({ name: 'ShelvingList' });
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
message: t('globals.dataDeleted'),
|
message: t('globals.dataDeleted'),
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
|
emit('onRemove', {});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import VnUserLink from 'components/ui/VnUserLink.vue';
|
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||||
|
import ShelvingDescriptorMenu from './ShelvingDescriptorMenu.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -14,7 +15,7 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const summary = ref({});
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -45,6 +46,12 @@ const filter = {
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
<div>{{ entity.code }}</div>
|
<div>{{ entity.code }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template #menu="{ entity }">
|
||||||
|
<ShelvingDescriptorMenu
|
||||||
|
:shelving="entity"
|
||||||
|
@on-remove="$refs.summary.fetch()"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
|
|
Loading…
Reference in New Issue