Selaa lähdekoodia

Merge branch 'live' into edit

戴艳蓉 3 vuotta sitten
vanhempi
commit
fe2e175148

+ 0 - 41
src/layout/components/Sidebar/Item.vue

@@ -1,41 +0,0 @@
-<script>
-export default {
-  name: 'MenuItem',
-  functional: true,
-  props: {
-    icon: {
-      type: String,
-      default: ''
-    },
-    title: {
-      type: String,
-      default: ''
-    }
-  },
-  render(h, context) {
-    const { icon, title } = context.props
-    const vnodes = []
-
-    if (icon) {
-      if (icon.includes('el-icon')) {
-        vnodes.push(<i class={[icon, 'sub-el-icon']} />)
-      } else {
-        vnodes.push(<svg-icon icon-class={icon} />)
-      }
-    }
-
-    if (title) {
-      vnodes.push(<span slot='title'>{title}</span>)
-    }
-    return vnodes
-  }
-}
-</script>
-
-<style scoped>
-.sub-el-icon {
-  color: currentColor;
-  width: 1em;
-  height: 1em;
-}
-</style>

+ 0 - 43
src/layout/components/Sidebar/Link.vue

@@ -1,43 +0,0 @@
-<template>
-  <component :is="type" v-bind="linkProps(to)">
-    <slot />
-  </component>
-</template>
-
-<script>
-import { isExternal } from '@/utils/validate'
-
-export default {
-  props: {
-    to: {
-      type: String,
-      required: true
-    }
-  },
-  computed: {
-    isExternal() {
-      return isExternal(this.to)
-    },
-    type() {
-      if (this.isExternal) {
-        return 'a'
-      }
-      return 'router-link'
-    }
-  },
-  methods: {
-    linkProps(to) {
-      if (this.isExternal) {
-        return {
-          href: to,
-          target: '_blank',
-          rel: 'noopener'
-        }
-      }
-      return {
-        to: to
-      }
-    }
-  }
-}
-</script>

+ 0 - 118
src/layout/components/Sidebar/SidebarItem.vue

