Browse Source

新增权限组、资源、授权管理

master
myTest383 7 months ago
parent
commit
c73c166370
  1. 50
      src/api/system/purviewManage/purviewManage.js
  2. 50
      src/api/system/resourcesManage/resourcesManage.js
  3. 31
      src/api/system/unitAuthorizeManage/unitAuthorizeManage.js
  4. BIN
      src/assets/loginImg/logo.png
  5. 232
      src/views/system/purviewManage/purviewManage.vue
  6. 232
      src/views/system/resourcesManage/resourcesManage.vue
  7. 227
      src/views/system/unitAuthorizeManage/unitAuthorizeManage.vue

50
src/api/system/purviewManage/purviewManage.js

@ -0,0 +1,50 @@
import request from '@/utils/request'
// 权限组接口文档
export default {
// 查询分页列表
listPage: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/baes/apiadmin/purviewManage/pageList',
method: 'POST',
data: data,
headers: {
'Content-Type': 'application/json'
}
})
},
// 新增、保存
savePurviewManage: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/base/apiadmin/purviewManage/saveOrUpdate',
method: 'post',
data: data,
headers: {
'Content-Type': 'application/json'
}
});
},
// 删除
deleteBySid: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/baes/apiadmin/purviewManage/delete/' + data,
method: 'DELETE',
})
},
// 查询所有权限组列表
getPurviewManageListAll: function(params) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/baes/apiadmin/purviewManage/listAll',
method: 'post',
data: params,
})
},
}

50
src/api/system/resourcesManage/resourcesManage.js

@ -0,0 +1,50 @@
import request from '@/utils/request'
// 资源 接口文档
export default {
// 查询分页列表
listPage: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/baes/apiadmin/resourcesManage/pageList',
method: 'POST',
data: data,
headers: {
'Content-Type': 'application/json'
}
})
},
// 新增、保存
savereSourcesManage: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/base/apiadmin/resourcesManage/saveOrUpdate',
method: 'post',
data: data,
headers: {
'Content-Type': 'application/json'
}
});
},
// 删除
deleteBySid: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/baes/apiadmin/resourcesManage/delete/' + data,
method: 'DELETE',
})
},
// 查询所有资源列表
getresourcesManageListAll: function(params) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/baes/apiadmin/resourcesManage/listAll',
method: 'post',
data: params,
})
},
}

31
src/api/system/unitAuthorizeManage/unitAuthorizeManage.js

@ -0,0 +1,31 @@
import request from '@/utils/request'
// 单位授权 接口文档
export default {
// 查询分页列表
listPage: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/baes/apiadmin/unitAuthorizeManage/pageList',
method: 'POST',
data: data,
headers: {
'Content-Type': 'application/json'
}
})
},
// 保存权限组
savePurviewManage: function(data) {
return request({
baseURL: "http://127.0.0.1:4523/m1/4061550-0-default",
url: '/base/apiadmin/unitAuthorizeManage/savePurviewManage',
method: 'post',
data: data,
headers: {
'Content-Type': 'application/json'
}
});
},
}

BIN
src/assets/loginImg/logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 17 KiB

232
src/views/system/purviewManage/purviewManage.vue

