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 selectedRows = ref([]);
const dialogVisible = ref(false); const dialogVisible = ref(false);
const route = useRoute(); const route = useRoute();
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const buttons = ref(props.buttons ?? route.meta.buttons); const buttons = ref(props.buttons ?? route.meta.buttons);
const baseUrl = props.controller ?? `${route.meta.controller}`; const baseUrl = props.controller ?? `${route.meta.controller}`;
@ -389,10 +390,22 @@ export default {
}; };
const showList = (value, nav) => { const showList = (value, nav) => {
if (!subDrawer.value) { 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 = { subListQuery.value = {
controller: nav.substr(0, nav.lastIndexOf(".")), controller,
query: { [nav.substr(nav.lastIndexOf(".") + 1)]: value }, query: { [nav.substr(nav.lastIndexOf(".") + 1)]: value },
buttons: [], buttons: targetRoute.meta.buttons,
}; };
subDrawer.value = true; subDrawer.value = true;
} }

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

@ -6,7 +6,11 @@ import { useRouter } from "vue-router";
export default { export default {
name: "menuItem", name: "menuItem",
components: { Icon }, 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> <template #title>
<el-icon><icon :name="modelValue.meta.icon??'folder'" /></el-icon> <el-icon><icon :name="modelValue.meta.icon??'folder'" /></el-icon>
<span>{{modelValue.meta.title}}</span> <span>{{modelValue.meta.title}}</span>
@ -22,7 +26,8 @@ export default {
<template #title> <template #title>
<span>{{modelValue.meta.title}}</span> <span>{{modelValue.meta.title}}</span>
</template> </template>
</el-menu-item>`, </el-menu-item>
</template>`,
props: { props: {
modelValue: { modelValue: {
typeof: Object, typeof: Object,

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

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

Loading…
Cancel
Save