Browse Source

update

pull/1/head
wanggang 1 year ago
parent
commit
01e53ce665
  1. 17
      docs/demo/src/WTA/wwwroot/components/list/index.js
  2. 9
      docs/demo/src/WTA/wwwroot/layouts/menu-item.js
  3. 3
      docs/demo/src/WTA/wwwroot/router/index.js

17
docs/demo/src/WTA/wwwroot/components/list/index.js

@ -225,6 +225,7 @@ export default {
const selectedRows = ref([]);
const dialogVisible = ref(false);
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const buttons = ref(props.buttons ?? route.meta.buttons);
const baseUrl = props.controller ?? `${route.meta.controller}`;
@ -389,10 +390,22 @@ export default {
};
const showList = (value, nav) => {
if (!subDrawer.value) {
const controller = nav.substr(0, nav.lastIndexOf(".")).toLowerCase();
const findRoute = (tree) => {
for (const item of tree) {
if (item.meta.controller === controller) {
return item;
}
if (item.children) {
return findRoute(item.children);
}
}
};
const targetRoute = router.getRoutes().find((o) => o.meta?.controller === controller);
subListQuery.value = {
controller: nav.substr(0, nav.lastIndexOf(".")),
controller,
query: { [nav.substr(nav.lastIndexOf(".") + 1)]: value },
buttons: [],
buttons: targetRoute.meta.buttons,
};
subDrawer.value = true;
}

9
docs/demo/src/WTA/wwwroot/layouts/menu-item.js

@ -6,7 +6,11 @@ import { useRouter } from "vue-router";
export default {
name: "menuItem",
components: { Icon },
template: html`<el-sub-menu :index="modelValue.meta.path" v-if="modelValue.children">
template: html`<template v-if="!modelValue.meta.isHidden">
<el-sub-menu
:index="modelValue.meta.path"
v-if="modelValue.children&&modelValue.children.some(o=>!o.meta.isHidden)"
>
<template #title>
<el-icon><icon :name="modelValue.meta.icon??'folder'" /></el-icon>
<span>{{modelValue.meta.title}}</span>
@ -22,7 +26,8 @@ export default {
<template #title>
<span>{{modelValue.meta.title}}</span>
</template>
</el-menu-item>`,
</el-menu-item>
</template>`,
props: {
modelValue: {
typeof: Object,

3
docs/demo/src/WTA/wwwroot/router/index.js

@ -117,7 +117,7 @@ const reset = (list, parent = null) => {
const refreshRouter = async () => {
await connect();
const appStore = useAppStore();
const permissions = appStore.user.permissions.filter((o) => !o.isHidden);
const permissions = appStore.user.permissions;
const tree = reset(
listToTree(permissions, (o) => {
o.meta = {
@ -126,6 +126,7 @@ const refreshRouter = async () => {
icon: o.icon,
order: o.order,
permission: o.number,
isHidden: o.isHidden,
isExternal: o.isExternal,
isTop: o.isTop,
htmlClass: o.htmlClass,

Loading…
Cancel
Save