From a459a9d4d2ad19732fb84182d217e8daeeb5bb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=99=8C?= Date: Wed, 5 Jul 2023 16:33:52 +0800 Subject: [PATCH] no message --- src/components/scFilterBar/index.vue | 2 +- src/router/index.js | 32 +++--- src/views/login/components/passwordForm.vue | 59 +++++------ src/views/login/index.vue | 59 +++++------ src/views/system/table/index.vue | 87 +++++++--------- src/views/system/tablegen/column.vue | 104 ++++++++++++++++---- src/views/system/tablegen/index.vue | 7 +- src/views/system/tablegen/options.vue | 80 +++++++++++++++ 8 files changed, 285 insertions(+), 145 deletions(-) create mode 100644 src/views/system/tablegen/options.vue diff --git a/src/components/scFilterBar/index.vue b/src/components/scFilterBar/index.vue index 8ca30ce..8d1c1d2 100644 --- a/src/components/scFilterBar/index.vue +++ b/src/components/scFilterBar/index.vue @@ -110,7 +110,7 @@ filterObj(){ const obj = {} this.filter.forEach((item) => { - if (this.data[item.name] === undefined || this.data[item.name] === null || JSON.stringify(this.data[item.name]) === '') { + if (this.data[item.name] === undefined || this.data[item.name] === '' || JSON.stringify(this.data[item.name]) === '') { return ; // 跳过当前迭代,继续下一次迭代 } if (item.options && item.options.items && item.options.items.length>0) { diff --git a/src/router/index.js b/src/router/index.js index 24a0c28..d6136e7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -9,6 +9,7 @@ import config from "@/config" import NProgress from 'nprogress' import 'nprogress/nprogress.css' import tool from '@/utils/tool'; +import store from '@/store' import api from '@/api' import systemRouter from './systemRouter'; import userRoutes from '@/config/route'; @@ -67,24 +68,27 @@ router.beforeEach(async (to, from, next) => { if (!isGetRouter) { // 重新获取菜单路 api.system.index.get().then((response) => { - - for (const key in response.data) { - if (Object.prototype.hasOwnProperty.call(response.data, key)) { + if (response.code==200) { + // 缓存 + for (const key in response.data) { tool.data.set(key, response.data[key]); + if (key=='layout') { + store.commit("SET_layout", response.data[key]) + } } + var menu = router.sc_getMenu(); + var menuRouter = filterAsyncRouter(menu) + menuRouter = flatAsyncRoutes(menuRouter) + menuRouter.forEach(item => { + router.addRoute("layout", item) + }) + routes_404_r = router.addRoute(routes_404) + if (to.matched.length == 0) { + router.push(to.fullPath); + } + isGetRouter = true; } - var menu = router.sc_getMenu(); - var menuRouter = filterAsyncRouter(menu) - menuRouter = flatAsyncRoutes(menuRouter) - menuRouter.forEach(item => { - router.addRoute("layout", item) - }) - routes_404_r = router.addRoute(routes_404) - if (to.matched.length == 0) { - router.push(to.fullPath); - } - isGetRouter = true; }).catch((error) => { console.log(error); }); diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue index e4c52f9..3470bc1 100644 --- a/src/views/login/components/passwordForm.vue +++ b/src/views/login/components/passwordForm.vue @@ -62,6 +62,7 @@ account: this.form.account, password: this.$tool.crypto.BASE64.encrypt( this.$tool.crypto.BASE64.encrypt( this.form.password ) + this.$tool.crypto.BASE64.encrypt( this.form.account ) ) } + //获取token var user = await this.$api.auth.token.post(data) if(user.code !== 200){ @@ -75,40 +76,42 @@ }) //获取菜单 - var menu = null - menu = await this.$api.system.index.get() + // var menu = null + // menu = await this.$api.system.index.get() - if(menu.code == 200){ - if(menu.data.menu.length==0){ - this.islogin = false - this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", { - type: 'error', - center: true - }) - return false - } + // if(menu.code == 200){ - for (const key in menu.data) { - if (Object.prototype.hasOwnProperty.call(menu.data, key)) { - this.$tool.data.set(key, menu.data[key]); - } - } + // if(menu.data.menu.length==0){ + // this.islogin = false + // this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", { + // type: 'error', + // center: true + // }) + // return false + // } - }else{ + // for (const key in menu.data) { + // if (Object.prototype.hasOwnProperty.call(menu.data, key)) { + // this.$tool.data.set(key, menu.data[key]); + // } + // } + // + // + + // 获取登录前的URL + const redirect = this.$route.query.redirect || '/' + this.$router.replace({ + path: redirect + }) + + this.$message.success("Login Success 登录成功") this.islogin = false - this.$message.warning(menu.message) return false - } - - // 获取登录前的URL - const redirect = this.$route.query.redirect || '/' - this.$router.replace({ - path: redirect - }) - - this.$message.success("Login Success 登录成功") - this.islogin = false + // } + // this.islogin = false + // this.$message.warning(menu.message) + // return false }, } } diff --git a/src/views/login/index.vue b/src/views/login/index.vue index aa833d3..ab3f9c4 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -148,43 +148,38 @@ expires: 86400*360 }) - //获取菜单 - var menu = null - menu = await this.$api.system.index.get() + // //获取菜单 + // var menu = null + // menu = await this.$api.system.index.get() - if(menu.code == 200){ - if(menu.data.menu.length==0){ - this.islogin = false - this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", { - type: 'error', - center: true - }) - return false - } + // if(menu.code == 200){ + // if(menu.data.menu.length==0){ + // this.islogin = false + // this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", { + // type: 'error', + // center: true + // }) + // return false + // } + // for (const key in menu.data) { + // if (Object.prototype.hasOwnProperty.call(menu.data, key)) { + // this.$tool.data.set(key, menu.data[key]); + // } + // } - for (const key in menu.data) { - if (Object.prototype.hasOwnProperty.call(menu.data, key)) { - this.$tool.data.set(key, menu.data[key]); - } - } + // 获取登录前的URL + const redirect = this.$route.query.redirect || '/' + this.$router.replace({ + path: redirect + }) - - }else{ + this.$message.success("Login Success 登录成功") this.islogin = false - this.$message.warning(menu.message) - return false - } - - // 获取登录前的URL - const redirect = this.$route.query.redirect || '/' - this.$router.replace({ - path: redirect - }) - - this.$message.success("Login Success 登录成功") - this.islogin = false - + return false + // } + // this.islogin = false + // this.$message.warning(menu.message) } },1000) diff --git a/src/views/system/table/index.vue b/src/views/system/table/index.vue index c5d2893..4c28d3e 100644 --- a/src/views/system/table/index.vue +++ b/src/views/system/table/index.vue @@ -9,46 +9,46 @@ - - - - - - -
- - -
-
- {{ s.label }} - - -
-
+ + + + + + +
+ + +
+
+ {{ s.label }} + + +
+
- - - + + + - - - - - - - - -
- + + + + + + + + + + @@ -59,9 +59,6 @@ import scFilterBar from '@/components/scFilterBar'; import scEcharts from '@/components/scEcharts' import XItem from '@/components/scForm/item' - - - export default { name: 'propertyAuth', components: { @@ -139,9 +136,7 @@ }, //树点击事件 groupClick(data){ - this.search[this.aside.searchkey||'groupid'] = data[this.aside.key || 'id']; - this.$refs.table.reload(this.search) }, // 筛选回调 @@ -153,10 +148,6 @@ tabChange(){ this.$refs.table.reload(this.search) }, - //搜索 - upsearch(){ - this.$refs.table.reload(this.search) - }, //增加 plus(){ this.dialog.save = true @@ -253,7 +244,6 @@ //本地更新数据 handleSuccess(data, mode){ - if (!this.operation.edit.url) { this.$alert('没有编辑相关配置', "提示", {type: 'error'}); return; @@ -290,6 +280,5 @@ } } - diff --git a/src/views/system/tablegen/column.vue b/src/views/system/tablegen/column.vue index d03b73b..2bbbb54 100644 --- a/src/views/system/tablegen/column.vue +++ b/src/views/system/tablegen/column.vue @@ -173,6 +173,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -241,22 +304,6 @@ - - - +