c3afa824 by xiaomiao

路由前置守卫修改

1 parent 01fc196e
...@@ -8,10 +8,21 @@ export function getUserInfo () { ...@@ -8,10 +8,21 @@ export function getUserInfo () {
8 }) 8 })
9 } 9 }
10 10
11 // // 获取菜单信息
12 // export function getMenuInfo () {
13 // return request({
14 // url: SERVER.SERVERAPI + '/rest/user/getUserAuthorizationMenus',
15 // method: 'get',
16 // })
17 // }
18
11 // 获取菜单信息 19 // 获取菜单信息
12 export function getMenuInfo () { 20 export function getMenuInfo (data) {
13 return request({ 21 return request({
14 url: SERVER.SERVERAPI + '/rest/user/getUserAuthorizationMenus', 22 url: SERVER.SERVERAPI + '/rest/user/getUserAuthorizationMenus',
15 method: 'get', 23 method: 'get',
24 params: {
25 productCode: data,
26 },
16 }) 27 })
17 }
...\ No newline at end of file ...\ No newline at end of file
28 }
......
...@@ -16,247 +16,247 @@ ...@@ -16,247 +16,247 @@
16 <sidebarRight /> 16 <sidebarRight />
17 </div> 17 </div>
18 </div> 18 </div>
19 </div> 19 </div>
20 </template> 20 </template>
21 <script> 21 <script>
22 import sidebarLeft from "./Sidebar/sidebarLeft"; 22 import sidebarLeft from "./Sidebar/sidebarLeft";
23 import sidebarRight from "./Sidebar/sidebarRight"; 23 import sidebarRight from "./Sidebar/sidebarRight";
24 import { logout } from "@/api/login.js"; 24 import { logout } from "@/api/login.js";
25 import { mapGetters } from "vuex"; 25 import { mapGetters } from "vuex";
26 export default { 26 export default {
27 components: { 27 components: {
28 sidebarLeft, 28 sidebarLeft,
29 sidebarRight, 29 sidebarRight,
30 },
31 computed: {
32 ...mapGetters(["sidebar", "dicData","userInfo"]),
33 logoName() {
34 return this.dicData['sysCode'] && this.dicData['sysCode'].filter(item =>
35 item.DCODE == "systemTitle"
36 )
37 }, 30 },
38 userName(){ 31 computed: {
39 return this.userInfo ? this.userInfo.name : "" 32 ...mapGetters(["sidebar", "dicData", "userInfo"]),
40 } 33 logoName () {
41 }, 34 return this.dicData['sysCode'] && this.dicData['sysCode'].filter(item =>
42 methods: { 35 item.DCODE == "systemTitle"
43 onCancel () { 36 )
44 logout() 37 },
45 .then((res) => { 38 userName () {
46 sessionStorage.removeItem("token"); 39 return this.userInfo ? this.userInfo.name : ""
47 this.$store.dispatch("user/resetState"); 40 }
48 this.$router.replace({ 41 },
49 path: "/login/jg", 42 methods: {
50 query: { 43 onCancel () {
51 redirect: this.$route.fullPath, 44 logout()
52 }, 45 .then((res) => {
46 sessionStorage.removeItem("token");
47 this.$store.dispatch("user/resetState");
48 this.$router.replace({
49 path: "/jg",
50 query: {
51 redirect: this.$route.fullPath,
52 },
53 });
54 })
55 .catch((error) => {
56 // console.dir(error);
53 }); 57 });
54 }) 58 },
55 .catch((error) => {
56 // console.dir(error);
57 });
58 }, 59 },
59 }, 60 };
60 };
61 </script> 61 </script>
62 <style lang="scss" scoped> 62 <style lang="scss" scoped>
63 /deep/.el-menu--horizontal { 63 /deep/.el-menu--horizontal {
64 display: flex; 64 display: flex;
65 align-items: center; 65 align-items: center;
66 } 66 }
67
68 .menubg {
69 height: 34px;
70 width: 130px;
71 text-align: center;
72 color: #ffffff;
73 margin-right: 20px;
74 background: url("~@/image/navbar.png") no-repeat;
75 background-size: 100% 100%;
76 }
77
78 /deep/.el-menu-item {
79 @extend .menubg;
80 }
81
82 /deep/.el-submenu {
83 @extend .menubg;
84 }
85
86 /deep/.el-submenu__title {
87 height: 34px;
88 color: #ffffff;
89 }
90 67
91 /deep/.el-submenu__title span { 68 .menubg {
92 font-size: 14px; 69 height: 34px;
93 } 70 width: 130px;
71 text-align: center;
72 color: #ffffff;
73 margin-right: 20px;
74 background: url("~@/image/navbar.png") no-repeat;
75 background-size: 100% 100%;
76 }
94 77
95 .sidebarLeft { 78 /deep/.el-menu-item {
96 position: relative; 79 @extend .menubg;
97 top: 13px; 80 }
98 width: 30%;
99 }
100 81
101 /deep/.el-menu { 82 /deep/.el-submenu {
102 display: flex; 83 @extend .menubg;
103 justify-content: space-between; 84 }
104 }
105 85
106 /deep/.el-menu-item { 86 /deep/.el-submenu__title {
107 flex: 1; 87 height: 34px;
108 width: 100%; 88 color: #ffffff;
109 } 89 }
110 90
111 .sidebarRight { 91 /deep/.el-submenu__title span {
112 position: relative; 92 font-size: 14px;
113 top: 13px; 93 }
114 width: 30%;
115 padding-left: 20px;
116 }
117 94
118 // 导航选中背景色 95 .sidebarLeft {
119 .xuanzhong { 96 position: relative;
120 background: url("~@/image/selNavbar.png") no-repeat; 97 top: 13px;
121 background-size: 100% 100%; 98 width: 30%;
122 color: #ffffff !important; 99 }
123 font-weight: 700;
124 }
125 100
126 /deep/.el-menu-item:hover { 101 /deep/.el-menu {
127 @extend .xuanzhong; 102 display: flex;
128 } 103 justify-content: space-between;
104 }
129 105
130 /deep/.el-submenu__title:hover { 106 /deep/.el-menu-item {
131 @extend .xuanzhong; 107 flex: 1;
132 } 108 width: 100%;
109 }
133 110
134 /deep/.el-menu--horizontal .el-menu-item:not(.is-disabled):focus { 111 .sidebarRight {
135 @extend .xuanzhong; 112 position: relative;
136 } 113 top: 13px;
114 width: 30%;
115 padding-left: 20px;
116 }
137 117
138 /deep/.el-menu-item.is-active { 118 // 导航选中背景色
139 @extend .xuanzhong; 119 .xuanzhong {
140 } 120 background: url("~@/image/selNavbar.png") no-repeat;
121 background-size: 100% 100%;
122 color: #ffffff !important;
123 font-weight: 700;
124 }
141 125
142 .navbar { 126 /deep/.el-menu-item:hover {
143 height: $headerHeight; 127 @extend .xuanzhong;
144 overflow: hidden; 128 }
145 position: relative;
146 display: flex;
147 align-items: center;
148 padding: 0 20px;
149 justify-content: space-between;
150 background: url("~@/image/header.png") no-repeat;
151 background-size: 100% 100%;
152 129
153 .user { 130 /deep/.el-submenu__title:hover {
154 font-size: 12px; 131 @extend .xuanzhong;
155 color: #ffffff; 132 }
156 position: absolute;
157 right: 20px;
158 top: 0;
159 cursor: pointer;
160 133
161 .closeStyle { 134 /deep/.el-menu--horizontal .el-menu-item:not(.is-disabled):focus {
162 margin-right: 5px; 135 @extend .xuanzhong;
163 }
164 } 136 }
165 137
166 .title { 138 /deep/.el-menu-item.is-active {
167 position: absolute; 139 @extend .xuanzhong;
168 left: 0;
169 top: 10px;
170 bottom: 0;
171 right: 0;
172 margin: 0 auto;
173 font-size: 32px;
174 color: #ffffff;
175 font-weight: 700;
176 text-align: center;
177 } 140 }
178 141
179 .right-menu { 142 .navbar {
180 float: right; 143 height: $headerHeight;
181 height: 100%; 144 overflow: hidden;
182 line-height: 50px; 145 position: relative;
183 display: flex; 146 display: flex;
184 align-items: center; 147 align-items: center;
148 padding: 0 20px;
149 justify-content: space-between;
150 background: url("~@/image/header.png") no-repeat;
151 background-size: 100% 100%;
185 152
186 .shutdown { 153 .user {
187 font-size: 20px; 154 font-size: 12px;
188 margin-left: 15px; 155 color: #ffffff;
156 position: absolute;
157 right: 20px;
158 top: 0;
189 cursor: pointer; 159 cursor: pointer;
160
161 .closeStyle {
162 margin-right: 5px;
163 }
190 } 164 }
191 165
192 .organization-item { 166 .title {
193 margin-right: 40px; 167 position: absolute;
194 margin-top: -40px !important; 168 left: 0;
169 top: 10px;
170 bottom: 0;
171 right: 0;
172 margin: 0 auto;
173 font-size: 32px;
174 color: #ffffff;
175 font-weight: 700;
176 text-align: center;
195 } 177 }
196 178
197 .item { 179 .right-menu {
198 margin-right: 40px; 180 float: right;
199 margin-top: -20px; 181 height: 100%;
200 line-height: 18.4px; 182 line-height: 50px;
201 cursor: pointer; 183 display: flex;
202 position: relative; 184 align-items: center;
203 185
204 .item-box { 186 .shutdown {
205 position: absolute; 187 font-size: 20px;
206 top: -5px; 188 margin-left: 15px;
207 left: 3px;
208 width: 100%;
209 min-width: 25px;
210 height: 25px;
211 cursor: pointer; 189 cursor: pointer;
212 z-index: 100;
213 } 190 }
214 }
215
216 &:focus {
217 outline: none;
218 }
219 191
220 .right-menu-item { 192 .organization-item {
221 display: inline-block; 193 margin-right: 40px;
222 height: 100%; 194 margin-top: -40px !important;
223 font-size: 18px; 195 }
224 color: #fff;
225 vertical-align: text-bottom;
226 196
227 &.hover-effect { 197 .item {
198 margin-right: 40px;
199 margin-top: -20px;
200 line-height: 18.4px;
228 cursor: pointer; 201 cursor: pointer;
229 transition: background 0.3s; 202 position: relative;
230 display: flex;
231 align-items: center;
232 203
233 &:hover { 204 .item-box {
234 background: rgba(0, 0, 0, 0.025); 205 position: absolute;
206 top: -5px;
207 left: 3px;
208 width: 100%;
209 min-width: 25px;
210 height: 25px;
211 cursor: pointer;
212 z-index: 100;
235 } 213 }
236 } 214 }
237 }
238 215
239 .avatar-wrapper { 216 &:focus {
240 position: relative; 217 outline: none;
241 display: flex; 218 }
242 height: 40px;
243 align-items: center;
244 219
245 .user-avatar { 220 .right-menu-item {
246 cursor: pointer; 221 display: inline-block;
247 width: 35px; 222 height: 100%;
248 height: 35px; 223 font-size: 18px;
249 border-radius: 50%; 224 color: #fff;
225 vertical-align: text-bottom;
226
227 &.hover-effect {
228 cursor: pointer;
229 transition: background 0.3s;
230 display: flex;
231 align-items: center;
232
233 &:hover {
234 background: rgba(0, 0, 0, 0.025);
235 }
236 }
250 } 237 }
251 238
252 .el-icon-caret-bottom { 239 .avatar-wrapper {
253 cursor: pointer; 240 position: relative;
254 position: absolute; 241 display: flex;
255 right: -15px; 242 height: 40px;
256 top: 17px; 243 align-items: center;
257 font-size: 12px; 244
245 .user-avatar {
246 cursor: pointer;
247 width: 35px;
248 height: 35px;
249 border-radius: 50%;
250 }
251
252 .el-icon-caret-bottom {
253 cursor: pointer;
254 position: absolute;
255 right: -15px;
256 top: 17px;
257 font-size: 12px;
258 }
258 } 259 }
259 } 260 }
260 } 261 }
261 }
262 </style> 262 </style>
......
1 /*
2 * @Description:
3 * @Autor: renchao
4 * @LastEditTime: 2023-03-09 21:06:38
5 */
6 import router from "./router";
7 import store from "./store";
8 import { getMenuInfo } from "@/api/user";
9 import NProgress from "nprogress"; // progress bar
10 import "nprogress/nprogress.css"; // progress bar style
11 import getPageTitle from "@/utils/get-page-title";
12 import Cookies from "js-cookie";
13 NProgress.configure({ showSpinner: false }); // NProgress Configuration
14
15 router.beforeEach(async (to, from, next) => {
16 NProgress.start();
17 document.title = getPageTitle(to.meta.title);
18 let hasAddDict = store.state.dict.addDict;
19 let hasUser = store.state.user.hasUser;
20 let hasAddRoute = store.state.permission.addRoutes;
21 if (to.path == "/sb" || to.path == "/jg") {
22 sessionStorage.removeItem("token");
23 sessionStorage.setItem("psth", to.path)
24 next();
25 } else {
26 let code = sessionStorage.getItem("psth") == "/sb" ? "BDCSBPT" : "BDCJGPT"
27 //判断token是否存在
28 const hasToken = sessionStorage.getItem("token");
29 if (hasToken) {
30 //请求用户信息
31 if (!hasUser) {
32 store.dispatch("user/getUserInfo");
33 import("@/styles/public.scss");
34 }
35 if (hasAddRoute) {
36 next();
37 } else {
38 //请求菜单
39 const { result: getMenuData } = (await getMenuInfo(code)) || [];
40 const accessRoutes = await store.dispatch(
41 "permission/generateRoutes",
42 getMenuData
43 );
44 router.addRoutes([
45 ...accessRoutes,
46 { path: "*", redirect: "/404", hidden: true },
47 ]);
48 const routeTo = Cookies.get("routerTo");
49 if (!hasAddDict) {
50 await store.dispatch("dict/generateDic");
51 }
52 if (routeTo && routeTo !== "/") {
53 next({ ...to, replace: true });
54 } else {
55 next("/home");
56 }
57 }
58 } else {
59 next(sessionStorage.getItem("psth"));
60 }
61 }
62
63 NProgress.done();
64 });
65 router.afterEach((to) => {
66 // 解决刷新页面报404问题
67 Cookies.set("routerTo", to.fullPath);
68 NProgress.done();
69 });
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-07 09:43:25 4 * @LastEditTime: 2023-03-09 21:06:38
5 */ 5 */
6 import router from "./router"; 6 import router from "./router";
7 import store from "./store"; 7 import store from "./store";
...@@ -18,50 +18,12 @@ router.beforeEach(async (to, from, next) => { ...@@ -18,50 +18,12 @@ router.beforeEach(async (to, from, next) => {
18 let hasAddDict = store.state.dict.addDict; 18 let hasAddDict = store.state.dict.addDict;
19 let hasUser = store.state.user.hasUser; 19 let hasUser = store.state.user.hasUser;
20 let hasAddRoute = store.state.permission.addRoutes; 20 let hasAddRoute = store.state.permission.addRoutes;
21 21 if (to.path == "/sb" || to.path == "/jg") {
22 if (to.path == "/login/sb") {
23 sessionStorage.removeItem("token");
24 next();
25 } else if (to.path !== "/login/jg") {
26 //判断token是否存在
27 const hasToken = sessionStorage.getItem("token");
28 if (hasToken) {
29 //请求用户信息
30 if (!hasUser) {
31 store.dispatch("user/getUserInfo");
32 }
33 if (hasAddRoute) {
34 next();
35 } else {
36 //请求菜单
37 const { result: getMenuData } = (await getMenuInfo()) || [];
38 const accessRoutes = await store.dispatch(
39 "permission/generateRoutes",
40 getMenuData
41 );
42 router.addRoutes([
43 ...accessRoutes,
44 { path: "*", redirect: "/404", hidden: true },
45 ]);
46 const routeTo = Cookies.get("routerTo");
47 if (!hasAddDict) {
48 await store.dispatch("dict/generateDic");
49 }
50 if (routeTo && routeTo !== "/") {
51 next({ ...to, replace: true });
52 } else {
53 alert("上报")
54 next("/home");
55 }
56 }
57 } else {
58 next("/login/sb");
59 }
60 }
61 if (to.path == "/login/jg") {
62 sessionStorage.removeItem("token"); 22 sessionStorage.removeItem("token");
23 sessionStorage.setItem("psth", to.path)
63 next(); 24 next();
64 } else if (to.path !== "/login/sb") { 25 } else {
26 let code = sessionStorage.getItem("psth") == "/sb" ? "BDCSBPT" : "BDCJGPT"
65 //判断token是否存在 27 //判断token是否存在
66 const hasToken = sessionStorage.getItem("token"); 28 const hasToken = sessionStorage.getItem("token");
67 if (hasToken) { 29 if (hasToken) {
...@@ -74,7 +36,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -74,7 +36,7 @@ router.beforeEach(async (to, from, next) => {
74 next(); 36 next();
75 } else { 37 } else {
76 //请求菜单 38 //请求菜单
77 const { result: getMenuData } = (await getMenuInfo()) || []; 39 const { result: getMenuData } = (await getMenuInfo(code)) || [];
78 const accessRoutes = await store.dispatch( 40 const accessRoutes = await store.dispatch(
79 "permission/generateRoutes", 41 "permission/generateRoutes",
80 getMenuData 42 getMenuData
...@@ -90,14 +52,16 @@ router.beforeEach(async (to, from, next) => { ...@@ -90,14 +52,16 @@ router.beforeEach(async (to, from, next) => {
90 if (routeTo && routeTo !== "/") { 52 if (routeTo && routeTo !== "/") {
91 next({ ...to, replace: true }); 53 next({ ...to, replace: true });
92 } else { 54 } else {
93 alert("监管")
94 next("/home"); 55 next("/home");
95 } 56 }
96 } 57 }
58 } else if (sessionStorage.getItem("psth")) {
59 next(sessionStorage.getItem("psth"));
97 } else { 60 } else {
98 next("/login/jg"); 61 next("/jg");
99 } 62 }
100 } 63 }
64
101 NProgress.done(); 65 NProgress.done();
102 }); 66 });
103 router.afterEach((to) => { 67 router.afterEach((to) => {
......
...@@ -24,12 +24,12 @@ export const constantRoutes = [ ...@@ -24,12 +24,12 @@ export const constantRoutes = [
24 }, 24 },
25 //登录 25 //登录
26 { 26 {
27 path: "/login/jg", 27 path: "/jg",
28 name: "loginjg", 28 name: "loginjg",
29 component: () => import("@/views/loginjg/index.vue"), 29 component: () => import("@/views/loginjg/index.vue"),
30 }, 30 },
31 { 31 {
32 path: "/login/sb", 32 path: "/sb",
33 name: "loginsb", 33 name: "loginsb",
34 component: () => import("@/views/loginsb/index.vue"), 34 component: () => import("@/views/loginsb/index.vue"),
35 }, 35 },
......
1 <template>
2 <div class="bg">
3 <div class="login-inner-bg login">
4 <h2>{{ productName }}</h2>
5 <div class="user_style">
6 <h3>欢迎登录</h3>
7 <el-form :model="user" :rules="rules" ref="user" id="loginform" class="demo-ruleForm">
8 <el-form-item prop="account">
9 <el-input class="username" v-model="user.account" placeholder="请输入用户名"></el-input>
10 </el-form-item>
11 <el-form-item prop="password">
12 <el-input type="password" class="password" @keyup.enter.native="login('user')" v-model="user.password"
13 placeholder="请输入密码"></el-input>
14 </el-form-item>
15 <el-form-item class="login-btn">
16 <el-button type="primary" style="width: 100%" @click="login('user')">登录</el-button>
17 </el-form-item>
18 </el-form>
19 </div>
20 </div>
21 </div>
22 </template>
23
24 <script>
25 import { loginIn } from "@/api/login.js";
26 import { api, getAction } from "@/api/manageApi";
27 export default {
28 name: "Login",
29 data () {
30 return {
31 user: {
32 account: "",
33 password: "",
34 checkStatus: false,
35 },
36 productName: "",
37 rules: {
38 account: [{ required: true, message: "请填写帐号", trigger: "blur" }],
39 password: [{ required: true, message: "请填写密码", trigger: "blur" }],
40 },
41 };
42 },
43 created () {
44 const params = {};
45 const queryOptions = {
46 conditionGroup: {
47 conditions: [
48 {
49 property: "code",
50 value: "BDCJGPT",
51 operator: "EQ",
52 },
53 ],
54 queryRelation: "AND",
55 },
56 };
57 params.queryOptions = JSON.stringify(queryOptions);
58 //根据子系统code获取子系统详细信息
59 getAction(api.subsystem, params).then((res) => {
60 if (res.status === 1) {
61 this.productName = res.content[0].name;
62 this.$store.dispatch("products/setData", res.content[0]);
63 } else {
64 this.$message.error({ message: res.message, showClose: true });
65 }
66 });
67 },
68 mounted () {
69 // this.checkUserName();
70 },
71 methods: {
72 //记住用户名
73 checkUserName: function (flag) {
74 this.user.checkStatus = flag;
75 if (this.user.checkStatus) {
76 localStorage.setItem("accountId", this.user.account);
77 let name = localStorage.getItem("accountId");
78 if (name === "") {
79 return;
80 } else {
81 this.user.account = name;
82 }
83 } else {
84 this.user.account = localStorage.getItem("accountId");
85 }
86 },
87 login (user) {
88 var self = this;
89 this.$refs[user].validate((valid) => {
90 if (valid) {
91 loginIn(self.user.account, self.user.password)
92 .then((res) => {
93 if (res.status === 1) {
94 //存储token
95 sessionStorage.setItem("token", `Bearer ${res.content}`);
96 //登录成功后需判断有无重定向,没有重定向则跳转首页
97 this.$router.replace(this.$route.query.redirect || "/");
98 } else {
99 //错误处理
100 }
101 })
102 .catch((error) => {
103 // console.dir(error);
104 });
105 }
106 });
107 },
108 },
109 components: {},
110 };
111 </script>
112 <style scoped lang="scss">
113 .username,
114 .password {
115 position: relative;
116
117 &:before {
118 content: "";
119 display: block;
120 width: 16px;
121 height: 16px;
122 position: absolute;
123 left: 10px;
124 top: 7px;
125 background-size: 100% 100%;
126 }
127
128 /deep/ .el-input__inner {
129 text-indent: 24px;
130 border: 1px solid rgba(11, 161, 248, 0.4);
131 background-color: rgba(6, 135, 205, 0.3) !important;
132 }
133 }
134
135 .username::before {
136 background-image: url(../../image/username.png);
137 }
138
139 .password::before {
140 background-image: url(../../image/password.png);
141 }
142
143 .bg {
144 width: 100%;
145 height: 100%;
146 min-width: 1440px;
147 min-height: 560px;
148 background: url(../../image/loginBoxBg.png) no-repeat;
149 background-size: 100% 100%;
150 overflow: hidden;
151 position: relative;
152 }
153
154 .login-inner-bg {
155 background: url(../../image/loginBg.png) no-repeat;
156 width: 21.6%;
157 height: 43%;
158 min-width: 360px;
159 min-height: 380px;
160 top: 30%;
161 right: 20%;
162 position: absolute;
163 background-size: 100% 100%;
164 box-sizing: border-box;
165 padding: 56px;
166
167 h2 {
168 width: 100%;
169 font-size: 36px;
170 font-weight: 700;
171 color: #fff;
172 text-align: center;
173 white-space: nowrap;
174 position: absolute;
175 right: 0;
176 top: -70px;
177 background-image: linear-gradient(180deg,
178 rgba(99, 163, 255, 1) 0,
179 rgba(99, 163, 255, 1) 0,
180 rgba(182, 220, 255, 1) 49.731445%,
181 rgba(114, 190, 255, 1) 100%,
182 rgba(114, 190, 255, 1) 100%);
183 overflow-wrap: break-word;
184 color: rgba(255, 255, 255, 1);
185 font-size: 36px;
186 font-family: AlimamaShuHeiTi-Bold;
187 -webkit-background-clip: text;
188 -webkit-text-fill-color: transparent;
189 }
190 }
191
192 .login {
193 .user_style {
194 h3 {
195 color: #fff;
196 font-size: 22px;
197 font-weight: normal;
198 text-align: center;
199 margin: 16px auto 34px;
200 font-weight: 400;
201 }
202 }
203
204 .btn {
205 width: 100%;
206 height: 6vh;
207 background-color: #00c2de;
208 border-radius: 5px;
209 font-size: 1.4vw;
210 color: #ffffff;
211 }
212
213 .btn:hover {
214 cursor: pointer;
215 background-color: #2d8cf0;
216 }
217 }
218
219 .login #loginform {
220 .el-form-item {
221 margin-bottom: 24px !important;
222 }
223
224 .login-btn {
225 margin-top: 40px !important;
226 }
227
228 .el-button {
229 font-size: 18px;
230 background: #0d8cc0 !important;
231 color: #ffffff !important;
232 cursor: pointer !important;
233 }
234
235 .el-input__inner {
236 width: 100% !important;
237 }
238
239 .el-checkbox__label {
240 color: #fff;
241 }
242 }
243
244 .inputUser .ivu-input {
245 padding: 6px 24px !important;
246 border: 1px solid #9f9f9f !important;
247 }
248 </style>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
60 getAction(api.subsystem, params).then((res) => { 60 getAction(api.subsystem, params).then((res) => {
61 if (res.status === 1) { 61 if (res.status === 1) {
62 this.productName = res.content[0].name; 62 this.productName = res.content[0].name;
63 this.$store.dispatch("products/setData", res.content[0]); 63 this.$store.dispatch("products/setData", res.content[0].code);
64 } else { 64 } else {
65 this.$message.error({ message: res.message, showClose: true }); 65 this.$message.error({ message: res.message, showClose: true });
66 } 66 }
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
67 getAction(api.subsystem, params).then((res) => { 67 getAction(api.subsystem, params).then((res) => {
68 if (res.status === 1) { 68 if (res.status === 1) {
69 this.productName = res.content[0].name; 69 this.productName = res.content[0].name;
70 this.$store.dispatch("products/setData", res.content[0]); 70 this.$store.dispatch("products/setData", res.content[0].code);
71 } else { 71 } else {
72 this.$message.error({ message: res.message, showClose: true }); 72 this.$message.error({ message: res.message, showClose: true });
73 } 73 }
......
...@@ -77,14 +77,14 @@ ...@@ -77,14 +77,14 @@
77 userInfo: { 77 userInfo: {
78 handler: function (val) { 78 handler: function (val) {
79 if (val) { 79 if (val) {
80 this.getUserInfo(val.id) 80 this.getUserdata(val.id)
81 } 81 }
82 } 82 }
83 } 83 }
84 }, 84 },
85 mounted () { 85 mounted () {
86 if (this.userInfo) { 86 if (this.userInfo) {
87 this.getUserInfo(this.userInfo) 87 this.getUserdata(this.userInfo)
88 } 88 }
89 this.sexList = [ 89 this.sexList = [
90 { 90 {
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
105 ] 105 ]
106 }, 106 },
107 methods: { 107 methods: {
108 getUserInfo (p) { 108 getUserdata (p) {
109 getAction(`${api.users}/${p.id}`).then((res) => { 109 getAction(`${api.users}/${p.id}`).then((res) => {
110 if (res.status === 1) { 110 if (res.status === 1) {
111 this.form = res.content 111 this.form = res.content
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
120 putAction(`${api.users}/${this.form.id}`, this.form).then((res) => { 120 putAction(`${api.users}/${this.form.id}`, this.form).then((res) => {
121 if (res.status === 1) { 121 if (res.status === 1) {
122 this.$message.success({ message: res.message, showClose: true }) 122 this.$message.success({ message: res.message, showClose: true })
123 this.getUserInfo(this.form.id) 123 this.getUserdata(this.form.id)
124 } else { 124 } else {
125 this.$message.error({ message: res.message, showClose: true }) 125 this.$message.error({ message: res.message, showClose: true })
126 } 126 }
......
...@@ -64,173 +64,174 @@ ...@@ -64,173 +64,174 @@
64 </template> 64 </template>
65 65
66 <script> 66 <script>
67 import Dialog from "@/components/Dialog/"; 67 import Dialog from "@/components/Dialog/";
68 import { getParentMenuListAction } from '@/api/authorityManage' 68 import { getParentMenuListAction } from '@/api/authorityManage'
69 import JsonEditor from '@/components/JsonEditors' 69 import JsonEditor from '@/components/JsonEditors'
70 import IconList from '@/components/IconList' 70 import IconList from '@/components/IconList'
71 import { validateCode } from '@/utils/validate'; 71 import { validateCode } from '@/utils/validate';
72 import { api, httpAction } from '@/api/manageApi' 72 import { api, httpAction } from '@/api/manageApi'
73 export default { 73 export default {
74 name: 'MenuModal', 74 name: 'MenuModal',
75 components: { 75 components: {
76 IconList, 76 IconList,
77 JsonEditor, 77 JsonEditor,
78 Dialog 78 Dialog
79 },
80 props: {
81 productId: {
82 type: String,
83 default: ''
84 }
85 },
86 data () {
87 return {
88 form: {
89 icon: '',
90 code: ''
91 },
92 rules: {
93 name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
94 code: [
95 { required: true, message: '必填', trigger: 'blur' },
96 { validator: validateCode, trigger: 'blur' }
97 ]
98 },
99 title: '',
100 type: '',
101 visible: false,
102 parentMenuList: [],
103 menuKey: 0,
104 jumpModeList: [
105 { name: '在当前页面显示', value: 1 },
106 { name: '跳转到新页面', value: 2 }
107 ],
108 setProps: {
109 value: 'id',
110 label: 'name',
111 children: 'children',
112 expandTrigger: 'hover',
113 checkStrictly: true, // 可取消关联,选择任意一级选项
114 emitPath: false
115 },
116 dataUrl: api.menus
117 }
118 },
119 computed: {
120 codeComputed: {
121 get: function () {
122 return this.form.code
123 },
124 set: function (val) {
125 this.form.code = val.toUpperCase()
126 }
127 }
128 },
129 created () { },
130 mounted () { },
131 methods: {
132 // 获取父级菜单
133 getParentMenuList (id) {
134
135 getParentMenuListAction(id).then((res) => {
136 if (res.status === 1) {
137 const list = this.$dealArrChildren(res.content)
138 if (id) {
139 this.parentMenuList = this.$dealArrDisabled(
140 this.$deepCopy(list),
141 id
142 )
143 this.menuKey++
144 } else {
145 this.parentMenuList = list
146 }
147 } else {
148 this.$message.error({ message: res.message, showClose: true })
149 }
150 })
151 },
152 getIconList () {
153 this.$refs.iconList.show(true)
154 },
155 getIconName (data) {
156 this.form.icon = data
157 }, 79 },
158 // 配置参数 80 props: {
159 getJsonString (data) { 81 productId: {
160 this.form.metadata = data 82 type: String,
161 }, 83 default: ''
162 // 新增菜单 84 }
163 add () {
164 this.getParentMenuList(this.productId)
165 this.visible = true
166 this.type = 0
167 this.form.jumpMode = 1
168 }, 85 },
169 // 编辑菜单 86 data () {
170 edit (record) { 87 return {
171 this.type = 1 88 form: {
172 // 若有id为编辑 89 icon: '',
173 if (record.id) { 90 code: ''
174 this.$nextTick(() => { 91 },
175 this.form = Object.assign({}, record) 92 rules: {
176 this.getParentMenuList(this.productId) 93 name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
177 }) 94 code: [
95 { required: true, message: '必填', trigger: 'blur' },
96 { validator: validateCode, trigger: 'blur' }
97 ]
98 },
99 title: '',
100 type: '',
101 visible: false,
102 parentMenuList: [],
103 menuKey: 0,
104 jumpModeList: [
105 { name: '在当前页面显示', value: 1 },
106 { name: '跳转到新页面', value: 2 }
107 ],
108 setProps: {
109 value: 'id',
110 label: 'name',
111 children: 'children',
112 expandTrigger: 'hover',
113 checkStrictly: true, // 可取消关联,选择任意一级选项
114 emitPath: false
115 },
116 dataUrl: api.menus
178 } 117 }
179 this.visible = true
180 }, 118 },
181 // 选择上级菜单 119 computed: {
182 handleChange (value) { 120 codeComputed: {
183 this.form.parentId = value 121 get: function () {
122 return this.form.code
123 },
124 set: function (val) {
125 this.form.code = val.toUpperCase()
126 }
127 }
184 }, 128 },
185 // 保存 129 created () { },
186 submitForm (submitType) { 130 mounted () { },
187 this.$refs.form.validate((valid) => { 131 methods: {
188 if (valid) { 132 // 获取父级菜单
189 let method = '' 133 getParentMenuList (id) {
190 let url = '' 134
191 const formData = this.form 135 getParentMenuListAction(id).then((res) => {
192 formData.productId = this.productId 136 if (res.status === 1) {
193 if (!formData.id) { 137 const list = this.$dealArrChildren(res.content)
194 method = 'post' 138 if (id) {
195 url = this.dataUrl 139 this.parentMenuList = this.$dealArrDisabled(
140 this.$deepCopy(list),
141 id
142 )
143 this.menuKey++
144 } else {
145 this.parentMenuList = list
146 }
196 } else { 147 } else {
197 method = 'put' 148 this.$message.error({ message: res.message, showClose: true })
198 url = `${this.dataUrl}/${formData.id}`
199 } 149 }
200 httpAction(url, formData, method) 150 })
201 .then((res) => { 151 },
202 if (res.status === 1) { 152 getIconList () {
203 this.$message.success({ 153 this.$refs.iconList.show(true)
204 message: res.message, 154 },
205 showClose: true 155 getIconName (data) {
206 }) 156 this.form.icon = data
157 },
158 // 配置参数
159 getJsonString (data) {
160 this.form.metadata = data
161 },
162 // 新增菜单
163 add () {
164 this.getParentMenuList(this.productId)
165 this.visible = true
166 this.type = 0
167 this.form.jumpMode = 1
168 },
169 // 编辑菜单
170 edit (record) {
171 this.type = 1
172 // 若有id为编辑
173 if (record.id) {
174 this.$nextTick(() => {
175 this.form = Object.assign({}, record)
176 this.getParentMenuList(this.productId)
177 })
178 }
179 this.visible = true
180 },
181 // 选择上级菜单
182 handleChange (value) {
183 this.form.parentId = value
184 },
185 // 保存
186 submitForm (submitType) {
187 this.$refs.form.validate((valid) => {
188 if (valid) {
189 let method = ''
190 let url = ''
191 const formData = this.form
192 formData.productId = this.productId
193 if (!formData.id) {
194 method = 'post'
195 url = this.dataUrl
196 } else {
197 method = 'put'
198 url = `${this.dataUrl}/${formData.id}`
199 }
200 debugger
201 httpAction(url, formData, method)
202 .then((res) => {
203 if (res.status === 1) {
204 this.$message.success({
205 message: res.message,
206 showClose: true
207 })
207 208
208 this.resetForm() 209 this.resetForm()
209 this.$emit('ok') 210 this.$emit('ok')
210 } else { 211 } else {
211 this.$message.error({ message: res.message, showClose: true }) 212 this.$message.error({ message: res.message, showClose: true })
212 } 213 }
213 }) 214 })
214 .catch((err) => { 215 .catch((err) => {
215 console.log(err) 216 console.log(err)
216 }) 217 })
218 }
219 })
220 },
221 resetForm () {
222 this.$refs.form.resetFields()
223 this.form = {
224 icon: '',
225 code: ''
217 } 226 }
218 }) 227 },
219 }, 228 close () {
220 resetForm () { 229 this.resetForm()
221 this.$refs.form.resetFields() 230 this.visible = false
222 this.form = {
223 icon: '',
224 code: ''
225 } 231 }
226 },
227 close () {
228 this.resetForm()
229 this.visible = false
230 } 232 }
231 } 233 }
232 }
233 </script> 234 </script>
234 <style scoped lang="scss"> 235 <style scoped lang="scss">
235 // @import "~@/styles/public.scss"; 236 // @import "~@/styles/public.scss";
236 </style> 237 </style>
......
...@@ -23,165 +23,169 @@ ...@@ -23,165 +23,169 @@
23 </div> 23 </div>
24 </template> 24 </template>
25 <script> 25 <script>
26 // 定时任务 26 // 定时任务
27 import data from "./data"; 27 import data from "./data";
28 import { deleteAction, getAction, api } from "@/api/manageApi"; 28 import { deleteAction, getAction, api } from "@/api/manageApi";
29 import EditDialog from "./edit-dialog.vue"; 29 import EditDialog from "./edit-dialog.vue";
30 // import authorizationdiglog from "./authorizationdiglog.vue"; 30 import { mapGetters } from "vuex";
31 export default { 31 // import authorizationdiglog from "./authorizationdiglog.vue";
32 name: "menus", 32 export default {
33 components: { 33 name: "menus",
34 EditDialog, 34 components: {
35 // authorizationdiglog, 35 EditDialog,
36 }, 36 // authorizationdiglog,
37 data () { 37 },
38 return { 38 data () {
39 tablelistData: [], 39 return {
40 resourceCategoryId: "", 40 tablelistData: [],
41 taskData: null, 41 resourceCategoryId: "",
42 form: { 42 taskData: null,
43 job_name: "", 43 form: {
44 currentPage: 1, 44 job_name: "",
45 }, 45 currentPage: 1,
46 title: "", 46 },
47 queryParam: {}, 47 title: "",
48 selectType: "0", 48 queryParam: {},
49 queryName: "", 49 selectType: "0",
50 organizationId: "", // 组织机构ID 50 queryName: "",
51 departmentId: "", // 部门ID 51 organizationId: "", // 组织机构ID
52 departmentList: [], // 部门列表 52 departmentId: "", // 部门ID
53 levelList: [], // 职务级别 53 departmentList: [], // 部门列表
54 sexList: [], 54 levelList: [], // 职务级别
55 55 sexList: [],
56 selectionList: [],
57 tableData: {
58 columns: [].concat(data.columns()).concat([
59 {
60 label: "操作",
61 width: 380,
62 render: (h, scope) => {
63 return (
64 <div>
65 <el-button
66 type="text"
67 size="mini"
68 icon="el-icon-edit"
69 onClick={() => {
70 this.handleEdit(scope.row);
71 }}
72 >
73 修改
74 </el-button>
75
76 <el-button
77 type="text"
78 size="mini"
79 icon="el-icon-delete"
80 style="color:#F56C6C"
81 onClick={() => {
82 this.handleDelete(scope.row.id, scope.row.name);
83 }}
84 >
85 删除
86 </el-button>
87 </div>
88 );
89 },
90 },
91 ]),
92 data: [],
93 },
94 pageData: {
95 total: 5,
96 pageSize: 15,
97 current: 1,
98 },
99 tableUrl: api.menus, // 菜单接口地址
100 meumurlid: api.subsystem,// 项目id接口地址
101 productId: ""//项目id
102 };
103 },
104 created () {
105 this.getTableList();
106 },
107 methods: {
108 // 加载表格数据
109 getTableList () {
110 56
111 const queryOptionsid = { 57 selectionList: [],
112 conditionGroup: { 58 tableData: {
113 queryRelation: "AND", 59 columns: [].concat(data.columns()).concat([
114 conditions: [
115 { 60 {
116 property: "code", 61 label: "操作",
117 value: "BDCJGPT", 62 width: 380,
118 operator: "EQ", 63 render: (h, scope) => {
64 return (
65 <div>
66 <el-button
67 type="text"
68 size="mini"
69 icon="el-icon-edit"
70 onClick={() => {
71 this.handleEdit(scope.row);
72 }}
73 >
74 修改
75 </el-button>
76
77 <el-button
78 type="text"
79 size="mini"
80 icon="el-icon-delete"
81 style="color:#F56C6C"
82 onClick={() => {
83 this.handleDelete(scope.row.id, scope.row.name);
84 }}
85 >
86 删除
87 </el-button>
88 </div>
89 );
90 },
119 }, 91 },
120 ], 92 ]),
93 data: [],
121 }, 94 },
95 pageData: {
96 total: 5,
97 pageSize: 15,
98 current: 1,
99 },
100 tableUrl: api.menus, // 菜单接口地址
101 meumurlid: api.subsystem,// 项目id接口地址
102 productId: ""//项目id
122 }; 103 };
123 const params = {
124 queryOptions: queryOptionsid,
125 };
126 // 获取系统id
127 getAction(this.meumurlid, params)
128 .then((res) => {
129 this.productId = res.content[0].id;
130 let queryOptions = {
131 conditionGroup: {
132 conditions: [
133 {
134 property: "productId",
135 value: this.productId,
136 operator: "EQ",
137 },
138 ],
139 queryRelation: "AND",
140 },
141 orderBys: [{ property: "sort", direction: "desc" }],
142 };
143 if (!this.tableUrl) {
144 console.log("请设置tableUrl属性为接口地址!");
145 return;
146 }
147 if (this.queryOptions !== "") {
148 this.queryParam.queryOptions = JSON.stringify(queryOptions);
149 }
150 // 查询系统菜单
151 getAction(this.tableUrl, this.queryParam)
152 .then((res) => {
153 if (res.status === 1) {
154 this.loading = false;
155 this.tablelistData = res.content;
156 } else {
157 this.$message.error({ message: res.message, showClose: true });
158 this.loading = false;
159 }
160 })
161 .catch((error) => {
162 console.log("er", error);
163 this.loading = false;
164 });
165 })
166 .catch((error) => {
167 console.log("er", error);
168 });
169 }, 104 },
170 // 新增菜单 105 created () {
171 handleAdd () { 106 this.getTableList();
172 this.$refs.dialogForm.add();
173 this.$refs.dialogForm.title = "添加";
174 }, 107 },
175 108 computed: {
176 // 修改 109 ...mapGetters(["products"]),
177 handleEdit (record) {
178 this.$refs.dialogForm.edit(record);
179 this.$refs.dialogForm.title = "修改";
180 }, 110 },
181 // 删除 111 methods: {
182 handleDelete (id, content) { 112 // 加载表格数据
183 this.$confirm( 113 getTableList () {
184 `<div class="customer-message-wrapper"> 114
115 const queryOptionsid = {
116 conditionGroup: {
117 queryRelation: "AND",
118 conditions: [
119 {
120 property: "code",
121 value: this.products,
122 operator: "EQ",
123 },
124 ],
125 },
126 };
127 const params = {
128 queryOptions: queryOptionsid,
129 };
130 // 获取系统id
131 getAction(this.meumurlid, params)
132 .then((res) => {
133 this.productId = res.content[0].id;
134 let queryOptions = {
135 conditionGroup: {
136 conditions: [
137 {
138 property: "productId",
139 value: this.productId,
140 operator: "EQ",
141 },
142 ],
143 queryRelation: "AND",
144 },
145 orderBys: [{ property: "sort", direction: "desc" }],
146 };
147 if (!this.tableUrl) {
148 console.log("请设置tableUrl属性为接口地址!");
149 return;
150 }
151 if (this.queryOptions !== "") {
152 this.queryParam.queryOptions = JSON.stringify(queryOptions);
153 }
154 // 查询系统菜单
155 getAction(this.tableUrl, this.queryParam)
156 .then((res) => {
157 if (res.status === 1) {
158 this.loading = false;
159 this.tablelistData = res.content;
160 } else {
161 this.$message.error({ message: res.message, showClose: true });
162 this.loading = false;
163 }
164 })
165 .catch((error) => {
166 console.log("er", error);
167 this.loading = false;
168 });
169 })
170 .catch((error) => {
171 console.log("er", error);
172 });
173 },
174 // 新增菜单
175 handleAdd () {
176 this.$refs.dialogForm.add();
177 this.$refs.dialogForm.title = "添加";
178 },
179
180 // 修改
181 handleEdit (record) {
182 this.$refs.dialogForm.edit(record);
183 this.$refs.dialogForm.title = "修改";
184 },
185 // 删除
186 handleDelete (id, content) {
187 this.$confirm(
188 `<div class="customer-message-wrapper">
185 <h5 class="title">您确认要执行该操作用于以下信息:</h5> 189 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
186 <p class="content" aria-controls="${content}">${content} 190 <p class="content" aria-controls="${content}">${content}
187 </p> 191 </p>
...@@ -189,51 +193,51 @@ export default { ...@@ -189,51 +193,51 @@ export default {
189 <span >无法恢复</span> 193 <span >无法恢复</span>
190 </p> 194 </p>
191 </div>`, 195 </div>`,
192 '执行确认', 196 '执行确认',
193 { 197 {
194 dangerouslyUseHTMLString: true, 198 dangerouslyUseHTMLString: true,
195 customClass: 'customer-delete', 199 customClass: 'customer-delete',
196 confirmButtonText: '确定', 200 confirmButtonText: '确定',
197 cancelButtonText: '取消', 201 cancelButtonText: '取消',
198 type: 'warning' 202 type: 'warning'
199 }
200 )
201 .then(() => {
202 if (!this.tableUrl) {
203 this.$message.error({
204 message: '请设置tableUrl属性为接口地址!',
205 showClose: true
206 })
207 return
208 } 203 }
209 const url = this.tableUrl + '/' + id 204 )
210 deleteAction(url).then(res => { 205 .then(() => {
211 if (res.status === 1) { 206 if (!this.tableUrl) {
212 this.$message.success({ message: res.message, showClose: true }) 207 this.$message.error({
213 this.reloadTableData() 208 message: '请设置tableUrl属性为接口地址!',
214 } else { 209 showClose: true
215 this.$message.error({ message: res.message, showClose: true }) 210 })
211 return
216 } 212 }
213 const url = this.tableUrl + '/' + id
214 deleteAction(url).then(res => {
215 if (res.status === 1) {
216 this.$message.success({ message: res.message, showClose: true })
217 this.reloadTableData()
218 } else {
219 this.$message.error({ message: res.message, showClose: true })
220 }
221 })
217 }) 222 })
218 }) 223 .catch(() => { })
219 .catch(() => { }) 224 },
220 }, 225 // 新增、编辑回显
221 // 新增、编辑回显 226 reloadTableData () {
222 reloadTableData () { 227 this.getTableList()
223 this.getTableList() 228 },
224 }, 229 },
225 }, 230 };
226 };
227 </script> 231 </script>
228 <style scoped lang="scss"> 232 <style scoped lang="scss">
229 @import "~@/styles/mixin.scss"; 233 @import "~@/styles/mixin.scss";
230 234
231 // @import "~@/styles/public.scss"; 235 // @import "~@/styles/public.scss";
232 .btnColRight { 236 .btnColRight {
233 margin-top: 20px; 237 margin-top: 20px;
234 } 238 }
235 239
236 /deep/.el-table__expand-icon { 240 /deep/.el-table__expand-icon {
237 color: #fff; 241 color: #fff;
238 } 242 }
239 </style> 243 </style>
......
...@@ -11,11 +11,6 @@ class data extends filter { ...@@ -11,11 +11,6 @@ class data extends filter {
11 width: 130 11 width: 130
12 }, 12 },
13 { 13 {
14 prop: "type",
15 label: "类别",
16 width: 200
17 },
18 {
19 prop: "description", 14 prop: "description",
20 label: "备注" 15 label: "备注"
21 } 16 }
......
...@@ -18,16 +18,6 @@ ...@@ -18,16 +18,6 @@
18 </el-form-item> 18 </el-form-item>
19 </el-col> 19 </el-col>
20 </el-row> 20 </el-row>
21 <el-row :gutter="24">
22 <el-col :span="24">
23 <el-form-item label="角色类型:" prop="roleType">
24 <el-input
25 v-model="dialogForm.roleType"
26 clearable
27 placeholder="角色类型" />
28 </el-form-item>
29 </el-col>
30 </el-row>
31 <el-row> 21 <el-row>
32 <el-col :span="24"> 22 <el-col :span="24">
33 <el-form-item label="备注:" class="form-item-mb0"> 23 <el-form-item label="备注:" class="form-item-mb0">
...@@ -75,9 +65,6 @@ ...@@ -75,9 +65,6 @@
75 roleName: [ 65 roleName: [
76 { required: true, message: '请输入角色名称', trigger: 'blur' } 66 { required: true, message: '请输入角色名称', trigger: 'blur' }
77 ], 67 ],
78 roleType: [
79 { required: true, message: '请输入角色类型', trigger: 'blur' }
80 ]
81 }, 68 },
82 roleTypeOptions: [ 69 roleTypeOptions: [
83 { name: '定制', value: '定制' }, 70 { name: '定制', value: '定制' },
...@@ -109,7 +96,6 @@ ...@@ -109,7 +96,6 @@
109 }) 96 })
110 this.dialogForm = { 97 this.dialogForm = {
111 roleName: '', 98 roleName: '',
112 roleType: ''
113 } 99 }
114 this.showAddEditDialog = val 100 this.showAddEditDialog = val
115 this.$emit('ok', this.menuType) 101 this.$emit('ok', this.menuType)
...@@ -130,7 +116,6 @@ ...@@ -130,7 +116,6 @@
130 }) 116 })
131 this.dialogForm = { 117 this.dialogForm = {
132 roleName: '', 118 roleName: '',
133 roleType: ''
134 } 119 }
135 this.showAddEditDialog = val 120 this.showAddEditDialog = val
136 this.$emit('ok', this.menuType) 121 this.$emit('ok', this.menuType)
...@@ -153,7 +138,6 @@ ...@@ -153,7 +138,6 @@
153 this.$refs.form.resetFields() 138 this.$refs.form.resetFields()
154 this.dialogForm = { 139 this.dialogForm = {
155 roleName: '', 140 roleName: '',
156 roleType: ''
157 } 141 }
158 this.showAddEditDialog = false 142 this.showAddEditDialog = false
159 } 143 }
......
...@@ -22,86 +22,87 @@ ...@@ -22,86 +22,87 @@
22 </div> 22 </div>
23 </template> 23 </template>
24 <script> 24 <script>
25 import { 25 import {
26 getUuid, 26 getUuid,
27 judgeSort, 27 judgeSort,
28 realMove, 28 realMove,
29 findParents, 29 findParents,
30 removeTreeListItem, 30 removeTreeListItem,
31 } from "@/utils/operation"; 31 } from "@/utils/operation";
32 import { getRolesById, getAuthorityListAction } from "@/api/authorityManage"; 32 import { getRolesById, getAuthorityListAction } from "@/api/authorityManage";
33 import { getUserRoles } from "@/api/personnelManage"; 33 import { getUserRoles } from "@/api/personnelManage";
34 import data from "./data"; 34 import data from "./data";
35 import { api, getAction, deleteAction } from "@/api/manageApi"; 35 import { api, getAction, deleteAction } from "@/api/manageApi";
36 import tableMixin from "@/mixins/tableMixin.js"; 36 import tableMixin from "@/mixins/tableMixin.js";
37 import EditDialog from "./edit-dialog.vue"; 37 import EditDialog from "./edit-dialog.vue";
38 import Roleslistdiglog from "./roleslistdiglog.vue"; 38 import Roleslistdiglog from "./roleslistdiglog.vue";
39 export default { 39 import { mapGetters } from "vuex";
40 name: "menus", 40 export default {
41 mixins: [tableMixin], 41 name: "menus",
42 components: { 42 mixins: [tableMixin],
43 EditDialog, 43 components: {
44 Roleslistdiglog, 44 EditDialog,
45 }, 45 Roleslistdiglog,
46 data () { 46 },
47 return { 47 data () {
48 personlist: null, 48 return {
49 waitMemberList: [], 49 personlist: null,
50 keyList: [], 50 waitMemberList: [],
51 listdata: [], 51 keyList: [],
52 tableUrl: api.roles, 52 listdata: [],
53 form: { 53 tableUrlroles: api.roles,
54 job_name: "", 54 form: {
55 currentPage: 1, 55 job_name: "",
56 }, 56 currentPage: 1,
57 // 当前所选角色id
58 roleId: "",
59 title: "",
60 queryParam: {},
61 multipleSelection: [],
62 // 菜单列表
63 menutablelistData: [],
64 tableUrl: api.menus, // 菜单接口地址
65 meumurlid: api.subsystem, // 项目id接口地址
66 selectType: "0",
67 queryName: "",
68 organizationId: "", // 组织机构ID
69 departmentId: "", // 部门ID
70 departmentList: [], // 部门列表
71 levelList: [], // 职务级别
72 sexList: [],
73 operationCodes: null, // 操作符对象
74 operationList: [], // 获取授权列表需要提交的操作符数组
75 typeOptions: [
76 {
77 value: "0",
78 label: "姓名",
79 },
80 {
81 value: "1",
82 label: "工号",
83 },
84 {
85 value: "2",
86 label: "部门",
87 },
88 {
89 value: "3",
90 label: "机构",
91 }, 57 },
92 ], 58 // 当前所选角色id
93 59 roleId: "",
94 selectionList: [], 60 title: "",
95 tableData: { 61 queryParam: {},
96 columns: [ 62 multipleSelection: [],
63 // 菜单列表
64 menutablelistData: [],
65 tableUrl: api.menus, // 菜单接口地址
66 meumurlid: api.subsystem, // 项目id接口地址
67 selectType: "0",
68 queryName: "",
69 organizationId: "", // 组织机构ID
70 departmentId: "", // 部门ID
71 departmentList: [], // 部门列表
72 levelList: [], // 职务级别
73 sexList: [],
74 operationCodes: null, // 操作符对象
75 operationList: [], // 获取授权列表需要提交的操作符数组
76 typeOptions: [
97 { 77 {
98 label: "序号", 78 value: "0",
99 type: "index", 79 label: "姓名",
100 width: "50",
101 index: this.indexMethod,
102 }, 80 },
103 ] 81 {
104 .concat(data.columns()) 82 value: "1",
83 label: "工号",
84 },
85 {
86 value: "2",
87 label: "部门",
88 },
89 {
90 value: "3",
91 label: "机构",
92 },
93 ],
94
95 selectionList: [],
96 tableData: {
97 columns: [
98 {
99 label: "序号",
100 type: "index",
101 width: "50",
102 index: this.indexMethod,
103 },
104 ]
105 .concat(data.columns())
105 .concat([ 106 .concat([
106 { 107 {
107 label: "排序", 108 label: "排序",
...@@ -208,202 +209,204 @@ export default { ...@@ -208,202 +209,204 @@ export default {
208 }, 209 },
209 210
210 }]), 211 }]),
211 }, 212 },
212 data: [], 213 data: [],
213 } 214 }
214 }, 215 },
216 computed: {
217 ...mapGetters(["products"]),
218 },
219 created () {
220 this.getTableData();
221 this.getTableList()
222 },
223 mounted () { },
224 methods: {
225 // 获取角色列表
226 getTableData () {
227 let Builtinrole = [];
228 let Publicrole = [];
215 229
216 created () { 230 getRolesById(1)
217 this.getTableData(); 231 .then((res) => {
218 this.getTableList() 232 Builtinrole = res.content;
219 }, 233 getRolesById(2)
220 mounted () { }, 234 .then((res) => {
221 methods: { 235 Publicrole = res.content;
222 // 获取角色列表
223 getTableData () {
224 let Builtinrole = [];
225 let Publicrole = [];
226
227 getRolesById(1)
228 .then((res) => {
229 Builtinrole = res.content;
230 getRolesById(2)
231 .then((res) => {
232 console.log("角色列表", res);
233 Publicrole = res.content;
234 236
235 this.listdata = Builtinrole.concat(Publicrole); 237 this.listdata = Builtinrole.concat(Publicrole);
236 238
237 this.listdata = judgeSort(this.listdata); 239 this.listdata = judgeSort(this.listdata);
238 }) 240 })
239 .catch((e) => console.error(e)); 241 .catch((e) => console.error(e));
240 }) 242 })
241 .catch((e) => console.error(e)); 243 .catch((e) => console.error(e));
242 }, 244 },
243 245
244 // 获取菜单列表 246 // 获取菜单列表
245 getTableList () { 247 getTableList () {
246 const queryOptionsid = { 248 const queryOptionsid = {
247 conditionGroup: { 249 conditionGroup: {
248 queryRelation: "AND", 250 queryRelation: "AND",
249 conditions: [ 251 conditions: [
250 { 252 {
251 property: "code", 253 property: "code",
252 value: "BDCJGPT", 254 value: this.products,
253 operator: "EQ", 255 operator: "EQ",
254 }, 256 },
255 ], 257 ],
256 }, 258 },
257 }; 259 };
258 const params = { 260 const params = {
259 queryOptions: queryOptionsid, 261 queryOptions: queryOptionsid,
260 }; 262 };
261 // 获取系统id 263 // 获取系统id
262 getAction(this.meumurlid, params) 264 getAction(this.meumurlid, params)
263 .then((res) => { 265 .then((res) => {
264 this.productId = res.content[0].id; 266 this.productId = res.content[0].id;
265 this.getAuthorityList(res.content[0].id, res.content[0].code) 267 this.getAuthorityList(res.content[0].id, res.content[0].code)
266 this.selectedSubsystemCode = res.content[0].code 268 this.selectedSubsystemCode = res.content[0].code
267 let queryOptions = { 269 let queryOptions = {
268 conditionGroup: { 270 conditionGroup: {
269 conditions: [ 271 conditions: [
270 { 272 {
271 property: "productId", 273 property: "productId",
272 value: this.productId, 274 value: this.productId,
273 operator: "EQ", 275 operator: "EQ",
274 }, 276 },
275 ], 277 ],
276 queryRelation: "AND", 278 queryRelation: "AND",
277 }, 279 },
278 orderBys: [{ property: "sort", direction: "desc" }], 280 orderBys: [{ property: "sort", direction: "desc" }],
279 }; 281 };
280 if (!this.tableUrl) { 282 if (!this.tableUrl) {
281 console.log("请设置tableUrl属性为接口地址!"); 283 console.log("请设置tableUrl属性为接口地址!");
282 return; 284 return;
283 } 285 }
284 if (this.queryOptions !== "") { 286 if (this.queryOptions !== "") {
285 this.queryParam.queryOptions = JSON.stringify(queryOptions); 287 this.queryParam.queryOptions = JSON.stringify(queryOptions);
286 } 288 }
287 // 查询系统菜单 289 // 查询系统菜单
288 getAction(this.tableUrl, this.queryParam) 290 getAction(this.tableUrl, this.queryParam)
289 .then((res) => { 291 .then((res) => {
290 if (res.status === 1) { 292 if (res.status === 1) {
291 this.loading = false; 293 this.loading = false;
292 this.menutablelistData = res.content; 294 this.menutablelistData = res.content;
293 } else { 295 } else {
294 this.$message.error({ message: res.message, showClose: true }); 296 this.$message.error({ message: res.message, showClose: true });
297 this.loading = false;
298 }
299 })
300 .catch((error) => {
301 console.log("er", error);
295 this.loading = false; 302 this.loading = false;
303 });
304 })
305 .catch((error) => {
306 console.log("er", error);
307 });
308 },
309 // 获取权限列表
310 getAuthorityList (productId, code) {
311 getAuthorityListAction(productId, code).then(
312 res => {
313 if (res.status === 1) {
314 if (res.content.length !== 0) {
315 this.operationCodes = res.content[0].operations
316 this.operationList = []
317 for (var k in this.operationCodes) {
318 this.operationList.push(k)
319 }
296 } 320 }
297 }) 321 } else {
298 .catch((error) => { 322 this.$message.error({ message: res.message, showClose: true })
299 console.log("er", error);
300 this.loading = false;
301 });
302 })
303 .catch((error) => {
304 console.log("er", error);
305 });
306 },
307 // 获取权限列表
308 getAuthorityList (productId, code) {
309 getAuthorityListAction(productId, code).then(
310 res => {
311 if (res.status === 1) {
312 if (res.content.length !== 0) {
313 this.operationCodes = res.content[0].operations
314 this.operationList = []
315 for (var k in this.operationCodes) {
316 this.operationList.push(k)
317 }
318 } 323 }
319 } else {
320 this.$message.error({ message: res.message, showClose: true })
321 } 324 }
322 } 325 )
323 ) 326 },
324 },
325 327
326 // 配置 328 // 配置
327 getUserList (row) { 329 getUserList (row) {
328 this.getTableList() 330 this.getTableList()
329 const params = {}; 331 const params = {};
330 const queryOptions = { 332 const queryOptions = {
331 conditionGroup: { 333 conditionGroup: {
332 conditions: [ 334 conditions: [
333 { 335 {
334 property: "organizationId", 336 property: "organizationId",
335 value: row.organizationId, 337 value: row.organizationId,
336 operator: "EQ", 338 operator: "EQ",
337 }, 339 },
338 { 340 {
339 property: "departmentId", 341 property: "departmentId",
340 value: row.departmentId, 342 value: row.departmentId,
341 operator: "EQ", 343 operator: "EQ",
342 }, 344 },
343 ], 345 ],
344 queryRelation: "AND", 346 queryRelation: "AND",
345 }, 347 },
346 orderBys: [{ property: "sort", direction: "desc" }], 348 orderBys: [{ property: "sort", direction: "desc" }],
347 }; 349 };
348 params.queryOptions = JSON.stringify(queryOptions); 350 params.queryOptions = JSON.stringify(queryOptions);
349 351
350 getUserRoles(row.id).then((res) => { 352 getUserRoles(row.id).then((res) => {
351 if (res.status === 1) { 353 if (res.status === 1) {
352 this.personlist = res.content; 354 this.personlist = res.content;
353 getAction(api.users, params).then((res) => { 355 getAction(api.users, params).then((res) => {
354 if (res.status === 1) { 356 if (res.status === 1) {
355 this.waitMemberList = res.content; 357 this.waitMemberList = res.content;
356 if (this.personlist) { 358 if (this.personlist) {
357 this.waitMemberList.forEach((item, i) => { 359 this.waitMemberList.forEach((item, i) => {
358 this.personlist.forEach((val) => { 360 this.personlist.forEach((val) => {
359 if (item.id === val.id) { 361 if (item.id === val.id) {
360 this.waitMemberList[i].selectStatus = 0; 362 this.waitMemberList[i].selectStatus = 0;
361 } 363 }
364 });
362 }); 365 });
363 }); 366 }
367
368 this.$refs.rolesForm.personlist(this.waitMemberList, row.id);
369 this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes);
370 } else {
371 this.$message.error({ message: res.message, showClose: true });
364 } 372 }
373 });
374 this.$refs.rolesForm.title = "人员配置";
375 } else this.$message.error({ message: res.message, showClose: true });
376 });
377 },
378 // 新增、修改角色
379 handleAddEdit (value) {
380 this.$refs.addEditDialog.menuType = this.menuType;
381 this.$refs.addEditDialog.roleId = value.id;
382 this.roleSort = value.sort ? value.sort : 0;
383 this.$refs.addEditDialog.dialogForm.roleType = this.products;
384 if (value.id) {
385 this.$refs.addEditDialog.dialogForm.roleName = value.name;
365 386
366 this.$refs.rolesForm.personlist(this.waitMemberList, row.id); 387 this.$refs.addEditDialog.dialogForm.roleTextArea = value.description;
367 this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes); 388 }
368 } else { 389 this.$refs.addEditDialog.showAddEditDialog = true;
369 this.$message.error({ message: res.message, showClose: true }); 390 this.$refs.addEditDialog.dialogTitle = value.id ? "修改" : "新增";
370 } 391 },
371 }); 392 // 上移下移
372 this.$refs.rolesForm.title = "人员配置"; 393 moveUpward (index, row) {
373 } else this.$message.error({ message: res.message, showClose: true }); 394 realMove(row.dictid, "UP", this.listdata);
374 }); 395 this.key++;
375 }, 396 let id = findParents(this.listdata, row.dictid);
376 // 新增、修改角色 397 this.keyList = id;
377 handleAddEdit (value) { 398 },
378 this.$refs.addEditDialog.menuType = this.menuType; 399 moveDown (index, row) {
379 this.$refs.addEditDialog.roleId = value.id; 400 realMove(row.dictid, "DOWN", this.listdata);
380 this.roleSort = value.sort ? value.sort : 0; 401 this.key++;
381 if (value.id) { 402 let id = findParents(this.listdata, row.dictid);
382 this.$refs.addEditDialog.dialogForm.roleName = value.name; 403 this.keyList = id;
383 this.$refs.addEditDialog.dialogForm.roleType = value.type; 404 },
384 this.$refs.addEditDialog.dialogForm.roleTextArea = value.description;
385 }
386 this.$refs.addEditDialog.showAddEditDialog = true;
387 this.$refs.addEditDialog.dialogTitle = value.id ? "修改" : "新增";
388 },
389 // 上移下移
390 moveUpward (index, row) {
391 realMove(row.dictid, "UP", this.listdata);
392 this.key++;
393 let id = findParents(this.listdata, row.dictid);
394 this.keyList = id;
395 },
396 moveDown (index, row) {
397 realMove(row.dictid, "DOWN", this.listdata);
398 this.key++;
399 let id = findParents(this.listdata, row.dictid);
400 this.keyList = id;
401 },
402 405
403 // 删除 406 // 删除
404 handleDelete: function (id, content = "") { 407 handleDelete: function (id, content = "") {
405 this.$confirm( 408 this.$confirm(
406 `<div class="customer-message-wrapper"> 409 `<div class="customer-message-wrapper">
407 <h5 class="title">您确认要执行该操作用于以下信息:</h5> 410 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
408 <p class="content" aria-controls="${content}">${content} 411 <p class="content" aria-controls="${content}">${content}
409 </p> 412 </p>
...@@ -411,48 +414,48 @@ export default { ...@@ -411,48 +414,48 @@ export default {
411 <span >无法恢复</span> 414 <span >无法恢复</span>
412 </p> 415 </p>
413 </div>`, 416 </div>`,
414 "执行确认", 417 "执行确认",
415 { 418 {
416 dangerouslyUseHTMLString: true, 419 dangerouslyUseHTMLString: true,
417 customClass: "customer-delete", 420 customClass: "customer-delete",
418 confirmButtonText: "确定", 421 confirmButtonText: "确定",
419 cancelButtonText: "取消", 422 cancelButtonText: "取消",
420 type: "warning", 423 type: "warning",
421 }
422 )
423 .then(() => {
424 if (!this.tableUrl) {
425 this.$message.error({
426 message: "请设置tableUrl属性为接口地址!",
427 showClose: true,
428 });
429 return;
430 } 424 }
431 const url = this.tableUrl + "/" + id; 425 )
432 deleteAction(url).then((res) => { 426 .then(() => {
433 if (res.status === 1) { 427 if (!this.tableUrlroles) {
434 this.$message.success({ message: res.message, showClose: true }); 428 this.$message.error({
435 this.getTableData(); 429 message: "请设置tableUrl属性为接口地址!",
436 } else { 430 showClose: true,
437 this.$message.error({ message: res.message, showClose: true }); 431 });
432 return;
438 } 433 }
439 }); 434 const url = this.tableUrlroles + "/" + id;
440 }) 435 deleteAction(url).then((res) => {
441 .catch(() => { }); 436 if (res.status === 1) {
442 }, 437 this.$message.success({ message: res.message, showClose: true });
443 // 新增回显 438 this.getTableData();
444 reloadTableData () { 439 } else {
445 this.getTableData(); 440 this.$message.error({ message: res.message, showClose: true });
441 }
442 });
443 })
444 .catch(() => { });
445 },
446 // 新增回显
447 reloadTableData () {
448 this.getTableData();
449 },
446 }, 450 },
447 }, 451 };
448 };
449 </script> 452 </script>
450 <style scoped lang="scss"> 453 <style scoped lang="scss">
451 @import "~@/styles/mixin.scss"; 454 @import "~@/styles/mixin.scss";
452 455
453 // @import "~@/styles/public.scss"; 456 // @import "~@/styles/public.scss";
454 .btnColRight { 457 .btnColRight {
455 margin-left: -30px; 458 margin-left: -30px;
456 margin-top: 20px; 459 margin-top: 20px;
457 } 460 }
458 </style> 461 </style>
......