|
|
@@ -10,7 +10,8 @@
|
|
|
<el-breadcrumb-item :to="{ path: '/system/userrole' }">角色管理</el-breadcrumb-item>
|
|
|
</el-breadcrumb>
|
|
|
<span style="float: right;">
|
|
|
- <el-button size="mini" type="primary" style="margin-left:10px; margin-top: -4px;" @click="opendialog(null)">添加</el-button>
|
|
|
+ <el-button size="mini" type="primary" style="margin-left:10px; margin-top: -4px;" @click="opendialog(null)">添加
|
|
|
+ </el-button>
|
|
|
</span>
|
|
|
<el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
|
|
|
<el-form-item label="角色名">
|
|
|
@@ -27,23 +28,29 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
- <el-table :data="list" size="mini" tooltip-effect="dark" border>
|
|
|
+ <el-table :data="list" size="mini" tooltip-effect="dark" border>
|
|
|
<el-table-column label="操作" min-width="150px" align="center" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button size="small" @click="opendialog(scope.row)" type="text" icon="el-icon-edit" title="编辑"></el-button>
|
|
|
- <el-button size="small" type="text" style="margin-left:3px" icon="el-icon-delete" title="删除" @click="deleteroledata(scope.row)"></el-button>
|
|
|
- <el-button size="small" type="text" style="margin-left:3px" title="用户列表" @click="showUserList(scope.row)"><i
|
|
|
+ <el-button size="small" @click="opendialog(scope.row)" type="text" icon="el-icon-edit" title="编辑">
|
|
|
+ </el-button>
|
|
|
+ <el-button size="small" type="text" style="margin-left:6px" icon="el-icon-delete" title="删除"
|
|
|
+ @click="deleteroledata(scope.row)"></el-button>
|
|
|
+ <el-button size="small" type="text" style="margin-left:6px" title="用户列表" @click="showUserList(scope.row)"><i
|
|
|
class="icon icon-user"></i></el-button>
|
|
|
- <el-button size="small" type="text" style="margin-left:3px" title="菜单权限" @click="setpower(scope.row)"><i
|
|
|
+ <el-button size="small" type="text" style="margin-left:6px" title="菜单权限" @click="setpower(scope.row)"><i
|
|
|
class="icon icon-file-text"></i></el-button>
|
|
|
- <el-button size="small" type="text" style="margin-left:3px" title="操作权限" @click="getItemPower(scope.row)"><i
|
|
|
+ <el-button size="small" type="text" style="margin-left:6px" title="操作权限" @click="getItemPower(scope.row)"><i
|
|
|
class="icon icon-lock"></i></el-button>
|
|
|
+ <el-button size="small" type="text" style="margin-left:6px" title="角色" @click="setRoleManage(scope.row)"
|
|
|
+ v-if="appclient == 'gfgl'"><i class="icon icon-cog"></i></el-button>
|
|
|
<!-- <el-button size="small" type="text" style="margin-left:3px" title="容器权限" @click="setequipmentpower(scope.row)"
|
|
|
v-if="appclient != 'lims'"><i class="icon icon-cog"></i></el-button> -->
|
|
|
- <el-button size="small" type="text" style="margin-left:3px" title="资源权限-部门" @click="departmentMessageViewSet(scope.row)"
|
|
|
- v-if="appclient == 'lims'"><i class="icon icon-cog"></i></el-button>
|
|
|
- <el-button size="small" type="text" style="margin-left:3px" title="资源权限-区域" @click="districtMessageViewSet(scope.row)"
|
|
|
- v-if="appclient == 'lims'"><i class="icon icon-file-text"></i></el-button>
|
|
|
+ <el-button size="small" type="text" style="margin-left:6px" title="资源权限-部门"
|
|
|
+ @click="departmentMessageViewSet(scope.row)" v-if="appclient == 'lims'"><i class="icon icon-cog"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-button size="small" type="text" style="margin-left:6px" title="资源权限-区域"
|
|
|
+ @click="districtMessageViewSet(scope.row)" v-if="appclient == 'lims'"><i class="icon icon-file-text"></i>
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="Realname" align="center" label="角色名" show-overflow-tooltip></el-table-column>
|
|
|
@@ -55,7 +62,8 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
|
|
|
- :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
|
|
|
+ :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="currentItemCount">
|
|
|
</el-pagination>
|
|
|
</el-card>
|
|
|
<!-- 添加角色 -->
|
|
|
@@ -75,13 +83,16 @@
|
|
|
</el-dialog>
|
|
|
<!-- 用户列表 -->
|
|
|
<el-dialog title="包含用户列表" :visible.sync="userDialogVisible">
|
|
|
- <el-button type="primary" size="mini" style="float: right; margin-top: -10px;margin-left :5px" @click="deleteuserdataall()">删除所有关联用户</el-button>
|
|
|
- <el-button type="primary" size="mini" style="float: right; margin-top: -10px" @click="roleadduser()">添加</el-button>
|
|
|
+ <el-button type="primary" size="mini" style="float: right; margin-top: -10px;margin-left :5px"
|
|
|
+ @click="deleteuserdataall()">删除所有关联用户</el-button>
|
|
|
+ <el-button type="primary" size="mini" style="float: right; margin-top: -10px" @click="roleadduser()">添加
|
|
|
+ </el-button>
|
|
|
<br />
|
|
|
<el-table :data="userList" border>
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button size="small" type="text" style="margin-left:3px" icon="el-icon-delete" title="删除" @click="deleteuserdata(scope.row)"></el-button>
|
|
|
+ <el-button size="small" type="text" style="margin-left:3px" icon="el-icon-delete" title="删除"
|
|
|
+ @click="deleteuserdata(scope.row)"></el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="Username" align="center" label="账号" show-overflow-tooltip></el-table-column>
|
|
|
@@ -93,8 +104,9 @@
|
|
|
show-overflow-tooltip></el-table-column> -->
|
|
|
</el-table>
|
|
|
|
|
|
- <el-pagination @size-change="handleUserSizeChange" @current-change="handleUserCurrentChange" :current-page="currentUserPage"
|
|
|
- :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentUserItemCount">
|
|
|
+ <el-pagination @size-change="handleUserSizeChange" @current-change="handleUserCurrentChange"
|
|
|
+ :current-page="currentUserPage" :page-sizes="[10, 15, 20, 25]" :page-size="size"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" :total="currentUserItemCount">
|
|
|
</el-pagination>
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
@@ -107,8 +119,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="用户">
|
|
|
- <el-select ref="selectOfficer" multiple filterable default-first-option v-model="OfficerList" placeholder="请选择"
|
|
|
- style="width: 100%">
|
|
|
+ <el-select ref="selectOfficer" multiple filterable default-first-option v-model="OfficerList"
|
|
|
+ placeholder="请选择" style="width: 100%">
|
|
|
<el-option v-for="item in selectuserlist" :key="item.Id" :label="item.Realname" :value="item.Id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -124,7 +136,8 @@
|
|
|
</el-dialog>
|
|
|
<!-- 菜单权限 -->
|
|
|
<el-dialog :title="powerdialogtitle" :visible.sync="powerdialogVisible">
|
|
|
- <el-tree style="border: 0" show-checkbox node-key="id" :data="modulepowerdata" :props="modulepowerProps" ref="modulepowertree">
|
|
|
+ <el-tree style="border: 0" show-checkbox node-key="id" :data="modulepowerdata" :props="modulepowerProps"
|
|
|
+ ref="modulepowertree">
|
|
|
</el-tree>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="powerdialogVisible = false">取 消</el-button>
|
|
|
@@ -132,8 +145,9 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<!-- 容器权限 -->
|
|
|
- <el-dialog title="容器权限" :visible.sync="powerequipmentdialogVisible">
|
|
|
- <el-checkbox :indeterminate="isequpicheckall" v-model="equipCheckAll" @change="handleCheckAllChange">全选</el-checkbox>
|
|
|
+ <!-- <el-dialog title="容器权限" :visible.sync="powerequipmentdialogVisible">
|
|
|
+ <el-checkbox :indeterminate="isequpicheckall" v-model="equipCheckAll" @change="handleCheckAllChange">全选
|
|
|
+ </el-checkbox>
|
|
|
<div style="margin-top:10px;" class="rowequippower">
|
|
|
<el-checkbox-group v-model="selectedequip">
|
|
|
<el-checkbox v-for="item in equipalllist" :key="item.Id" @change="handlecheckedequpichange" :label="item.Id"
|
|
|
@@ -144,10 +158,11 @@
|
|
|
<el-button @click="powerequipmentdialogVisible = false">取 消</el-button>
|
|
|
<el-button type="primary" @click="saveequiptmentpower()">确 定</el-button>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
+ </el-dialog> -->
|
|
|
<!-- 操作权限 -->
|
|
|
<el-dialog title="操作权限" :visible.sync="operationPowerDialogVisible">
|
|
|
- <el-tree style="border: 0" show-checkbox node-key="id" :data="operationPowerData" :props="modulepowerProps" ref="operationPowerTree">
|
|
|
+ <el-tree style="border: 0" show-checkbox node-key="id" :data="operationPowerData" :props="modulepowerProps"
|
|
|
+ ref="operationPowerTree">
|
|
|
</el-tree>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="operationPowerDialogVisible = false">取 消</el-button>
|
|
|
@@ -156,7 +171,8 @@
|
|
|
</el-dialog>
|
|
|
<!-- 资源权限 -->
|
|
|
<el-dialog title="资源权限(部门信息)" :visible.sync="messageviewVisible">
|
|
|
- <el-tree style="border: 0" show-checkbox node-key="id" :data="operationOrganizeData" :props="organizeProps" ref="operationOriganizeTree">
|
|
|
+ <el-tree style="border: 0" show-checkbox node-key="id" :data="operationOrganizeData" :props="organizeProps"
|
|
|
+ ref="operationOriganizeTree">
|
|
|
</el-tree>
|
|
|
<div slot="footer">
|
|
|
<el-button @click="messageviewVisible = false">取消</el-button>
|
|
|
@@ -165,13 +181,29 @@
|
|
|
</el-dialog>
|
|
|
<!-- 资源权限 -->
|
|
|
<el-dialog title="资源权限(区域信息)" :visible.sync="districtVisible">
|
|
|
- <el-tree style="border: 0" show-checkbox node-key="id" :data="operationdistrictData" :props="districtProps" ref="operationdistrictTree">
|
|
|
+ <el-tree style="border: 0" show-checkbox node-key="id" :data="operationdistrictData" :props="districtProps"
|
|
|
+ ref="operationdistrictTree">
|
|
|
</el-tree>
|
|
|
<div slot="footer">
|
|
|
<el-button @click="districtVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click="savedistrictPower()">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- 设置角色管理角色 -->
|
|
|
+ <el-dialog title="管理角色" :visible.sync="rolesetVisible">
|
|
|
+ <el-checkbox :indeterminate="isrolecheckall" v-model="roleCheckAll" @change="handleCheckAllRole">全选
|
|
|
+ </el-checkbox>
|
|
|
+ <div style="margin-top:20px;">
|
|
|
+ <el-checkbox-group v-model="selectedrole">
|
|
|
+ <el-checkbox v-for="role in list" @change="handlecheckedrolechange" :label="role.Id" :value="role.Id"
|
|
|
+ :key="role.Id">{{role.Realname}}</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </div>
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button @click="rolesetVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="managerolesave()">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
|
|
|
<!-- 给操作权限添加角色 -->
|
|
|
<!-- <el-dialog title="给操作权限选择角色" :visible.sync="addRoleOpsDialogVisible">
|
|
|
@@ -199,6 +231,13 @@
|
|
|
}),
|
|
|
data() {
|
|
|
return {
|
|
|
+ //角色管理角色
|
|
|
+ rolesetVisible: false,
|
|
|
+ roleCheckAll: false,
|
|
|
+ isrolecheckall: false,
|
|
|
+ selectedrole: [],
|
|
|
+ rolelistcheckall: [],
|
|
|
+ mustrolelist: [],
|
|
|
//添加用户
|
|
|
addUserShow: false,
|
|
|
partuserlist: [],
|
|
|
@@ -212,6 +251,7 @@
|
|
|
currentPage: 1,
|
|
|
size: 10,
|
|
|
list: [],
|
|
|
+ rolelist: [],
|
|
|
|
|
|
currentUserItemCount: 0,
|
|
|
currentUserPage: 1,
|
|
|
@@ -269,7 +309,8 @@
|
|
|
this.appclient = process.env.appclient
|
|
|
// initial data
|
|
|
this.initData()
|
|
|
- this.getallequipmentlist()
|
|
|
+ //this.getallequipmentlist()
|
|
|
+ this.getallrolelist()
|
|
|
},
|
|
|
methods: {
|
|
|
initData() {
|
|
|
@@ -296,6 +337,23 @@
|
|
|
_this.exportloading = false
|
|
|
})
|
|
|
},
|
|
|
+ getallrolelist() {
|
|
|
+ this.$axios.get('role/list', {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ this.rolelist = res.data.items
|
|
|
+ let roleItemCount = res.data.currentItemCount
|
|
|
+ for (var i = 0; i < roleItemCount; i++) {
|
|
|
+ this.rolelistcheckall.push(this.rolelist[i].Id)
|
|
|
+ }
|
|
|
+ this.exportloading = false
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.exportloading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
getpartuserlist() {
|
|
|
let _this = this
|
|
|
this.$axios.get('users/list', {})
|
|
|
@@ -310,6 +368,40 @@
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
+ managerolesave() {
|
|
|
+ console.log(this.selectedrole)
|
|
|
+ let _this = this
|
|
|
+ for (let mdx in this.mustrolelist) {
|
|
|
+ if (this.selectedrole.indexOf(this.mustrolelist[mdx]) == -1) {
|
|
|
+ this.selectedrole.push(parseInt(this.mustrolelist[mdx]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let rolestring = this.selectedrole.join(',')
|
|
|
+ // request
|
|
|
+ this.$axios.put('role/setmanrole/' + this.selectedroleid + '_' + rolestring, {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ // 更新界面
|
|
|
+ this.rolelist = []
|
|
|
+ this.initData()
|
|
|
+ this.rolesetVisible = false
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
roleadduser() {
|
|
|
this.addUserShow = true
|
|
|
this.getpartuserlist()
|
|
|
@@ -735,7 +827,7 @@
|
|
|
// response
|
|
|
_this.operationdistrictData = window.toolfun_gettreejson(res.data.District, 'id', 'pId',
|
|
|
'id,name,scope')
|
|
|
- let selectmodels = []
|
|
|
+ let selectmodels = []
|
|
|
if (res.data.SelectedDistrict) {
|
|
|
for (var i = 0; i < res.data.SelectedDistrict.length; i++) {
|
|
|
let isParent = false
|
|
|
@@ -837,6 +929,52 @@
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
+ setRoleManage(val) {
|
|
|
+ this.selectedroleid = val.Id + ''
|
|
|
+ this.selectedrole = []
|
|
|
+ let _this = this
|
|
|
+ // request
|
|
|
+ this.$axios.get('role/getmanagerole/' + this.selectedroleid, {})
|
|
|
+ .then(res => {
|
|
|
+ console.log("-------res----",res.data)
|
|
|
+ this.rolesetVisible = true
|
|
|
+ _this.mustrolelist = []
|
|
|
+ // response
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
+ if (_this.roleisexist(parseInt(res.data[i]))) {
|
|
|
+ _this.selectedrole.push(parseInt(res.data[i]))
|
|
|
+ }
|
|
|
+ let flag = false
|
|
|
+ let rdx = 0
|
|
|
+ for (rdx = 0; rdx < _this.rolelist.length; rdx++) {
|
|
|
+ if (parseInt(_this.rolelist[rdx].Id) == parseInt(res.data[i])) {
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ _this.mustrolelist.push(parseInt(res.data[i]))
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ let checkedCount = this.selectedrole.length
|
|
|
+ this.roleCheckAll = checkedCount === this.rolelist.length
|
|
|
+ this.isrolecheckall = checkedCount > 0 && checkedCount < this.rolelist.length
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ roleisexist(val) {
|
|
|
+ for (let i = 0; i < this.rolelist.length; i++) {
|
|
|
+ if (this.rolelist[i].Id === val) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ },
|
|
|
setequipmentpower(val) {
|
|
|
let _this = this
|
|
|
_this.operationid = val.Id
|
|
|
@@ -963,6 +1101,15 @@
|
|
|
// this.addRoleOpsDialogVisible = true
|
|
|
// },
|
|
|
|
|
|
+ handlecheckedrolechange() {
|
|
|
+ let checkedCount = this.selectedrole.length
|
|
|
+ this.roleCheckAll = checkedCount === this.rolelist.length
|
|
|
+ this.isrolecheckall = checkedCount > 0 && checkedCount < this.rolelist.length
|
|
|
+ },
|
|
|
+ handleCheckAllRole(val) {
|
|
|
+ this.selectedrole = val ? this.rolelistcheckall : []
|
|
|
+ this.isrolecheckall = false
|
|
|
+ },
|
|
|
|
|
|
// 全选框控制
|
|
|
handleCheckAllChange(val) {
|