Commit 77879666 authored by Mac's avatar Mac
parents f65503ff 100391c8
......@@ -184,3 +184,26 @@ export function setRoleStatus(data) {
data
})
}
/**
* 获取角色菜单和功能权限
* @param {JSON对象} data
*/
export function GetRolePermission(data) {
return request({
url: '/Public/GetRolePermission',
method: 'post',
data
})
}
/**
* 保存角色权限
*/
export function SetRolePermission(data) {
return request({
url: '/Public/SetRolePermission',
method: 'post',
data
})
}
......@@ -16,12 +16,6 @@
title="注意:关闭后,角色将无法正常使用." />
</div>
</div>
<div class="text-caption q-mb-lg q-px-md text-grey-6">权限设置</div>
<div class="row wrap">
<selectTree v-if="TreeMenuList&&TreeMenuList.length>0" :treeData='TreeMenuList' :defaultArray="returnString"
nodeKey="MenuId" :multiple="true" labelKey="MenuName" childrenKey="SubList" tipText="选择菜单"
@getChild="getChild" classStr="col-6 q-pr-lg q-pb-lg"></selectTree>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
......@@ -35,7 +29,6 @@
<script>
import {
queryTreeMenu,
queryRoleInfo,
saveRoleInfo,
} from '../../api/system/index'
......@@ -57,7 +50,6 @@
RoleId: 0, //角色编号
RoleName: "", //角色名称
RoleIntro: "", //角色介绍
RoleAuth: "", //角色权限
Status: 0, //状态(0-正常,1-禁用)},
},
returnString: [],
......@@ -70,25 +62,9 @@
}
},
mounted() {
this.queryMenuList();
this.initObj()
},
methods: {
getChild(menuArray) {
var tempStr = "";
if (menuArray && menuArray != '') {
tempStr = menuArray;
}
this.objOption.RoleAuth = tempStr;
},
//获取菜单列表
queryMenuList() {
this.TreeMenuList = [];
var qMsg = {}
queryTreeMenu(qMsg).then(res => {
this.TreeMenuList = res.Data;
})
},
//初始化表单
initObj() {
this.returnString = [];
......@@ -99,7 +75,6 @@
this.objOption.RoleId = res.Data.RoleId;
this.objOption.RoleName = res.Data.RoleName;
this.objOption.RoleIntro = res.Data.RoleIntro;
this.objOption.RoleAuth = res.Data.RoleAuth;
this.objOption.Status = res.Data.Status;
this.returnString = res.Data.CheckMenuList;
})
......@@ -109,7 +84,6 @@
this.objOption.RoleId = 0;
this.objOption.RoleName = "";
this.objOption.RoleIntro = "";
this.objOption.RoleAuth = "";
this.objOption.Status = 0;
}
},
......
......@@ -87,7 +87,7 @@
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.Remark"
class="col-6 q-pb-lg q-pr-lg" label="校区备注" />
<selectTree v-if="DeptList&&DeptList.length>0" :treeData='DeptList' :defaultArray="returnString"
nodeKey="DeptId" :multiple="false" labelKey="DeptName" childrenKey="ChildList" tipText="所属部门"
nodeKey="DeptId" :multiple="false" labelKey="DeptName" childrenKey="ChildList" tipText="上级部门"
@getChild="getChild" classStr="col-6 q-pr-lg q-pb-lg"></selectTree>
<div class="col-6">
<q-toggle size="md" label="校区状态" color="primary" :false-value="1" :true-value="0"
......@@ -254,14 +254,14 @@
},
methods: {
filterFn(val, update) {
if (val && val != '') {
update(() => {
update(() => {
if (val === '') {
this.EmployeeList = JSON.parse(JSON.stringify(this.AllemployeeList))
} else {
const needle = val.toLowerCase()
this.EmployeeList = this.AllemployeeList.filter(v => v.EmployeeName.toLowerCase().indexOf(needle) > -1)
})
} else {
this.EmployeeList = JSON.parse(JSON.stringify(this.AllemployeeList));
}
}
})
},
//获取员工列表
getEmployee() {
......@@ -271,9 +271,9 @@
queryEmployee(qMsg).then(res => {
if (res.Code == 1) {
var jsonData = res.Data;
if (jsonData && jsonData > 0) {
this.AllemployeeList = JOSN.parse(JSON.stringify(jsonData));
this.EmployeeList = JOSN.parse(JSON.stringify(jsonData));;
if (jsonData && jsonData.length > 0) {
this.AllemployeeList = JSON.parse(JSON.stringify(jsonData));
this.EmployeeList = JSON.parse(JSON.stringify(jsonData));;
}
}
})
......
......@@ -34,6 +34,9 @@
<q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="EditRole(props.row)" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="设置权限"
@click="gotoSub(props.row)" />
</q-td>
</template>
</q-table>
......@@ -134,6 +137,12 @@
this.getRolelist()
},
methods: {
gotoSub(obj) {
var tempStr = '/system/setroleauth?roleId=' + obj.RoleId;
this.$router.push({
path: tempStr
});
},
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
......
<style scoped>
.commonTable {
width: 100%;
border-collapse: collapse;
}
.commonTable tr th {
background: #E6E6E6;
height: 40px;
font-size: 14px;
color: #333;
border: 1px solid #E6E6E6
}
.commonTable tr {
background: #fff;
text-align: center;
height: 40px;
}
.commonTable tr:nth-child(2n+1) {
background: #fafafa;
}
.commonTable tr td {
font-size: 12px;
border: 1px solid #E5E5E5;
}
</style>
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
</div>
<div class="page-option">
<q-btn color="accent" class="q-mr-md" icon="add" label="保存权限" @click="saveRolePermission" />
</div>
</div>
<div class="page-content">
<span>菜单权限</span>
<table class="commonTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
<tr>
<th style="width:200px;">一级菜单</th>
<th style="width:200px;">二级菜单</th>
<th>三级菜单</th>
</tr>
<template v-for="(item,index) in MenuList">
<template v-for="(subItem,subIndex) in item.SubList">
<tr :key="index+'1'+subIndex">
<td v-if="subIndex==0" :rowspan="item.SubList.length">
<el-checkbox v-model="item.IsChecked" :key="index" @change="ChangeItem(item)">{{item.MenuName}}
</el-checkbox>
</td>
<td style="text-align:left;padding-left:5px;">
<el-checkbox v-model="subItem.IsChecked" :key="subIndex"
@change="ChangeItem(subItem);SetParent(subItem,0)">
{{subItem.MenuName}}</el-checkbox>
</td>
<td style="text-align:left;padding-left:5px;">
<template v-for="(childItem,childIndex) in subItem.SubList">
<el-checkbox v-model="childItem.IsChecked" :key="childIndex"
@change="SetParent(childItem,subItem.ParentId)">
{{childItem.MenuName}}</el-checkbox>
</template>
</td>
</tr>
</template>
</template>
</table>
<span>功能权限</span>
<table class="commonTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
<tr>
<th style="width:200px;">一级分类</th>
<th>功能名称</th>
</tr>
<template v-for="(item,index) in ActionList">
<template v-for="(subItem,subIndex) in item.SubList">
<tr :key="index+'1'+subIndex">
<td v-if="subIndex==0" :rowspan="item.SubList.length">
<el-checkbox v-model="item.IsChecked" :key="index" @change="ChangeItem(item)">{{item.CategoryName}}
</el-checkbox>
</td>
<td style="text-align:left;padding-left:5px;">
<el-checkbox v-model="subItem.IsChecked" :key="subIndex"
@change="ChangeItem(subItem);SetParent(subItem,0)">
{{subItem.ActionName}}</el-checkbox>
</td>
</tr>
</template>
</template>
</table>
</div>
</div>
</template>
<script>
import {
GetRolePermission,
SetRolePermission
} from '../../api/system/index'
export default {
meta: {
title: "设置角色权限"
},
components: {
},
data() {
return {
currentUrl: "",
loading: false,
roleId: 0, //角色编号
MenuList: [], //菜单权限
ActionList: [], //功能权限
}
},
mounted() {
this.currentUrl = this.$route.path
if (this.$route.query.roleId) {
this.roleId = this.$route.query.roleId
}
this.queryRolePermission();
},
methods: {
//设置选中
ChangeItem(item) {
if (item.SubList && item.SubList.length > 0) {
item.SubList.forEach(subItem => {
subItem.IsChecked = item.IsChecked;
if (subItem.SubList && subItem.SubList.length > 0) {
subItem.SubList.forEach(childItem => {
childItem.IsChecked = item.IsChecked;
})
}
})
}
},
//设置父项选中
SetParent(pItem, pValue) {
this.MenuList.forEach(item => {
if (item.MenuId == pItem.ParentId && pItem.IsChecked) {
item.IsChecked = pItem.IsChecked
}
if (pValue > 0 && item.MenuId == pValue && pItem.IsChecked) {
item.IsChecked = pItem.IsChecked
}
if (item.SubList && item.SubList.length > 0) {
item.SubList.forEach(subItem => {
if (subItem.MenuId == pItem.ParentId && pItem.IsChecked) {
subItem.IsChecked = pItem.IsChecked
}
if (subItem.SubList && subItem.SubList.length > 0) {
subItem.SubList.forEach(childItem => {
if (childItem.MenuId == pItem.ParentId && pItem.IsChecked) {
childItem.IsChecked = pItem.IsChecked
}
});
}
})
}
})
},
//获取权限
queryRolePermission() {
var qMsg = {
Role_Id: this.roleId
};
GetRolePermission(qMsg).then(res => {
if (res.Code == 1) {
this.MenuList = res.Data.menuList;
this.ActionList = res.Data.functionList;
}
}).catch(() => {
})
},
//保存角色权限
saveRolePermission() {
var tempMenu = [];
var tempAction = [];
if (this.MenuList && this.MenuList.length > 0) {
this.MenuList.forEach(item => {
if (item.IsChecked) {
tempMenu.push({
ID: 0,
Role_Id: this.roleId,
Menu_Id: item.MenuId
});
}
if (item.SubList && item.SubList.length > 0) {
item.SubList.forEach(subItem => {
if (subItem.IsChecked) {
tempMenu.push({
ID: 0,
Role_Id: this.roleId,
Menu_Id: subItem.MenuId
});
}
if (subItem.SubList && subItem.SubList.length > 0) {
subItem.SubList.forEach(childItem => {
if (childItem.IsChecked) {
tempMenu.push({
ID: 0,
Role_Id: this.roleId,
Menu_Id: subItem.MenuId
});
}
});
}
})
}
})
}
if (this.ActionList && this.ActionList.length > 0) {
this.ActionList.forEach(item => {
if (item.SubList && item.SubList.length > 0) {
item.SubList.forEach(subItem => {
if (subItem.IsChecked) {
tempAction.push({
ID: 0,
Role_Id: this.roleId,
Action_Id: item.Action_Id,
ActionName: item.ActionName
});
}
})
}
})
}
var data = {
roleMenu: tempMenu,
roleFunction:tempAction
};
console.log("data",data);
SetRolePermission(data).then(res => {
if (res.Code == 1) {
this
this.queryRolePermission();
}
});
}
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass');
</style>
......@@ -72,6 +72,11 @@ const routes = [{
component: () =>
import("pages/system/role.vue")
},
{
path: "/system/setroleauth", //设置角色权限
component: () =>
import("pages/system/setroleauth.vue")
},
{
path: "/course/catagory", //课程分类
component: () =>
......@@ -95,12 +100,12 @@ const routes = [{
{
path: "/financial/PlatformAccount", //平台账户
component: () =>
import("pages/financial/PlatformAccount.vue")
import("pages/financial/PlatformAccount.vue")
},
{
path: "/financial/CompanyAccount", //银行账户
component: () =>
import("pages/financial/CompanyAccount.vue")
import("pages/financial/CompanyAccount.vue")
},
{
path: "/financial/TeamRevenueReport", //营收报表
......@@ -120,7 +125,7 @@ const routes = [{
{
path: "/financial/AccountType", //账户类型
component: () =>
import("pages/financial/AccountType.vue")
import("pages/financial/AccountType.vue")
},
{
path: "/financial/AccountPageList", //关联账户
......@@ -130,22 +135,22 @@ const routes = [{
{
path: "/financial/CostType", //费用类型
component: () =>
import("pages/financial/CostType.vue")
import("pages/financial/CostType.vue")
},
{
path: "/financial/paySetting", //支付配置管理
component: () =>
import("pages/financial/paySetting.vue")
import("pages/financial/paySetting.vue")
},
{
path: '/financial/HistoryRateQuery', //历史汇率
component: () =>
import("pages/financial/HistoryRateQuery.vue")
import("pages/financial/HistoryRateQuery.vue")
},
{
path: "/financial/Maninfo", //未认款信息
component: () =>
import("pages/financial/Maninfo.vue")
import("pages/financial/Maninfo.vue")
},
{
path: "/financial/Manfunds", //未认款管理
......@@ -168,15 +173,15 @@ const routes = [{
import("pages/financial/sellCommissionRules.vue")
},
{
        path: "/financial/FProcessManagement", //流程管理、
        component: () =>
        import("pages/financial/FProcessManagement.vue")
      },
      {
        path: "/financial/addFinancialProcess", //新增修改等级
        component: () =>
        import("pages/financial/addFinancialProcess.vue")
      },
path: "/financial/FProcessManagement", //流程管理、
component: () =>
import("pages/financial/FProcessManagement.vue")
},
{
path: "/financial/addFinancialProcess", //新增修改等级
component: () =>
import("pages/financial/addFinancialProcess.vue")
},
{
path: "/financial/accountingWork", //会计窗口
component: () =>
......@@ -216,7 +221,7 @@ const routes = [{
path: "/financial/accDetail/CashReport", //现金日报表
component: () =>
import("pages/financial/accDetail/CashReport.vue")
},{
}, {
path: "/financial/accDetail/CashReport", //现金日报表
component: () =>
import("pages/financial/accDetail/CashReport.vue")
......@@ -229,7 +234,7 @@ const routes = [{
{
path: "/financial/financalDocument/addReceivablesDocuments",
component: () =>
import("pages/financial/financalDocument/addReceivablesDocuments.vue")
import("pages/financial/financalDocument/addReceivablesDocuments.vue")
},
{
path: "/financial/financalDocument/invoicesManager", //发票管理
......@@ -254,22 +259,22 @@ const routes = [{
{
path: "/financial/financalDocument/RecPayQuery", //收支查询
component: () =>
import("pages/financial/financalDocument/RecPayQuery.vue")
import("pages/financial/financalDocument/RecPayQuery.vue")
},
{
path: "/financial/financalDocument/FinancialDocuments", //我的财务单据
component: () =>
import("pages/financial/financalDocument/FinancialDocuments.vue")
import("pages/financial/financalDocument/FinancialDocuments.vue")
},
{
path: "/financial/financalDocument/WorkEntrustmentMy", //工作委托
component: () =>
import("pages/financial/financalDocument/WorkEntrustmentMy.vue")
import("pages/financial/financalDocument/WorkEntrustmentMy.vue")
},
{
path: "/financial/financalDocument/CapitalAllocationDetail", //资金调拨单 详情
component: () =>
import("pages/financial/financalDocument/CapitalAllocationDetail.vue")
import("pages/financial/financalDocument/CapitalAllocationDetail.vue")
},
{
path: "/financial/financalDocument/addFinancialDocuments", //新增财务单据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment