You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
3.4 KiB
Vue
128 lines
3.4 KiB
Vue
<!--
|
|
* @description:
|
|
* @fileName: AuthorityManagement
|
|
* @author: 17076
|
|
* @date: 2024/6/14-下午2:13
|
|
* @version: V1.0.0
|
|
-->
|
|
|
|
<template>
|
|
<div class="auth-content">
|
|
<cs-search :data="searchData" :span="8" direction="row" @getData="onSearch" />
|
|
<div class="content-info">
|
|
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="handleAdd">新增</el-button>
|
|
<vxe-grid v-bind="gridOptions" style="margin-top: 20px">
|
|
<template #operate="{row}">
|
|
<!-- <el-button type="text" @click="handleDetails(row)">详情</el-button> -->
|
|
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
|
<el-button type="text" style="color: red" @click="handleDel(row)">删除</el-button>
|
|
</template>
|
|
</vxe-grid>
|
|
<div style="text-align: center">
|
|
<cs-page
|
|
:page.sync="queryForm.page"
|
|
:limit.sync="queryForm.size"
|
|
:total="queryForm.total"
|
|
@pagination="fetchData"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<!--角色编辑-->
|
|
<edit-authority ref="edit" @reloadData="fetchData" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import mixin from '@/views/mixin'
|
|
import EditAuthority from '@/views/system/accountManagement/components/EditAuthority.vue'
|
|
import { getRoleList, deleteRole } from '@/api/system/user.js'
|
|
export default {
|
|
name: 'AuthorityManagement',
|
|
components: { EditAuthority },
|
|
mixins: [mixin],
|
|
data() {
|
|
return {
|
|
searchData: [
|
|
{ label: '角色', model: 'roleName', type: 'input' }
|
|
],
|
|
gridOptions: {
|
|
...mixin.data().gridOptions,
|
|
columns: [
|
|
{ title: '序号', type: 'seq', width: 80 },
|
|
{ title: '角色', field: 'roleName' },
|
|
{ title: '关联用户数', field: 'userCount' },
|
|
{ title: '说明', field: 'remark' },
|
|
{ title: '注册时间', field: 'updateTime', sortable: true },
|
|
{ title: '操作', slots: { default: 'operate' }, fixed: 'right', width: '150px' }
|
|
],
|
|
data: [
|
|
|
|
]
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
this.tableHeight(400)
|
|
},
|
|
methods: {
|
|
// 获取数据
|
|
fetchData() {
|
|
getRoleList({
|
|
roleName: this.searchFormData.roleName,
|
|
pageNumber: this.queryForm.page,
|
|
pageSize: this.queryForm.size
|
|
}).then(res => {
|
|
this.gridOptions.data = res.data.records
|
|
this.queryForm.total = res.data.total
|
|
})
|
|
},
|
|
// 新增
|
|
handleAdd() {
|
|
this.$refs.edit.show()
|
|
},
|
|
// 详情
|
|
handleDetails(row) {
|
|
this.$refs.edit.show(row, false)
|
|
},
|
|
// 编辑
|
|
handleEdit(row) {
|
|
this.$refs.edit.show(row, true)
|
|
},
|
|
// 删除
|
|
handleDel(row) {
|
|
this.$baseConfirm('确定要删除吗?', null, async() => {
|
|
const { code, msg } = await deleteRole({ id: row.id })
|
|
code === 200 ? this.$baseMessage.success(msg || '删除成功!') : this.$baseMessage.error(msg || '删除失败!')
|
|
this.fetchData()
|
|
})
|
|
},
|
|
// 搜索
|
|
onSearch(data, callback) {
|
|
this.searchFormData = Object.assign({}, data)
|
|
this.queryForm.page = 1
|
|
this.fetchData()
|
|
if (callback) callback(true)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.auth-content {
|
|
height: 100%;
|
|
.content-info {
|
|
margin-top: 10px;
|
|
border: 1px solid #EAEAEA;
|
|
border-radius: 8px;
|
|
padding: 15px;
|
|
box-sizing: border-box;
|
|
}
|
|
}
|
|
::v-deep {
|
|
.header-blue {
|
|
background: #F2F6FA;
|
|
}
|
|
}
|
|
</style>
|