|
@@ -1,261 +1,127 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">
|
|
|
- <el-form-item label="角色名称" prop="roleName">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.roleName"
|
|
|
- placeholder="请输入角色名称"css选择器 同时拥有两个类名
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- style="width: 240px"
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="权限字符" prop="roleKey">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.roleKey"
|
|
|
- placeholder="请输入权限字符"
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- style="width: 240px"
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="状态" prop="status">
|
|
|
- <el-select
|
|
|
- v-model="queryParams.status"
|
|
|
- placeholder="角色状态"
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- style="width: 240px"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="dict in statusOptions"
|
|
|
- :key="dict.dictValue"
|
|
|
- :label="dict.dictLabel"
|
|
|
- :value="dict.dictValue"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="创建时间">
|
|
|
- <el-date-picker
|
|
|
- v-model="dateRange"
|
|
|
- size="small"
|
|
|
- style="width: 240px"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- type="daterange"
|
|
|
- range-separator="-"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
- ></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAdd"
|
|
|
- v-hasPermi="['system:role:add']"
|
|
|
- >新增</el-button>
|
|
|
+ <el-row class="roleBox">
|
|
|
+ <el-col :span="24" class="roleCol">
|
|
|
+ <div class="roleH"></div>
|
|
|
+ <span>功能权限</span>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- plain
|
|
|
- icon="el-icon-edit"
|
|
|
- size="mini"
|
|
|
- :disabled="single"
|
|
|
- @click="handleUpdate"
|
|
|
- v-hasPermi="['system:role:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ <el-col :span="24" class="roleBot">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <div class="roleBtn" style="background-color: #2AC1CA;">
|
|
|
+ <img src="@/assets/images/icon_btn_xz@2x.png" alt="" class="icon">
|
|
|
+ <span>新增</span>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <div class="roleBtn" style="background-color: #FF9639;">
|
|
|
+ <img src="@/assets/images/icon_btn_sx@2x.png" alt="" class="icon">
|
|
|
+ <span>刷新</span>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <div class="roleBtn" style="background-color: #3C8DBC;">
|
|
|
+ <img src="@/assets/images/icon_btn_bc@2x.png" alt="" class="icon">
|
|
|
+ <span>保存</span>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- icon="el-icon-delete"
|
|
|
- size="mini"
|
|
|
- :disabled="multiple"
|
|
|
- @click="handleDelete"
|
|
|
- v-hasPermi="['system:role:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-top: 18px;">
|
|
|
+ <el-col :span = "5" class="searBoxs">
|
|
|
+ <div class="searBox">
|
|
|
+ <div class="searInput">
|
|
|
+ <input type="text" placeholder="请输入角色">
|
|
|
+ </div>
|
|
|
+ <div class="searBtn">
|
|
|
+ <img src="@/assets/images/icon_sr_ss@2x.png" alt="" class="icon">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="searList">
|
|
|
+ <div class="searItem" v-for="item in 15" @click="indexs = item" :class="{'active': item==indexs}">
|
|
|
+ 用户角色
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="warning"
|
|
|
- plain
|
|
|
- icon="el-icon-download"
|
|
|
- size="mini"
|
|
|
- @click="handleExport"
|
|
|
- v-hasPermi="['system:role:export']"
|
|
|
- >导出</el-button>
|
|
|
+ <el-col :span = "19" class="roleContr">
|
|
|
+ <div class="roleContrBox">
|
|
|
+ <el-col :span = "7">
|
|
|
+ <div class="searContLeft">
|
|
|
+ <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="17">
|
|
|
+ <div class="searContRight">
|
|
|
+ <div class="searTitle">
|
|
|
+ <div class="searName">
|
|
|
+ 功能
|
|
|
+ </div>
|
|
|
+ <div class="searItem" v-for="item in 8">
|
|
|
+ <el-checkbox :label="'新增'+item"></el-checkbox>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="searCont" v-for="items in 12" @click="searIndex = item" :class="{'active': searIndex == item}">
|
|
|
+ <div class="searName">
|
|
|
+ 功能功能{{items}}
|
|
|
+ </div>
|
|
|
+ <div class="searItem" v-for="item in 8">
|
|
|
+ <el-checkbox></el-checkbox>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
-
|
|
|
- <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="角色编号" prop="id" width="120" />
|
|
|
- <el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
|
|
|
- <el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
|
|
|
- <el-table-column label="显示顺序" prop="roleSort" width="100" />
|
|
|
- <el-table-column label="状态" align="center" width="100">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-switch
|
|
|
- v-model="scope.row.status"
|
|
|
- active-value="0"
|
|
|
- inactive-value="1"
|
|
|
- @change="handleStatusChange(scope.row)"
|
|
|
- ></el-switch>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
- v-hasPermi="['system:role:edit']"
|
|
|
- >修改</el-button>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-circle-check"
|
|
|
- @click="handleDataScope(scope.row)"
|
|
|
- v-hasPermi="['system:role:edit']"
|
|
|
- >数据权限</el-button>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
- v-hasPermi="['system:role:remove']"
|
|
|
- >删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination
|
|
|
- v-show="total>0"
|
|
|
- :total="total"
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
-
|
|
|
- <!-- 添加或修改角色配置对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="角色名称" prop="roleName">
|
|
|
- <el-input v-model="form.roleName" placeholder="请输入角色名称" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="权限字符" prop="roleKey">
|
|
|
- <el-input v-model="form.roleKey" placeholder="请输入权限字符" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="角色顺序" prop="roleSort">
|
|
|
- <el-input-number v-model="form.roleSort" controls-position="right" :min="0" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="状态">
|
|
|
- <el-radio-group v-model="form.status">
|
|
|
- <el-radio
|
|
|
- v-for="dict in statusOptions"
|
|
|
- :key="dict.dictValue"
|
|
|
- :label="dict.dictValue"
|
|
|
- >{{dict.dictLabel}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="菜单权限">
|
|
|
- <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
|
|
- <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
|
|
|
- <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>
|
|
|
- <el-tree
|
|
|
- class="tree-border"
|
|
|
- :data="menuOptions"
|
|
|
- show-checkbox
|
|
|
- ref="menu"
|
|
|
- node-key="id"
|
|
|
- :check-strictly="!form.menuCheckStrictly"
|
|
|
- empty-text="加载中,请稍后"
|
|
|
- :props="defaultProps"
|
|
|
- ></el-tree>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="备注">
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <!-- 分配角色数据权限对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="openDataScope" width="500px" append-to-body>
|
|
|
- <el-form :model="form" label-width="80px">
|
|
|
- <el-form-item label="角色名称">
|
|
|
- <el-input v-model="form.roleName" :disabled="true" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="权限字符">
|
|
|
- <el-input v-model="form.roleKey" :disabled="true" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="权限范围">
|
|
|
- <el-select v-model="form.dataScope" @change="dataScopeSelectChange">
|
|
|
- <el-option
|
|
|
- v-for="item in dataScopeOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="数据权限" v-show="form.dataScope == 2">
|
|
|
- <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">展开/折叠</el-checkbox>
|
|
|
- <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox>
|
|
|
- <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动</el-checkbox>
|
|
|
- <el-tree
|
|
|
- class="tree-border"
|
|
|
- :data="deptOptions"
|
|
|
- show-checkbox
|
|
|
- default-expand-all
|
|
|
- ref="dept"
|
|
|
- node-key="id"
|
|
|
- :check-strictly="!form.deptCheckStrictly"
|
|
|
- empty-text="加载中,请稍后"
|
|
|
- :props="defaultProps"
|
|
|
- ></el-tree>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitDataScope">确 定</el-button>
|
|
|
- <el-button @click="cancelDataScope">取 消</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role";
|
|
|
-import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
|
|
|
-import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
|
|
|
|
|
|
export default {
|
|
|
name: "Role",
|
|
|
data() {
|
|
|
return {
|
|
|
+ searIndex: '',
|
|
|
+ data: [{
|
|
|
+ label: '一级 1',
|
|
|
+ children: [{
|
|
|
+ label: '二级 1-1',
|
|
|
+ children: [{
|
|
|
+ label: '三级 1-1-1'
|
|
|
+ }]
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ label: '一级 2',
|
|
|
+ children: [{
|
|
|
+ label: '二级 2-1',
|
|
|
+ children: [{
|
|
|
+ label: '三级 2-1-1'
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ label: '二级 2-2',
|
|
|
+ children: [{
|
|
|
+ label: '三级 2-2-1'
|
|
|
+ }]
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ label: '一级 3',
|
|
|
+ children: [{
|
|
|
+ label: '二级 3-1',
|
|
|
+ children: [{
|
|
|
+ label: '三级 3-1-1'
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ label: '二级 3-2',
|
|
|
+ children: [{
|
|
|
+ label: '三级 3-2-1'
|
|
|
+ }]
|
|
|
+ }]
|
|
|
+ }],
|
|
|
+ defaultProps: {
|
|
|
+ children: 'children',
|
|
|
+ label: 'label'
|
|
|
+ },
|
|
|
+ indexs: 3,
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
// 选中数组
|
|
@@ -601,3 +467,161 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .roleContrBox{
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 6px;
|
|
|
+ overflow: hidden;
|
|
|
+ padding: 23px 0;
|
|
|
+ }
|
|
|
+ .roleContr{
|
|
|
+ padding-left: 17px;
|
|
|
+
|
|
|
+ .searContLeft{
|
|
|
+ padding: 23px 17px 23px 23px;
|
|
|
+ border-right: 2px solid #E5E5E5;
|
|
|
+ }
|
|
|
+ .searContRight{
|
|
|
+ padding-left: 18px;
|
|
|
+ .searTitle{
|
|
|
+ display: flex;
|
|
|
+ padding-left: 11px;
|
|
|
+ margin-bottom: 26px;
|
|
|
+ .searName{
|
|
|
+ color: #343434;
|
|
|
+ font-size: 12px;
|
|
|
+ width: 156px;
|
|
|
+ }
|
|
|
+ .searItem{
|
|
|
+ flex: 1;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .searCont{
|
|
|
+ display: flex;
|
|
|
+ height: 23px;
|
|
|
+ padding-left: 11px;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ .searName{
|
|
|
+ color: #343434;
|
|
|
+ font-size: 12px;
|
|
|
+ width: 156px;
|
|
|
+ }
|
|
|
+ .searItem{
|
|
|
+ flex: 1;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ &:hover{
|
|
|
+ background-color: rgba(0,0,0,.1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ background-color: #CADBE4;
|
|
|
+ .searName{
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .searBoxs{
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 6px;
|
|
|
+ padding: 23px;
|
|
|
+ .searBox{
|
|
|
+ display: flex;
|
|
|
+ .searInput{
|
|
|
+ flex: 1;
|
|
|
+ height: 32px;
|
|
|
+ margin-right: 8px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ input{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background-color: #F7F6F6;
|
|
|
+ border: none;
|
|
|
+ padding: 0 7px;
|
|
|
+ outline: none;
|
|
|
+ &::placeholder{
|
|
|
+ color: #AAAAAA;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .searBtn{
|
|
|
+ width: 30px;
|
|
|
+ height: 32px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ background-color: #3C8DBC;
|
|
|
+ .icon{
|
|
|
+ width: 18px;
|
|
|
+ height: 17px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .searList{
|
|
|
+ padding: 10px 0;
|
|
|
+ .searItem{
|
|
|
+ padding: 0 8px;
|
|
|
+ line-height: 30px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #343434;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ background-color: #CADBE4;
|
|
|
+ color: #3C8DBC;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .app-container{
|
|
|
+ background-color: #EFF0FF;
|
|
|
+ min-height: calc(100vh - 60px);
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .roleBox{
|
|
|
+ padding: 0 23px;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 6px;
|
|
|
+ .roleCol{
|
|
|
+ padding: 20px 0;
|
|
|
+ border-bottom: 1px solid #E5E5E5;
|
|
|
+ .roleH{
|
|
|
+ width: 18px;
|
|
|
+ height: 8px;
|
|
|
+ border-radius: 4px;
|
|
|
+ background-color: #3C8DBC;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ }
|
|
|
+ span{
|
|
|
+ font-size: 15px;
|
|
|
+ color: #3C8DBC;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .roleBot{
|
|
|
+ padding: 22px 0;
|
|
|
+ .roleBtn{
|
|
|
+ height: 32px;
|
|
|
+ display: flex;
|
|
|
+ border-radius: 3px;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 83px;
|
|
|
+ margin-right: 18px;
|
|
|
+ .icon{
|
|
|
+ width: 14px;
|
|
|
+ height: 14px;
|
|
|
+ margin-right: 7px;
|
|
|
+ }
|
|
|
+ span{
|
|
|
+ color: #fff;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|