Commit 2b397df8 authored by zhangrui123's avatar zhangrui123

权限修改的bug处理

parent b2667ea6
...@@ -46,7 +46,42 @@ const appRoutes = [ ...@@ -46,7 +46,42 @@ const appRoutes = [
{ // 拓展信息管理 { // 拓展信息管理
path: '/systemManagement/tbls', name: 'tbls', component: resolve => require(['@/views/houseData/tbls'], resolve), //Tbls, path: '/systemManagement/tbls', name: 'tbls', component: resolve => require(['@/views/houseData/tbls'], resolve), //Tbls,
meta: { title: '拓展信息管理', menuPath: true, menuIcon: 'setting', authCode: '000002', hideInBread: false, }, meta: { title: '拓展信息管理', menuPath: true, menuIcon: 'setting', authCode: '000002', hideInBread: false, },
}, },
// //角色权限配置
// {
// path: '/systemManagement/permissionConfig',
// name: '/systemManagement/permissionConfig',
// component: resolve => require(['@/views/permissionConfig/index'], resolve),
// meta: { title: '角色权限配置', menuPath: true, authCode: '', menuIcon: 'cluster', hideInBread: false, openMode: 'normal' },
// children: [{
// path: '/systemManagement/permissionConfig/point',
// name: '/systemManagement/permissionConfig/point',
// component: resolve => require(['@/views/permissionConfig/point'], resolve),
// meta: { title: '功能点管理', menuPath: false, authCode: '', menuIcon: 'cluster', hideInBread: false, openMode: 'normal' },
// children: [
// {
// path: '/systemManagement/permissionConfig/point/add',
// name: '/systemManagement/permissionConfig/point/add',
// component: resolve => require(['@/views/permissionConfig/addPoint'], resolve),
// meta: { title: '添加功能点', menuPath: false, authCode: '', menuIcon: 'cluster', hideInBread: false, openMode: 'normal' },
// },
// {
// path: '/systemManagement/permissionConfig/point/addBatch',
// name: '/systemManagement/permissionConfig/point/addBatch',
// component: resolve => require(['@/views/permissionConfig/editPoint'], resolve),
// meta: { title: '批量添加功能点', menuPath: false, authCode: '', menuIcon: 'cluster', hideInBread: false, openMode: 'normal' },
// },
// {
// path: '/systemManagement/permissionConfig/point/edit',
// name: '/systemManagement/permissionConfig/point/edit',
// component: resolve => require(['@/views/permissionConfig/index'], resolve),
// meta: { title: '编辑功能点', menuPath: false, authCode: '', menuIcon: 'cluster', hideInBread: false, openMode: 'normal' },
// }
// ]
// },
// ]
// },
{ // 角色管理 { // 角色管理
path: '/systemManagement/role', name: 'role', component: resolve => require(['@/views/personal/role/list'], resolve), //role, path: '/systemManagement/role', name: 'role', component: resolve => require(['@/views/personal/role/list'], resolve), //role,
meta: { title: '角色管理', authCode: '000903', menuPath: true, menuIcon: 'cluster', hideInBread: false, }, meta: { title: '角色管理', authCode: '000903', menuPath: true, menuIcon: 'cluster', hideInBread: false, },
......
...@@ -66,7 +66,7 @@ default: // 默认环境下(开发环境) ...@@ -66,7 +66,7 @@ default: // 默认环境下(开发环境)
// BASE_URL = 'http://31.0.161.39/apiv2' // BASE_URL = 'http://31.0.161.39/apiv2'
// BASE_URL = 'http://211.136.105.193/apiv2' // BASE_URL = 'http://211.136.105.193/apiv2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2' // BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2' BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://pudong.hm.omniview.pro/api/v2' // BASE_URL = 'http://pudong.hm.omniview.pro/api/v2'
// BASE_URL = 'http://211.136.105.193/apiv2' // BASE_URL = 'http://211.136.105.193/apiv2'
MOCK_URL = 'https://yapi.omniview.pro/mock/283' MOCK_URL = 'https://yapi.omniview.pro/mock/283'
...@@ -215,6 +215,10 @@ export default { ...@@ -215,6 +215,10 @@ export default {
GET_USER_PEIMISSION: '/service-permission/user/perms', // 当前用户角色权限树 -- 传userId GET_USER_PEIMISSION: '/service-permission/user/perms', // 当前用户角色权限树 -- 传userId
GET_ALL_PEIMISSION: '/service-permission/perms', // 全部角色权限树 GET_ALL_PEIMISSION: '/service-permission/perms', // 全部角色权限树
GET_ALL_ROLE: '/service-permission/menu/tree', //获取权限 GET_ALL_ROLE: '/service-permission/menu/tree', //获取权限
GET_PREMSPOINT_LIST: '/service-permission/perm/points', //获取功能点清单
POST_PREMSBRANCH: '/service-permission/perm/perm', //单个新增权限分支
DELETE_PREMSPOINT: '/service-permission/perm/point/{id}', //删除功能点
SYSTEM_LIST_ALL_GET: '/service-user/user/systems', //查询系统列表
GET_USER_CODE: '/service-permission/user/menus/code', //获取用户权限 GET_USER_CODE: '/service-permission/user/menus/code', //获取用户权限
GET_USER_PERM: '/service-permission/user/menus/{id}', GET_USER_PERM: '/service-permission/user/menus/{id}',
......
...@@ -56,4 +56,7 @@ export default { ...@@ -56,4 +56,7 @@ export default {
SET_TABNAME(state, tabName) { SET_TABNAME(state, tabName) {
state.tabName = tabName state.tabName = tabName
}, },
SET_CURRENTROLEID(state, roleId) {
state.roleId = roleId
}
} }
...@@ -19,4 +19,5 @@ export default { ...@@ -19,4 +19,5 @@ export default {
content: null, content: null,
openKeys: [], openKeys: [],
isXuhui: false, // 是否为徐汇项目 isXuhui: false, // 是否为徐汇项目
currentRoleId: ''
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<a-row class="formItemLine"> <a-row class="formItemLine">
<a-col span="8"> <a-col span="8">
<a-form-item label="机构类型" v-bind="colSpe"> <a-form-item label="机构类型" v-bind="colSpe">
<a-select placeholder="请选择" allowClear mode="multip" @change="changeType" v-decorator="['orgType', {initialValue:'2', <a-select placeholder="请选择" allowClear mode="multip" @select="changeType" v-decorator="['orgType', {
validateTrigger: 'change', rules: [ { required: true, message: '请选择机构类型!' } ] validateTrigger: 'change', rules: [ { required: true, message: '请选择机构类型!' } ]
}]"> }]">
<a-select-option value="2">房办</a-select-option> <a-select-option value="2">房办</a-select-option>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<a-row class="formItemLine"> <a-row class="formItemLine">
<a-col span="8" > <a-col span="8" >
<a-form-item label="角色名称" v-bind="colSpe"> <a-form-item label="角色名称" v-bind="colSpe">
<a-select placeholder="请选择" @change="roleChange" allowClear mode="multiple" show-search labelInValue v-decorator="['notes'] <a-select placeholder="请选择" @change="roleChange" allowClear mode="multiple" show-search v-decorator="['notes']
"> ">
<a-select-option v-for="(item,index) in roleList" :key="index" :value="item.roleName+'#'+item.id">{{item.roleName}}</a-select-option> <a-select-option v-for="(item,index) in roleList" :key="index" :value="item.roleName+'#'+item.id">{{item.roleName}}</a-select-option>
</a-select> </a-select>
...@@ -85,6 +85,7 @@ export default { ...@@ -85,6 +85,7 @@ export default {
exclusionRoleIds: [ '999999', ], exclusionRoleIds: [ '999999', ],
userRoldIDsOrg: [], userRoldIDsOrg: [],
orgnazation: [], orgnazation: [],
detail: [],
colSpe: { colSpe: {
labelCol: { labelCol: {
span: 6 span: 6
...@@ -108,6 +109,7 @@ export default { ...@@ -108,6 +109,7 @@ export default {
}, },
mounted() { mounted() {
this.getRoleLists()
this.$ajax.get({ this.$ajax.get({
url: this.$api.GET_HOS_LIST, url: this.$api.GET_HOS_LIST,
...@@ -118,13 +120,12 @@ export default { ...@@ -118,13 +120,12 @@ export default {
}).then(res => { }).then(res => {
if (res.code == '200') { if (res.code == '200') {
this.orgnazation = res.data.content this.orgnazation = res.data.content
console.log(this.orgnazation)
} }
}) })
//如果路由有id则为修改数据-- 去获取对应数据渲染
this.getTree() this.getTree()
this.getRoleLists()
console.log(123)
}, },
methods: { methods: {
// 查询权限树 // 查询权限树
...@@ -159,9 +160,9 @@ export default { ...@@ -159,9 +160,9 @@ export default {
}, },
//添加账户 //添加账户
handleAdd() { handleAdd() {
this.searchForm.validateFields((err, values) => { this.searchForm.validateFields((err, values) => {
values={...values, status: 1, roleIds: ''} // 直接启用账户 values={...values, status: 1, roleIds: ''} // 直接启用账户
console.log(values)
if (values.phone1 ) { if (values.phone1 ) {
values.phone+=','+ values.phone1 +',' values.phone+=','+ values.phone1 +','
...@@ -169,21 +170,24 @@ export default { ...@@ -169,21 +170,24 @@ export default {
if (values.phone2) { if (values.phone2) {
values.phone+= values.phone2 values.phone+= values.phone2
} }
values.DorgId = ''
values.orgId = this.searchForm.getFieldValue('DorgId')?this.searchForm.getFieldValue('DorgId').split('#')[0]:'' values.orgId = this.searchForm.getFieldValue('DorgId')?this.searchForm.getFieldValue('DorgId').split('#')[0]:''
values.orgName = this.searchForm.getFieldValue('DorgId')?this.searchForm.getFieldValue('DorgId').split('#')[1]:'' values.orgName = this.searchForm.getFieldValue('DorgId')?this.searchForm.getFieldValue('DorgId').split('#')[1]:''
values.notes.forEach((item, index) => { values.notes.forEach((item, index) => {
let key = item.split('#')[1]
if (index == 0) { if (index == 0) {
values.roleIds += item.key values.roleIds += key
return return
} }
values.roleIds += ','+ item.key values.roleIds += ','+ key
}) })
values.roleNames = '' values.roleNames = ''
values.notes.forEach((ele, index) => { values.notes.forEach((ele, index) => {
if (index == 0) { if (index == 0) {
values.roleNames += ele.label values.roleNames += ele.split('#')[0]
}else{ }else{
values.roleNames += ','+ ele.label values.roleNames += ','+ ele.split('#')[0]
} }
}) })
if (!err) { if (!err) {
...@@ -220,10 +224,9 @@ export default { ...@@ -220,10 +224,9 @@ export default {
//获取当前登录账号可操作的角色列表 供多选框选择 //获取当前登录账号可操作的角色列表 供多选框选择
getRoleLists() { getRoleLists() {
const curUserRoles = this.$store.state.userInfos.roleIds const curUserRoles = this.$store.state.userInfos.roleIds
console.log(this.$store.state)
const sparams = { const sparams = {
pageNo: 1, pageNo: 1,
pageSize: 10000 pageSize: 10000,
} }
if (!this.$store.state.userInfos.isAllPerm ) { if (!this.$store.state.userInfos.isAllPerm ) {
if(!!curUserRoles){ if(!!curUserRoles){
...@@ -235,31 +238,24 @@ export default { ...@@ -235,31 +238,24 @@ export default {
params: sparams params: sparams
}).then(res => { }).then(res => {
this.roleList = this.$com.confirm(res, 'data.content', []) // 得到当前账号可支配全部角色 供多选框选择 this.roleList = this.$com.confirm(res, 'data.content', []) // 得到当前账号可支配全部角色 供多选框选择
console.log(this.roleList)
//如果路由有id则为修改数据-- 去获取对应数据渲染
if (this.$route.query.id) { if (this.$route.query.id) {
this.getDetail() this.getDetail()
} }
}) })
}, },
// 角色切换 // 角色切换
roleChange(item) { roleChange(item) {
let treeRoles = []
this.userRoldIDsOrg.forEach((userRoldId) => {
if(this.$com.oneOf(userRoldId.key, this.exclusionRoleIds)){
treeRoles.push(userRoldId)
}
})
this.roles = item this.roles = item
treeRoles = item.concat(treeRoles) this.checkedKeys = []
if (treeRoles.length != 0) {
const params = treeRoles.map((it) => { if (item.length != 0) {
return it.key const params = item.map((it) => {
return it.split('#')[1]
}) })
this.checkedKeys = []
this.$ajax.get({ this.$ajax.get({
url: this.$api.ROLE_DETAIL.replace('{id}', params) url: this.$api.ROLE_DETAIL.replace('{id}', params.join(','))
}).then(res => { }).then(res => {
if (res.code === '200') { if (res.code === '200') {
const data = res.data.content const data = res.data.content
...@@ -273,7 +269,6 @@ export default { ...@@ -273,7 +269,6 @@ export default {
} }
}, },
changeType(val){ changeType(val){
console.log(val)
if(val == 4){ if(val == 4){
this.show = false this.show = false
}else{ }else{
...@@ -286,6 +281,7 @@ export default { ...@@ -286,6 +281,7 @@ export default {
url: this.$api.GET_USER_DETAIL.replace('{id}', this.$route.query.id) url: this.$api.GET_USER_DETAIL.replace('{id}', this.$route.query.id)
}).then(res => { }).then(res => {
this.detail = res.data.content this.detail = res.data.content
let { let {
mail, mail,
name, name,
...@@ -297,19 +293,17 @@ export default { ...@@ -297,19 +293,17 @@ export default {
orgId, orgId,
addr, addr,
zipCode, zipCode,
orgName orgName,
orgType,
roleIds
} = this.detail } = this.detail
if(res.code === '200'){ if(res.code === '200'){
const data = res.data.content const data = res.data.content
this.$nextTick(() => { this.$nextTick(() => {
this.searchForm.setFieldsValue({ this.searchForm.setFieldsValue({
DorgId: data.orgId+'#'+data.orgName DorgId: data.orgId+'#'+data.orgName
}) })
}) })
console.log(data.orgId+'#'+data.orgName)
} }
if (phone.indexOf(',') != -1 ) { if (phone.indexOf(',') != -1 ) {
phone.split(',').forEach((ele, index) => { phone.split(',').forEach((ele, index) => {
...@@ -324,9 +318,7 @@ export default { ...@@ -324,9 +318,7 @@ export default {
} }
// 整理当前用户详情中的角色ID数据,去除重复 // 整理当前用户详情中的角色ID数据,去除重复
const userRoldIdsOrg = this.detail.roleIds != null ? this.detail.roleIds.split(',') : [] const userRoldIdsOrg = this.detail.roleIds != null ? this.detail.roleIds.split(',') : []
// if(userRoldIdsOrg.length>0 && userRoldIdsOrg[0]=='999999'){
// userRoldIdsOrg.shift()
// }
const userRoleIDs = [] const userRoleIDs = []
for(let i=0;i<userRoldIdsOrg.length;i++){ for(let i=0;i<userRoldIdsOrg.length;i++){
if(!this.$com.oneOf(userRoldIdsOrg[i], userRoleIDs) && !this.$com.oneOf(userRoldIdsOrg[i], this.exclusionRoleIds)){ if(!this.$com.oneOf(userRoldIdsOrg[i], userRoleIDs) && !this.$com.oneOf(userRoldIdsOrg[i], this.exclusionRoleIds)){
...@@ -343,18 +335,22 @@ export default { ...@@ -343,18 +335,22 @@ export default {
} }
// 组装需要展示在用户信息表单“角色名称”项的初始数据 // 组装需要展示在用户信息表单“角色名称”项的初始数据
userRoleIDs.forEach((ele, index) => { userRoleIDs.forEach((ele, index) => {
userRoleIDs[index] = { // userRoleIDs[index] = {
'key': ele, // 'key': ele,
'label': userRoleNames[index] // 'label': userRoleNames[index]
} // }
userRoleIDs[index] = userRoleNames[index]+'#'+ele
}) })
let _this = this let _this = this
this.userRoldIDsOrg = [] this.userRoldIDsOrg = []
userRoldIdsOrg.forEach((ele, index) => { userRoldIdsOrg.forEach((ele, index) => {
this.userRoldIDsOrg.push({ this.userRoldIDsOrg.push(
'key': ele, // {
'label': userRoldNamesOrg[index] // 'key': ele,
}) // 'label': userRoldNamesOrg[index]
// }
userRoldNamesOrg[index]+'#'+ele
)
}) })
const setDatas = { const setDatas = {
mail, mail,
...@@ -366,14 +362,20 @@ export default { ...@@ -366,14 +362,20 @@ export default {
addr, addr,
zipCode, zipCode,
username, username,
DorgId orgType
// DorgId
} }
this.show = orgType=='2'
setDatas.notes = userRoleIDs setDatas.notes = userRoleIDs
this.roles = userRoleIDs this.roles = userRoleIDs
this.searchForm.setFieldsValue(setDatas)
this.roleChange(this.userRoldIDsOrg) this.roleChange(this.userRoldIDsOrg)
this.$nextTick(() => {
this.searchForm.setFieldsValue(setDatas)
})
}) })
}, },
validateUserName(rule, value, callback){ validateUserName(rule, value, callback){
if(this.fromCenter){ if(this.fromCenter){
...@@ -415,7 +417,6 @@ export default { ...@@ -415,7 +417,6 @@ export default {
if(!filter.test(value)){ if(!filter.test(value)){
callback('请输入正确手机号!') callback('请输入正确手机号!')
}else { }else {
console.log(value)
if(value==this.searchForm.getFieldValue('phone1')){ if(value==this.searchForm.getFieldValue('phone1')){
callback('手机号不能重复') callback('手机号不能重复')
}else if(value==this.searchForm.getFieldValue('phone2')){ }else if(value==this.searchForm.getFieldValue('phone2')){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment