shuishen
2024-01-22 3835cf1ca8d5ac8475052d3876ebeb4a2c4160f1
根据角色,动态切换首页,及首页变更的一系列相关调整
19 files modified
1431 ■■■■■ changed files
src/cache.js 45 ●●●● patch | view | raw | blame | history
src/components/error-page/404.vue 5 ●●●●● patch | view | raw | blame | history
src/config/website.js 43 ●●●● patch | view | raw | blame | history
src/mock/menu.js 53 ●●●●● patch | view | raw | blame | history
src/page/index/sidebar/index.vue 40 ●●●● patch | view | raw | blame | history
src/page/index/sidebar/sidebarItem.vue 78 ●●●●● patch | view | raw | blame | history
src/page/index/tags.vue 130 ●●●●● patch | view | raw | blame | history
src/page/index/top/index.vue 5 ●●●●● patch | view | raw | blame | history
src/page/login/userlogin.vue 32 ●●●●● patch | view | raw | blame | history
src/permission.js 73 ●●●●● patch | view | raw | blame | history
src/router/page/index.js 9 ●●●● patch | view | raw | blame | history
src/router/router.js 34 ●●●● patch | view | raw | blame | history
src/router/views/index.js 236 ●●●●● patch | view | raw | blame | history
src/store/getters.js 4 ●●● patch | view | raw | blame | history
src/store/modules/common.js 3 ●●●● patch | view | raw | blame | history
src/store/modules/tags.js 73 ●●●● patch | view | raw | blame | history
src/store/modules/user.js 391 ●●●●● patch | view | raw | blame | history
src/views/system/user.vue 10 ●●●● patch | view | raw | blame | history
src/views/wel/index.vue 167 ●●●●● patch | view | raw | blame | history
src/cache.js
@@ -1,29 +1,50 @@
import Vue from 'vue'
import store from './store';
/*
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-22 13:23:37
 * @FilePath: \jczz_web\src\cache.js
 * @Description:
 *
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
 */
import Vue from "vue";
import store from "./store";
Vue.mixin({
  beforeRouteEnter: function (to, from, next) {
    next(() => {
      let avueView = document.getElementById('avue-view');
      let avueView = document.getElementById("avue-view");
      if (avueView && to.meta.savedPosition) {
        avueView.scrollTop = to.meta.savedPosition
        avueView.scrollTop = to.meta.savedPosition;
      }
    })
    });
  },
  beforeRouteLeave: function (to, from, next) {
    let avueView = document.getElementById('avue-view');
    let avueView = document.getElementById("avue-view");
    if (from && from.meta.keepAlive) {
      if (avueView) {
        from.meta.savedPosition = avueView.scrollTop
        from.meta.savedPosition = avueView.scrollTop;
      }
      const result = this.$route.meta.keepAlive === true && store.state.tags.tagList.some(ele => {
      console.log(store.state.tags.tagList, this.$route.fullPath, 909999);
      const result =
        this.$route.meta.keepAlive === true &&
        store.state.tags.tagList.some((ele) => {
        return ele.value === this.$route.fullPath;
      });
      if (this.$vnode && !result) {
        from.meta.savedPosition = 0
        if (this.$vnode.parent && this.$vnode.parent.componentInstance && this.$vnode.parent.componentInstance.cache) {
        from.meta.savedPosition = 0;
        if (
          this.$vnode.parent &&
          this.$vnode.parent.componentInstance &&
          this.$vnode.parent.componentInstance.cache
        ) {
          if (this.$vnode.componentOptions) {
            let key = this.$vnode.key == null
              ? this.$vnode.componentOptions.Ctor.cid + (this.$vnode.componentOptions.tag ? `::${this.$vnode.componentOptions.tag}` : '')
            let key =
              this.$vnode.key == null
                ? this.$vnode.componentOptions.Ctor.cid +
                  (this.$vnode.componentOptions.tag
                    ? `::${this.$vnode.componentOptions.tag}`
                    : "")
              : this.$vnode.key;
            let cache = this.$vnode.parent.componentInstance.cache;
            let keys = this.$vnode.parent.componentInstance.keys;
src/components/error-page/404.vue
@@ -1,7 +1,6 @@
<template>
  <div class="error-page">
    <div class="img"
         style=" background-image: url('/img/bg/404.svg');"></div>
        <div class="img" style=" background-image: url('/img/bg/404.svg');"></div>
    <div class="content">
      <h1>404</h1>
      <div class="desc">抱歉,你访问的页面不存在</div>
@@ -17,7 +16,7 @@
<script>
export default {
  name: "error-404"
};
}
</script>
<style lang="scss" scoped>
@import "./style.scss";
src/config/website.js
@@ -4,52 +4,55 @@
export default {
  title: "saber",
  logo: "S",
  key: 'saber', //配置主键,目前用于存储
  indexTitle: '基层智治综合协同平台',
  clientId: 'saber', // 客户端id
  clientSecret: 'saber_secret', // 客户端密钥
  key: "saber", //配置主键,目前用于存储
  indexTitle: "基层智治综合协同平台",
  clientId: "saber", // 客户端id
  clientSecret: "saber_secret", // 客户端密钥
  tenantMode: true, // 是否开启租户模式
  tenantId: "000000", // 管理组租户编号
  captchaMode: true, // 是否开启验证码模式
  switchMode: false, // 是否开启部门切换模式
  lockPage: '/lock',
  lockPage: "/lock",
  tokenTime: 3000,
  tokenHeader: 'Blade-Auth',
  tokenHeader: "Blade-Auth",
  //http的status默认放行列表
  statusWhiteList: [],
  //配置首页不可关闭
  isFirstPage: false,
  fistPage: {
    label: "首页",
    value: "/wel/index",
    params: {},
    query: {},
    meta: {
      i18n: 'dashboard'
      i18n: "dashboard",
    },
    group: [],
    close: false
    close: false,
  },
  //配置菜单的属性
  menu: {
    iconDefault: 'iconfont icon-caidan',
    iconDefault: "iconfont icon-caidan",
    props: {
      label: 'name',
      path: 'path',
      icon: 'source',
      children: 'children'
    }
      label: "name",
      path: "path",
      icon: "source",
      children: "children",
    },
  },
  // 第三方系统授权地址
  authUrl: 'http://localhost/blade-auth/oauth/render',
  authUrl: "http://localhost/blade-auth/oauth/render",
  // 报表设计器地址(cloud端口为8108,boot端口为80)
  reportUrl: 'https://srgdjczzxtpt.com:2080/jczz-ureport/ureport',
  reportUrl: "https://srgdjczzxtpt.com:2080/jczz-ureport/ureport",
  // reportUrl: 'http://localhost:9528/ureport',
  // 单点登录系统认证(blade-auth服务的地)
  ssoUrl: 'http://localhost:8100/oauth/authorize?client_id=saber&response_type=code&redirect_uri=',
  ssoUrl:
    "http://localhost:8100/oauth/authorize?client_id=saber&response_type=code&redirect_uri=",
  // 单点登录回调地址(Saber服务的地址)
  redirectUri: 'http://localhost:1888',
  redirectUri: "http://localhost:1888",
  // redirectUri:'http://192.168.0.102:9528',
  // minio 基础路径
  minioUrl: 'https://srgdjczzxtpt.com:2080/gminio/jczz/'
}
  minioUrl: "https://srgdjczzxtpt.com:2080/gminio/jczz/",
};
src/mock/menu.js
@@ -1,47 +1,58 @@
import Mock from 'mockjs'
/*
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-22 10:20:25
 * @FilePath: \jczz_web\src\mock\menu.js
 * @Description:
 *
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
 */
import Mock from "mockjs";
const top = [{
const top = [
  {
  label: "首页",
  path: "/wel/index",
  icon: 'el-icon-menu',
    icon: "el-icon-menu",
  meta: {
    i18n: 'dashboard',
      i18n: "dashboard",
  },
  parentId: 0
    parentId: 0,
},
  {
    label: "bladex官网",
    icon: 'el-icon-document',
    icon: "el-icon-document",
    meta: {
      i18n: 'website',
      i18n: "website",
    },
    path: "https://bladex.cn/#/",
    parentId: 1
    parentId: 1,
  },
  {
    label: "avuex官网",
    icon: 'el-icon-document',
    icon: "el-icon-document",
    meta: {
      i18n: 'avuexwebsite',
      i18n: "avuexwebsite",
    },
    path: "https://avuex.avue.top",
    parentId: 2
    parentId: 2,
  },
  {
    label: "测试",
    icon: 'el-icon-document',
    icon: "el-icon-document",
    path: "/test/index",
    meta: {
      i18n: 'test',
      i18n: "test",
    },
    parentId: 3
  }]
    parentId: 3,
  },
];
export default ({mock}) => {
  if (!mock) return;
  Mock.mock('/user/getTopMenu', 'get', () => {
  Mock.mock("/user/getTopMenu", "get", () => {
    return {
      data: top
    }
  })
}
      data: top,
    };
  });
};
src/page/index/sidebar/index.vue
@@ -1,19 +1,22 @@
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-22 11:32:56
 * @FilePath: \jczz_web\src\page\index\sidebar\index.vue
 * @Description:
 *
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
-->
<template>
  <div class="avue-sidebar">
    <logo></logo>
    <el-scrollbar style="height:100%">
      <div v-if="validatenull(menu)"
           class="avue-sidebar--tip">{{$t('menuTip')}}
            <div v-if="validatenull(menu)" class="avue-sidebar--tip">{{ $t('menuTip') }}
      </div>
      <el-menu unique-opened
               :default-active="nowTagValue"
               mode="vertical"
               :show-timeout="200"
            <el-menu unique-opened :default-active="nowTagValue" mode="vertical" :show-timeout="200"
               :collapse="keyCollapse">
        <sidebar-item :menu="menu"
                      :screen="screen"
                      first
                      :props="website.menu.props"
                <sidebar-item :menu="menu" :screen="screen" first :props="website.menu.props"
                      :collapse="keyCollapse"></sidebar-item>
      </el-menu>
    </el-scrollbar>
@@ -21,29 +24,28 @@
</template>
<script>
  import {mapGetters} from "vuex";
  import logo from "../logo";
  import sidebarItem from "./sidebarItem";
import { mapGetters } from "vuex"
import logo from "../logo"
import sidebarItem from "./sidebarItem"
  export default {
    name: "sidebar",
    components: {sidebarItem, logo},
    inject: ["index"],
    data() {
      return {};
        return {}
    },
    created() {
      this.index.openMenu();
        // this.index.openMenu()
    },
    computed: {
      ...mapGetters(["website", "menu", "tag", "keyCollapse", "screen", "menuId"]),
      nowTagValue: function () {
        return this.$router.$avueRouter.getValue(this.$route);
            return this.$router.$avueRouter.getValue(this.$route)
      }
    },
    methods: {}
  };
}
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>
src/page/index/sidebar/sidebarItem.vue
@@ -1,37 +1,25 @@
<template>
  <div class="menu-wrapper">
    <template v-for="item in menu">
      <el-menu-item v-if="validatenull(item[childrenKey]) && vaildRoles(item)"
                    :index="item[pathKey]"
                    @click="open(item)"
                    :key="item[labelKey]"
                    :class="{'is-active':vaildActive(item)}">
            <el-menu-item v-if="validatenull(item[childrenKey]) && vaildRoles(item)" :index="item[pathKey]"
                @click="open(item)" :key="item[labelKey]" :class="{ 'is-active': vaildActive(item) }">
        <i :class="item[iconKey]"></i>
        <span slot="title"
              :alt="item[pathKey]">{{generateTitle(item)}}</span>
                <span slot="title" :alt="item[pathKey]">{{ generateTitle(item) }}</span>
      </el-menu-item>
      <el-submenu v-else-if="!validatenull(item[childrenKey])&&vaildRoles(item)"
                  :index="item[pathKey]"
            <el-submenu v-else-if="!validatenull(item[childrenKey]) && vaildRoles(item)" :index="item[pathKey]"
                  :key="item[labelKey]">
        <template slot="title">
          <i :class="item[iconKey]"></i>
          <span slot="title"
                :class="{'el-menu--display':collapse && first}">{{generateTitle(item)}}</span>
                    <span slot="title" :class="{ 'el-menu--display': collapse && first }">{{ generateTitle(item) }}</span>
        </template>
        <template v-for="(child,cindex) in item[childrenKey]">
          <el-menu-item :index="child[pathKey],cindex"
                        @click="open(child)"
                        :class="{'is-active':vaildActive(child)}"
                        v-if="validatenull(child[childrenKey])"
                    <el-menu-item :index="child[pathKey], cindex" @click="open(child)"
                        :class="{ 'is-active': vaildActive(child) }" v-if="validatenull(child[childrenKey])"
                        :key="child[labelKey]">
            <i :class="child[iconKey]"></i>
            <span slot="title">{{generateTitle(child)}}</span>
          </el-menu-item>
          <sidebar-item v-else
                        :menu="[child]"
                        :key="cindex"
                        :props="props"
                        :screen="screen"
                    <sidebar-item v-else :menu="[child]" :key="cindex" :props="props" :screen="screen"
                        :collapse="collapse"></sidebar-item>
        </template>
      </el-submenu>
@@ -39,16 +27,16 @@
  </div>
</template>
<script>
  import {mapGetters} from "vuex";
  import {isURL, validatenull} from "@/util/validate";
  import config from "./config.js";
import { mapGetters } from "vuex"
import { isURL, validatenull } from "@/util/validate"
import config from "./config.js"
  export default {
    name: "sidebarItem",
    data() {
      return {
        config: config
      };
        }
    },
    props: {
      menu: {
@@ -64,7 +52,7 @@
      props: {
        type: Object,
        default: () => {
          return {};
                return {}
        }
      },
      collapse: {
@@ -78,22 +66,22 @@
    computed: {
      ...mapGetters(["roles"]),
      labelKey() {
        return this.props.label || this.config.propsDefault.label;
            return this.props.label || this.config.propsDefault.label
      },
      pathKey() {
        return this.props.path || this.config.propsDefault.path;
            return this.props.path || this.config.propsDefault.path
      },
      iconKey() {
        return this.props.icon || this.config.propsDefault.icon;
            return this.props.icon || this.config.propsDefault.icon
      },
      childrenKey() {
        return this.props.children || this.config.propsDefault.children;
            return this.props.children || this.config.propsDefault.children
      },
      isOpenKey() {
        return this.props.isOpen || this.config.propsDefault.isOpen;
            return this.props.isOpen || this.config.propsDefault.isOpen
      },
      nowTagValue() {
        return this.$router.$avueRouter.getValue(this.$route);
            return this.$router.$avueRouter.getValue(this.$route)
      }
    },
    methods: {
@@ -101,46 +89,46 @@
        return this.$router.$avueRouter.generateTitle(
          item[this.labelKey],
          (item.meta || {}).i18n
        );
            )
      },
      vaildActive(item) {
        if (this.validIsOpen(item)) {
          return false;
                return false
        }
        const groupFlag = (item["group"] || []).some(ele =>
          this.$route.path.includes(ele)
        );
        return this.nowTagValue === item[this.pathKey] || groupFlag;
            )
            return this.nowTagValue === item[this.pathKey] || groupFlag
      },
      vaildRoles(item) {
        item.meta = item.meta || {};
        return item.meta.roles ? item.meta.roles.includes(this.roles) : true;
            item.meta = item.meta || {}
            return item.meta.roles ? item.meta.roles.includes(this.roles) : true
      },
      validatenull(val) {
        return validatenull(val);
            return validatenull(val)
      },
      validIsOpen(item) {
        if (item[this.isOpenKey] === 2 && isURL(item[this.pathKey])) {
          return true;
                return true
        }
      },
      open(item) {
        if (this.screen <= 1) this.$store.commit("SET_COLLAPSE");
            if (this.screen <= 1) this.$store.commit("SET_COLLAPSE")
        if (this.validIsOpen(item)) {
          window.open(item[this.pathKey]);
                window.open(item[this.pathKey])
        } else {
          this.$router.$avueRouter.group = item.group;
          this.$router.$avueRouter.meta = item.meta;
                this.$router.$avueRouter.group = item.group
                this.$router.$avueRouter.meta = item.meta
          this.$router.push({
            path: this.$router.$avueRouter.getPath({
              name: item[this.labelKey],
              src: item[this.pathKey]
            }, item.meta),
            query: item.query
          });
                })
        }
      }
    }
  };
}
</script>
src/page/index/tags.vue
@@ -1,38 +1,24 @@
<template>
  <div class="avue-tags"
       v-if="showTag">
    <div class="avue-tags" v-if="showTag">
    <!-- tag盒子 -->
    <div v-if="contextmenuFlag"
         class="avue-tags__contentmenu"
        <div v-if="contextmenuFlag" class="avue-tags__contentmenu"
         :style="{left:contentmenuX+'px',top:contentmenuY+'px'}">
      <div class="item"
           @click="clearCacheTags">{{$t('tagsView.clearCache')}}
            <div class="item" @click="clearCacheTags">{{ $t('tagsView.clearCache') }}
      </div>
      <div class="item"
           @click="closeOthersTags">{{$t('tagsView.closeOthers')}}
            <div class="item" @click="closeOthersTags">{{ $t('tagsView.closeOthers') }}
      </div>
      <div class="item"
           @click="closeAllTags">{{$t('tagsView.closeAll')}}
            <div class="item" @click="closeAllTags">{{ $t('tagsView.closeAll') }}
      </div>
    </div>
    <div class="avue-tags__box"
         :class="{'avue-tags__box--close':!website.isFirstPage}">
      <el-tabs v-model="active"
               type="card"
               @contextmenu.native="handleContextmenu"
               :closable="tagLen!==1"
               @tab-click="openTag"
               @edit="menuTag">
        <el-tab-pane :key="item.value"
                     v-for="item in tagList"
                     :label="generateTitle(item)"
                     :name="item.value">
        <div class="avue-tags__box" :class="{ 'avue-tags__box--close': !website.isFirstPage }">
            <el-tabs v-model="active" type="card" @contextmenu.native="handleContextmenu" :closable="tagLen !== 1"
                @tab-click="openTag" @edit="menuTag">
                <el-tab-pane :key="item.value" v-for="item in tagList" :label="generateTitle(item)" :name="item.value">
        </el-tab-pane>
      </el-tabs>
      <el-dropdown class="avue-tags__menu">
        <el-button type="primary"
                   size="mini">
                <el-button type="primary" size="mini">
          {{$t('tagsView.menu')}}
          <i class="el-icon-arrow-down el-icon--right"></i>
        </el-button>