@ -1,8 +1,238 @@
<template>
<el-tabs class="my-tabs" v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="权限组列表" name="roleList">
<div class="container">
<div class="tab-header">
<el-form ref="form" :inline="true" :model="page" label-width="80px">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="权限组名称">
<el-input v-model="page.search.name" clearable></el-input>
</el-form-item>
<el-button @click="getList(1)">查询</el-button>
</el-col>
</el-row>
</el-form>
</div>
<!-- table -->
<el-table :data="roleTable" border style="width: 100%;">
<el-table-column label="序号" width="80px" type="index" align="center">
</el-table-column>
<el-table-column label="操作" width="220px" align="center">
<template slot-scope="scope">
<el-button @click="editRow(scope.row)" type="primary" size="mini"> 修改</el-button>
<el-button @click="delRow(scope.row)" type="danger" size="mini"> 删除</el-button>
</template>
</el-table-column>
<el-table-column prop="purviewManageName" label="权限组名称" align="center"></el-table-column>
<el-table-column prop="purviewManageCode" label="权限组编码" align="center"></el-table-column>
<el-table-column prop="remarks" label="说明" align="center"></el-table-column>
</el-table>
<pagination :total="page.total" :page.sync="page.current" :limit.sync="page.size" @pagination="pagination" />
<!-- 编辑权限组信息 -->
<el-dialog :title="dialogTitle + '权限组信息'" :visible.sync="editDialog" width="40%">
<table class="e-table" cellspacing="0">
<tr>
<td>权限组名称</td>
<td>
<el-input v-model="roleForm.purviewManageName" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>权限组编码</td>
<td>
<el-input v-model="roleForm.purviewManageCode" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>权限组说明</td>
<td>
<el-input v-model="roleForm.remarks" style="width:300px"></el-input>
</td>
</tr>
</table>
<div style="margin-top: 20px; text-align: center;">
<el-button type="primary" @click="save()"> </el-button>
<el-button @click="editDialog = false"> </el-button>
</div>
</el-dialog>
</div>
</el-tab-pane>
<!-- 新增权限组信息 -->
<el-tab-pane label="新增权限组" name="addrole">
<el-card class="box-card">
<table class="e-table" cellspacing="0">
<tr>
<td>权限组名称</td>
<td>
<el-input v-model="roleForm.purviewManageName" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>权限组编码</td>
<td>
<el-input v-model="roleForm.purviewManageCode" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>权限组说明</td>
<td>
<el-input v-model="roleForm.remarks" style="width:300px"></el-input>
</td>
</tr>
</table>
<div style="margin-top: 20px; text-align: center;">
<el-button type="primary" @click="save()"> </el-button>
</div>
</el-card>
</el-tab-pane>
</el-tabs>
</template>
<script>
import req from '@/api/system/purviewManage/purviewManage.js'
export default {
data() {
return {
dialogTitle: '',
activeName: 'roleList',
roleForm: {
sid: "",
purviewManageName: "",
purviewManageCode: '',
remarks: '',
},
formBackup: {},
page: {
total: 0, //
current: 1, //
size: 10, //
search: {
name: '',
},
},
roleTable: [],
editDialog: false,
};
},
mounted() {
this.formBackup = Object.assign({}, this.roleForm),
this.getList()
},
methods: {
pagination(val) { //
this.page.current = val.pageNum
this.page.size = val.pageSize
this.getList()
},
//
getList(flag) {
if (flag == '1') {
this.page.current = 1
}
req.listPage(this.page).then(res => {
this.page.total = res.data.total
this.roleTable = res.data.records
})
},
handleClick(tab, event) {
if (tab.name == 'addrole') {
this.dialogTitle = '新增'
this.roleForm = Object.assign({}, this.formBackup)
} else {
this.getList()
}
},
editRow(row) {
this.dialogTitle = '编辑'
this.editDialog = true
console.log(row)
this.roleForm = Object.assign({}, row)
this.checkedId1 = [this.roleForm.orgSid]
},
delRow(row) {
this.$confirm('确定要删除该权限组吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
req.deleteBySid(row.sid).then(res => {
this.getList()
this.$message({
type: 'success',
message: '删除成功!'
});
})
})
},
//
save() {
if (this.roleForm.purviewManageName == '') {
this.$message({
message: '权限组名称不能为空',
type: 'warning'
})
return
}
if (this.roleForm.purviewManageCode == '') {
this.$message({
message: '权限组编码不能为空',
type: 'warning'
})
return
}
req.savePurviewManage(this.roleForm).then(res => {
if (res.code == '200') {
this.getList()
this.reset()
this.editDialog = false
this.$message({
message: res.msg,
type: 'success'
})
}
})
},
reset() {
this.roleForm = {
sid: "",
purviewManageName: "",
purviewManageCode: '',
remarks: '',
};
this.page = {
total: 0, //
current: 1, //
size: 10, //
search: {
name: '',
},
}
},
}
};
</script>
<style>
<style scoped>
.el-select>.el-input {
display: block;
width: 300px;
}
/deep/ .tab-header .el-select {
width: 180px;
}
.my-tabs {
margin-top: 10px;
}
</style>

232
src/views/system/resourcesManage/resourcesManage.vue

