feat: 权限逻辑处理
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
const BASE_URL = '/carbon-smart';
|
||||
export enum permission {
|
||||
add = `${BASE_URL}/admin/permission/save`,
|
||||
permissionTree = `${BASE_URL}/api/dept/QueryOrgPermission`,
|
||||
queryOrgPermission = `${BASE_URL}/api/dept/queryOrgPermission`,
|
||||
queryRolePermission = `${BASE_URL}/api/dept/queryRolePermission`,
|
||||
queryFilterDeptPermission = `${BASE_URL}/api/dept/queryFilterDeptPermission`,
|
||||
queryDeptPermission = `${BASE_URL}/api/dept/queryDeptPermission`,
|
||||
}
|
||||
|
||||
export enum origanizemanage {
|
||||
@@ -18,7 +21,7 @@ export enum origanizemanage {
|
||||
}
|
||||
|
||||
export enum department {
|
||||
dartList = `${BASE_URL}/api/user/queryDeptTree`,
|
||||
queryDeptTree = `${BASE_URL}/api/dept/queryDeptTree`,
|
||||
deptSave = `${BASE_URL}/api/dept/save`,
|
||||
deptEdit = `${BASE_URL}/api/dept/edit`,
|
||||
deptDel = `${BASE_URL}/api/dept/del`,
|
||||
@@ -28,7 +31,4 @@ export enum department {
|
||||
addRole = `${BASE_URL}/api/dept/addRole`,
|
||||
editRole = `${BASE_URL}/api/dept/editRole`,
|
||||
queryRoleTree = `${BASE_URL}/api/dept/queryRoleTree`,
|
||||
|
||||
queryDeptPermission = `${BASE_URL}/api/dept/queryDeptPermission`,
|
||||
queryRolePermission = `${BASE_URL}/api/dept/queryRolePermission`,
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ import { http } from '/nerv-lib/saas';
|
||||
import { ref } from 'vue';
|
||||
import { permission } from '/@/api/origanizemanage';
|
||||
|
||||
// const { linkList } = sessionStorage.getItem('userInfo')
|
||||
// const { permissionVos } = sessionStorage.getItem('userInfo');
|
||||
// ? JSON.parse(sessionStorage.getItem('userInfo')!)
|
||||
// : [{}];
|
||||
// const value = ref(linkList[0]?.orgId);
|
||||
@@ -19,7 +19,7 @@ const transform = (data, map) => {
|
||||
export const appConfig = {
|
||||
projectType: 'web',
|
||||
baseApi: '/api',
|
||||
enablePermissions: false,
|
||||
enablePermissions: true,
|
||||
// themeColor: '#eee',
|
||||
siderPosition: 'left',
|
||||
baseHeader: '/parkingManage',
|
||||
@@ -70,9 +70,13 @@ export const appConfig = {
|
||||
},
|
||||
},
|
||||
timeout: 60 * 1000,
|
||||
userLoginApi: '/carbon-smart/user/login',
|
||||
userLoginApi: (params) => {
|
||||
return http.post('/carbon-smart/user/login', { ...params });
|
||||
},
|
||||
userResourceApi: () => {
|
||||
return { data: mockResource.menus };
|
||||
return http.post('/carbon-smart/user/login/logInInfo').then((res) => {
|
||||
return { data: res.data.permissionVos };
|
||||
});
|
||||
},
|
||||
userInfoApi: () => {
|
||||
return http.post('/carbon-smart/user/login/logInInfo').then((res) => {
|
||||
@@ -85,9 +89,8 @@ export const appConfig = {
|
||||
orgName: 'orgName',
|
||||
projectId: 'projectId',
|
||||
linkList: 'linkList',
|
||||
permissionInfoList: 'permissionInfoList',
|
||||
permissionVos: 'permissionVos',
|
||||
});
|
||||
|
||||
return { data: { ...trD } };
|
||||
});
|
||||
},
|
||||
|
@@ -6,23 +6,22 @@ const home = {
|
||||
redirect: { name: 'homeIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'homeModule',
|
||||
name: 'HomeModule',
|
||||
path: 'index',
|
||||
name: 'homeIndex',
|
||||
meta: { title: '首页', hideChildren: true, icon: 'dicizhishou' },
|
||||
component: Base,
|
||||
component: () => import('/@/view/developing.vue'),
|
||||
redirect: { name: 'homeIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'homeIndex',
|
||||
component: () => import('/@/view/developing.vue'),
|
||||
meta: {
|
||||
title: '首页',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
// children: [
|
||||
// {
|
||||
// path: 'index',
|
||||
// name: 'homeIndex',
|
||||
// meta: {
|
||||
// title: '首页',
|
||||
// keepAlive: true,
|
||||
// // backApi: [],
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@@ -3,27 +3,8 @@ const organizationManage = {
|
||||
path: '/organizationManage',
|
||||
name: 'organizationManage',
|
||||
meta: { title: '组织管理', icon: 'dicizhishou', index: 99 },
|
||||
redirect: { name: 'EnterpriseManage' },
|
||||
redirect: { name: 'UserManage' },
|
||||
children: [
|
||||
{
|
||||
path: 'enterpriseManage',
|
||||
name: 'EnterpriseManage',
|
||||
meta: { title: '企业管理', hideChildren: true, icon: 'dicizhishou' },
|
||||
component: Base,
|
||||
redirect: { name: 'enterpriseManageIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'enterpriseManageIndex',
|
||||
component: () => import('/@/view/organizationManage/enterpriseManage/index.vue'),
|
||||
meta: {
|
||||
title: '企业管理',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'userManage',
|
||||
name: 'UserManage',
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<a-tree
|
||||
v-if="apartmentTreeData?.length"
|
||||
:tree-data="apartmentTreeData"
|
||||
:checkedKeys="['0-0']"
|
||||
v-model:checkedKeys="deptTreeCheckedKeys"
|
||||
defaultExpandAll
|
||||
@select="SelectApartmentTree">
|
||||
<template #title="data">
|
||||
@@ -29,8 +29,13 @@
|
||||
:model="formData"
|
||||
formLayout="vertical"
|
||||
class="form" />
|
||||
<!-- <ns-button style="margin: 16px" type="primary" @click="CancelApartment"
|
||||
>取消
|
||||
</ns-button>
|
||||
<ns-button v-show="disabled" type="primary" @click="deptEdit">编辑</ns-button>
|
||||
<ns-button v-show="!disabled" type="primary" @click="ApartmentSure">确定</ns-button> -->
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" :disabled="disabled" tab="部门权限">
|
||||
<a-tab-pane key="2" :disabled="!selectKey?.length" tab="部门权限">
|
||||
<a-tree
|
||||
:tree-data="apartmentAdminTreeData"
|
||||
:fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }"
|
||||
@@ -38,21 +43,18 @@
|
||||
checkable
|
||||
:selectable="false"
|
||||
defaultExpandAll
|
||||
@check="deptCheck"
|
||||
@select="ApartmentSelect">
|
||||
<template #title="data"> {{ data.label }}</template>
|
||||
</a-tree>
|
||||
<ns-button style="margin-left: 16px" type="primary" @click="apartmentPermission"
|
||||
>确定
|
||||
</ns-button>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<div v-show="activeKey === '1'">
|
||||
<ns-button style="margin: 16px" type="primary" @click="CancelApartment">取消</ns-button>
|
||||
<ns-button v-show="disabled" type="primary" @click="deptEdit">编辑</ns-button>
|
||||
<ns-button v-show="!disabled" type="primary" @click="ApartmentSure">确定</ns-button>
|
||||
</div>
|
||||
<div v-show="activeKey === '2'">
|
||||
<ns-button style="margin-left: 16px" type="primary" @click="apartmentPermission"
|
||||
>确定</ns-button
|
||||
>
|
||||
</div>
|
||||
<ns-button style="margin: 16px" type="primary" @click="CancelApartment">取消 </ns-button>
|
||||
<ns-button v-show="disabled" type="primary" @click="deptEdit">编辑</ns-button>
|
||||
<ns-button v-show="!disabled" type="primary" @click="ApartmentSure">确定</ns-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
@@ -60,7 +62,13 @@
|
||||
<div class="ns-table-title">角色管理</div>
|
||||
<a-row>
|
||||
<a-col :span="12" class="tree">
|
||||
<ns-button style="margin: 10px" type="primary" @click="addUser">新增角色</ns-button>
|
||||
<ns-button
|
||||
:disabled="!selectKey?.length"
|
||||
style="margin: 10px"
|
||||
type="primary"
|
||||
@click="addUser"
|
||||
>新增角色</ns-button
|
||||
>
|
||||
<ns-button :disabled="disabled2" type="primary" @click="addUserSon">新增子角色</ns-button>
|
||||
<ns-button :disabled="disabled2" style="margin: 10px" type="primary" @click="deleteUser"
|
||||
>删除</ns-button
|
||||
@@ -83,31 +91,25 @@
|
||||
:model="formData2"
|
||||
formLayout="vertical"
|
||||
class="form" />
|
||||
<ns-button style="margin: 16px" type="primary" @click="CancelUser">取消</ns-button>
|
||||
<ns-button v-show="disabled2" type="primary" @click="roleEdit"> 编辑 </ns-button>
|
||||
<ns-button v-show="!disabled2" type="primary" @click="UserSure"> 确定 </ns-button>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" :disabled="disabled2" tab="角色权限">
|
||||
<a-tab-pane key="2" :disabled="!selectKey2?.length" tab="角色权限">
|
||||
<a-tree
|
||||
v-if="userAdminTreeData?.length"
|
||||
:tree-data="userAdminTreeData"
|
||||
v-model:checkedKeys="UsercheckedKeys"
|
||||
defaultExpandAll
|
||||
:fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }"
|
||||
:selectable="false"
|
||||
checkable
|
||||
@check="roleCheck"
|
||||
@select="UserSelect" />
|
||||
<ns-button style="margin: 16px" type="primary" @click="rolePermission">
|
||||
确定
|
||||
</ns-button>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<div v-show="activeKey2 === '1'">
|
||||
<ns-button style="margin: 16px" type="primary" @click="CancelUser">取消</ns-button>
|
||||
<ns-button v-show="disabled2" type="primary" :disabled="disabled2" @click="UserSure">
|
||||
确定</ns-button
|
||||
>
|
||||
<ns-button v-show="!disabled2" type="primary" :disabled="disabled2" @click="UserSure">
|
||||
确定</ns-button
|
||||
>
|
||||
</div>
|
||||
<div v-show="activeKey2 === '2'">
|
||||
<ns-button style="margin: 16px" type="primary" @click="rolePermission"> 确定</ns-button>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
@@ -134,6 +136,7 @@
|
||||
const activeKey2 = ref('1');
|
||||
const disabled = ref(true);
|
||||
const disabled2 = ref(true);
|
||||
const deptTreeCheckedKeys = ref(['0-0-0']);
|
||||
const ApartcheckedKeys = ref<string[]>([]);
|
||||
const UsercheckedKeys = ref<string[]>([]);
|
||||
const selectKey = ref();
|
||||
@@ -148,9 +151,13 @@
|
||||
const apartmentAdminTreeData = ref([]);
|
||||
const userTreeData = ref([]);
|
||||
const getPermissionTree = (params) => {
|
||||
return http.post(permission.permissionTree, params).then((res) => {
|
||||
apartmentAdminTreeData.value = get(res, 'data.data');
|
||||
userAdminTreeData.value = get(res, 'data.data');
|
||||
return http.post(permission.queryOrgPermission, params).then((res) => {
|
||||
apartmentAdminTreeData.value = get(res, 'data');
|
||||
});
|
||||
};
|
||||
const getRolePermissionTree = (params) => {
|
||||
return http.post(permission.queryFilterDeptPermission, params).then((res) => {
|
||||
userAdminTreeData.value = get(res, 'data');
|
||||
});
|
||||
};
|
||||
|
||||
@@ -165,16 +172,27 @@
|
||||
|
||||
// 部门树
|
||||
const getDepartList = (params) => {
|
||||
return http.post(department.dartList, params);
|
||||
return http.post(department.queryDeptTree, params).then((res) => {
|
||||
const result = res.data.map((item, index) => {
|
||||
item['deptInfo'] = item.orgInfo;
|
||||
item['deptInfo'] = item.orgInfo;
|
||||
item['deptInfo']['deptName'] = item?.orgInfo?.orgName;
|
||||
item['own'] = !index;
|
||||
item['children'] = item.deptTrees;
|
||||
return item;
|
||||
});
|
||||
|
||||
return result;
|
||||
});
|
||||
};
|
||||
getDepartList({ orgId }).then((res) => {
|
||||
apartmentTreeData.value = res.data;
|
||||
apartmentTreeData.value = res;
|
||||
});
|
||||
|
||||
// 获取部门树
|
||||
const getTree = () => {
|
||||
getDepartList({ orgId }).then((res) => {
|
||||
apartmentTreeData.value = res.data;
|
||||
apartmentTreeData.value = res;
|
||||
NsMessage.success('操作成功');
|
||||
});
|
||||
};
|
||||
@@ -199,18 +217,19 @@
|
||||
callback: null,
|
||||
};
|
||||
|
||||
function fetch(api, params) {
|
||||
return http.post(api, params);
|
||||
}
|
||||
|
||||
const addApartment = () => {
|
||||
disabled.value = false;
|
||||
opMap.type = 'addDept';
|
||||
formData.value = {};
|
||||
let sourceOrgId = '';
|
||||
if (!selectRef.value.own) {
|
||||
sourceOrgId = orgId;
|
||||
}
|
||||
opMap.fuc = (params) => {
|
||||
return http.post(department.deptSave, {
|
||||
...params,
|
||||
orgId,
|
||||
orgId: selectRef.value.deptInfo?.orgId,
|
||||
sourceOrgId,
|
||||
projectId,
|
||||
orgName,
|
||||
});
|
||||
@@ -222,13 +241,22 @@
|
||||
disabled.value = false;
|
||||
opMap.type = 'addson';
|
||||
formData.value = {};
|
||||
let sourceOrgId = '';
|
||||
if (!selectRef.value.own) {
|
||||
sourceOrgId = orgId;
|
||||
}
|
||||
opMap.fuc = (params) => {
|
||||
if (!selectRef.value?.deptInfo?.deptId) {
|
||||
NsMessage.warn('请选择部门');
|
||||
return;
|
||||
}
|
||||
return http.post(department.deptSave, {
|
||||
...params,
|
||||
orgId,
|
||||
projectId,
|
||||
pdeptId: selectRef.value.deptInfo.deptId,
|
||||
deptName: selectRef.value.deptInfo.deptName,
|
||||
sourceOrgId,
|
||||
// deptName: selectRef.value.deptInfo.deptName,
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -311,6 +339,58 @@
|
||||
opMap.fuc = '';
|
||||
selectKey.value = '';
|
||||
};
|
||||
const clearRoleData = () => {
|
||||
selectRef2.value = {};
|
||||
formData2.value = {};
|
||||
opMap.type = '';
|
||||
opMap.fuc = '';
|
||||
selectKey2.value = '';
|
||||
};
|
||||
|
||||
const deptTotalCheckedKeys = ref([]);
|
||||
const roleTotalCheckedKeys = ref([]);
|
||||
// 部门权限选择
|
||||
const deptCheck = (checked, { halfCheckedKeys }) => {
|
||||
console.log(checked, halfCheckedKeys);
|
||||
|
||||
const result = checked.map((item) => {
|
||||
return {
|
||||
halfCheck: false,
|
||||
permissionId: item,
|
||||
};
|
||||
});
|
||||
const finalResult = halfCheckedKeys
|
||||
.map((item) => {
|
||||
return {
|
||||
halfCheck: true,
|
||||
permissionId: item,
|
||||
};
|
||||
})
|
||||
.concat(result);
|
||||
|
||||
deptTotalCheckedKeys.value = finalResult;
|
||||
};
|
||||
|
||||
// 角色权限选择
|
||||
const roleCheck = (checked, { halfCheckedKeys }) => {
|
||||
console.log(checked, halfCheckedKeys);
|
||||
|
||||
const result = checked.map((item) => {
|
||||
return {
|
||||
halfCheck: false,
|
||||
permissionId: item,
|
||||
};
|
||||
});
|
||||
const finalResult = halfCheckedKeys
|
||||
.map((item) => {
|
||||
return {
|
||||
halfCheck: true,
|
||||
permissionId: item,
|
||||
};
|
||||
})
|
||||
.concat(result);
|
||||
roleTotalCheckedKeys.value = finalResult;
|
||||
};
|
||||
|
||||
// 保存部门权限
|
||||
const apartmentPermission = () => {
|
||||
@@ -318,9 +398,7 @@
|
||||
.post(department.addPermission, {
|
||||
deptId: selectRef.value?.deptInfo.deptId,
|
||||
projectId,
|
||||
permissionVoList: ApartcheckedKeys.value.map((item) => {
|
||||
return { permissionId: item };
|
||||
}),
|
||||
permissionVoList: deptTotalCheckedKeys.value,
|
||||
})
|
||||
.then(() => {
|
||||
NsMessage.success('保存成功');
|
||||
@@ -333,9 +411,7 @@
|
||||
// deptId: selectRef.value?.deptInfo.deptId,
|
||||
roleId: selectRef2.value?.roleId,
|
||||
projectId,
|
||||
permissionVoList: UsercheckedKeys.value.map((item) => {
|
||||
return { permissionId: item };
|
||||
}),
|
||||
permissionVoList: roleTotalCheckedKeys.value,
|
||||
})
|
||||
.then(() => {
|
||||
NsMessage.success('保存成功');
|
||||
@@ -345,22 +421,28 @@
|
||||
// 获取部门拥有的权限
|
||||
const getDeptPermission = () => {
|
||||
http
|
||||
.post(department.queryDeptPermission, { deptId: selectRef.value?.deptInfo.deptId })
|
||||
.post(permission.queryDeptPermission, { deptId: selectRef.value?.deptInfo.deptId })
|
||||
.then((res) => {
|
||||
ApartcheckedKeys.value = res.data.map((item) => {
|
||||
return item.permissionId;
|
||||
});
|
||||
ApartcheckedKeys.value = res.data
|
||||
?.filter((item) => !item.halfCheck)
|
||||
.map((item) => {
|
||||
return item.permissionId;
|
||||
});
|
||||
deptTotalCheckedKeys.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
// 获取角色拥有的权限
|
||||
const getRolePermission = () => {
|
||||
http
|
||||
.post(department.queryRolePermission, { roleId: selectRef2.value?.roleId })
|
||||
.post(permission.queryRolePermission, { roleId: selectRef2.value?.roleId })
|
||||
.then((res) => {
|
||||
UsercheckedKeys.value = res.data.map((item) => {
|
||||
return item.permissionId;
|
||||
});
|
||||
UsercheckedKeys.value = res.data
|
||||
?.filter((item) => !item.halfCheck)
|
||||
.map((item) => {
|
||||
return item.permissionId;
|
||||
});
|
||||
roleTotalCheckedKeys.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -377,6 +459,7 @@
|
||||
|
||||
// 部门编辑
|
||||
const deptEdit = () => {
|
||||
disabledTree();
|
||||
disabled.value = false;
|
||||
apartmentChoose();
|
||||
};
|
||||
@@ -404,24 +487,27 @@
|
||||
* type editDpet
|
||||
*/
|
||||
const roleChoose = () => {
|
||||
opMap.type = 'editDpet';
|
||||
opMap.type = 'editRole';
|
||||
opMap.fuc = (params) => {
|
||||
return http.post(department.deptEdit, params);
|
||||
return http.post(department.editRole, params);
|
||||
};
|
||||
};
|
||||
|
||||
const roleEdit = () => {
|
||||
disabled2.value = false;
|
||||
roleChoose();
|
||||
};
|
||||
// 角色选择
|
||||
const SelectUserTree = (selectedKeys: any, info: any) => {
|
||||
const { selected } = info;
|
||||
disabled2.value = !selected;
|
||||
console.log(selectedKeys, 'selectedKeys');
|
||||
console.log(info, 'info');
|
||||
// disabled2.value = !selected;
|
||||
|
||||
if (!selectedKeys?.length) return;
|
||||
selectKey2.value = selectedKeys[0];
|
||||
selectRef2.value = info.node.dataRef;
|
||||
formData2.value = cloneDeep(info.node.dataRef);
|
||||
roleChoose();
|
||||
UsercheckedKeys.value.splice(0);
|
||||
getRolePermission();
|
||||
getRolePermissionTree({ deptId: selectRef.value.deptInfo.deptId });
|
||||
};
|
||||
|
||||
const CancelApartment = () => {
|
||||
@@ -452,6 +538,7 @@
|
||||
opMap.fuc &&
|
||||
opMap.fuc(formData.value).then(() => {
|
||||
getTree();
|
||||
clearApartData();
|
||||
disabled.value = true;
|
||||
});
|
||||
} else if (opMap.type === 'deptDelete') {
|
||||
@@ -466,6 +553,7 @@
|
||||
opMap.fuc &&
|
||||
opMap.fuc(formData2.value).then(() => {
|
||||
getUserTree();
|
||||
clearRoleData();
|
||||
});
|
||||
} else if (selectRef2.value && opMap.type === 'addson')
|
||||
selectRef2.value['children'] = [
|
||||
@@ -480,6 +568,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
const disabledTree = (data, disabled) => {
|
||||
console.log(userAdminTreeData.value, 'userAdminTreeData.value');
|
||||
userAdminTreeData.value.map((item) => {
|
||||
item['disabled'] = disabled;
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
disabled,
|
||||
disabled2,
|
||||
@@ -513,6 +608,12 @@
|
||||
apartmentPermission,
|
||||
rolePermission,
|
||||
deptEdit,
|
||||
selectKey,
|
||||
selectKey2,
|
||||
deptTreeCheckedKeys,
|
||||
deptCheck,
|
||||
roleCheck,
|
||||
roleEdit,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
@@ -62,7 +62,9 @@ export const appConfig = {
|
||||
// },
|
||||
// },
|
||||
timeout: 60 * 1000,
|
||||
userLoginApi: '/carbon-smart/user/login',
|
||||
userLoginApi: (params) => {
|
||||
return http.post('/carbon-smart/user/login', { ...params, operation: true });
|
||||
},
|
||||
userResourceApi: () => {
|
||||
return { data: [] };
|
||||
},
|
||||
|
@@ -109,9 +109,9 @@ export const appConfigStore = defineStore({
|
||||
userLogin(data: loginData) {
|
||||
if (this.userLoginApi) {
|
||||
console.log(data);
|
||||
// return httpRequest({ api: this.userLoginApi, params: data, pathParams: {}, requestConfig });
|
||||
return httpRequest({ api: this.userLoginApi, params: data, pathParams: {}, requestConfig });
|
||||
|
||||
return http.post(this.userLoginApi, data);
|
||||
// return http.post(this.userLoginApi, data);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
import { defineStore } from 'pinia';
|
||||
import { appConfigStore } from '/nerv-base/store/modules/app-config';
|
||||
export const authorizationService = defineStore({
|
||||
@@ -72,6 +70,8 @@ export const authorizationService = defineStore({
|
||||
this.dealResourceTree(this.userResourceList);
|
||||
} else {
|
||||
const res = await this.appConfig.userResource();
|
||||
console.log(res, 'hshshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh');
|
||||
|
||||
this.userResourceList = res.data ? res.data : [];
|
||||
if (this.appConfig.defaultResource) {
|
||||
this.userResourceList.push(this.appConfig.defaultResource);
|
||||
@@ -92,6 +92,8 @@ export const authorizationService = defineStore({
|
||||
//初始化菜单树
|
||||
async initMenuResource() {
|
||||
const res = await this.appConfig.userResource();
|
||||
console.log(res, 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
|
||||
|
||||
this.initMenus = [];
|
||||
if (this.appConfig.resourceName && res.data && res.data.length) {
|
||||
res.data.forEach((item) => {
|
||||
|
@@ -105,6 +105,8 @@
|
||||
loading.value = false;
|
||||
if (configStore.enablePermissions) {
|
||||
const res = await configStore.userResource();
|
||||
console.log(res, 'cccccccccccccccccccccccccccccc');
|
||||
|
||||
if (configStore.customApplication) {
|
||||
await useAuthorization.initMenuResource();
|
||||
}
|
||||
|
Reference in New Issue
Block a user