@@ -44,12 +30,11 @@
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>
<script>
  import {mapGetters, mapState} from "vuex";
  import {clearCache} from "@/api/user";
import { mapGetters, mapState } from "vuex"
import { clearCache } from "@/api/user"
  export default {
    name: "tags",
@@ -59,28 +44,28 @@
        contentmenuX: "",
        contentmenuY: "",
        contextmenuFlag: false
      };
        }
    },
    created() {
    },
    mounted() {
      this.setActive();
        this.setActive()
    },
    watch: {
      tag() {
        this.setActive();
            this.setActive()
      },
      contextmenuFlag() {
        window.addEventListener("mousedown", this.watchContextmenu);
            window.addEventListener("mousedown", this.watchContextmenu)
      }
    },
    computed: {
      ...mapGetters(["tagWel", "tagList", "tag", "website"]),
        ...mapGetters(["tagWel", "tagList", "tag", "website", "homeFirstPage"]),
      ...mapState({
        showTag: state => state.common.showTag
      }),
      tagLen() {
        return this.tagList.length || 0;
            return this.tagList.length || 0
      }
    },
    methods: {
@@ -88,52 +73,52 @@
        return this.$router.$avueRouter.generateTitle(
          item.label,
          (item.meta || {}).i18n
        );
            )
      },
      watchContextmenu(event) {
        if (!this.$el.contains(event.target) || event.button !== 0) {
          this.contextmenuFlag = false;
                this.contextmenuFlag = false
        }
        window.removeEventListener("mousedown", this.watchContextmenu);
            window.removeEventListener("mousedown", this.watchContextmenu)
      },
      handleContextmenu(event) {
        let target = event.target;
            let target = event.target
        // 解决 https://github.com/d2-projects/d2-admin/issues/54
        let flag = false;
        if (target.className.indexOf("el-tabs__item") > -1) flag = true;
            let flag = false
            if (target.className.indexOf("el-tabs__item") > -1) flag = true
        else if (target.parentNode.className.indexOf("el-tabs__item") > -1) {
          target = target.parentNode;
          flag = true;
                target = target.parentNode
                flag = true
        }
        if (flag) {
          event.preventDefault();
          event.stopPropagation();
          this.contentmenuX = event.clientX;
          this.contentmenuY = event.clientY;
          this.tagName = target.getAttribute("aria-controls").slice(5);
          this.contextmenuFlag = true;
                event.preventDefault()
                event.stopPropagation()
                this.contentmenuX = event.clientX
                this.contentmenuY = event.clientY
                this.tagName = target.getAttribute("aria-controls").slice(5)
                this.contextmenuFlag = true
        }
      },
      //激活当前选项
      setActive() {
        this.active = this.tag.value;
            this.active = this.tag.value
      },
      menuTag(value, action) {
        if (action === "remove") {
          let {tag, key} = this.findTag(value);
          this.$store.commit("DEL_TAG", tag);
                let { tag, key } = this.findTag(value)
                this.$store.commit("DEL_TAG", tag)
          if (tag.value === this.tag.value) {
            tag = this.tagList[key === 0 ? key : key - 1]; //如果关闭本标签让前推一个
            this.openTag(tag);
                    tag = this.tagList[key === 0 ? key : key - 1] //如果关闭本标签让前推一个
                    this.openTag(tag)
          }
        }
      },
      openTag(item) {
        let tag;
            let tag
        if (item.name) {
          tag = this.findTag(item.name).tag;
                tag = this.findTag(item.name).tag
        } else {
          tag = item;
                tag = item
        }
        this.$router.push({
          path: this.$router.$avueRouter.getPath({
@@ -141,31 +126,26 @@
            src: tag.value
          }, tag.meta),
          query: tag.query
        });
            })
      },
      closeOthersTags() {
        this.contextmenuFlag = false;
        this.$store.commit("DEL_TAG_OTHER");
            this.contextmenuFlag = false
            this.$store.commit("DEL_TAG_OTHER")
      },
      findTag(value) {
        let tag, key;
            let tag, key
        this.tagList.map((item, index) => {
          if (item.value === value) {
            tag = item;
            key = index;
                    tag = item
                    key = index
          }
        });
        return {tag: tag, key: key};
            })
            return { tag: tag, key: key }
      },
      closeAllTags() {
        this.contextmenuFlag = false;
        this.$store.commit("DEL_ALL_TAG");
        this.$router.push({
          path: this.$router.$avueRouter.getPath({
            src: this.tagWel.value
          }),
          query: this.tagWel.query
        });
            this.contextmenuFlag = false
            this.$store.commit("DEL_ALL_TAG")
            this.$router.push({ path: this.homeFirstPage })
      },
      clearCacheTags() {
        this.$confirm("是否需要清除缓存?", {
@@ -174,13 +154,13 @@
          type: "warning"
        }).then(() => {
          clearCache().then(() => {
            this.contextmenuFlag = false;
            this.$message.success('清除完毕');
                    this.contextmenuFlag = false
                    this.$message.success('清除完毕')
          })
        });
            })
      }
    }
  };
}
</script>
src/page/index/top/index.vue
@@ -170,7 +170,9 @@
                        }],
                    },
                ]
            }
            },
            showMenu: getStore({ name: "showMenu" }),
            globalUserInfo: getStore({ name: "userInfo" }),
        }
    },
    filters: {},