@ -1,8 +1,238 @@
<template>
<el-tabs class="my-tabs" v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="资源列表" name="roleList">
<div class="container">
<div class="tab-header">
<el-form ref="form" :inline="true" :model="page" label-width="80px">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="资源名称">
<el-input v-model="page.search.name" clearable></el-input>
</el-form-item>
<el-button @click="getList(1)">查询</el-button>
</el-col>
</el-row>
</el-form>
</div>
<!-- table -->
<el-table :data="roleTable" border style="width: 100%;">
<el-table-column label="序号" width="80px" type="index" align="center">
</el-table-column>
<el-table-column label="操作" width="220px" align="center">
<template slot-scope="scope">
<el-button @click="editRow(scope.row)" type="primary" size="mini"> 修改</el-button>
<el-button @click="delRow(scope.row)" type="danger" size="mini"> 删除</el-button>
</template>
</el-table-column>
<el-table-column prop="resourcesManageName" label="资源名称" align="center"></el-table-column>
<el-table-column prop="resourcesManageCode" label="资源编码" align="center"></el-table-column>
<el-table-column prop="remarks" label="说明" align="center"></el-table-column>
</el-table>
<pagination :total="page.total" :page.sync="page.current" :limit.sync="page.size" @pagination="pagination" />
<!-- 编辑资源信息 -->
<el-dialog :title="dialogTitle + '资源信息'" :visible.sync="editDialog" width="40%">
<table class="e-table" cellspacing="0">
<tr>
<td>资源名称</td>
<td>
<el-input v-model="roleForm.resourcesManageName" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>资源编码</td>
<td>
<el-input v-model="roleForm.resourcesManageCode" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>资源说明</td>
<td>
<el-input v-model="roleForm.remarks" style="width:300px"></el-input>
</td>
</tr>
</table>
<div style="margin-top: 20px; text-align: center;">
<el-button type="primary" @click="save()"> </el-button>
<el-button @click="editDialog = false"> </el-button>
</div>
</el-dialog>
</div>
</el-tab-pane>
<!-- 新增资源信息 -->
<el-tab-pane label="新增资源" name="addrole">
<el-card class="box-card">
<table class="e-table" cellspacing="0">
<tr>
<td>资源名称</td>
<td>
<el-input v-model="roleForm.resourcesManageName" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>资源编码</td>
<td>
<el-input v-model="roleForm.resourcesManageCode" style="width:300px"></el-input>
</td>
</tr>
<tr>
<td>资源说明</td>
<td>
<el-input v-model="roleForm.remarks" style="width:300px"></el-input>
</td>
</tr>
</table>
<div style="margin-top: 20px; text-align: center;">
<el-button type="primary" @click="save()"> </el-button>
</div>
</el-card>
</el-tab-pane>
</el-tabs>
</template>
<script>
import req from '@/api/system/resourcesManage/resourcesManage.js'
export default {
data() {
return {
dialogTitle: '',
activeName: 'roleList',
roleForm: {
sid: "",
resourcesManageName: "",
resourcesManageCode: '',
remarks: '',
},
formBackup: {},
page: {
total: 0, //
current: 1, //
size: 10, //
search: {
name: '',
},
},
roleTable: [],
editDialog: false,
};
},
mounted() {
this.formBackup = Object.assign({}, this.roleForm),
this.getList()
},
methods: {
pagination(val) { //
this.page.current = val.pageNum
this.page.size = val.pageSize
this.getList()
},
//
getList(flag) {
if (flag == '1') {
this.page.current = 1
}
req.listPage(this.page).then(res => {
this.page.total = res.data.total
this.roleTable = res.data.records
})
},
handleClick(tab, event) {
if (tab.name == 'addrole') {
this.dialogTitle = '新增'
this.roleForm = Object.assign({}, this.formBackup)
} else {
this.getList()
}
},
editRow(row) {
this.dialogTitle = '编辑'
this.editDialog = true
console.log(row)
this.roleForm = Object.assign({}, row)
this.checkedId1 = [this.roleForm.orgSid]
},
delRow(row) {
this.$confirm('确定要删除该资源吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
req.deleteBySid(row.sid).then(res => {
this.getList()
this.$message({
type: 'success',
message: '删除成功!'
});
})
})
},
//
save() {
if (this.roleForm.resourcesManageName == '') {
this.$message({
message: '资源名称不能为空',
type: 'warning'
})
return
}
if (this.roleForm.resourcesManageCode == '') {
this.$message({
message: '资源编码不能为空',
type: 'warning'
})
return
}
req.savereSourcesManage(this.roleForm).then(res => {
if (res.code == '200') {
this.getList()
this.reset()
this.editDialog = false
this.$message({
message: res.msg,
type: 'success'
})
}
})
},
reset() {
this.roleForm = {
sid: "",
resourcesManageName: "",
resourcesManageCode: '',
remarks: '',
};
this.page = {
total: 0, //
current: 1, //
size: 10, //
search: {
name: '',
},
}
},
}
};
</script>
<style>
<style scoped>
.el-select>.el-input {
display: block;
width: 300px;
}
/deep/ .tab-header .el-select {
width: 180px;
}
.my-tabs {
margin-top: 10px;
}
</style>

227
src/views/system/unitAuthorizeManage/unitAuthorizeManage.vue

