Skip to content

Commit 04820f7

Browse files
author
ofh
committed
角色列表加入权限赋值
1 parent 34213f1 commit 04820f7

File tree

13 files changed

+606
-10
lines changed

13 files changed

+606
-10
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = {
2424
}
2525
}
2626
],
27+
'vue/attributes-order': 'error', // 属性排序
2728
'vue/singleline-html-element-content-newline': 'off',
2829
'vue/multiline-html-element-content-newline': 'off',
2930
'vue/name-property-casing': ['error', 'PascalCase'],

src/api/permission.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ export function permissionDelByIdsApi(data) {
3535
data
3636
})
3737
}
38+

src/api/role.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
import request from '@/utils/request'
3+
4+
// 分页
5+
export function getRoleByPageApi(data) {
6+
return request({
7+
url: '/role/getRoleByPage',
8+
method: 'get',
9+
params: data
10+
})
11+
}
12+
13+
// 根据id获取信息
14+
export function getRoleById(id) {
15+
return request({
16+
url: '/role/get/' + id,
17+
method: 'get'
18+
})
19+
}
20+
21+
// 根据id保存数据
22+
export function roleSaveBaseApi(data) {
23+
return request({
24+
url: '/role/saveBase',
25+
method: 'post',
26+
data
27+
})
28+
}
29+
30+
// 根据id修改数据
31+
export function roleUpdateBaseApi(data) {
32+
return request({
33+
url: '/role/updateBase',
34+
method: 'post',
35+
data
36+
})
37+
}
38+
39+
// 根据id删除数据(可以传递多个id)
40+
export function roleDelByIdsApi(data) {
41+
return request({
42+
url: '/role/delByIds',
43+
method: 'post',
44+
data
45+
})
46+
}
47+
// 获取所有数据
48+
export function getRoleAllBaseApi() {
49+
return request({
50+
url: '/role/getAllBase',
51+
method: 'get'
52+
})
53+
}
54+
55+
// 根据角色id获取所有权限
56+
export function getPermission(data) {
57+
return request({
58+
url: '/role/getPermission',
59+
method: 'get',
60+
params: data
61+
})
62+
}
63+
export function setPermission(data) {
64+
return request({
65+
url: '/role/setPermission',
66+
method: 'post',
67+
data: data
68+
})
69+
}

src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Vue.use(ElementUI)
2727
Vue.filter('dictFilter', function(value, dictList) {
2828
let name = ''
2929
for (let i = 0; i < dictList.length; i++) {
30-
if (dictList[i].code == value) {
30+
if (dictList[i].code === value) {
3131
name = dictList[i].name
3232
break
3333
}

src/mixins/formMixin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const formMixin = {
4040
// 重置表单属性
4141
resetForm(formName, form = 'form') {
4242
this.$refs[formName].resetFields()
43-
4443
}
4544
}
4645
}

src/router/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ export const constantRoutes = [
6767
name: 'User',
6868
component: () => import('@/views/system/user/index'),
6969
meta: { title: '用户管理', icon: 'table' }
70-
}, {
70+
},
71+
{
72+
path: 'role',
73+
name: 'Role',
74+
component: () => import('@/views/system/role/index'),
75+
meta: { title: '角色管理', icon: 'table' }
76+
},
77+
{
7178
path: 'permission',
7279
name: 'Permission',
7380
component: () => import('@/views/system/permission/index'),

src/store/modules/dep.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { getAllDepartmentApi } from '@/api/dep'
2-
import commonUtil from '@/utils/common'
32
import treeDeepUtil from '@/utils/treeDeepUtil'
43

54
const getDefaultState = () => {

src/store/modules/dict.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { getDictDetailByDictKey } from '@/api/dict'
33
const getDefaultState = () => {
44
return {
55
sexDictList: [], // 性别字典列表
6-
statusDictList: [] // 状态字典
6+
statusDictList: [], // 状态字典
7+
authorityDictList: []
78
}
89
}
910

@@ -17,6 +18,9 @@ const mutations = {
1718
},
1819
SET_STATUS_DICT_LIST(state, statusDictList) {
1920
state.statusDictList = statusDictList
21+
},
22+
SET_AUTHORITY_DICT_LIST(state, authorityDictList) {
23+
state.authorityDictList = authorityDictList
2024
}
2125
}
2226

@@ -58,6 +62,25 @@ const actions = {
5862
reject([])
5963
})
6064
})
65+
},
66+
// 获取数据权限类型字典
67+
getAuthorityDictList({ commit, state }) {
68+
return new Promise((resolve, reject) => {
69+
if (state.authorityDictList.length > 0) {
70+
resolve(state.authorityDictList)
71+
return
72+
}
73+
getDictDetailByDictKey({
74+
dictKey: 'authority'
75+
}).then(response => {
76+
if (response.code === 200) {
77+
commit('SET_AUTHORITY_DICT_LIST', response.result)
78+
}
79+
resolve(response.result)
80+
}).catch(() => {
81+
reject([])
82+
})
83+
})
6184
}
6285
}
6386

