| | |
| | | if (to.query.target) { |
| | | window.open(value) |
| | | } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) { |
| | | store.commit('', { |
| | | store.commit('ADD_TAG', { |
| | | label: label, |
| | | value: value, |
| | | params: to.params, |
| | |
| | | setStore({name: 'tagList', content: state.tagList}) |
| | | }, |
| | | DEL_TAG: (state, action) => { |
| | | console.log('779',state,action) |
| | | state.tagList = state.tagList.filter(item => { |
| | | return !diff(item, action); |
| | | }) |
| | |
| | | <!-- 主体视图层 --> |
| | | <div style="height:100%;overflow-y:auto;overflow-x:hidden;" id="avue-view" v-show="!isSearch"> |
| | | <keep-alive> |
| | | <router-view class="avue-view" v-if="$route.meta.keepAlive" :key="$route.fullPath"></router-view> |
| | | <router-view class="avue-view" v-if="$route.meta.keepAlive" :key="$route.fullPath"/> |
| | | </keep-alive> |
| | | <router-view class="avue-view" v-if="!$route.meta.keepAlive" :key="$route.fullPath" ></router-view> |
| | | <router-view class="avue-view" v-if="!$route.meta.keepAlive" :key="$route.fullPath"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | import {validatenull} from "@/util/validate"; |
| | | import {calcDate} from "@/util/date.js"; |
| | | import {getStore} from "@/util/store.js"; |
| | | import {getRoutes} from "@/api/system/menu" |
| | | |
| | | export default { |
| | | components: { |
| | | top, |
| | |
| | | refreshLock: false, |
| | | //刷新token的时间 |
| | | refreshTime: "", |
| | | loading:true, |
| | | routeList:[], |
| | | ids:[] |
| | | loading:true |
| | | }; |
| | | }, |
| | | |
| | | created() { |
| | | //实时检测刷新token |
| | | this.refreshToken(); |
| | | |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | |
| | | import {validatenull} from '@/util/validate' |
| | | import {getToken} from '@/util/auth' |
| | | import NProgress from 'nprogress' // progress bar |
| | | import 'nprogress/nprogress.css' |
| | | import Store from "@/store"; // progress bar style |
| | | import 'nprogress/nprogress.css' // progress bar style |
| | | NProgress.configure({showSpinner: false}); |
| | | const lockPage = store.getters.website.lockPage; //锁屏页 |
| | | router.beforeEach((to, from, next) => { |
| | |
| | | next({path: '/login'}) |
| | | }) |
| | | } else { |
| | | const fullPath = to.fullPath |
| | | const queryString = fullPath.split('?')[1]; |
| | | const value = to.query.src || to.fullPath; |
| | | const label = queryString === 'wupin' |
| | | ? '物品主数据' |
| | | : (queryString === 'renyuan' |
| | | ? '人员主数据' |
| | | : (queryString === 'gongyingshang' |
| | | ? '供应商主数据' |
| | | : (to.query.name || to.name))); |
| | | const label = to.query.name || to.name; |
| | | const meta = to.meta || router.$avueRouter.meta || {}; |
| | | const i18n = to.query.i18n; |
| | | if (to.query.target) { |
| | |
| | | return result.join('&'); |
| | | } |
| | | |
| | | let titileName; |
| | | this.$router.$avueRouter = { |
| | | //全局配置 |
| | | $website: this.$store.getters.website, |
| | | group: '', |
| | | meta: {}, |
| | | safe: this, |
| | | tianyuan:'', |
| | | // 设置标题 |
| | | setTitle: (title) => { |
| | | titileName=title |
| | | const defaultTitle = this.$vue.$t('title'); |
| | | this.$router.$avueRouter.tianyuan=title |
| | | title = title ? `${title}-${defaultTitle}` : defaultTitle; |
| | | document.title = title; |
| | | }, |
| | | |
| | | closeTag: (value) => { |
| | | let tag = value || this.$store.getters.tag; |
| | | if (typeof value === 'string') { |
| | |
| | | }, |
| | | //动态路由 |
| | | // 路由是专门的一个接口获取 |
| | | /** |
| | | * aMenu: 接受到的动态路由数据 menu的结构外层有父级path 里面有一个childen 记录页面的路由 |
| | | * first: 为了区分外界 调用formatRoutes 和 当前文件调用 formatRoutes |
| | | */ |
| | | /** |
| | | * aMenu: 接受到的动态路由数据 menu的结构外层有父级path 里面有一个childen 记录页面的路由 |
| | | * first: 为了区分外界 调用formatRoutes 和 当前文件调用 formatRoutes |
| | | */ |
| | | formatRoutes: function (aMenu = [], first) { |
| | | // window.console.log('aMenu') |
| | | // window.console.log(aMenu) |
| | | const aRouter = [] |
| | | // 获取到全局配置中的 props |
| | | const propsConfig = this.$website.menu.props; |
| | |
| | | icon = oMenu[propsDefault.icon], |
| | | children = oMenu[propsDefault.children], |
| | | meta = oMenu[propsDefault.meta] || {}; |
| | | // meta中 keepalive 的处理 |
| | | // meta中 keepalive 的处理 |
| | | meta = Object.assign(meta, (function () { |
| | | if (option.keepAlive === true) { |
| | | return { |
| | |
| | | /** |
| | | * 这里是重点,当有子路由的时候 会再去执行 formatRoutes 方法,然后又会有一个新的 aMenu for循环。 |
| | | * 最后返回的是一个数组 aRouter 这个数组就会作为 childen的值被 return |
| | | */ |
| | | */ |
| | | return this.formatRoutes(children, false) |
| | | })() |
| | | } |
| | | aRouter.push(oRouter) |
| | | // console.log(aRouter) |
| | | } |
| | | // for循环结束 |
| | | // 这个first 卡的其实就是首路由 |