Commit 8ec19b30 by 杨北旺

角色管理部分

1 parent e0c891ce
......@@ -5126,7 +5126,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -5550,7 +5551,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -5606,6 +5608,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -5649,12 +5652,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......
const staticRoutes = Object.freeze([
{
const staticRoutes = Object.freeze([{
name: 'home',
path: '/',
meta: {},
component: resolve => require([`@/views/home/index.vue`], resolve)
}
},
{
name: 'role',
path: '/role/index/index',
component: resolve => require([`@/views/role/index/index.vue`], resolve),
meta: {}
},
{
name: 'role',
path: '/role/create/index',
component: resolve => require([`@/views/role/create/index.vue`], resolve),
meta: {}
},
])
export default staticRoutes
\ No newline at end of file
<template>
<div class="role-create-page">
<div class="top_title_widget">
<span class="title">新增角色</span>
</div>
<div class="main_widget">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="所属商户" prop="merchantName">
<el-select style="width: 40%" v-model="ruleForm.merchantName" placeholder="请选择所属商户">
<el-option label="区域一" value="1"></el-option>
<el-option label="区域二" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="角色名称" prop="roleName">
<el-input style="width: 40%" v-model="ruleForm.roleName"></el-input>
</el-form-item>
<el-form-item label="角色说明" prop="roleDesc">
<el-input style="width: 40%" v-model="ruleForm.roleDesc"></el-input>
</el-form-item>
<el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element">
<div class="root_wrap">
<div class="root_name">引流渠道商</div>
<div class="root_icon">
<i class="show-icon el-icon-check"></i>
</div>
</div>
</div>
</el-form-item>
</el-form>
<div class="new_wrap">
<div class="root_menu_line">
<div v-for="(item, index) in rootList" :key="index" class="menu_item" :class="curRootIndex == index ? 'menu_item_active' : ''" @click="selectRootItem(index)">
{{ item }}
</div>
</div>
</div>
<div class="product_line_wrap">
<div class="label_title">选择产品</div>
<div class="product_con">
<el-checkbox v-for="(item, index) in productList" :key="index" v-model="checked">
<div class="check_text">备选项备选项备选项备选项备选项备选项备选项</div>
</el-checkbox>
</div>
</div>
<div class="product_root_wrap">
<div class="label_title">请选择产品权限</div>
</div>
<div class="product_root_content_wrap">
<div class="content_menu_line">
<div v-for="(item, index) in storeList"
:key="index" class="menu_line_item"
:class="curMenuIndex==index?'menu_line_item_active':''"
@click="selectMenuItem(index)"
>{{ item }}</div>
</div>
<div class="content_menu_con"></div>
</div>
</div>
<div style="height: 84px"></div>
<div class="fixed_bottom">
<el-button type="primary">草稿</el-button>
<div class="wrap_driver">
<el-button type="primary">确定</el-button>
</div>
<el-button type="primary">取消</el-button>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
ruleForm: {
merchantName: '',
roleName: '',
roleDesc: '',
roleRoot: ''
},
rules: {
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
merchantName: [{ required: true, message: '请选择所属商户', trigger: 'change' }],
roleRoot: [{ required: true, message: '请选择角色权限', trigger: 'change' }]
},
rootList: ['引流渠道商', '引流渠道商', '引流渠道商'],
curRootIndex: 0,
productList: [1, 2, 3],
storeList: ['门店1', '门店2', '门店3', '门店4'],
curMenuIndex:0
}
},
methods: {
selectRootItem(index) {
this.curRootIndex = index
},
selectMenuItem(index){
this.curMenuIndex = index
},
}
}
</script>
<style lang="scss" scoped>
.role-create-page {
height: 100%;
width: 100%;
background: #ffffff;
}
.top_title_widget {
width: 100%;
height: 58px;
box-sizing: border-box;
padding: 0 20px;
border-bottom: 1px solid #d8d8d8;
display: flex;
align-items: center;
.title {
font-size: 16px;
font-weight: 500;
color: #424242;
}
}
.main_widget {
box-sizing: border-box;
padding-top: 32px;
background: #ffffff;
}
.new_wrap {
box-sizing: border-box;
width: 100%;
padding: 0 22px;
}
.root_menu_line {
height: 36px;
background: #f4f6fc;
border-radius: 4px;
display: flex;
align-items: center;
.menu_item {
width: 180px;
height: 32px;
text-align: center;
line-height: 32px;
color: #333333;
font-size: 14px;
margin-right: 2px;
background: #f4f6fc;
cursor: pointer;
border-radius: 2px;
}
.menu_item_active {
color: #5850ff;
background: #ffffff;
}
}
.product_line_wrap {
margin-top: 25px;
display: flex;
align-items: center;
.label_title {
box-sizing: border-box;
width: 100px;
font-size: 14px;
font-weight: 500;
color: #333333;
text-align: right;
padding: 0 12px 0 0;
}
.product_con {
display: flex;
align-items: center;
/deep/ .el-checkbox {
display: flex;
align-items: center;
}
.check_text {
width: 140px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
.product_root_wrap {
margin-top: 30px;
.label_title {
font-size: 14px;
font-weight: 500;
color: #333333;
padding-left: 30px;
}
}
.product_root_content_wrap {
// width: 100%;
box-sizing: border-box;
background: #f4f6fc;
border-radius: 4px;
margin: 0 20px;
margin-top: 10px;
.content_menu_line {
height: 50px;
width: 100%;
box-sizing: border-box;
padding-top: 10px;
display: flex;
.menu_line_item {
width: 112px;
height: 40px;
text-align: center;
line-height: 40px;
color: #666666;
font-size: 14px;
border-radius: 4px 4px 0px 0px;
cursor: pointer;
}
.menu_line_item_active {
color: #322AD9;
background: #ffffff;
}
}
.content_menu_con{
height: 100%;
}
}
.fixed_bottom {
position: fixed;
left: 0;
right: 0;
bottom: 0;
// width: calc(100% - 60px);
width: 100%;
height: 64px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
.wrap_driver {
margin: 0 40px;
}
}
// 角色权限按钮样式
.custom_element {
display: flex;
align-items: center;
height: 40px;
}
.root_wrap {
display: flex;
min-width: 80px;
.root_name {
padding: 0 16px;
height: 30px;
border-radius: 4px 0 0 4px;
font-size: 14px;
font-weight: 400;
color: #ffffff;
line-height: 30px;
background: #d2d2d2;
cursor: pointer;
border: 1px solid #d2d2d2;
}
.root_icon {
width: 30px;
height: 30px;
border: 1px solid #d2d2d2;
border-left: none;
border-radius: 0 4px 4px 0;
cursor: pointer;
}
.show-icon {
display: none;
}
}
.root_wrap:hover > .root_name {
background: #999999;
border: 1px solid #999999;
}
.root_wrap:hover > .root_icon > .show-icon {
display: block;
text-align: center;
line-height: 30px;
font-size: 20px;
color: #d2d2d2;
}
</style>
<template>
<div class="role-home-page">
<div class="top_widget">
<el-button size="small" icon="el-icon-plus" type="primary">创建角色</el-button>
<div class="top_select">
<span class="select_label">商户名称</span>
<el-select size="small" v-model="merchantName" placeholder="请选择">
<el-option v-for="item in merchantList" :key="item.id" :label="item.merchantName" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div style="height: 20px"></div>
<div class="table_widget">
<el-form :inline="true" :model="searchForm" class="follow-form-item">
<el-form-item label="状态">
<el-select size="small" v-model="searchForm.status" placeholder="请选择">
<el-option v-for="item in optionData" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="角色名称">
<el-input size="small" v-model="searchForm.name" clearable placeholder="请输入"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small">查询</el-button>
</el-form-item>
</el-form>
<GLTable ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams">
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text">查看</el-button>
<el-button type="text">修改</el-button>
</template>
</GLTable>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
searchForm: {
status: '',
name: ''
},
merchantName:'',
optionData: [
{
value: '',
label: '全部'
},
{
value: '1',
label: '草稿'
},
{
value: '2',
label: '启用'
}
],
//表格配置
layout: 'sizes, prev, pager, next, jumper, ->, total',
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableParams: {
tableOption: true,
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '角色名称',
prop: 'roleName'
},
{
label: '角色号',
prop: 'roleCode'
},
{
label: '状态',
prop: 'statusName'
},
{
label: '创建时间',
prop: 'createdTime'
},
{
label: '更新时间',
prop: 'updatedTime',
formatter: val => {
if (!val.updatedTime) {
return '--'
} else {
return val.updatedTime
}
}
}
]
},
tableData: [],
tableTotal: 0,
//商户名称
merchantList: []
}
},
mounted() {
this.getMerchangName()
this.getTableData()
},
methods: {
// 获取表格数据
getTableData() {
let data = [
{
id: 388,
roleName: 'ddd',
roleCode: 'ROLE1634644163409687',
roleDescription: '',
merchantId: 40168,
merchantName: '广联嘀加平台超级管理员(44184606)',
createdBy: null,
delFlag: 0,
statusName: '正常',
createdTime: '2021-10-19 19:49:23',
updatedBy: null,
updatedTime: '2021-10-19 19:49:23',
createdAccount: null,
updatedAccount: null,
responseList: null
},
{
id: 383,
roleName: 'dasf',
roleCode: 'ROLE1634628185568777',
roleDescription: 'adsfa',
merchantId: 40168,
merchantName: '广联嘀加平台超级管理员(44184606)',
createdBy: null,
delFlag: 0,
statusName: '正常',
createdTime: '2021-10-19 15:23:05',
updatedBy: null,
updatedTime: '2021-10-19 15:23:05',
createdAccount: null,
updatedAccount: null,
responseList: null
},
{
id: 324,
roleName: '工厂角色',
roleCode: 'ROLE1000012649',
roleDescription: '超级管理员创建的角色,分配给工厂',
merchantId: 40168,
merchantName: '广联嘀加平台超级管理员(44184606)',
createdBy: null,
delFlag: 0,
statusName: '正常',
createdTime: '2021-10-15 10:29:12',
updatedBy: null,
updatedTime: null,
createdAccount: 'DJZX',
updatedAccount: null,
responseList: null
}
]
this.tableData = data
this.$nextTick(() => {
this.$refs.table.setTableHeightFun()
})
},
// 获取商户名称
getMerchangName() {
let data = [
{
id: 40168,
merchantName: '广联嘀加平台超级管理员'
}
]
this.merchantList = data
}
}
}
</script>
<style lang="scss" scoped>
.role-home-page {
box-sizing: border-box;
display: flex;
flex-direction: column;
height: 100%;
}
.top_widget {
width: 100%;
height: 78px;
display: flex;
align-items: center;
justify-content: space-between;
background: #ffffff;
box-sizing: border-box;
padding: 0 20px;
.top_select {
display: flex;
align-items: center;
.select_label {
font-size: 14px;
font-weight: 400;
color: #333333;
margin-right: 10px;
}
}
}
.table_widget {
width: 100%;
height: calc(100% - 138px);
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
padding: 20px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!