@ -1,8 +1,231 @@
<template>
<div class="app-container">
<div v-show="viewState == 1">
<button-bar ref="btnbar" view-title="单位授权管理" :btndisabled="btndisabled" @btnhandle="btnHandle" />
<div class="main-content">
<div class="searchcon">
<el-button size="small" class="searchbtn" @click="clicksearchShow">
{{ searchxianshitit }}
</el-button>
<div v-show="isSearchShow" class="search">
<el-form :inline="true" class="tab-header">
<el-form-item label="单位名称">
<el-input v-model="queryParams.params.unitName" placeholder="" clearable />
</el-form-item>
<el-form-item label="联系人">
<el-input v-model="queryParams.params.contacts" placeholder="" clearable />
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="queryParams.params.contactNumber" placeholder="" clearable />
</el-form-item>
<el-form-item label="注册日期">
<el-date-picker v-model="queryParams.params.createDateStart" type="date" placeholder="选择日期"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 200px;">
</el-date-picker>
<el-date-picker v-model="queryParams.params.createDateEnd" type="date" placeholder="选择日期"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 200px;">
</el-date-picker>
</el-form-item>
</el-form>
<div class="btn" style="text-align: center;">
<el-button type="primary" size="small" icon="el-icon-search" @click="dosearch">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</div>
</div>
</div>
<!-- Start 项目列表头部 -->
<div class="listtop">
<div class="tit">单位列表</div>
</div>
<!-- End 项目列表头部 -->
<!-- Start 项目列表 -->
<div class="">
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%">
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center" />
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="toRelevancy(scope.row)">授权</el-button>
</template>
</el-table-column>
<el-table-column prop="unitName" label="单位名称" align="center" />
<el-table-column prop="unitAddress" label="单位地址" align="center" />
<el-table-column prop="contacts" label="联系人" align="center" />
<el-table-column prop="contactNumber" label="联系电话" align="center" />
<el-table-column prop="registerDate" label="注册日期" align="center" />
<el-table-column prop="purviews" label="权限组" align="center" />
</el-table>
</div>
<!-- End 项目列表 -->
<div class="pages">
<div class="tit" />
<!-- 翻页 -->
<pagination v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current"
:limit.sync="queryParams.size" class="pagination" @pagination="loadList" />
</div>
</div>
</div>
<!-- 权限组设置 -->
<el-dialog title="权限授权" :visible.sync="roleDialog" width="20%">
<el-form :model="roleForm" ref="roleForm">
<el-form-item label="权限组" label-width="100">
<el-select v-model="roleForm.roleSid" placeholder="请选择" filterable multiple>
<el-option v-for="(item,i) in roleList" :key="i" :label="item.purviewManageName"
:value="item.sid"></el-option>
</el-select>
<!--<el-button type="primary" size='mini' @click="toNav('RoleAdminister')" style="margin-left: 10px;" circle icon="el-icon-plus"></el-button>-->
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveRole('roleForm')"> </el-button>
<el-button @click="closeDialog"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
</script>
import req from '@/api/system/unitAuthorizeManage/unitAuthorizeManage.js'
import req2 from '@/api/system/purviewManage/purviewManage.js'
import ButtonBar from '@/components/ButtonBar'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
export default {
components: {
ButtonBar,
Pagination,
pageye,
},
data() {
return {
btndisabled: false,
viewState: 1, // 1 2 3 4
isSearchShow: false,
searchxianshitit: '显示查询条件',
tableLoading: false,
dataList: [],
btnList: [{
type: 'info',
size: 'small',
icon: 'cross',
btnKey: 'doClose',
btnLabel: '关闭'
}],
queryParams: {
current: 1,
size: 10,
total: 0,
params: {
name: ''
}
},
roleDialog: false,
roleForm: {
roleSid: [],
unitSid: ''
},
roleList: []
}
},
mounted() {
this.$refs['btnbar'].setButtonList(this.btnList)
},
created() {
this.loadList()
this.init()
},
methods: {
init() {
req2.getPurviewManageListAll().then(res => {
this.roleList = res.data
})
},
//
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
if (this.isSearchShow) {
this.searchxianshitit = '隐藏查询条件'
} else {
this.searchxianshitit = '显示查询条件'
}
},
btnHandle(btnKey) {
switch (btnKey) {
case 'doClose':
this.doClose()
break
default:
break
}
},
loadList() {
this.tableLoading = true
req.listPage(this.queryParams).then((resp) => {
this.tableLoading = false
if (resp.success) {
const data = resp.data
this.queryParams.total = data.total
this.dataList = data.records
} else {
// resp.code
this.dataList = []
this.queryParams.total = 0
}
}).catch(() => {
this.tableLoading = false
})
},
//
indexMethod(index) {
var pagestart = (this.queryParams.current - 1) * this.queryParams.size
var pageindex = index + 1 + pagestart
return pageindex
},
dosearch() {
this.queryParams.current = 1
this.loadList()
},
resetQuery() {
this.queryParams = {
current: 1,
size: 10,
total: 0,
params: {
name: ''
}
}
this.loadList()
},
toRelevancy(row) {
this.roleDialog = true
this.roleForm.unitSid = row.sid
this.roleForm.roleSid = row.purviewsList
<style>
},
saveRole() {
console.log("saveRole", this.roleForm);
req.savePurviewManage(this.roleForm).then(res => {
this.loadList()
this.closeDialog()
})
},
closeDialog() {
this.roleDialog = false
this.roleForm = {
roleSid: [],
unitSid: ''
}
}
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save