@@ -188,7 +190,6 @@
            showFullScren: state => state.common.showFullScren,
            showCollapse: state => state.common.showCollapse,
            showSearch: state => state.common.showSearch,
            showMenu: state => state.common.showMenu,
            showColor: state => state.common.showColor
        }),
        ...mapGetters([
src/page/login/userlogin.vue
@@ -53,6 +53,7 @@
</template>
<script>
import Layout from "@/page/index/"
import { mapGetters } from "vuex"
import { info } from "@/api/system/tenant"
// import {getCaptcha} from "@/api/user";
@@ -176,15 +177,15 @@
    },
    props: [],
    methods: {
        refreshCode () {
            if (this.website.captchaMode) {
                getCaptcha().then(res => {
                    const data = res.data
                    this.loginForm.key = data.key
                    this.loginForm.image = data.image
                })
            }
        },
        // refreshCode () {
        //     if (this.website.captchaMode) {
        //         getCaptcha().then(res => {
        //             const data = res.data
        //             this.loginForm.key = data.key
        //             this.loginForm.image = data.image
        //         })
        //     }
        // },
        showPassword () {
            this.passwordType === ""
                ? (this.passwordType = "password")
@@ -208,7 +209,7 @@
                        text: '登录中,请稍后。。。',
                        spinner: "el-icon-loading"
                    })
                    this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
                    this.$store.dispatch("LoginByUsername", this.loginForm).then((res) => {
                        if (this.website.switchMode) {
                            const deptId = this.userInfo.dept_id
                            const roleId = this.userInfo.role_id
@@ -222,15 +223,24 @@
                                return false
                            }
                        }
                        if (JSON.stringify(res) == '{}') {
                        this.$router.push({ path: this.tagWel.value })
                        } else {
                            this.$router.$avueRouter.formatRoutes(res.menuData, true)
                            this.$router.push({ path: res.fistMenu.path })
                        }
                        loading.close()
                    }).catch(() => {
                        loading.close()
                        this.refreshCode()
                        // this.refreshCode()
                    })
                }
            })
        },
        getTenant () {
            let domain = getTopUrl()
            // 临时指定域名,方便测试
src/permission.js
@@ -1,66 +1,89 @@
/*
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-22 13:30:53
 * @FilePath: \jczz_web\src\permission.js
 * @Description:
 *
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
 */
/**
 * 全站权限配置
 *
 */
import router from './router/router'
import store from './store'
import {validatenull} from '@/util/validate'
import {getToken} from '@/util/auth'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import router from "./router/router";
import store from "./store";
import { validatenull } from "@/util/validate";
import { getToken } from "@/util/auth";
import NProgress from "nprogress"; // progress bar
import "nprogress/nprogress.css"; // progress bar style
import { getStore } from "@/util/store";
NProgress.configure({showSpinner: false});
const lockPage = store.getters.website.lockPage; //锁屏页
router.beforeEach((to, from, next) => {
  const meta = to.meta || {};
  const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
  store.commit('SET_IS_MENU', isMenu === undefined);
  store.commit("SET_IS_MENU", isMenu === undefined);
  if (getToken()) {
    if (store.getters.isLock && to.path !== lockPage) { //如果系统激活锁屏,全部跳转到锁屏页
      next({path: lockPage})
    } else if (to.path === '/login') { //如果登录成功访问登录页跳转到主页
      next({path: '/'})
    if (store.getters.isLock && to.path !== lockPage) {
      //如果系统激活锁屏,全部跳转到锁屏页
      next({ path: lockPage });
    } else if (to.path === "/login") {
      //如果登录成功访问登录页跳转到主页
      next({ path: "/" });
    } else {
      //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
      if (store.getters.token.length === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({path: '/login'})
        })
        store.dispatch("FedLogOut").then(() => {
          next({ path: "/login" });
        });
      } else {
        const value = to.query.src || to.fullPath;
        const label = to.query.name || to.name;
        const meta = to.meta || router.$avueRouter.meta || {};
        const i18n = to.query.i18n;
        if (to.query.target) {
          window.open(value)
        } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
          store.commit('ADD_TAG', {
          window.open(value);
        } else if (
          meta.isTab !== false &&
          !validatenull(value) &&
          !validatenull(label)
        ) {
          store.commit("ADD_TAG", {
            label: label,
            value: value,
            params: to.params,
            query: to.query,
            meta: (() => {
              if (!i18n) {
                return meta
                return meta;
              }
              return {
                i18n: i18n
              }
                i18n: i18n,
              };
            })(),
            group: router.$avueRouter.group || []
            group: router.$avueRouter.group || [],
          });
        }
        next()
        if (to.path === "/welindex") {
          next(store.getters.homeFirstPage);
          return;
        }
        next();
      }
    }
  } else {
    //判断是否需要认证,没有登录访问去登录页
    if (meta.isAuth === false) {
      next()
      next();
    } else {
      next('/login')
      next("/login");
    }
  }
})
});
router.afterEach(() => {
  NProgress.done();
src/router/page/index.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-19 11:40:51
 * @LastEditTime: 2024-01-22 12:40:01
 * @FilePath: \jczz_web\src\router\page\index.js
 * @Description:
 *
@@ -79,8 +79,13 @@
  {
    path: "/",
    name: "主页",
    redirect: "/wel",
    redirect: "/welindex",
  },
  {
    path: "/welindex",
  },
  {
    path: "/myiframe",
    component: Layout,
src/router/router.js
@@ -6,19 +6,20 @@
 * isTab是否加入到tag导航
 * isAuth是否需要授权
 */
import Vue from 'vue';
import VueRouter from 'vue-router';
import PageRouter from './page/' // 页面路由
import ViewsRouter from './views/' // 页面路由
import AvueRouter from './avue-router'; //封装的路由控制方法
import i18n from '@/lang' // Internationalization 国际化 多语言
import Store from '../store/'; // vuex
Vue.use(VueRouter)
import Vue from "vue";
import VueRouter from "vue-router";
import PageRouter from "./page/"; // 页面路由
import ViewsRouter from "./views/"; // 页面路由
import AvueRouter from "./avue-router"; //封装的路由控制方法
import i18n from "@/lang"; // Internationalization 国际化 多语言
import Store from "../store/"; // vuex
Vue.use(VueRouter);
//创建路由
export const createRouter = () => new VueRouter({
  routes: [...PageRouter, ...ViewsRouter]
})
const Router = createRouter() // 获得 route 实例
export const createRouter = () =>
  new VueRouter({
    routes: [...PageRouter, ...ViewsRouter],
  });
const Router = createRouter(); // 获得 route 实例
// 初始化和注册 AvueRouter
AvueRouter.install(Vue, {
  router: Router,
@@ -28,9 +29,10 @@
});
Router.$avueRouter.formatRoutes(Store.state.user.menuAll, true); // 动态路由核心方法
Router.addRoutes([...PageRouter, ...ViewsRouter]);
export function resetRouter () {  // 重置路由 比如用于身份验证失败,需要重新登录时 先清空当前的路有权限
  const newRouter = createRouter()
  Router.matcher = newRouter.matcher // reset router
export function resetRouter() {
  // 重置路由 比如用于身份验证失败,需要重新登录时 先清空当前的路有权限
  const newRouter = createRouter();
  Router.matcher = newRouter.matcher; // reset router
  AvueRouter.install(Vue, {
    router: Router,
    store: Store,
@@ -38,4 +40,4 @@
    keepAlive: false,
  });
}
export default Router
export default Router;
src/router/views/index.js
@@ -1,143 +1,189 @@
import Layout from '@/page/index/'
import Layout from "@/page/index/";
export default [{
  path: '/wel',
export default [
  {
    path: "/wel",
  component: Layout,
  redirect: '/wel/index',
  children: [{
    path: 'index',
    name: '首页',
    redirect: "/wel/index",
    children: [
      {
        path: "index",
        name: "首页",
    meta: {
      i18n: 'dashboard'
          i18n: "dashboard",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/wel/index')
  }, {
    path: 'dashboard',
    name: '控制台',
          import(/* webpackChunkName: "views" */ "@/views/wel/index"),
      },
      {
        path: "dashboard",
        name: "控制台",
    meta: {
      i18n: 'dashboard',
          i18n: "dashboard",
      menu: false,
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/wel/dashboard')
  }]
}, {
  path: '/test',
          import(/* webpackChunkName: "views" */ "@/views/wel/dashboard"),
      },
    ],
  },
  {
    path: "/test",
  component: Layout,
  redirect: '/test/index',
  children: [{
    path: 'index',
    name: '测试页',
    redirect: "/test/index",
    children: [
      {
        path: "index",
        name: "测试页",
    meta: {
      i18n: 'test'
          i18n: "test",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/util/test')
  }]
}, {
  path: '/dict-horizontal',
          import(/* webpackChunkName: "views" */ "@/views/util/test"),
      },
    ],
  },
  {
    path: "/dict-horizontal",
  component: Layout,
  redirect: '/dict-horizontal/index',
  children: [{
    path: 'index',
    name: '字典管理',
    redirect: "/dict-horizontal/index",
    children: [
      {
        path: "index",
        name: "字典管理",
    meta: {
      i18n: 'dict'
          i18n: "dict",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal')
  }]
}, {
  path: '/dict-vertical',
          import(
            /* webpackChunkName: "views" */ "@/views/util/demo/dict-horizontal"
          ),
      },
    ],
  },
  {
    path: "/dict-vertical",
  component: Layout,
  redirect: '/dict-vertical/index',
  children: [{
    path: 'index',
    name: '字典管理',
    redirect: "/dict-vertical/index",
    children: [
      {
        path: "index",
        name: "字典管理",
    meta: {
      i18n: 'dict'
          i18n: "dict",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical')
  }]
}, {
  path: '/info',
          import(
            /* webpackChunkName: "views" */ "@/views/util/demo/dict-vertical"
          ),
      },
    ],
  },
  {
    path: "/info",
  component: Layout,
  redirect: '/info/index',
  children: [{
    path: 'index',
    name: '个人信息',
    redirect: "/info/index",
    children: [
      {
        path: "index",
        name: "个人信息",
    meta: {
      i18n: 'info'
          i18n: "info",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/system/userinfo')
  }]
}, {
  path: '/work/process/leave',
          import(/* webpackChunkName: "views" */ "@/views/system/userinfo"),
      },
    ],
  },
  {
    path: "/work/process/leave",
  component: Layout,
  redirect: '/work/process/leave/form',
  children: [{
    path: 'form/:processDefinitionId',
    name: '请假流程',
    redirect: "/work/process/leave/form",
    children: [
      {
        path: "form/:processDefinitionId",
        name: "请假流程",
    meta: {
      i18n: 'work'
          i18n: "work",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
  }, {
    path: 'handle/:taskId/:processInstanceId/:businessId',
    name: '处理请假流程',
          import(
            /* webpackChunkName: "views" */ "@/views/work/process/leave/form"
          ),
      },
      {
        path: "handle/:taskId/:processInstanceId/:businessId",
        name: "处理请假流程",
    meta: {
      i18n: 'work'
          i18n: "work",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
  }, {
    path: 'detail/:processInstanceId/:businessId',
    name: '请假流程详情',
          import(
            /* webpackChunkName: "views" */ "@/views/work/process/leave/handle"
          ),
      },
      {
        path: "detail/:processInstanceId/:businessId",
        name: "请假流程详情",
    meta: {
      i18n: 'work'
          i18n: "work",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/work/process/leave/detail')
  }]
}, {
  path: '/work/process/maintenanceFundApply',
          import(
            /* webpackChunkName: "views" */ "@/views/work/process/leave/detail"
          ),
      },
    ],
  },
  {
    path: "/work/process/maintenanceFundApply",
  component: Layout,
  redirect: '/work/process/maintenanceFundApply/form',
  children: [{
    path: 'form/:processDefinitionId',
    name: '维修基金申请',
    redirect: "/work/process/maintenanceFundApply/form",
    children: [
      {
        path: "form/:processDefinitionId",
        name: "维修基金申请",
    meta: {
      i18n: 'work'
          i18n: "work",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/work/process/maintenanceFundApply/form')
  }, {
    path: 'handle/:taskId/:processInstanceId/:businessId',
    name: '处理维修基金申请',
          import(
            /* webpackChunkName: "views" */ "@/views/work/process/maintenanceFundApply/form"
          ),
      },
      {
        path: "handle/:taskId/:processInstanceId/:businessId",
        name: "处理维修基金申请",
    meta: {
      i18n: 'work'
          i18n: "work",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/work/process/maintenanceFundApply/handle')
  }, {
    path: 'detail/:processInstanceId/:businessId',
    name: '维修基金申请详情',
          import(
            /* webpackChunkName: "views" */ "@/views/work/process/maintenanceFundApply/handle"
          ),
      },
      {
        path: "detail/:processInstanceId/:businessId",
        name: "维修基金申请详情",
    meta: {
      i18n: 'work'
          i18n: "work",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/work/process/maintenanceFundApply/detail')
  }, {
    path: 'edit/:taskId/:processInstanceId/:businessId',
    name: '调整维修基金申请',
          import(
            /* webpackChunkName: "views" */ "@/views/work/process/maintenanceFundApply/detail"
          ),
      },
      {
        path: "edit/:taskId/:processInstanceId/:businessId",
        name: "调整维修基金申请",
    meta: {
      i18n: 'work'
          i18n: "work",
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/work/process/maintenanceFundApply/edit')
  }]
}]
          import(
            /* webpackChunkName: "views" */ "@/views/work/process/maintenanceFundApply/edit"
          ),
      },
    ],
  },
];
src/store/getters.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-19 15:58:57
 * @LastEditTime: 2024-01-22 13:12:40
 * @FilePath: \jczz_web\src\store\getters.js
 * @Description:
 *
@@ -28,6 +28,8 @@
  tagWel: (state) => state.tags.tagWel,
  token: (state) => state.user.token,
  roles: (state) => state.user.roles,
  homeFirstPage: (state) => state.user.homeFirstPage,
  permission: (state) => state.user.permission,
  menu: (state) => state.user.menu,
  menuId: (state) => state.user.menuId,
src/store/modules/common.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-19 16:43:29
 * @LastEditTime: 2024-01-22 11:00:49
 * @FilePath: \jczz_web\src\store\modules\common.js
 * @Description:
 *
@@ -27,7 +27,6 @@
    showLock: true,
    showFullScren: true,
    showTheme: true,
    showMenu: true,
    showColor: true,
    colorName: getStore({ name: "colorName" }) || "#409EFF",
    themeName: "theme-white",
src/store/modules/tags.js
@@ -1,76 +1,81 @@
import {setStore, getStore} from '@/util/store'
import {diff} from '@/util/util'
import website from '@/config/website'
import { setStore, getStore } from "@/util/store";
import { diff } from "@/util/util";
import website from "@/config/website";
import { Alert } from "element-ui";
import user from "./user";
const isFirstPage = website.isFirstPage;
const tagWel = website.fistPage;
const tagObj = {
  label: '', //标题名称
  value: '', //标题的路径
  params: '', //标题的路径参数
  query: '', //标题的参数
  label: "", //标题名称
  value: "", //标题的路径
  params: "", //标题的路径参数
  query: "", //标题的参数
  meta: {},//额外参数
  group: [], //分组
}
};
//处理首个标签
function setFistTag(list) {
  if (list.length === 1) {
    list[0].close = false;
  } else {
    list.forEach(ele => {
    list.forEach((ele) => {
      if (ele.value === tagWel.value && isFirstPage === false) {
        ele.close = false
        ele.close = false;
      } else {
        ele.close = true
        ele.close = true;
      }
    })
    });
  }
}
const navs = {
  state: {
    tagList: getStore({name: 'tagList'}) || [],
    tag: getStore({name: 'tag'}) || tagObj,
    tagWel: tagWel
    tagList: getStore({ name: "tagList" }) || [],
    tag: getStore({ name: "tag" }) || tagObj,
    tagWel: tagWel,
  },
  actions: {},
  mutations: {
    ADD_TAG: (state, action) => {
      state.tag = action;
      setStore({name: 'tag', content: state.tag})
      if (state.tagList.some(ele => diff(ele, action))) return
      state.tagList.push(action)
      setStore({ name: "tag", content: state.tag });
      if (state.tagList.some((ele) => diff(ele, action))) return;
      state.tagList.push(action);
      setFistTag(state.tagList);
      setStore({name: 'tagList', content: state.tagList})
      setStore({ name: "tagList", content: state.tagList });
    },
    DEL_TAG: (state, action) => {
      state.tagList = state.tagList.filter(item => {
      state.tagList = state.tagList.filter((item) => {
        return !diff(item, action);
      })
      });
      setFistTag(state.tagList);
      setStore({name: 'tagList', content: state.tagList})
      setStore({ name: "tagList", content: state.tagList });
    },
    DEL_ALL_TAG: (state) => {
      state.tagList = [state.tagWel];
      setStore({name: 'tagList', content: state.tagList})
      state.tagList = [user.state.homeFirstTagPage];
      setStore({ name: "tagList", content: state.tagList });
    },
    DEL_TAG_OTHER: (state) => {
      state.tagList = state.tagList.filter(item => {
      state.tagList = state.tagList.filter((item) => {
        if (item.value === state.tag.value) {
          return true;
        } else if (!website.isFirstPage && item.value === website.fistPage.value) {
        } else if (
          !website.isFirstPage &&
          item.value === user.state.homeFirstTagPage.value
        ) {
          return true;
        }
      })
      });
      setFistTag(state.tagList);
      setStore({name: 'tagList', content: state.tagList})
      setStore({ name: "tagList", content: state.tagList });
    },
    SET_TAG_LIST(state, tagList) {
      state.tagList = tagList;
      setStore({name: 'tagList', content: state.tagList})
    }
  }
}
export default navs
      setStore({ name: "tagList", content: state.tagList });
    },
  },
};
export default navs;
src/store/modules/user.js
@@ -1,272 +1,376 @@
import {setToken, setRefreshToken, removeToken, removeRefreshToken} from '@/util/auth'
import {Message} from 'element-ui'
import {setStore, getStore} from '@/util/store'
import {isURL, validatenull} from '@/util/validate'
import {deepClone} from '@/util/util'
import website from '@/config/website'
import {loginByUsername, loginBySocial, loginBySso, getUserInfo, logout, refreshToken, getButtons} from '@/api/user'
import {getTopMenu, getRoutes} from '@/api/system/menu'
import md5 from 'js-md5'
import {
  setToken,
  setRefreshToken,
  removeToken,
  removeRefreshToken,
} from "@/util/auth";
import { Alert, Message } from "element-ui";
import { setStore, getStore } from "@/util/store";
import { isURL, validatenull } from "@/util/validate";
import { deepClone } from "@/util/util";
import website from "@/config/website";
import {
  loginByUsername,
  loginBySocial,
  loginBySso,
  getUserInfo,
  logout,
  refreshToken,
  getButtons,
} from "@/api/user";
import { getTopMenu, getRoutes } from "@/api/system/menu";
import md5 from "js-md5";
function findChildrenUrl(data) {
  if ("children" in data[0] && data[0].children.length > 0) {
    return findChildrenUrl(data[0].children);
  } else {
    return data[0];
  }
}
function addPath(ele, first) {
  const menu = website.menu;
  const propsConfig = menu.props;
  const propsDefault = {
    label: propsConfig.label || 'name',
    path: propsConfig.path || 'path',
    icon: propsConfig.icon || 'icon',
    children: propsConfig.children || 'children'
  }
    label: propsConfig.label || "name",
    path: propsConfig.path || "path",
    icon: propsConfig.icon || "icon",
    children: propsConfig.children || "children",
  };
  const icon = ele[propsDefault.icon];
  ele[propsDefault.icon] = validatenull(icon) ? menu.iconDefault : icon;
  const isChild = ele[propsDefault.children] && ele[propsDefault.children].length !== 0;
  const isChild =
    ele[propsDefault.children] && ele[propsDefault.children].length !== 0;
  if (!isChild) ele[propsDefault.children] = [];
  if (!isChild && first && !isURL(ele[propsDefault.path])) {
    ele[propsDefault.path] = ele[propsDefault.path] + '/index'
    ele[propsDefault.path] = ele[propsDefault.path] + "/index";
  } else {
    ele[propsDefault.children].forEach(child => {
    ele[propsDefault.children].forEach((child) => {
      addPath(child);
    })
    });
  }
}
const user = {
  state: {
    tenantId: getStore({name: 'tenantId'}) || '',
    userInfo: getStore({name: 'userInfo'}) || [],
    permission: getStore({name: 'permission'}) || {},
    tenantId: getStore({ name: "tenantId" }) || "",
    userInfo: getStore({ name: "userInfo" }) || [],
    permission: getStore({ name: "permission" }) || {},
    roles: [],
    menuId: {},
    menu: getStore({name: 'menu'}) || [],
    menuAll: getStore({name: 'menuAll'}) || [],
    token: getStore({name: 'token'}) || '',
    refreshToken: getStore({name: 'refreshToken'}) || '',
    menu: getStore({ name: "menu" }) || [],
    menuAll: getStore({ name: "menuAll" }) || [],
    token: getStore({ name: "token" }) || "",
    refreshToken: getStore({ name: "refreshToken" }) || "",
    homeFirstPage: getStore({ name: "firstPage" }) || "",
    homeFirstTagPage: getStore({ name: "firstTagPage" }) || {},
  },
  actions: {
    //根据用户名登录
    LoginByUsername({commit}, userInfo) {
    LoginByUsername({ dispatch, commit }, userInfo) {
      return new Promise((resolve, reject) => {
        loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key, userInfo.code).then(res => {
        loginByUsername(
          userInfo.tenantId,
          userInfo.deptId,
          userInfo.roleId,
          userInfo.username,
          md5(userInfo.password),
          userInfo.type,
          userInfo.key,
          userInfo.code
        )
          .then((res) => {
          const data = res.data;
          if (data.error_description) {
            Message({
              message: data.error_description,
              type: 'error'
            })
                type: "error",
              });
          } else {
            commit('SET_TOKEN', data.access_token);
            commit('SET_REFRESH_TOKEN', data.refresh_token);
            commit('SET_TENANT_ID', data.tenant_id);
            commit('SET_USER_INFO', data);
            commit('DEL_ALL_TAG');
            commit('CLEAR_LOCK');
              commit("SET_TOKEN", data.access_token);
              commit("SET_REFRESH_TOKEN", data.refresh_token);
              commit("SET_TENANT_ID", data.tenant_id);
              commit("SET_USER_INFO", data);
              commit("CLEAR_LOCK");
              commit("CLEAR_LOCK");
              dispatch("GetMenu").then((menuData) => {
                let fistMenu = findChildrenUrl(menuData);
                if (data.role_name == "jdgly" || data.role_name == "sqgly") {
                  setStore({ name: "showMenu", content: true });
                  commit("SET_HOMEFIRSTTAGPAGE", {
                    label: "首页",
                    value: "/wel/index",
                    params: {},
                    query: {},
                    meta: {
                      i18n: "dashboard",
                    },
                    group: [],
                    close: false,
                  });
                  commit("SET_HOMEFIRSTPAGE", "/wel");
                  resolve({});
                } else {
                  setStore({ name: "showMenu", content: false });
                  commit("SET_HOMEFIRSTTAGPAGE", {
                    label: fistMenu.name,
                    value: fistMenu.path,
                    params: {},
                    query: {},
                    meta: {
                      i18n: "dashboard",
                    },
                    group: [],
                    close: false,
                  });
                  commit("SET_HOMEFIRSTPAGE", fistMenu.path);
                  resolve({ fistMenu, menuData });
          }
          resolve();
        }).catch(error => {
                commit("DEL_ALL_TAG");
              });
            }
          })
          .catch((error) => {
          reject(error);
        })
      })
          });
      });
    },
    //根据手机号登录
    LoginByPhone({commit}, userInfo) {
      return new Promise((resolve) => {
        loginByUsername(userInfo.phone, userInfo.code).then(res => {
        loginByUsername(userInfo.phone, userInfo.code).then((res) => {
          const data = res.data.data;
          commit('SET_TOKEN', data);
          commit('DEL_ALL_TAG');
          commit('CLEAR_LOCK');
          commit("SET_TOKEN", data);
          commit("DEL_ALL_TAG");
          commit("CLEAR_LOCK");
          resolve();
        })
      })
        });
      });
    },
    //根据第三方信息登录
    LoginBySocial({commit}, userInfo) {
      return new Promise((resolve) => {
        loginBySocial(userInfo.tenantId, userInfo.source, userInfo.code, userInfo.state).then(res => {
        loginBySocial(
          userInfo.tenantId,
          userInfo.source,
          userInfo.code,
          userInfo.state
        ).then((res) => {
          const data = res.data;
          if (data.error_description) {
            Message({
              message: data.error_description,
              type: 'error'
            })
              type: "error",
            });
          } else {
            commit('SET_TOKEN', data.access_token);
            commit('SET_REFRESH_TOKEN', data.refresh_token);
            commit('SET_USER_INFO', data);
            commit('SET_TENANT_ID', data.tenant_id);
            commit('DEL_ALL_TAG');
            commit('CLEAR_LOCK');
            commit("SET_TOKEN", data.access_token);
            commit("SET_REFRESH_TOKEN", data.refresh_token);
            commit("SET_USER_INFO", data);
            commit("SET_TENANT_ID", data.tenant_id);
            commit("DEL_ALL_TAG");
            commit("CLEAR_LOCK");
          }
          resolve();
        })
      })
        });
      });
    },
    //根据单点信息登录
    LoginBySso({commit}, userInfo) {
      return new Promise((resolve) => {
        loginBySso(userInfo.state, userInfo.code).then(res => {
        loginBySso(userInfo.state, userInfo.code).then((res) => {
          const data = res.data;
          if (data.error_description) {
            Message({
              message: data.error_description,
              type: 'error'
            })
              type: "error",
            });
          } else {
            commit('SET_TOKEN', data.access_token);
            commit('SET_REFRESH_TOKEN', data.refresh_token);
            commit('SET_USER_INFO', data);
            commit('SET_TENANT_ID', data.tenant_id);
            commit('DEL_ALL_TAG');
            commit('CLEAR_LOCK');
            commit("SET_TOKEN", data.access_token);
            commit("SET_REFRESH_TOKEN", data.refresh_token);
            commit("SET_USER_INFO", data);
            commit("SET_TENANT_ID", data.tenant_id);
            commit("DEL_ALL_TAG");
            commit("CLEAR_LOCK");
          }
          resolve();
        })
      })
        });
      });
    },
    //获取用户信息
    GetUserInfo({commit}) {
      return new Promise((resolve, reject) => {
        getUserInfo().then((res) => {
        getUserInfo()
          .then((res) => {
          const data = res.data.data;
          commit('SET_ROLES', data.roles);
            commit("SET_ROLES", data.roles);
          resolve(data);
        }).catch(err => {
          })
          .catch((err) => {
          reject(err);
        })
      })
          });
      });
    },
    //刷新token
    refreshToken({state, commit}, userInfo) {
      window.console.log('handle refresh token');
      return new Promise((resolve, reject) => {
        refreshToken(state.refreshToken, state.tenantId,
        refreshToken(
          state.refreshToken,
          state.tenantId,
          !validatenull(userInfo) ? userInfo.deptId : state.userInfo.dept_id,
          !validatenull(userInfo) ? userInfo.roleId : state.userInfo.role_id
        ).then(res => {
        )
          .then((res) => {
          const data = res.data;
          commit('SET_TOKEN', data.access_token);
          commit('SET_REFRESH_TOKEN', data.refresh_token);
          commit('SET_USER_INFO', data);
            commit("SET_TOKEN", data.access_token);
            commit("SET_REFRESH_TOKEN", data.refresh_token);
            commit("SET_USER_INFO", data);
          resolve();
        }).catch(error => {
          reject(error)
        })
      })
          .catch((error) => {
            reject(error);
          });
      });
    },
    // 登出
    LogOut({commit}) {
      return new Promise((resolve, reject) => {
        logout().then(() => {
          commit('SET_TOKEN', '');
          commit('SET_MENU', []);
          commit('SET_MENU_ALL_NULL', []);
          commit('SET_ROLES', []);
          commit('SET_TAG_LIST', []);
          commit('DEL_ALL_TAG');
          commit('CLEAR_LOCK');
        logout()
          .then(() => {
            commit("SET_TOKEN", "");
            commit("SET_MENU", []);
            commit("SET_MENU_ALL_NULL", []);
            commit("SET_ROLES", []);
            commit("SET_TAG_LIST", []);
            commit("DEL_ALL_TAG");
            commit("CLEAR_LOCK");
          removeToken();
          removeRefreshToken();
          resolve();
        }).catch(error => {
          reject(error)
        })
      })
          .catch((error) => {
            reject(error);
          });
      });
    },
    //注销session
    FedLogOut({commit}) {
      return new Promise(resolve => {
        commit('SET_TOKEN', '');
        commit('SET_MENU_ALL_NULL', []);
        commit('SET_MENU', []);
        commit('SET_ROLES', []);
        commit('SET_TAG_LIST', []);
        commit('DEL_ALL_TAG');
        commit('CLEAR_LOCK');
      return new Promise((resolve) => {
        commit("SET_TOKEN", "");
        commit("SET_MENU_ALL_NULL", []);
        commit("SET_MENU", []);
        commit("SET_ROLES", []);
        commit("SET_TAG_LIST", []);
        commit("DEL_ALL_TAG");
        commit("CLEAR_LOCK");
        removeToken();
        removeRefreshToken();
        resolve();
      })
      });
    },
    //获取顶部菜单
    GetTopMenu() {
      return new Promise(resolve => {
      return new Promise((resolve) => {
        getTopMenu().then((res) => {
          const data = res.data.data || [];
          resolve(data)
        })
      })
          resolve(data);
        });
      });
    },
    //获取系统菜单
    GetMenu({commit, dispatch}, topMenuId) {
      return new Promise(resolve => {
      return new Promise((resolve) => {
        getRoutes(topMenuId).then((res) => {
          const data = res.data.data
          const data = res.data.data;
          let menu = deepClone(data);
          menu.forEach(ele => {
          menu.forEach((ele) => {
            addPath(ele, true);
          });
          commit('SET_MENU_ALL', menu)
          commit('SET_MENU', menu)
          dispatch('GetButtons');
          resolve(menu)
        })
      })
          commit("SET_MENU_ALL", menu);
          commit("SET_MENU", menu);
          dispatch("GetButtons");
          resolve(menu);
        });
      });
    },
    //获取系统按钮
    GetButtons({commit}) {
      return new Promise((resolve) => {
        getButtons().then(res => {
        getButtons().then((res) => {
          const data = res.data.data;
          commit('SET_PERMISSION', data);
          commit("SET_PERMISSION", data);
          resolve();
        })
      })
        });
      });
    },
  },
  mutations: {
    SET_HOMEFIRSTPAGE: (state, homeFirstPage) => {
      setStore({ name: "firstPage", content: homeFirstPage });
      state.homeFirstPage = homeFirstPage;
    },
    SET_HOMEFIRSTTAGPAGE: (state, homeFirstTagPage) => {
      setStore({
        name: "firstTagPage",
        content: homeFirstTagPage,
      });
      state.homeFirstTagPage = homeFirstTagPage;
    },
    SET_TOKEN: (state, token) => {
      setToken(token);
      state.token = token;
      setStore({name: 'token', content: state.token})
      setStore({ name: "token", content: state.token });
    },
    SET_MENU_ID(state, menuId) {
      state.menuId = menuId;
    },
    SET_MENU_ALL: (state, menuAll) => {
      let menu = state.menuAll;
      menuAll.forEach(ele => {
        if (!menu.find(item => item.label === ele.label && item.path === ele.path)) {
      menuAll.forEach((ele) => {
        if (
          !menu.find(
            (item) => item.label === ele.label && item.path === ele.path
          )
        ) {
          menu.push(ele);
        }
      })
      state.menuAll = menu
      setStore({ name: 'menuAll', content: state.menuAll })
      });
      state.menuAll = menu;
      setStore({ name: "menuAll", content: state.menuAll });
    },
    SET_MENU_ALL_NULL: (state) => {
      state.menuAll = []
      setStore({ name: 'menuAll', content: state.menuAll })
      state.menuAll = [];
      setStore({ name: "menuAll", content: state.menuAll });
    },
    SET_MENU: (state, menu) => {
      state.menu = menu
      setStore({ name: 'menu', content: state.menu })
      state.menu = menu;
      setStore({ name: "menu", content: state.menu });
    },
    SET_REFRESH_TOKEN: (state, refreshToken) => {
      setRefreshToken(refreshToken)
      setRefreshToken(refreshToken);
      state.refreshToken = refreshToken;
      setStore({name: 'refreshToken', content: state.refreshToken})
      setStore({ name: "refreshToken", content: state.refreshToken });
    },
    SET_TENANT_ID: (state, tenantId) => {
      state.tenantId = tenantId;
      setStore({name: 'tenantId', content: state.tenantId})
      setStore({ name: "tenantId", content: state.tenantId });
    },
    SET_USER_INFO: (state, userInfo) => {
      if (validatenull(userInfo.avatar)) {
        userInfo.avatar = "/img/bg/img-logo.png";
      }
      state.userInfo = userInfo;
      setStore({name: 'userInfo', content: state.userInfo})
      setStore({ name: "userInfo", content: state.userInfo });
    },
    SET_ROLES: (state, roles) => {
      state.roles = roles;
@@ -275,27 +379,26 @@
      let result = [];
      function getCode(list) {
        list.forEach(ele => {
          if (typeof (ele) === 'object') {
        list.forEach((ele) => {
          if (typeof ele === "object") {
            const chiildren = ele.children;
            const code = ele.code;
            if (chiildren) {
              getCode(chiildren)
              getCode(chiildren);
            } else {
              result.push(code);
            }
          }
        })
        });
      }
      getCode(permission);
      state.permission = {};
      result.forEach(ele => {
      result.forEach((ele) => {
        state.permission[ele] = true;
      });
      setStore({name: 'permission', content: state.permission})
    }
  }
}
export default user
      setStore({ name: "permission", content: state.permission });
    },
  },
};
export default user;
src/views/system/user.vue
@@ -436,14 +436,14 @@
                            {
                                label: "所属角色",
                                prop: "roleId",
                                multiple: true,
                                type: "tree",
                                multiple: true,
                                checkStrictly: true,
                                leafOnly: false,
                                dicData: [],
                                props: {
                                    label: "title"
                                },
                                checkStrictly: true,
                                slot: true,
                                rules: [{
                                    required: true,
                                    message: "请选择所属角色",
@@ -699,7 +699,7 @@
            row['userType'] = 1
            row.deptId = func.join(row.deptId)
            row.roleId = func.join(row.roleId)
            row.postId = func.join(row.postId);
            row.postId = func.join(row.postId)
            add(row).then(() => {
                this.initFlag = false
                this.onLoad(this.page)
@@ -718,7 +718,7 @@
            row['userType'] = 1
            row.deptId = func.join(row.deptId)
            row.roleId = func.join(row.roleId)
            row.postId = func.join(row.postId);
            row.postId = func.join(row.postId)
            update(row).then(() => {
                this.initFlag = false
                this.onLoad(this.page)
src/views/wel/index.vue
@@ -4,25 +4,10 @@
            <span class="h1">{{ webTitle }}</span>
            <span class="h2"></span>
        </div>
        <div class="homeL-bar">
            <div class="outS" @click="down1">
                <div class="down1"><span>住户管理</span></div>
        <div class="homeL-bar" v-if="homeMenuData.length">
            <div class="outS" v-for="(item, index) in homeMenuData" :key="index" @click="openMenu(item, item.newOpen)">
                <div :style="{ backgroundImage: `url(${publicPath + item.imageUrl})` }"><span>{{ item.title }}</span>
            </div>
            <div class="outS" @click="down2">
                <div class="down2"><span>房屋管理</span></div>
            </div>
            <div class="outS" @click="down3">
                <div class="down3"><span>E呼即办</span></div>
            </div>
            <div class="outS" @click="down4">
                <div class="down4"><span>报事报修</span></div>
            </div>
            <div class="outS" @click="down5">
                <div class="down5"><span>走访日志</span></div>
            </div>
            <div class="outS" @click="down6"
                v-show="globalUserInfo.role_name == 'administrator' || globalUserInfo.role_name.split(',').find(item => item == 'admin')">
                <div class="down6"><span>驾驶舱</span></div>
            </div>
        </div>
    </div>
@@ -39,29 +24,106 @@
            webType: getStore({ name: "webType" }),
            a: 1,
            globalUserInfo: getStore({ name: "userInfo" }),
            publicPath: process.env.BASE_URL,
            homeMenuData: []
        }
    },
    created () {
        if (this.webType == 'secend') {
            // 住建局
            // if (this.globalUserInfo.role_name == 'zjj') {
            //     this.homeMenuData = [
            //         {
            //             imageUrl: 'img/yijianbaoj.png',
            //             url: '/propertySupervision/residentSupervision',
            //             title: '居民监管',
            //             newOpen: false,
            //         },
            //         {
            //             imageUrl: 'img/yijianbaoj.png',
            //             url: '/propertySupervision/houseHoldSupervision',
            //             title: '住房监管',
            //             newOpen: false,
            //         },
            //         {
            //             imageUrl: 'img/yijianbaoj.png',
            //             url: '/propertySupervision/ownersCommittee',
            //             title: '业主大会',
            //             newOpen: false,
            //         },
            //         {
            //             imageUrl: 'img/yijianbaoj.png',
            //             url: '/propertySupervision/propertyCapitalManage',
            //             title: '维修基金管理',
            //             newOpen: false,
            //         },
            //     ]
            // } else {
            //     // 物业
            //     this.homeMenuData = [
            //         {
            //             imageUrl: 'img/yijianbaoj.png',
            //             url: '/userHouse/houseHoldList',
            //             title: '住户管理',
            //             newOpen: false,
            //         },
            //     ]
            // }
        } else {
            this.homeMenuData = [
                {
                    imageUrl: 'img/yijianbaoj.png',
                    url: '/userHouse/houseHoldList',
                    title: '住户管理',
                    newOpen: false,
                },
                {
                    imageUrl: 'img/fangyi.png',
                    url: '/userHouse/houseList',
                    title: '房屋管理',
                    newOpen: false,
                },
                {
                    imageUrl: 'img/anjian.png',
                    url: '/cGovernance/taskECall',
                    title: 'E呼即办',
                    newOpen: false,
                },
                {
                    imageUrl: 'img/tiwen.png',
                    url: '/task/reportForRepairs',
                    title: '报事报修',
                    newOpen: false,
                },
                {
                    imageUrl: 'img/tongji.png',
                    url: '/cGovernance/gridWorkLog',
                    title: '走访日志',
                    newOpen: false,
                }
            ]
            if (this.globalUserInfo.role_name == 'administrator' || this.globalUserInfo.role_name.split(',').find(item => item == 'admin')) {
                this.homeMenuData.push({
                    imageUrl: 'img/jsc.png',
                    url: `http://srgdjczzxtpt.com:2181/uniform-auth/login?app=app_smart_aoi&Blade-Auth=bearer ${getToken()}`,
                    title: '驾驶舱',
                    newOpen: true,
                })
            }
        }
    },
    methods: {
        down1 () {
            this.$router.push({ path: "/userHouse/houseHoldList" })
        },
        down2 () {
            this.$router.push({ path: "/userHouse/houseList" })
        },
        down3 () {
            this.$router.push({ path: "/cGovernance/taskECall" })
        },
        down4 () {
            this.$router.push({ path: "/task/reportForRepairs" })
        },
        down5 () {
            this.$router.push({ path: "/cGovernance/gridWorkLog" })
        },
        down6 () {
            let token = 'bearer ' + getToken()
            window.open(`http://srgdjczzxtpt.com:2181/uniform-auth/login?app=app_smart_aoi&Blade-Auth=${token}`)
        },
        openMenu (data, flag = false) {
            if (flag) {
                window.open(data.url)
            } else {
                this.$router.push({ path: data.url })
            }
        }
    },
    mouted () { },
}
@@ -118,14 +180,8 @@
            height: 94.6%;
            display: flex;
            justify-content: center;
        }
        .down1,
        .down2,
        .down3,
        .down4,
        .down5,
        .down6 {
            &>div {
            width: 96%;
            height: 100%;
            background-repeat: no-repeat;
@@ -153,29 +209,6 @@
                // border: 1px solid rgb(180, 22, 75);
            }
        }
        .down1 {
            background-image: url("../../../public/img/yijianbaoj.png");
        }
        .down2 {
            background-image: url("../../../public/img/fangyi.png");
        }
        .down3 {
            background-image: url("../../../public/img/anjian.png");
        }
        .down4 {
            background-image: url("../../../public/img/tiwen.png");
        }
        .down5 {
            background-image: url("../../../public/img/tongji.png");
        }
        .down6 {
            background-image: url("../../../public/img/jsc.png");
        }
    }
}