|
@@ -1,6 +1,7 @@
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
import { Modal } from 'ant-design-vue';
|
|
|
-import { getTenantId } from "/@/utils/auth";
|
|
|
+import { getTenantId } from '/@/utils/auth';
|
|
|
+import { getAllRolesListNoByTenant } from '@/views/system/user/user.api';
|
|
|
|
|
|
enum Api {
|
|
|
list = '/sys/tenant/list',
|
|
@@ -26,7 +27,7 @@ enum Api {
|
|
|
addTenantPackUser = '/sys/tenant/addTenantPackUser',
|
|
|
//获取用户租户列表
|
|
|
getTenantPageListByUserId = '/sys/tenant/getTenantPageListByUserId',
|
|
|
-
|
|
|
+
|
|
|
//新增、编辑用户租户
|
|
|
saveUser = '/sys/user/add',
|
|
|
editUser = '/sys/user/editTenantUser',
|
|
@@ -45,7 +46,7 @@ export const getTenantList = (params) => {
|
|
|
* @param params
|
|
|
*/
|
|
|
export const saveOrUpdateTenant = (params, isUpdate) => {
|
|
|
- let url = isUpdate ? Api.edit : Api.save;
|
|
|
+ const url = isUpdate ? Api.edit : Api.save;
|
|
|
return defHttp.post({ url: url, params });
|
|
|
};
|
|
|
|
|
@@ -168,22 +169,25 @@ export const recycleBinPageList = (params) => {
|
|
|
* 租户彻底删除
|
|
|
* @param params
|
|
|
*/
|
|
|
-export const deleteLogicDeleted = (params,handleSuccess) => {
|
|
|
- return defHttp.delete({ url: Api.deleteLogicDeleted, params },{ joinParamsToUrl: true }).then(() => {
|
|
|
- handleSuccess();
|
|
|
- }).catch(()=>{
|
|
|
- handleSuccess();
|
|
|
- });
|
|
|
+export const deleteLogicDeleted = (params, handleSuccess) => {
|
|
|
+ return defHttp
|
|
|
+ .delete({ url: Api.deleteLogicDeleted, params }, { joinParamsToUrl: true })
|
|
|
+ .then(() => {
|
|
|
+ handleSuccess();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ handleSuccess();
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 租户还原
|
|
|
* @param params
|
|
|
*/
|
|
|
-export const revertTenantLogic = (params,handleSuccess) => {
|
|
|
- return defHttp.put({ url: Api.revertTenantLogic, params },{ joinParamsToUrl: true }).then(() => {
|
|
|
+export const revertTenantLogic = (params, handleSuccess) => {
|
|
|
+ return defHttp.put({ url: Api.revertTenantLogic, params }, { joinParamsToUrl: true }).then(() => {
|
|
|
handleSuccess();
|
|
|
- })
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -198,17 +202,17 @@ export const queryTenantPackUserList = (params) => {
|
|
|
* 移除用户和产品包的关系数据
|
|
|
* @param params
|
|
|
*/
|
|
|
-export const deleteTenantPackUser = (params)=>{
|
|
|
+export const deleteTenantPackUser = (params) => {
|
|
|
return defHttp.put({ url: Api.deleteTenantPackUser, params });
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* 添加用户和产品包的关系数据
|
|
|
* @param params
|
|
|
*/
|
|
|
-export const addTenantPackUser = (params)=>{
|
|
|
+export const addTenantPackUser = (params) => {
|
|
|
return defHttp.post({ url: Api.addTenantPackUser, params });
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* 查询用户租户列表
|
|
@@ -218,19 +222,18 @@ export const getTenantPageListByUserId = (params) => {
|
|
|
return defHttp.get({ url: Api.getTenantPageListByUserId, params });
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取当前登录租户名称
|
|
|
*/
|
|
|
export async function getLoginTenantName() {
|
|
|
- let tenantId = getTenantId();
|
|
|
- if(tenantId){
|
|
|
- let result = await getTenantById({ id:tenantId });
|
|
|
- if(result){
|
|
|
+ const tenantId = getTenantId();
|
|
|
+ if (tenantId) {
|
|
|
+ const result = await getTenantById({ id: tenantId });
|
|
|
+ if (result) {
|
|
|
return result.name;
|
|
|
}
|
|
|
}
|
|
|
- return "空";
|
|
|
+ return '空';
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -238,6 +241,15 @@ export async function getLoginTenantName() {
|
|
|
* @param params
|
|
|
*/
|
|
|
export const saveOrUpdateTenantUser = (params, isUpdate) => {
|
|
|
- let url = isUpdate ? Api.editUser : Api.saveUser;
|
|
|
- return defHttp.post({ url: url, params },{ joinParamsToUrl: true });
|
|
|
+ const url = isUpdate ? Api.editUser : Api.saveUser;
|
|
|
+ return defHttp.post({ url: url, params }, { joinParamsToUrl: true });
|
|
|
+};
|
|
|
+
|
|
|
+export const getAdWebVipRoleID = async (params) => {
|
|
|
+ const result = await getAllRolesListNoByTenant(params);
|
|
|
+
|
|
|
+ console.log(result, '获取非租户隔离的所有角色,并查出默认给租户用户的角色');
|
|
|
+ const foundObject = result.find((obj) => obj.roleCode === 'adweb_vip');
|
|
|
+
|
|
|
+ return foundObject ? foundObject.id : undefined;
|
|
|
};
|