@@ -1,118 +0,0 @@
-<template>
-  <div v-if="!item.hidden">
-    <template
-      v-if="
-        hasOneShowingChild(item.children, item) &&
-        (!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
-        !item.alwaysShow
-      "
-    >
-      <!-- <div>{{ item.path }}</div> -->
-      <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
-        <el-menu-item
-          :index="resolvePath(onlyOneChild.path)"
-          :class="{ 'submenu-title-noDropdown': !isNest }"
-        >
-          <item
-            :icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
-            :title="onlyOneChild.meta.title"
-          />
-        </el-menu-item>
-      </app-link>
-    </template>
-
-    <el-submenu
-      v-else
-      ref="subMenu"
-      :index="resolvePath(item.path)"
-      popper-append-to-body
-    >
-      <template slot="title">
-        <item
-          v-if="item.meta"
-          :icon="item.meta && item.meta.icon"
-          :title="item.meta.title"
-        />
-      </template>
-      <sidebar-item
-        v-for="child in item.children"
-        :key="child.path"
-        :is-nest="true"
-        :item="child"
-        :base-path="resolvePath(child.path)"
-        class="nest-menu"
-      />
-    </el-submenu>
-  </div>
-  <div v-else>{{ item }}</div>
-</template>
-
-<script>
-import path from "path";
-import { isExternal } from "@/utils/validate";
-import Item from "./Item";
-import AppLink from "./Link";
-import FixiOSBug from "./FixiOSBug";
-
-export default {
-  name: "SidebarItem",
-  components: { Item, AppLink },
-  mixins: [FixiOSBug],
-  props: {
-    // route object
-    item: {
-      type: Object,
-      required: true,
-    },
-    isNest: {
-      type: Boolean,
-      default: false,
-    },
-    basePath: {
-      type: String,
-      default: "",
-    },
-  },
-  data() {
-    // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
-    // TODO: refactor with render function
-    this.onlyOneChild = null;
-    return {};
-  },
-  methods: {
-    hasOneShowingChild(children = [], parent) {
-      const showingChildren = children.filter((item) => {
-        if (item.hidden) {
-          return false;
-        } else {
-          // Temp set(will be used if only has one showing child)
-          this.onlyOneChild = item;
-          return true;
-        }
-      });
-
-      // When there is only one child router, the child router is displayed by default
-      if (showingChildren.length === 1) {
-        return true;
-      }
-
-      // Show parent if there are no child router to display
-      if (showingChildren.length === 0) {
-        this.onlyOneChild = { ...parent, path: "", noShowingChildren: true };
-        return true;
-      }
-
-      return false;
-    },
-    resolvePath(routePath) {
-      if (isExternal(routePath)) {
-        return routePath;
-      }
-      if (isExternal(this.basePath)) {
-        return this.basePath;
-      }
-      return path.resolve(this.basePath, routePath);
-    },
-  },
-};
-</script>

+ 6 - 5
src/layout/components/Sidebar/index.vue

@@ -7,22 +7,23 @@
         :default-active="activeMenu"
         :collapse="isCollapse"
         router
-          :background-color="variables.menuBg"
+        :background-color="variables.menuBg"
         :text-color="variables.menuText"
-        :active-text-color="variables.menuActiveText" 
+        :active-text-color="variables.menuActiveText"
         :unique-opened="false"
         :collapse-transition="false"
         mode="vertical"
       >
-      
         <el-menu-item
           v-for="(route, index) in menuList"
           :key="route.path + index"
           :route="route.path"
           :index="index + ''"
         >
-          <i :class="route.meta.icon"></i>
-          <span slot="title">{{ route.meta.title }}</span>
+          <template v-if="!route.hidden">
+            <i :class="route.meta.icon"></i>
+            <span slot="title">{{ route.meta.title }}</span>
+          </template>
         </el-menu-item>
       </el-menu>
     </el-scrollbar>

+ 2 - 0
src/store/modules/user.js

@@ -125,6 +125,7 @@ const actions = {
             let pItem = {
               name: v1.menu_route,
               path: `/${v1.menu_route}`,
+              hidden: parseInt(v1.is_display + "") === 0,
               meta: {
                 title: v1.menu_name,
                 icon: v1.menu_img
@@ -141,6 +142,7 @@ const actions = {
               let item = {
                 path: v2.menu_route,
                 name: v2.menu_route,
+                hidden: parseInt(v2.is_display + "") === 0,
                 meta: {
                   title: v2.menu_name,
                   icon: v2.menu_img

+ 7 - 10
src/views/interest/organize/index.vue

@@ -12,7 +12,7 @@
                 class="my-breadcrumb-item"
                 v-for="(item, index) in titleList"
                 :key="item + index"
-                :class="{ chover: index + 1 !== titleList.length }"
+                :class="{ chover: true }"
                 @click="changeBreadcrumb(index)"
               >
                 <span class="label">{{ item.titleName }}</span
@@ -63,7 +63,7 @@
                   @click="
                     addEditFn(
                       0,
-                      parmValue && parmValue.pid!=='' ? parmValue.pid : '0',
+                      parmValue && parmValue.pid !== '' ? parmValue.pid : '0',
                       1,
                       false,
                       true,
@@ -159,12 +159,7 @@ export default {
   },
   data() {
     return {
-      titleList: [
-        {
-          id: 0,
-          titleName: "北京华软中维科技服务有限公司",
-        },
-      ],
+      titleList: [],
       sitem: null,
 
       statusList: statusList,
@@ -204,12 +199,14 @@ export default {
     },
 
     async changeBreadcrumb(index) {
-      console.log(index);
       if (index + 1 !== this.titleList.length) {
         this.parmValue.pid = this.titleList[index].id;
         this.titleList = this.titleList.slice(0, index + 1);
-        await this.searchList();
+      } else {
+        this.parmValue.pid = 0;
+        this.titleList = [];
       }
+      await this.searchList();
     },
     async openChildren(item) {
       this.parmValue.pid = item.id;