src/utils/request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { MessageBox, Message } from 'element-ui'
33
import store from '@/store'
44
import { getToken } from '@/utils/auth'
55
import qs from 'qs'
6-
import router from '@/router'
6+
// import router from '@/router'
77

88
// create an axios instance
99
const service = axios.create({
@@ -26,7 +26,7 @@ service.interceptors.request.use(
2626

2727
// form表单提交
2828
if (config.method.toLocaleLowerCase() === 'post' && config.headers['Content-Type'] === 'application/json') {
29-
29+
console.log('')
3030
} else {
3131
config.data = qs.stringify(config.data)
3232
}

src/views/login/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
</template>
6767

6868
<script>
69-
import { validUsername } from '@/utils/validate'
69+
// import { validUsername } from '@/utils/validate'
7070
7171
export default {
7272
name: 'Login',

src/views/system/codeRender/codeShow.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,39 @@
88
</div>
99
<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
1010
<el-tab-pane label="api" name="api">
11+
{{ name }}.js
1112
<pre v-highlightjs="result.api"><code class="javascript" /></pre>
1213
</el-tab-pane>
1314
<el-tab-pane label="table.vue" name="table">
15+
{{ name }}.vue
1416
<pre v-highlightjs="result.table"><code class="javascript" /></pre>
1517
</el-tab-pane>
1618
<el-tab-pane label="vuexDict.js" name="vuexDict">
19+
{{ name }}Dict.js
1720
<pre v-highlightjs="result.vuexDict"><code class="javascript" /></pre>
1821
</el-tab-pane>
1922
<el-tab-pane label="entity" name="entity">
23+
{{ Name }}.java
2024
<pre v-highlightjs="result.entity"><code class="java" /></pre>
2125
</el-tab-pane>
2226
<el-tab-pane label="controller" name="controller">
27+
{{ Name }}Controller.java
2328
<pre v-highlightjs="result.controller"><code class="java" /></pre>
2429
</el-tab-pane>
2530
<el-tab-pane label="service" name="service">
31+
{{ Name }}Service.java
2632
<pre v-highlightjs="result.service"><code class="java" /></pre>
2733
</el-tab-pane>
2834
<el-tab-pane label="serviceImpl" name="serviceImpl">
35+
{{ Name }}ServiceImpl.java
2936
<pre v-highlightjs="result.serviceImpl"><code class="java" /></pre>
3037
</el-tab-pane>
3138
<el-tab-pane label="mapper" name="mapper">
39+
{{ Name }}Mapper.java
3240
<pre v-highlightjs="result.mapper"><code class="java" /></pre>
3341
</el-tab-pane>
3442
<el-tab-pane label="mysql" name="mysql">
43+
t_{{ name }}.sql
3544
<pre v-highlightjs="result.mysql"><code class="sql" /></pre>
3645
</el-tab-pane>
3746
</el-tabs>
@@ -47,17 +56,21 @@ export default {
4756
return {
4857
activeName: 'api',
4958
result: {},
50-
inputData: ''
59+
inputData: '',
60+
name: ''
5161
}
5262
},
5363
created() {
5464
this.getCode()
65+
this.name = this.$route.query.name
66+
this.Name = this.name.slice(0, 1).toUpperCase() + this.name.slice(1)
5567
},
5668
methods: {
5769
goBack() {
5870
this.$router.back()
5971
},
6072
handleClick(tab, event) {
73+
console.log(this.result[tab.name])
6174
this.inputData = this.result[tab.name]
6275
},
6376
getCode() {

src/views/system/dict/dictDetail.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ import {
147147
dictDetailDelByIdsApi,
148148
dictDetailSaveBaseApi,
149149
dictDetailUpdateBaseApi,
150-
getDictDetailByPageApi, getDictDetailByDictIdApi
150+
getDictDetailByDictIdApi
151151
} from '@/api/dictDetail'
152152
import commonUtil from '@/utils/common'
153153
import CommonEnum from '@/enum/CommonEnum'

0 commit comments

Comments
 (0)