asd123a20 2 éve
szülő
commit
2117c4d8cf
3 módosított fájl, 124 hozzáadás és 2 törlés
  1. 7 2
      src/components/heads/nav/index.vue
  2. 5 0
      src/router/index.js
  3. 112 0
      src/views/org.vue

+ 7 - 2
src/components/heads/nav/index.vue

@@ -41,6 +41,8 @@ export default {
       this.$setParentsetSession({ menus: this.menusall, iscode: last });
       // 写入当前菜单编码
       sessionStorage.setItem('code', this.activeIndex);
+      // 获取当前一例的顶级菜单编码
+      const parentCode = env.code.substring(0, 2);
       // 如果编码 = 00 进入主页
       if (env.code == '00') {
         this.$router.push('/www');
@@ -51,8 +53,11 @@ export default {
         this.$router.push('/leader');
         return;
       }
-      // 获取当前一例的顶级菜单编码
-      const parentCode = env.code.substring(0, 2);
+      // 如果编码 = 014(机构)进入机构页
+      if (env.code == '014') {
+        this.$router.push(`/org/${this.activeIndex}?parentCode=${parentCode}`);
+        return;
+      }
       // 类型为1(栏目)进入列表页
       if (env.type == '1') this.$router.push(`/list/${this.activeIndex}?parentCode=${parentCode}`);
       // 类型为2(单页)进入单页页面

+ 5 - 0
src/router/index.js

@@ -14,6 +14,11 @@ const routes = [
     name: 'leader',
     component: () => import('../views/leader.vue')
   },
+  {
+    path: '/org/:code',
+    name: 'org',
+    component: () => import('../views/org.vue')
+  },
   {
     path: '/details/:id',
     name: 'details',

+ 112 - 0
src/views/org.vue

@@ -0,0 +1,112 @@
+<template>
+  <div>
+    <breadcrumb ref="breadcrumb"></breadcrumb>
+    <div class="listHome">
+      <div class="listBoxLeft">
+        <letnav ref="letnav" :menuTree="menu"></letnav>
+      </div>
+      <div class="listBoxRight"  v-if="listTotal > 0">
+        <el-button v-for="(item, index) in contentList" :key="index" @click="newClick(item)" class="btn">
+            {{ item.title }}
+            <i class="xian"></i>
+        </el-button>
+      </div>
+      <el-divider class="divider" v-else>暂无数据</el-divider>
+    </div>
+  </div>
+</template>
+
+<script>
+import moment from 'moment';
+import letnav from '../components/leftmenu/index.vue';
+import breadcrumb from '../components/breadcrumb/index.vue';
+import { mapState, mapActions } from 'vuex';
+export default {
+  name: 'listHome',
+  components: {
+    letnav,
+    breadcrumb
+  },
+  computed: {
+    ...mapState(['contentList', 'listTotal', 'menusall'])
+  },
+  data() {
+    return {
+      code: null,
+      pageSize: 10,
+      parentCode: null,
+      menu: {}
+    };
+  },
+  async mounted() {
+    // 当前菜单参数
+    this.code = this.$route.params.code;
+    // 顶级菜单参数
+    this.parentCode = this.$route.query.parentCode;
+    console.log(this.code, 'this.code');
+    await this.filterQuery();
+    // 获取一例菜单
+    this.menu = this.$setChildrenSession({ menus: this.menusall, iscode: this.parentCode });
+    // 控制左侧菜单当前选项
+    this.$refs.letnav.setIndex();
+  },
+  methods: {
+    ...mapActions(['contentsList']),
+    // 查询函数
+    async filterQuery ({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
+      filter.bind = this.code;
+      if (this.code.length == 2) filter.parentCode = this.code;
+      await this.contentsList({ filter, paging });
+    },
+    // 列表点击
+    newClick(e) {
+      this.$router.push(`/details/${e._id}`);
+    }
+  },
+  filters: {
+    dates(e) {
+      return moment(e).format('YYYY-MM-DD');
+    }
+  }
+};
+</script>
+<style lang="scss">
+.divider {
+  width: 70%;
+  margin: 5% auto;
+}
+.listHome {
+  width: 70%;
+  margin: 0 auto;
+  display: flex;
+  .listBoxLeft {
+    width: 25%;
+    margin-top: 5%;
+    margin-right: 5%;
+  }
+  .listBoxRight {
+    width: 70%;
+    margin-top: 5%;
+    display: flex;
+    flex-wrap: wrap;
+    .btn {
+        height: 3em;
+        line-height: 1em;
+        padding: 0 8%;
+        margin-right: 2%;
+        position: relative;
+        .xian {
+            position: absolute;
+            width: 5%;
+            height: 2px;
+            background: #19a33a;
+            top: 10%;
+            right: 5%;
+        }
+    }
+  }
+  .pagination {
+    margin-bottom: 5%;
+  }
+}
+</style>