mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-18 06:02:01 +08:00
refactor: 迁移requestClient到alovaInstance并移除旧版上传组件
重构项目中所有使用requestClient的API调用,替换为alovaInstance 移除已废弃的旧版上传组件及相关代码 调整上传组件类型定义以适配antdv-next更新 优化上传逻辑,移除不必要的进度事件和取消信号 更新类型定义文件,迁移axios配置到alova类型
This commit is contained in:
@@ -3,7 +3,7 @@ import type { HttpResponse } from '@vben/request';
|
||||
|
||||
import { useAppConfig } from '@vben/hooks';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
const { clientId, sseEnable } = useAppConfig(
|
||||
import.meta.env,
|
||||
@@ -78,7 +78,7 @@ export namespace AuthApi {
|
||||
* 登录
|
||||
*/
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>(
|
||||
return alovaInstance.post<AuthApi.LoginResult>(
|
||||
'/auth/login',
|
||||
{ ...data, clientId },
|
||||
{
|
||||
@@ -92,7 +92,7 @@ export async function loginApi(data: AuthApi.LoginParams) {
|
||||
* @returns void
|
||||
*/
|
||||
export function doLogout() {
|
||||
return requestClient.post<HttpResponse<void>>('/auth/logout');
|
||||
return alovaInstance.post<HttpResponse<void>>('/auth/logout');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +106,7 @@ export function seeConnectionClose() {
|
||||
if (!sseEnable) {
|
||||
return;
|
||||
}
|
||||
return requestClient.get<void>('/resource/sse/close');
|
||||
return alovaInstance.get<void>('/resource/sse/close');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,7 @@ export interface TenantResp {
|
||||
* 获取租户列表 下拉框使用
|
||||
*/
|
||||
export function tenantList() {
|
||||
return requestClient.get<TenantResp>('/auth/tenant/list');
|
||||
return alovaInstance.get<TenantResp>('/auth/tenant/list');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +141,7 @@ export function tenantList() {
|
||||
* @returns string[]
|
||||
*/
|
||||
export async function getAccessCodesApi() {
|
||||
return requestClient.get<string[]>('/auth/codes');
|
||||
return alovaInstance.get<string[]>('/auth/codes');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ export async function getAccessCodesApi() {
|
||||
* @returns 跳转url
|
||||
*/
|
||||
export function authBinding(source: string, tenantId: string) {
|
||||
return requestClient.get<string>(`/auth/binding/${source}`, {
|
||||
return alovaInstance.get<string>(`/auth/binding/${source}`, {
|
||||
params: {
|
||||
domain: window.location.host,
|
||||
tenantId,
|
||||
@@ -163,7 +163,7 @@ export function authBinding(source: string, tenantId: string) {
|
||||
* @param id id
|
||||
*/
|
||||
export function authUnbinding(id: string) {
|
||||
return requestClient.deleteWithMsg<void>(`/auth/unlock/${id}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`/auth/unlock/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,5 +172,5 @@ export function authUnbinding(id: string) {
|
||||
* @returns void
|
||||
*/
|
||||
export function authCallback(data: AuthApi.OAuthLoginParams) {
|
||||
return requestClient.post<void>('/auth/social/callback', data);
|
||||
return alovaInstance.post<void>('/auth/social/callback', data);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
@@ -6,7 +6,7 @@ import { requestClient } from '#/api/request';
|
||||
* @returns void
|
||||
*/
|
||||
export function sendSmsCode(phonenumber: string) {
|
||||
return requestClient.get<void>('/resource/sms/code', {
|
||||
return alovaInstance.get<void>('/resource/sms/code', {
|
||||
params: { phonenumber },
|
||||
});
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export function sendSmsCode(phonenumber: string) {
|
||||
* @returns void
|
||||
*/
|
||||
export function sendEmailCode(email: string) {
|
||||
return requestClient.get<void>('/resource/email/code', {
|
||||
return alovaInstance.get<void>('/resource/email/code', {
|
||||
params: { email },
|
||||
});
|
||||
}
|
||||
@@ -38,5 +38,5 @@ export interface CaptchaResponse {
|
||||
* @returns resp
|
||||
*/
|
||||
export function captchaImage() {
|
||||
return requestClient.get<CaptchaResponse>('/auth/code');
|
||||
return alovaInstance.get<CaptchaResponse>('/auth/code');
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* @description: 菜单meta
|
||||
@@ -41,5 +41,5 @@ export interface Menu {
|
||||
* 获取用户所有菜单
|
||||
*/
|
||||
export async function getAllMenusApi() {
|
||||
return requestClient.get<Menu[]>('/system/menu/getRouters');
|
||||
return alovaInstance.get<Menu[]>('/system/menu/getRouters');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AxiosRequestConfig } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* Axios上传进度事件
|
||||
@@ -20,24 +20,20 @@ export interface UploadResult {
|
||||
* 通过单文件上传接口
|
||||
* @param file 上传的文件
|
||||
* @param options 一些配置项
|
||||
* @param options.onUploadProgress 上传进度事件
|
||||
* @param options.signal 上传取消信号
|
||||
* @param options.otherData 其他请求参数 后端拓展可能会用到
|
||||
* @returns 上传结果
|
||||
*/
|
||||
export function uploadApi(
|
||||
file: Blob | File,
|
||||
options?: {
|
||||
onUploadProgress?: AxiosProgressEvent;
|
||||
otherData?: Record<string, any>;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
) {
|
||||
const { onUploadProgress, signal, otherData = {} } = options ?? {};
|
||||
return requestClient.upload<UploadResult>(
|
||||
const { otherData = {} } = options ?? {};
|
||||
return alovaInstance.post<UploadResult>(
|
||||
'/resource/oss/upload',
|
||||
{ file, ...otherData },
|
||||
{ onUploadProgress, signal, timeout: 60_000 },
|
||||
{ timeout: 60_000 },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
export interface Role {
|
||||
dataScope: string;
|
||||
@@ -42,5 +42,5 @@ export interface UserInfoResp {
|
||||
* 存在返回null的情况(401) 不会抛出异常 需要手动抛异常
|
||||
*/
|
||||
export async function getUserInfoApi() {
|
||||
return requestClient.get<null | UserInfoResp>('/system/user/getInfo');
|
||||
return alovaInstance.get<null | UserInfoResp>('/system/user/getInfo');
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { useAuthStore } from '#/store';
|
||||
|
||||
import { requestClient } from './request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* @description: contentType
|
||||
@@ -23,8 +22,7 @@ export const ContentTypeEnum = {
|
||||
* @returns blob二进制
|
||||
*/
|
||||
export function commonExport(url: string, data: Record<string, any>) {
|
||||
return requestClient.post<Blob>(url, data, {
|
||||
data,
|
||||
return alovaInstance.post<Blob>(url, data, {
|
||||
headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
|
||||
isTransformResponse: false,
|
||||
responseType: 'blob',
|
||||
|
||||
4
apps/web-antd/src/api/monitor/cache/index.ts
vendored
4
apps/web-antd/src/api/monitor/cache/index.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
export interface CommandStats {
|
||||
name: string;
|
||||
@@ -20,5 +20,5 @@ export interface CacheInfo {
|
||||
* @returns redis信息
|
||||
*/
|
||||
export function redisCacheInfo() {
|
||||
return requestClient.get<CacheInfo>('/monitor/cache');
|
||||
return alovaInstance.get<CacheInfo>('/monitor/cache');
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { LoginLog } from './model';
|
||||
import type { IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
loginInfoClean = '/monitor/logininfor/clean',
|
||||
@@ -19,7 +19,7 @@ enum Api {
|
||||
* @returns list[]
|
||||
*/
|
||||
export function loginInfoList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<LoginLog>>(Api.loginInfoList, { params });
|
||||
return alovaInstance.get<PageResult<LoginLog>>(Api.loginInfoList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ export function loginInfoExport(data: any) {
|
||||
* @returns void
|
||||
*/
|
||||
export function loginInfoRemove(infoIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${infoIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${infoIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ export function loginInfoRemove(infoIds: IDS) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userUnlock(username: string) {
|
||||
return requestClient.get<void>(`${Api.userUnlock}/${username}`, {
|
||||
return alovaInstance.get<void>(`${Api.userUnlock}/${username}`, {
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
}
|
||||
@@ -56,5 +56,5 @@ export function userUnlock(username: string) {
|
||||
* @returns void
|
||||
*/
|
||||
export function loginInfoClean() {
|
||||
return requestClient.deleteWithMsg<void>(Api.loginInfoClean);
|
||||
return alovaInstance.deleteWithMsg<void>(Api.loginInfoClean);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { OnlineUser } from './model';
|
||||
|
||||
import type { PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
onlineList = '/monitor/online/list',
|
||||
@@ -14,7 +14,7 @@ enum Api {
|
||||
* @returns OnlineUser[]
|
||||
*/
|
||||
export function onlineDeviceList() {
|
||||
return requestClient.get<PageResult<OnlineUser>>(Api.root);
|
||||
return alovaInstance.get<PageResult<OnlineUser>>(Api.root);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ export function onlineDeviceList() {
|
||||
* @returns 结果
|
||||
*/
|
||||
export function onlineList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<OnlineUser>>(Api.onlineList, { params });
|
||||
return alovaInstance.get<PageResult<OnlineUser>>(Api.onlineList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ export function onlineList(params?: PageQuery) {
|
||||
* @returns void
|
||||
*/
|
||||
export function forceLogout(tokenId: string) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${tokenId}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${tokenId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,5 +41,5 @@ export function forceLogout(tokenId: string) {
|
||||
* @returns void
|
||||
*/
|
||||
export function forceLogout2(tokenId: string) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/myself/${tokenId}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/myself/${tokenId}`);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { OperationLog } from './model';
|
||||
import type { IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
operLogClean = '/monitor/operlog/clean',
|
||||
@@ -18,7 +18,7 @@ enum Api {
|
||||
* @returns 分页结果
|
||||
*/
|
||||
export function operLogList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<OperationLog>>(Api.operLogList, {
|
||||
return alovaInstance.get<PageResult<OperationLog>>(Api.operLogList, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
@@ -28,14 +28,14 @@ export function operLogList(params?: PageQuery) {
|
||||
* @param operIds id/ids
|
||||
*/
|
||||
export function operLogDelete(operIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${operIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${operIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空全部分页日志
|
||||
*/
|
||||
export function operLogClean() {
|
||||
return requestClient.deleteWithMsg<void>(Api.operLogClean);
|
||||
return alovaInstance.deleteWithMsg<void>(Api.operLogClean);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,318 +0,0 @@
|
||||
/**
|
||||
* 该文件可自行根据业务逻辑进行调整
|
||||
*/
|
||||
|
||||
import type { HttpResponse } from '@vben/request';
|
||||
import type {
|
||||
BaseAsymmetricEncryption,
|
||||
BaseSymmetricEncryption,
|
||||
} from '@vben/utils';
|
||||
|
||||
import { BUSINESS_SUCCESS_CODE, UNAUTHORIZED_CODE } from '@vben/constants';
|
||||
import { useAppConfig } from '@vben/hooks';
|
||||
import { $t } from '@vben/locales';
|
||||
import { preferences } from '@vben/preferences';
|
||||
import {
|
||||
authenticateResponseInterceptor,
|
||||
errorMessageResponseInterceptor,
|
||||
RequestClient,
|
||||
stringify,
|
||||
} from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import {
|
||||
AesEncryption,
|
||||
decodeBase64,
|
||||
encodeBase64,
|
||||
randomStr,
|
||||
RsaEncryption,
|
||||
} from '@vben/utils';
|
||||
|
||||
import { isEmpty, isNull } from 'lodash-es';
|
||||
|
||||
import { useAuthStore } from '#/store';
|
||||
|
||||
import { handleUnauthorizedLogout } from './helper';
|
||||
|
||||
const { apiURL, clientId, enableEncrypt, rsaPublicKey, rsaPrivateKey } =
|
||||
useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
|
||||
/**
|
||||
* 使用非对称加密的实现 前端已经实现RSA/SM2
|
||||
*
|
||||
* 你可以使用Sm2Encryption来替换 后端也需要同步替换公私钥对
|
||||
*
|
||||
* 后端文件位置: ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/filter/DecryptRequestBodyWrapper.java
|
||||
*
|
||||
* 注意前端sm-crypto库只能支持04开头的公钥! 否则加密会有问题 你可以使用前端的import { logSm2KeyPair } from '@vben/utils';方法来生成
|
||||
* 如果你生成的公钥开头不是04 那么不能正常加密
|
||||
* 或者使用这个网站来生成: https://tool.hiofd.com/sm2-key-gen/
|
||||
*/
|
||||
const asymmetricEncryption: BaseAsymmetricEncryption = new RsaEncryption({
|
||||
publicKey: rsaPublicKey,
|
||||
privateKey: rsaPrivateKey,
|
||||
});
|
||||
|
||||
/**
|
||||
* 对称加密的实现 AES/SM4
|
||||
*/
|
||||
const symmetricEncryption: BaseSymmetricEncryption = new AesEncryption();
|
||||
|
||||
function createRequestClient(baseURL: string) {
|
||||
const client = new RequestClient({
|
||||
// 后端地址
|
||||
baseURL,
|
||||
// 消息提示类型
|
||||
errorMessageMode: 'message',
|
||||
// 是否返回原生响应 比如:需要获取响应头时使用该属性
|
||||
isReturnNativeResponse: false,
|
||||
// 需要对返回数据进行处理
|
||||
isTransformResponse: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* 重新认证逻辑
|
||||
*/
|
||||
async function doReAuthenticate() {
|
||||
console.warn('Access token or refresh token is invalid or expired. ');
|
||||
const accessStore = useAccessStore();
|
||||
const authStore = useAuthStore();
|
||||
accessStore.setAccessToken(null);
|
||||
if (
|
||||
preferences.app.loginExpiredMode === 'modal' &&
|
||||
accessStore.isAccessChecked
|
||||
) {
|
||||
accessStore.setLoginExpired(true);
|
||||
} else {
|
||||
await authStore.logout();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token逻辑
|
||||
*/
|
||||
async function doRefreshToken() {
|
||||
// 不需要
|
||||
// 保留此方法只是为了合并方便
|
||||
return '';
|
||||
}
|
||||
|
||||
function formatToken(token: null | string) {
|
||||
return token ? `Bearer ${token}` : null;
|
||||
}
|
||||
|
||||
client.addRequestInterceptor({
|
||||
fulfilled: (config) => {
|
||||
const accessStore = useAccessStore();
|
||||
// 添加token
|
||||
config.headers.Authorization = formatToken(accessStore.accessToken);
|
||||
/**
|
||||
* locale跟后台不一致 需要转换
|
||||
*/
|
||||
const language = preferences.app.locale.replace('-', '_');
|
||||
config.headers['Accept-Language'] = language;
|
||||
config.headers['Content-Language'] = language;
|
||||
/**
|
||||
* 添加全局clientId
|
||||
* 关于header的clientId被错误绑定到实体类
|
||||
* https://gitee.com/dapppp/ruoyi-plus-vben5/issues/IC0BDS
|
||||
*/
|
||||
config.headers.ClientID = clientId;
|
||||
/**
|
||||
* 格式化get/delete参数
|
||||
* 如果包含自定义的paramsSerializer则不走此逻辑
|
||||
*/
|
||||
if (
|
||||
['DELETE', 'GET'].includes(config.method?.toUpperCase() || '') &&
|
||||
config.params &&
|
||||
!config.paramsSerializer
|
||||
) {
|
||||
/**
|
||||
* 1. 格式化参数 微服务在传递区间时间选择(后端的params Map类型参数)需要格式化key 否则接收不到
|
||||
* 2. 数组参数需要格式化 后端才能正常接收 会变成arr=1&arr=2&arr=3的格式来接收
|
||||
*/
|
||||
config.paramsSerializer = (params) =>
|
||||
stringify(params, { arrayFormat: 'repeat' });
|
||||
}
|
||||
|
||||
const { encrypt } = config;
|
||||
// 全局开启请求加密功能 && 该请求开启 && 是post/put请求
|
||||
if (
|
||||
enableEncrypt &&
|
||||
encrypt &&
|
||||
['POST', 'PUT'].includes(config.method?.toUpperCase() || '')
|
||||
) {
|
||||
// sm4这里改为randomStr(16)
|
||||
const key = randomStr(32);
|
||||
const keyWithBase64 = encodeBase64(key);
|
||||
config.headers['encrypt-key'] =
|
||||
asymmetricEncryption.encrypt(keyWithBase64);
|
||||
/**
|
||||
* axios会默认给字符串前后加上引号 RSA可以正常解密(加不加都能解密) 但是SM2不行(大坑!!!)
|
||||
* 这里通过transformRequest强制返回原始内容
|
||||
*/
|
||||
config.transformRequest = (data) => data;
|
||||
|
||||
config.data =
|
||||
typeof config.data === 'object'
|
||||
? symmetricEncryption.encrypt(JSON.stringify(config.data), key)
|
||||
: symmetricEncryption.encrypt(config.data, key);
|
||||
}
|
||||
return config;
|
||||
},
|
||||
});
|
||||
|
||||
// 通用的错误处理, 如果没有进入上面的错误处理逻辑,就会进入这里
|
||||
// 主要处理http状态码不为200(如网络异常/离线)的情况 必须放在在下面的响应拦截器之前
|
||||
client.addResponseInterceptor(
|
||||
errorMessageResponseInterceptor((msg: string) => window.message.error(msg)),
|
||||
);
|
||||
|
||||
client.addResponseInterceptor<HttpResponse>({
|
||||
fulfilled: async (response) => {
|
||||
const encryptKey = (response.headers ?? {})['encrypt-key'];
|
||||
if (encryptKey) {
|
||||
/** RSA私钥解密 拿到解密秘钥的base64 */
|
||||
const base64Str = asymmetricEncryption.decrypt(encryptKey);
|
||||
/** base64 解码 得到请求头的 AES 秘钥 */
|
||||
const secret = decodeBase64(base64Str);
|
||||
/** 使用aesKey解密 responseData */
|
||||
const decryptData = symmetricEncryption.decrypt(
|
||||
response.data as unknown as string,
|
||||
secret,
|
||||
);
|
||||
/** 赋值 需要转为对象 */
|
||||
response.data = JSON.parse(decryptData);
|
||||
}
|
||||
|
||||
const { isReturnNativeResponse, isTransformResponse } = response.config;
|
||||
// 是否返回原生响应 比如:需要获取响应时使用该属性
|
||||
if (isReturnNativeResponse) {
|
||||
return response;
|
||||
}
|
||||
// 不进行任何处理,直接返回
|
||||
// 用于页面代码可能需要直接获取code,data,message这些信息时开启
|
||||
if (!isTransformResponse) {
|
||||
/**
|
||||
* @warning 注意 微服务版本在401(网关)会返回text/plain的头 所以这里代码会无效
|
||||
* 我建议你改后端而不是前端来做兼容
|
||||
*/
|
||||
// json数据的判断
|
||||
if (response.headers['content-type']?.includes?.('application/json')) {
|
||||
/**
|
||||
* 需要判断是否登录超时/401
|
||||
* 执行登出操作
|
||||
*/
|
||||
const resp = response.data as unknown as HttpResponse;
|
||||
// 抛出异常 不再执行
|
||||
if (
|
||||
typeof resp === 'object' &&
|
||||
Reflect.has(resp, 'code') &&
|
||||
resp.code === UNAUTHORIZED_CODE
|
||||
) {
|
||||
handleUnauthorizedLogout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要判断下载二进制的情况 正常是返回二进制 报错会返回json
|
||||
* 当type为blob且content-type为application/json时 则判断已经下载出错
|
||||
*/
|
||||
if (response.config.responseType === 'blob') {
|
||||
// 这时候的data为blob类型
|
||||
const blob = response.data as unknown as Blob;
|
||||
// 拿到字符串转json对象
|
||||
response.data = JSON.parse(await blob.text());
|
||||
// 然后按正常逻辑执行下面的代码(判断业务状态码)
|
||||
} else {
|
||||
// 其他类型数据 直接返回
|
||||
return response.data;
|
||||
}
|
||||
} else {
|
||||
// 非json数据 直接返回 不做校验
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
const axiosResponseData = response.data;
|
||||
if (!axiosResponseData) {
|
||||
throw new Error($t('http.apiRequestFailed'));
|
||||
}
|
||||
|
||||
// 后端并没有采用严格的{code, msg, data}模式
|
||||
const { code, data, msg, ...other } = axiosResponseData;
|
||||
|
||||
// 业务状态码为200 则请求成功
|
||||
const hasSuccess =
|
||||
Reflect.has(axiosResponseData, 'code') &&
|
||||
code === BUSINESS_SUCCESS_CODE;
|
||||
if (hasSuccess) {
|
||||
let successMsg = msg;
|
||||
|
||||
if (isNull(successMsg) || isEmpty(successMsg)) {
|
||||
successMsg = $t(`http.operationSuccess`);
|
||||
}
|
||||
|
||||
if (response.config.successMessageMode === 'modal') {
|
||||
window.modal.success({
|
||||
content: successMsg,
|
||||
title: $t('http.successTip'),
|
||||
});
|
||||
} else if (response.config.successMessageMode === 'message') {
|
||||
window.message.success(successMsg);
|
||||
}
|
||||
// 分页情况下为code msg rows total 并没有data字段
|
||||
// 如果有data 直接返回data 没有data将剩余参数(...other)封装为data返回
|
||||
// 需要考虑data为null的情况(比如查询为空) 所以这里直接判断undefined
|
||||
if (data !== undefined) {
|
||||
return data;
|
||||
}
|
||||
// 没有data 将其他参数包装为data
|
||||
return other;
|
||||
}
|
||||
// 在此处根据自己项目的实际情况对不同的code执行不同的操作
|
||||
// 如果不希望中断当前请求,请return数据,否则直接抛出异常即可
|
||||
let timeoutMsg = '';
|
||||
switch (code) {
|
||||
// 登录超时
|
||||
case UNAUTHORIZED_CODE: {
|
||||
handleUnauthorizedLogout();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (msg) {
|
||||
timeoutMsg = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// errorMessageMode='modal'的时候会显示modal错误弹窗,而不是消息提示,用于一些比较重要的错误
|
||||
// errorMessageMode='none' 一般是调用时明确表示不希望自动弹出错误提示
|
||||
if (response.config.errorMessageMode === 'modal') {
|
||||
window.modal.error({
|
||||
content: timeoutMsg,
|
||||
title: $t('http.errorTip'),
|
||||
});
|
||||
} else if (response.config.errorMessageMode === 'message') {
|
||||
window.message.error(timeoutMsg);
|
||||
}
|
||||
|
||||
throw new Error(timeoutMsg || $t('http.apiRequestFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
// token过期的处理
|
||||
client.addResponseInterceptor(
|
||||
authenticateResponseInterceptor({
|
||||
client,
|
||||
doReAuthenticate,
|
||||
doRefreshToken,
|
||||
enableRefreshToken: preferences.app.enableRefreshToken,
|
||||
formatToken,
|
||||
}),
|
||||
);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
export const requestClient = createRequestClient(apiURL);
|
||||
|
||||
export const baseRequestClient = new RequestClient({ baseURL: apiURL });
|
||||
@@ -3,7 +3,7 @@ import type { Client } from './model';
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
clientChangeStatus = '/system/client/changeStatus',
|
||||
@@ -18,7 +18,7 @@ enum Api {
|
||||
* @returns 列表
|
||||
*/
|
||||
export function clientList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<Client>>(Api.clientList, { params });
|
||||
return alovaInstance.get<PageResult<Client>>(Api.clientList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ export function clientExport(data: Partial<Client>) {
|
||||
* @returns 详情
|
||||
*/
|
||||
export function clientInfo(id: ID) {
|
||||
return requestClient.get<Client>(`${Api.root}/${id}`);
|
||||
return alovaInstance.get<Client>(`${Api.root}/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ export function clientInfo(id: ID) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function clientAdd(data: Partial<Client>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ export function clientAdd(data: Partial<Client>) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function clientUpdate(data: Partial<Client>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ export function clientChangeStatus(data: any) {
|
||||
clientId: data.clientId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.clientChangeStatus, requestData);
|
||||
return alovaInstance.putWithMsg<void>(Api.clientChangeStatus, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,5 +71,5 @@ export function clientChangeStatus(data: any) {
|
||||
* @param ids id集合
|
||||
*/
|
||||
export function clientRemove(ids: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ids}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${ids}`);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { SysConfig } from './model';
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
configExport = '/system/config/export',
|
||||
@@ -19,11 +19,11 @@ enum Api {
|
||||
* @returns 列表
|
||||
*/
|
||||
export function configList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<SysConfig>>(Api.configList, { params });
|
||||
return alovaInstance.get<PageResult<SysConfig>>(Api.configList, { params });
|
||||
}
|
||||
|
||||
export function configInfo(configId: ID) {
|
||||
return requestClient.get<SysConfig>(`${Api.root}/${configId}`);
|
||||
return alovaInstance.get<SysConfig>(`${Api.root}/${configId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ export function configExport(data: Partial<SysConfig>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function configRefreshCache() {
|
||||
return requestClient.deleteWithMsg<void>(Api.configRefreshCache);
|
||||
return alovaInstance.deleteWithMsg<void>(Api.configRefreshCache);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ export function configRefreshCache() {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function configUpdate(data: Partial<SysConfig>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ export function configUpdate(data: Partial<SysConfig>) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function configAdd(data: Partial<SysConfig>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ export function configAdd(data: Partial<SysConfig>) {
|
||||
* @param configIds ids
|
||||
*/
|
||||
export function configRemove(configIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${configIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${configIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,5 +72,5 @@ export function configRemove(configIds: IDS) {
|
||||
* @returns value
|
||||
*/
|
||||
export function configInfoByKey(configKey: string) {
|
||||
return requestClient.get<string>(`${Api.configInfoByKey}/${configKey}`);
|
||||
return alovaInstance.get<string>(`${Api.configInfoByKey}/${configKey}`);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Dept } from './model';
|
||||
|
||||
import type { ID } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
deptList = '/system/dept/list',
|
||||
@@ -15,7 +15,7 @@ enum Api {
|
||||
* @returns list
|
||||
*/
|
||||
export function deptList(params?: { deptName?: string; status?: string }) {
|
||||
return requestClient.get<Dept[]>(Api.deptList, { params });
|
||||
return alovaInstance.get<Dept[]>(Api.deptList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ export function deptList(params?: { deptName?: string; status?: string }) {
|
||||
* @returns void
|
||||
*/
|
||||
export function deptNodeList(deptId: ID) {
|
||||
return requestClient.get<Dept[]>(`${Api.deptNodeInfo}/${deptId}`);
|
||||
return alovaInstance.get<Dept[]>(`${Api.deptNodeInfo}/${deptId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ export function deptNodeList(deptId: ID) {
|
||||
* @returns 部门信息
|
||||
*/
|
||||
export function deptInfo(deptId: ID) {
|
||||
return requestClient.get<Dept>(`${Api.root}/${deptId}`);
|
||||
return alovaInstance.get<Dept>(`${Api.root}/${deptId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ export function deptInfo(deptId: ID) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function deptAdd(data: Partial<Dept>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ export function deptAdd(data: Partial<Dept>) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function deptUpdate(data: Partial<Dept>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,5 +58,5 @@ export function deptUpdate(data: Partial<Dept>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function deptRemove(deptId: ID) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${deptId}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${deptId}`);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { DictData } from './dict-data-model';
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
dictDataExport = '/system/dict/data/export',
|
||||
@@ -17,7 +17,7 @@ enum Api {
|
||||
* @returns 字典数据
|
||||
*/
|
||||
export function dictDataInfo(dictType: string) {
|
||||
return requestClient.get<DictData[]>(`${Api.root}/type/${dictType}`);
|
||||
return alovaInstance.get<DictData[]>(`${Api.root}/type/${dictType}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ export function dictDataInfo(dictType: string) {
|
||||
* @returns 字典数据列表
|
||||
*/
|
||||
export function dictDataList(params?: PageQuery) {
|
||||
return requestClient.get<DictData[]>(Api.dictDataList, { params });
|
||||
return alovaInstance.get<DictData[]>(Api.dictDataList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ export function dictDataExport(data: Partial<DictData>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function dictDataRemove(dictIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${dictIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${dictIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ export function dictDataRemove(dictIds: IDS) {
|
||||
* @returns void
|
||||
*/
|
||||
export function dictDataAdd(data: Partial<DictData>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ export function dictDataAdd(data: Partial<DictData>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function dictDataUpdate(data: Partial<DictData>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,5 +71,5 @@ export function dictDataUpdate(data: Partial<DictData>) {
|
||||
* @returns 字典数据
|
||||
*/
|
||||
export function dictDetailInfo(dictCode: ID) {
|
||||
return requestClient.get<DictData>(`${Api.root}/${dictCode}`);
|
||||
return alovaInstance.get<DictData>(`${Api.root}/${dictCode}`);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { DictType } from './dict-type-model';
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
dictOptionSelectList = '/system/dict/type/optionselect',
|
||||
@@ -19,7 +19,7 @@ enum Api {
|
||||
* @returns list
|
||||
*/
|
||||
export function dictTypeList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<DictType>>(Api.dictTypeList, { params });
|
||||
return alovaInstance.get<PageResult<DictType>>(Api.dictTypeList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ export function dictTypeExport(data: Partial<DictType>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function dictTypeRemove(dictIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${dictIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${dictIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ export function dictTypeRemove(dictIds: IDS) {
|
||||
* @returns void
|
||||
*/
|
||||
export function refreshDictTypeCache() {
|
||||
return requestClient.deleteWithMsg<void>(Api.dictTypeRefreshCache);
|
||||
return alovaInstance.deleteWithMsg<void>(Api.dictTypeRefreshCache);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ export function refreshDictTypeCache() {
|
||||
* @returns void
|
||||
*/
|
||||
export function dictTypeAdd(data: Partial<DictType>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ export function dictTypeAdd(data: Partial<DictType>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function dictTypeUpdate(data: Partial<DictType>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ export function dictTypeUpdate(data: Partial<DictType>) {
|
||||
* @returns 信息
|
||||
*/
|
||||
export function dictTypeInfo(dictId: ID) {
|
||||
return requestClient.get<DictType>(`${Api.root}/${dictId}`);
|
||||
return alovaInstance.get<DictType>(`${Api.root}/${dictId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,5 +81,5 @@ export function dictTypeInfo(dictId: ID) {
|
||||
* @returns options
|
||||
*/
|
||||
export function dictOptionSelectList() {
|
||||
return requestClient.get<DictType[]>(Api.dictOptionSelectList);
|
||||
return alovaInstance.get<DictType[]>(Api.dictOptionSelectList);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Menu, MenuOption, MenuQuery, MenuResp } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
menuList = '/system/menu/list',
|
||||
@@ -18,7 +18,7 @@ enum Api {
|
||||
* @returns 列表
|
||||
*/
|
||||
export function menuList(params?: MenuQuery) {
|
||||
return requestClient.get<Menu[]>(Api.menuList, { params });
|
||||
return alovaInstance.get<Menu[]>(Api.menuList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ export function menuList(params?: MenuQuery) {
|
||||
* @returns 菜单详情
|
||||
*/
|
||||
export function menuInfo(menuId: ID) {
|
||||
return requestClient.get<Menu>(`${Api.root}/${menuId}`);
|
||||
return alovaInstance.get<Menu>(`${Api.root}/${menuId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ export function menuInfo(menuId: ID) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function menuAdd(data: Partial<Menu>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ export function menuAdd(data: Partial<Menu>) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function menuUpdate(data: Partial<Menu>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ export function menuUpdate(data: Partial<Menu>) {
|
||||
* @param menuIds ids
|
||||
*/
|
||||
export function menuRemove(menuIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${menuIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${menuIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ export function menuRemove(menuIds: IDS) {
|
||||
* @returns resp
|
||||
*/
|
||||
export function roleMenuTreeSelect(roleId: ID) {
|
||||
return requestClient.get<MenuResp>(`${Api.roleMenuTree}/${roleId}`);
|
||||
return alovaInstance.get<MenuResp>(`${Api.roleMenuTree}/${roleId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ export function roleMenuTreeSelect(roleId: ID) {
|
||||
* @returns []
|
||||
*/
|
||||
export function menuTreeSelect() {
|
||||
return requestClient.get<MenuOption[]>(Api.menuTreeSelect);
|
||||
return alovaInstance.get<MenuOption[]>(Api.menuTreeSelect);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ export function menuTreeSelect() {
|
||||
* @returns resp
|
||||
*/
|
||||
export function tenantPackageMenuTreeSelect(packageId: ID) {
|
||||
return requestClient.get<MenuResp>(
|
||||
return alovaInstance.get<MenuResp>(
|
||||
`${Api.tenantPackageMenuTreeselect}/${packageId}`,
|
||||
);
|
||||
}
|
||||
@@ -88,5 +88,5 @@ export function tenantPackageMenuTreeSelect(packageId: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function menuCascadeRemove(menuIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/cascade/${menuIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/cascade/${menuIds}`);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Notice } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
noticeList = '/system/notice/list',
|
||||
@@ -15,7 +15,7 @@ enum Api {
|
||||
* @returns 分页结果
|
||||
*/
|
||||
export function noticeList(params?: PageQuery) {
|
||||
return requestClient.get<Notice[]>(Api.noticeList, { params });
|
||||
return alovaInstance.get<Notice[]>(Api.noticeList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ export function noticeList(params?: PageQuery) {
|
||||
* @returns 详情
|
||||
*/
|
||||
export function noticeInfo(noticeId: ID) {
|
||||
return requestClient.get<Notice>(`${Api.root}/${noticeId}`);
|
||||
return alovaInstance.get<Notice>(`${Api.root}/${noticeId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ export function noticeInfo(noticeId: ID) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function noticeAdd(data: Partial<Notice>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ export function noticeAdd(data: Partial<Notice>) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function noticeUpdate(data: any) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,5 +48,5 @@ export function noticeUpdate(data: any) {
|
||||
* @param noticeIds ids
|
||||
*/
|
||||
export function noticeRemove(noticeIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${noticeIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${noticeIds}`);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { OssConfig } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
ossConfigChangeStatus = '/resource/oss/config/changeStatus',
|
||||
@@ -12,27 +12,27 @@ enum Api {
|
||||
|
||||
// 获取OSS配置列表
|
||||
export function ossConfigList(params?: PageQuery) {
|
||||
return requestClient.get<OssConfig[]>(Api.ossConfigList, { params });
|
||||
return alovaInstance.get<OssConfig[]>(Api.ossConfigList, { params });
|
||||
}
|
||||
|
||||
// 获取OSS配置的信息
|
||||
export function ossConfigInfo(ossConfigId: ID) {
|
||||
return requestClient.get<OssConfig>(`${Api.root}/${ossConfigId}`);
|
||||
return alovaInstance.get<OssConfig>(`${Api.root}/${ossConfigId}`);
|
||||
}
|
||||
|
||||
// 添加新的OSS配置
|
||||
export function ossConfigAdd(data: Partial<OssConfig>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
// 更新现有的OSS配置
|
||||
export function ossConfigUpdate(data: Partial<OssConfig>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
// 删除OSS配置
|
||||
export function ossConfigRemove(ossConfigIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ossConfigIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${ossConfigIds}`);
|
||||
}
|
||||
|
||||
// 更改OSS配置的状态
|
||||
@@ -42,5 +42,5 @@ export function ossConfigChangeStatus(data: any) {
|
||||
status: data.status,
|
||||
configKey: data.configKey,
|
||||
};
|
||||
return requestClient.putWithMsg(Api.ossConfigChangeStatus, requestData);
|
||||
return alovaInstance.putWithMsg(Api.ossConfigChangeStatus, requestData);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import type { AxiosRequestConfig } from '@vben/request';
|
||||
|
||||
import type { OssFile } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { ContentTypeEnum } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
ossDownload = '/resource/oss/download',
|
||||
@@ -21,7 +19,7 @@ enum Api {
|
||||
* @returns 分页
|
||||
*/
|
||||
export function ossList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<OssFile>>(Api.ossList, { params });
|
||||
return alovaInstance.get<PageResult<OssFile>>(Api.ossList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +28,7 @@ export function ossList(params?: PageQuery) {
|
||||
* @returns 信息数组
|
||||
*/
|
||||
export function ossInfo(ossIds: ID | IDS) {
|
||||
return requestClient.get<OssFile[]>(`${Api.ossInfo}/${ossIds}`);
|
||||
return alovaInstance.get<OssFile[]>(`${Api.ossInfo}/${ossIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +39,7 @@ export function ossInfo(ossIds: ID | IDS) {
|
||||
export function ossUpload(file: Blob | File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return requestClient.postWithMsg(Api.ossUpload, formData, {
|
||||
return alovaInstance.postWithMsg(Api.ossUpload, formData, {
|
||||
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
|
||||
timeout: 30 * 1000,
|
||||
});
|
||||
@@ -50,18 +48,13 @@ export function ossUpload(file: Blob | File) {
|
||||
/**
|
||||
* 下载文件 返回为二进制
|
||||
* @param ossId ossId
|
||||
* @param onDownloadProgress 下载进度(可选)
|
||||
* @returns blob
|
||||
*/
|
||||
export function ossDownload(
|
||||
ossId: ID,
|
||||
onDownloadProgress?: AxiosRequestConfig['onDownloadProgress'],
|
||||
) {
|
||||
return requestClient.get<Blob>(`${Api.ossDownload}/${ossId}`, {
|
||||
export function ossDownload(ossId: ID) {
|
||||
return alovaInstance.get<Blob>(`${Api.ossDownload}/${ossId}`, {
|
||||
responseType: 'blob',
|
||||
timeout: 30 * 1000,
|
||||
isTransformResponse: false,
|
||||
onDownloadProgress,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,7 +67,7 @@ export function ossDownload(
|
||||
* @returns void
|
||||
*/
|
||||
export function checkLoginBeforeDownload() {
|
||||
return requestClient.get<OssFile[]>(`${Api.ossInfo}/1`, {
|
||||
return alovaInstance.get<OssFile[]>(`${Api.ossInfo}/1`, {
|
||||
errorMessageMode: 'none',
|
||||
});
|
||||
}
|
||||
@@ -85,5 +78,5 @@ export function checkLoginBeforeDownload() {
|
||||
* @returns void
|
||||
*/
|
||||
export function ossRemove(ossIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ossIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${ossIds}`);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Post } from './model';
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
postExport = '/system/post/export',
|
||||
@@ -19,7 +19,7 @@ enum Api {
|
||||
* @returns Post[]
|
||||
*/
|
||||
export function postList(params?: PageQuery) {
|
||||
return requestClient.get<Post[]>(Api.postList, { params });
|
||||
return alovaInstance.get<Post[]>(Api.postList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ export function postExport(data: Partial<Post>) {
|
||||
* @returns 岗位信息
|
||||
*/
|
||||
export function postInfo(postId: ID) {
|
||||
return requestClient.get<Post>(`${Api.root}/${postId}`);
|
||||
return alovaInstance.get<Post>(`${Api.root}/${postId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ export function postInfo(postId: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function postAdd(data: Partial<Post>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ export function postAdd(data: Partial<Post>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function postUpdate(data: Partial<Post>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ export function postUpdate(data: Partial<Post>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function postRemove(postIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${postIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${postIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ export function postRemove(postIds: IDS) {
|
||||
* @returns 岗位
|
||||
*/
|
||||
export function postOptionSelect(deptId: ID) {
|
||||
return requestClient.get<Post[]>(Api.postSelect, { params: { deptId } });
|
||||
return alovaInstance.get<Post[]>(Api.postSelect, { params: { deptId } });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,5 +81,5 @@ export function postOptionSelect(deptId: ID) {
|
||||
* @returns 部门树
|
||||
*/
|
||||
export function postDeptTreeSelect() {
|
||||
return requestClient.get<DeptTree[]>('/system/post/deptTree');
|
||||
return alovaInstance.get<DeptTree[]>('/system/post/deptTree');
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { FileCallBack, UpdatePasswordParam, UserProfile } from './model';
|
||||
|
||||
import { buildUUID } from '@vben/utils';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
root = '/system/user/profile',
|
||||
@@ -15,7 +15,7 @@ enum Api {
|
||||
* @returns userInformation
|
||||
*/
|
||||
export function userProfile() {
|
||||
return requestClient.get<UserProfile>(Api.root);
|
||||
return alovaInstance.get<UserProfile>(Api.root);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ export function userProfile() {
|
||||
* @returns void
|
||||
*/
|
||||
export function userProfileUpdate(data: any) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ export function userProfileUpdate(data: any) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userUpdatePassword(data: UpdatePasswordParam) {
|
||||
return requestClient.putWithMsg<void>(Api.updatePassword, data, {
|
||||
return alovaInstance.putWithMsg<void>(Api.updatePassword, data, {
|
||||
encrypt: true,
|
||||
});
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export function userUpdateAvatar(fileCallback: FileCallBack) {
|
||||
file = filename
|
||||
? new File([file], filename)
|
||||
: new File([file], `${buildUUID()}.png`);
|
||||
return requestClient.post(
|
||||
return alovaInstance.post(
|
||||
Api.updateAvatar,
|
||||
{
|
||||
avatarfile: file,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { DeptResp, Role } from './model';
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
roleAllocatedList = '/system/role/authUser/allocatedList',
|
||||
@@ -27,7 +27,7 @@ enum Api {
|
||||
* @returns 分页列表
|
||||
*/
|
||||
export function roleList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<Role>>(Api.roleList, { params });
|
||||
return alovaInstance.get<PageResult<Role>>(Api.roleList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ export function roleExport(data: Partial<Role>) {
|
||||
* @returns 角色信息
|
||||
*/
|
||||
export function roleInfo(roleId: ID) {
|
||||
return requestClient.get<Role>(`${Api.root}/${roleId}`);
|
||||
return alovaInstance.get<Role>(`${Api.root}/${roleId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ export function roleInfo(roleId: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleAdd(data: Partial<Role>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ export function roleAdd(data: Partial<Role>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleUpdate(data: Partial<Role>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ export function roleChangeStatus(data: Partial<Role>) {
|
||||
roleId: data.roleId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.roleChangeStatus, requestData);
|
||||
return alovaInstance.putWithMsg<void>(Api.roleChangeStatus, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ export function roleChangeStatus(data: Partial<Role>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleRemove(roleIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${roleIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${roleIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,14 +94,14 @@ export function roleRemove(roleIds: IDS) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleDataScope(data: any) {
|
||||
return requestClient.putWithMsg<void>(Api.roleDataScope, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.roleDataScope, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 全局并没有用到这个方法
|
||||
*/
|
||||
export function roleOptionSelect(params?: any) {
|
||||
return requestClient.get(Api.roleOptionSelect, { params });
|
||||
return alovaInstance.get(Api.roleOptionSelect, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +110,7 @@ export function roleOptionSelect(params?: any) {
|
||||
* @returns 分页
|
||||
*/
|
||||
export function roleAllocatedList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<User>>(Api.roleAllocatedList, { params });
|
||||
return alovaInstance.get<PageResult<User>>(Api.roleAllocatedList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ export function roleAllocatedList(params?: PageQuery) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleUnallocatedList(params: any) {
|
||||
return requestClient.get<PageResult<User>>(Api.roleUnallocatedList, {
|
||||
return alovaInstance.get<PageResult<User>>(Api.roleUnallocatedList, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
@@ -129,7 +129,7 @@ export function roleUnallocatedList(params: any) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleAuthCancel(data: { roleId: ID; userId: ID }) {
|
||||
return requestClient.putWithMsg<void>(Api.roleAuthCancel, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.roleAuthCancel, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +139,7 @@ export function roleAuthCancel(data: { roleId: ID; userId: ID }) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleAuthCancelAll(roleId: ID, userIds: IDS) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
return alovaInstance.putWithMsg<void>(
|
||||
`${Api.roleAuthCancelAll}?roleId=${roleId}&userIds=${userIds.join(',')}`,
|
||||
);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export function roleAuthCancelAll(roleId: ID, userIds: IDS) {
|
||||
* @returns void
|
||||
*/
|
||||
export function roleSelectAll(roleId: ID, userIds: IDS) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
return alovaInstance.putWithMsg<void>(
|
||||
`${Api.roleAuthSelectAll}?roleId=${roleId}&userIds=${userIds.join(',')}`,
|
||||
);
|
||||
}
|
||||
@@ -162,5 +162,5 @@ export function roleSelectAll(roleId: ID, userIds: IDS) {
|
||||
* @returns DeptResp
|
||||
*/
|
||||
export function roleDeptTree(roleId: ID) {
|
||||
return requestClient.get<DeptResp>(`${Api.roleDeptTree}/${roleId}`);
|
||||
return alovaInstance.get<DeptResp>(`${Api.roleDeptTree}/${roleId}`);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { SocialInfo } from './model';
|
||||
|
||||
import type { ID } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
root = '/system/social',
|
||||
@@ -14,12 +14,12 @@ enum Api {
|
||||
* @returns info
|
||||
*/
|
||||
export function socialList() {
|
||||
return requestClient.get<SocialInfo[]>(Api.socialList);
|
||||
return alovaInstance.get<SocialInfo[]>(Api.socialList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 并没有用到这个方法
|
||||
*/
|
||||
export function socialInfo(id: ID) {
|
||||
return requestClient.get(`${Api.root}/${id}`);
|
||||
return alovaInstance.get(`${Api.root}/${id}`);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { TenantPackage } from './model';
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
packageChangeStatus = '/system/tenant/package/changeStatus',
|
||||
@@ -19,7 +19,7 @@ enum Api {
|
||||
* @returns 分页列表
|
||||
*/
|
||||
export function packageList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TenantPackage>>(Api.packageList, {
|
||||
return alovaInstance.get<PageResult<TenantPackage>>(Api.packageList, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export function packageList(params?: PageQuery) {
|
||||
* @returns 下拉框
|
||||
*/
|
||||
export function packageSelectList() {
|
||||
return requestClient.get<TenantPackage[]>(Api.packageSelectList);
|
||||
return alovaInstance.get<TenantPackage[]>(Api.packageSelectList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ export function packageExport(data: Partial<TenantPackage>) {
|
||||
* @returns 信息
|
||||
*/
|
||||
export function packageInfo(id: ID) {
|
||||
return requestClient.get<TenantPackage>(`${Api.root}/${id}`);
|
||||
return alovaInstance.get<TenantPackage>(`${Api.root}/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ export function packageInfo(id: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function packageAdd(data: Partial<TenantPackage>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ export function packageAdd(data: Partial<TenantPackage>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function packageUpdate(data: Partial<TenantPackage>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ export function packageChangeStatus(data: Partial<TenantPackage>) {
|
||||
packageId: data.packageId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.packageChangeStatus, packageId);
|
||||
return alovaInstance.putWithMsg<void>(Api.packageChangeStatus, packageId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,5 +87,5 @@ export function packageChangeStatus(data: Partial<TenantPackage>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function packageRemove(ids: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ids}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${ids}`);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Tenant } from './model';
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
dictSync = '/system/tenant/syncTenantDict',
|
||||
@@ -22,7 +22,7 @@ enum Api {
|
||||
* @returns 分页
|
||||
*/
|
||||
export function tenantList(params?: PageQuery) {
|
||||
return requestClient.get<Tenant[]>(Api.tenantList, { params });
|
||||
return alovaInstance.get<Tenant[]>(Api.tenantList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ export function tenantExport(data: Partial<Tenant>) {
|
||||
* @returns 租户信息
|
||||
*/
|
||||
export function tenantInfo(id: ID) {
|
||||
return requestClient.get<Tenant>(`${Api.root}/${id}`);
|
||||
return alovaInstance.get<Tenant>(`${Api.root}/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ export function tenantInfo(id: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantAdd(data: Partial<Tenant>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data, { encrypt: true });
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data, { encrypt: true });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ export function tenantAdd(data: Partial<Tenant>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantUpdate(data: Partial<Tenant>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ export function tenantStatusChange(data: Partial<Tenant>) {
|
||||
tenantId: data.tenantId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg(Api.tenantStatus, requestData);
|
||||
return alovaInstance.putWithMsg(Api.tenantStatus, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ export function tenantStatusChange(data: Partial<Tenant>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantRemove(ids: IDS) {
|
||||
return requestClient.deleteWithMsg(`${Api.root}/${ids}`);
|
||||
return alovaInstance.deleteWithMsg(`${Api.root}/${ids}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ export function tenantRemove(ids: IDS) {
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantDynamicToggle(tenantId: string) {
|
||||
return requestClient.get<void>(`${Api.tenantDynamic}/${tenantId}`);
|
||||
return alovaInstance.get<void>(`${Api.tenantDynamic}/${tenantId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ export function tenantDynamicToggle(tenantId: string) {
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantDynamicClear() {
|
||||
return requestClient.get<void>(Api.tenantDynamicClear);
|
||||
return alovaInstance.get<void>(Api.tenantDynamicClear);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ export function tenantDynamicClear() {
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantSyncPackage(tenantId: string, packageId: string) {
|
||||
return requestClient.get<void>(Api.tenantSyncPackage, {
|
||||
return alovaInstance.get<void>(Api.tenantSyncPackage, {
|
||||
params: { packageId, tenantId },
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
@@ -120,7 +120,7 @@ export function tenantSyncPackage(tenantId: string, packageId: string) {
|
||||
* @returns void
|
||||
*/
|
||||
export function dictSyncTenant(tenantId?: string) {
|
||||
return requestClient.get<void>(Api.dictSync, {
|
||||
return alovaInstance.get<void>(Api.dictSync, {
|
||||
params: { tenantId },
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
@@ -131,7 +131,7 @@ export function dictSyncTenant(tenantId?: string) {
|
||||
* @returns void
|
||||
*/
|
||||
export function syncTenantConfig() {
|
||||
return requestClient.get<void>('/system/tenant/syncTenantConfig', {
|
||||
return alovaInstance.get<void>('/system/tenant/syncTenantConfig', {
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport, ContentTypeEnum } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
deptTree = '/system/user/deptTree',
|
||||
@@ -30,7 +30,7 @@ enum Api {
|
||||
* @returns User
|
||||
*/
|
||||
export function userList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<User>>(Api.userList, { params });
|
||||
return alovaInstance.get<PageResult<User>>(Api.userList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ export function userExport(data: Partial<User>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userImportData(data: UserImportParam) {
|
||||
return requestClient.post<{ code: number; msg: string }>(
|
||||
return alovaInstance.post<{ code: number; msg: string }>(
|
||||
Api.userImport,
|
||||
data,
|
||||
{
|
||||
@@ -65,7 +65,7 @@ export function userImportData(data: UserImportParam) {
|
||||
* @returns blob
|
||||
*/
|
||||
export function downloadImportTemplate() {
|
||||
return requestClient.post<Blob>(
|
||||
return alovaInstance.post<Blob>(
|
||||
Api.userImportTemplate,
|
||||
{},
|
||||
{
|
||||
@@ -83,7 +83,7 @@ export function downloadImportTemplate() {
|
||||
*/
|
||||
export function findUserInfo(userId?: ID) {
|
||||
const url = userId ? `${Api.root}/${userId}` : `${Api.root}/`;
|
||||
return requestClient.get<UserInfoResponse>(url);
|
||||
return alovaInstance.get<UserInfoResponse>(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ export function findUserInfo(userId?: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userAdd(data: Partial<User>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ export function userAdd(data: Partial<User>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userUpdate(data: Partial<User>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
return alovaInstance.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +114,7 @@ export function userStatusChange(data: Partial<User>) {
|
||||
userId: data.userId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.userStatusChange, requestData);
|
||||
return alovaInstance.putWithMsg<void>(Api.userStatusChange, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +123,7 @@ export function userStatusChange(data: Partial<User>) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userRemove(userIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${userIds}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`${Api.root}/${userIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ export function userRemove(userIds: IDS) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userResetPassword(data: ResetPwdParam) {
|
||||
return requestClient.putWithMsg<void>(Api.userResetPassword, data, {
|
||||
return alovaInstance.putWithMsg<void>(Api.userResetPassword, data, {
|
||||
encrypt: true,
|
||||
});
|
||||
}
|
||||
@@ -143,7 +143,7 @@ export function userResetPassword(data: ResetPwdParam) {
|
||||
* @returns void
|
||||
*/
|
||||
export function getUserAuthRole(userId: ID) {
|
||||
return requestClient.get(`${Api.userAuthRole}/${userId}`);
|
||||
return alovaInstance.get(`${Api.userAuthRole}/${userId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +152,7 @@ export function getUserAuthRole(userId: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function userAuthRoleUpdate(userId: ID, roleIds: number[]) {
|
||||
return requestClient.putWithMsg(Api.userAuthRole, { roleIds, userId });
|
||||
return alovaInstance.putWithMsg(Api.userAuthRole, { roleIds, userId });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,12 +160,12 @@ export function userAuthRoleUpdate(userId: ID, roleIds: number[]) {
|
||||
* @returns 部门树数组
|
||||
*/
|
||||
export function getDeptTree() {
|
||||
return requestClient.get<DeptTree[]>(Api.deptTree);
|
||||
return alovaInstance.get<DeptTree[]>(Api.deptTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下的所有用户信息
|
||||
*/
|
||||
export function listUserByDeptId(deptId: ID) {
|
||||
return requestClient.get<User[]>(`${Api.listDeptUsers}/${deptId}`);
|
||||
return alovaInstance.get<User[]>(`${Api.listDeptUsers}/${deptId}`);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { GenInfo } from './model';
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { ContentTypeEnum } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
enum Api {
|
||||
batchGenCode = '/tool/gen/batchGenCode',
|
||||
@@ -20,22 +20,22 @@ enum Api {
|
||||
}
|
||||
// 查询代码生成列表
|
||||
export function generatedList(params?: PageQuery) {
|
||||
return requestClient.get(Api.generatedList, { params });
|
||||
return alovaInstance.get(Api.generatedList, { params });
|
||||
}
|
||||
|
||||
// 修改代码生成业务
|
||||
export function genInfo(tableId: ID) {
|
||||
return requestClient.get<GenInfo>(`${Api.root}/${tableId}`);
|
||||
return alovaInstance.get<GenInfo>(`${Api.root}/${tableId}`);
|
||||
}
|
||||
|
||||
// 查询数据库列表
|
||||
export function readyToGenList(params?: PageQuery) {
|
||||
return requestClient.get(Api.readyToGenList, { params });
|
||||
return alovaInstance.get(Api.readyToGenList, { params });
|
||||
}
|
||||
|
||||
// 查询数据表字段列表
|
||||
export function columnList(tableId: ID) {
|
||||
return requestClient.get(`${Api.columnList}/${tableId}`);
|
||||
return alovaInstance.get(`${Api.columnList}/${tableId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ export function columnList(tableId: ID) {
|
||||
* @returns ret
|
||||
*/
|
||||
export function importTable(tables: string | string[], dataName: string) {
|
||||
return requestClient.postWithMsg(
|
||||
return alovaInstance.postWithMsg(
|
||||
Api.importTable,
|
||||
{ dataName, tables },
|
||||
{
|
||||
@@ -56,41 +56,41 @@ export function importTable(tables: string | string[], dataName: string) {
|
||||
|
||||
// 修改保存代码生成业务
|
||||
export function editSave(data: any) {
|
||||
return requestClient.putWithMsg(Api.root, data);
|
||||
return alovaInstance.putWithMsg(Api.root, data);
|
||||
}
|
||||
|
||||
// 删除代码生成
|
||||
export function genRemove(tableIds: IDS) {
|
||||
return requestClient.deleteWithMsg(`${Api.root}/${tableIds}`);
|
||||
return alovaInstance.deleteWithMsg(`${Api.root}/${tableIds}`);
|
||||
}
|
||||
|
||||
// 预览代码
|
||||
export function previewCode(tableId: ID) {
|
||||
return requestClient.get<{ [key: string]: string }>(
|
||||
return alovaInstance.get<{ [key: string]: string }>(
|
||||
`${Api.preview}/${tableId}`,
|
||||
);
|
||||
}
|
||||
|
||||
// 生成代码(下载方式)
|
||||
export function genDownload(tableId: ID) {
|
||||
return requestClient.get<Blob>(`${Api.download}/${tableId}`);
|
||||
return alovaInstance.get<Blob>(`${Api.download}/${tableId}`);
|
||||
}
|
||||
|
||||
// 生成代码(自定义路径)
|
||||
export function genWithPath(tableId: ID) {
|
||||
return requestClient.get<void>(`${Api.genCode}/${tableId}`);
|
||||
return alovaInstance.get<void>(`${Api.genCode}/${tableId}`);
|
||||
}
|
||||
|
||||
// 同步数据库
|
||||
export function syncDb(tableId: ID) {
|
||||
return requestClient.get(`${Api.syncDb}/${tableId}`, {
|
||||
return alovaInstance.get(`${Api.syncDb}/${tableId}`, {
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
}
|
||||
|
||||
// 批量生成代码
|
||||
export function batchGenCode(tableIdStr: ID | IDS) {
|
||||
return requestClient.get<Blob>(Api.batchGenCode, {
|
||||
return alovaInstance.get<Blob>(Api.batchGenCode, {
|
||||
isTransformResponse: false,
|
||||
params: { tableIdStr },
|
||||
responseType: 'blob',
|
||||
@@ -99,5 +99,5 @@ export function batchGenCode(tableIdStr: ID | IDS) {
|
||||
|
||||
// 查询数据源名称列表
|
||||
export function getDataSourceNames() {
|
||||
return requestClient.get<string[]>(Api.dataSourceNames);
|
||||
return alovaInstance.get<string[]>(Api.dataSourceNames);
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ import type {
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* 获取流程分类树列表
|
||||
* @returns tree
|
||||
*/
|
||||
export function categoryTree() {
|
||||
return requestClient.get<CategoryTree[]>('/workflow/category/categoryTree');
|
||||
return alovaInstance.get<CategoryTree[]>('/workflow/category/categoryTree');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ export function categoryTree() {
|
||||
* @returns 流程分类列表
|
||||
*/
|
||||
export function categoryList(params?: CategoryQuery) {
|
||||
return requestClient.get<CategoryVO[]>(`/workflow/category/list`, { params });
|
||||
return alovaInstance.get<CategoryVO[]>(`/workflow/category/list`, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ export function categoryList(params?: CategoryQuery) {
|
||||
* @returns 流程分类详情
|
||||
*/
|
||||
export function categoryInfo(id: ID) {
|
||||
return requestClient.get<CategoryVO>(`/workflow/category/${id}`);
|
||||
return alovaInstance.get<CategoryVO>(`/workflow/category/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ export function categoryInfo(id: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function categoryAdd(data: CategoryForm) {
|
||||
return requestClient.postWithMsg<void>('/workflow/category', data);
|
||||
return alovaInstance.postWithMsg<void>('/workflow/category', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ export function categoryAdd(data: CategoryForm) {
|
||||
* @returns void
|
||||
*/
|
||||
export function categoryUpdate(data: CategoryForm) {
|
||||
return requestClient.putWithMsg<void>('/workflow/category', data);
|
||||
return alovaInstance.putWithMsg<void>('/workflow/category', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,5 +59,5 @@ export function categoryUpdate(data: CategoryForm) {
|
||||
* @returns void
|
||||
*/
|
||||
export function categoryRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/workflow/category/${id}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`/workflow/category/${id}`);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { ProcessDefinition } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* 全部的流程定义
|
||||
@@ -10,7 +10,7 @@ import { requestClient } from '#/api/request';
|
||||
* @returns 分页
|
||||
*/
|
||||
export function workflowDefinitionList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<ProcessDefinition>>(
|
||||
return alovaInstance.get<PageResult<ProcessDefinition>>(
|
||||
'/workflow/definition/list',
|
||||
{ params },
|
||||
);
|
||||
@@ -22,7 +22,7 @@ export function workflowDefinitionList(params?: PageQuery) {
|
||||
* @returns 分页
|
||||
*/
|
||||
export function unPublishList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<ProcessDefinition>>(
|
||||
return alovaInstance.get<PageResult<ProcessDefinition>>(
|
||||
'/workflow/definition/unPublishList',
|
||||
{ params },
|
||||
);
|
||||
@@ -34,7 +34,7 @@ export function unPublishList(params?: PageQuery) {
|
||||
* @returns ProcessDefinition[]
|
||||
*/
|
||||
export function getHisListByKey(flowCode: string) {
|
||||
return requestClient.get<ProcessDefinition[]>(
|
||||
return alovaInstance.get<ProcessDefinition[]>(
|
||||
`/workflow/definition/getHisListByKey/${flowCode}`,
|
||||
);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export function getHisListByKey(flowCode: string) {
|
||||
* @returns ProcessDefinition
|
||||
*/
|
||||
export function workflowDefinitionInfo(id: ID) {
|
||||
return requestClient.get<ProcessDefinition>(`/workflow/definition/${id}`);
|
||||
return alovaInstance.get<ProcessDefinition>(`/workflow/definition/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ export function workflowDefinitionInfo(id: ID) {
|
||||
* @param data
|
||||
*/
|
||||
export function workflowDefinitionAdd(data: any) {
|
||||
return requestClient.postWithMsg<void>('/workflow/definition', data);
|
||||
return alovaInstance.postWithMsg<void>('/workflow/definition', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ export function workflowDefinitionAdd(data: any) {
|
||||
* @param data
|
||||
*/
|
||||
export function workflowDefinitionUpdate(data: any) {
|
||||
return requestClient.putWithMsg<void>('/workflow/definition', data);
|
||||
return alovaInstance.putWithMsg<void>('/workflow/definition', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ export function workflowDefinitionUpdate(data: any) {
|
||||
* @returns boolean
|
||||
*/
|
||||
export function workflowDefinitionPublish(id: ID) {
|
||||
return requestClient.putWithMsg<boolean>(
|
||||
return alovaInstance.putWithMsg<boolean>(
|
||||
`/workflow/definition/publish/${id}`,
|
||||
);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export function workflowDefinitionPublish(id: ID) {
|
||||
* @returns boolean
|
||||
*/
|
||||
export function workflowDefinitionUnPublish(id: ID) {
|
||||
return requestClient.putWithMsg<boolean>(
|
||||
return alovaInstance.putWithMsg<boolean>(
|
||||
`/workflow/definition/unPublish/${id}`,
|
||||
);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ export function workflowDefinitionUnPublish(id: ID) {
|
||||
* @param ids idList
|
||||
*/
|
||||
export function workflowDefinitionDelete(ids: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/workflow/definition/${ids}`);
|
||||
return alovaInstance.deleteWithMsg<void>(`/workflow/definition/${ids}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ export function workflowDefinitionDelete(ids: IDS) {
|
||||
* @param id id
|
||||
*/
|
||||
export function workflowDefinitionCopy(id: ID) {
|
||||
return requestClient.postWithMsg<void>(`/workflow/definition/copy/${id}`);
|
||||
return alovaInstance.postWithMsg<void>(`/workflow/definition/copy/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +110,7 @@ export function workflowDefinitionImport(data: {
|
||||
category: ID;
|
||||
file: Blob | File;
|
||||
}) {
|
||||
return requestClient.postWithMsg<boolean>(
|
||||
return alovaInstance.postWithMsg<boolean>(
|
||||
'/workflow/definition/importDef',
|
||||
data,
|
||||
{ headers: { 'Content-Type': 'multipart/form-data' } },
|
||||
@@ -123,7 +123,7 @@ export function workflowDefinitionImport(data: {
|
||||
* @returns blob
|
||||
*/
|
||||
export function workflowDefinitionExport(id: ID) {
|
||||
return requestClient.postWithMsg<Blob>(
|
||||
return alovaInstance.postWithMsg<Blob>(
|
||||
`/workflow/definition/exportDef/${id}`,
|
||||
{},
|
||||
{
|
||||
@@ -139,7 +139,7 @@ export function workflowDefinitionExport(id: ID) {
|
||||
* @returns xml
|
||||
*/
|
||||
export function workflowDefinitionXml(id: ID) {
|
||||
return requestClient.get<string>(`/workflow/definition/xmlString/${id}`);
|
||||
return alovaInstance.get<string>(`/workflow/definition/xmlString/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +149,7 @@ export function workflowDefinitionXml(id: ID) {
|
||||
* @returns boolean
|
||||
*/
|
||||
export function workflowDefinitionActive(id: ID, active: boolean) {
|
||||
return requestClient.putWithMsg<boolean>(
|
||||
return alovaInstance.putWithMsg<boolean>(
|
||||
`/workflow/definition/active/${id}?active=${active}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ import type { FlowInfoResponse, FlowInstanceVariableResp } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* @param businessId 业务ID
|
||||
* @returns TaskInfo
|
||||
*/
|
||||
export function getTaskByBusinessId(businessId: string) {
|
||||
return requestClient.get<TaskInfo>(
|
||||
return alovaInstance.get<TaskInfo>(
|
||||
`/workflow/instance/getInfo/${businessId}`,
|
||||
);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export function getTaskByBusinessId(businessId: string) {
|
||||
* @returns
|
||||
*/
|
||||
export function pageByRunning(params?: PageQuery) {
|
||||
return requestClient.get('/workflow/instance/pageByRunning', { params });
|
||||
return alovaInstance.get('/workflow/instance/pageByRunning', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ export function pageByRunning(params?: PageQuery) {
|
||||
* @returns
|
||||
*/
|
||||
export function pageByFinish(params?: PageQuery) {
|
||||
return requestClient.get('/workflow/instance/pageByFinish', { params });
|
||||
return alovaInstance.get('/workflow/instance/pageByFinish', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,7 +38,7 @@ export function pageByFinish(params?: PageQuery) {
|
||||
* @param businessIds 业务id
|
||||
*/
|
||||
export function deleteByBusinessIds(businessIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(
|
||||
return alovaInstance.deleteWithMsg<void>(
|
||||
`/workflow/instance/deleteByBusinessIds${businessIds}`,
|
||||
);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export function deleteByBusinessIds(businessIds: IDS) {
|
||||
* @param instanceIds 实例id
|
||||
*/
|
||||
export function deleteByInstanceIds(instanceIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(
|
||||
return alovaInstance.deleteWithMsg<void>(
|
||||
`/workflow/instance/deleteByInstanceIds/${instanceIds}`,
|
||||
);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export function deleteByInstanceIds(instanceIds: IDS) {
|
||||
* @param data
|
||||
*/
|
||||
export function cancelProcessApply(data: { businessId: ID; message?: string }) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
return alovaInstance.putWithMsg<void>(
|
||||
'/workflow/instance/cancelProcessApply',
|
||||
data,
|
||||
);
|
||||
@@ -70,7 +70,7 @@ export function cancelProcessApply(data: { businessId: ID; message?: string }) {
|
||||
* @param active
|
||||
*/
|
||||
export function workflowInstanceActive(instanceId: ID, active: boolean) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
return alovaInstance.putWithMsg<void>(
|
||||
`/workflow/instance/active/${instanceId}?active=${active}`,
|
||||
);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export function workflowInstanceActive(instanceId: ID, active: boolean) {
|
||||
* @returns PageResult<Flow>
|
||||
*/
|
||||
export function pageByCurrent(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TaskInfo>>(
|
||||
return alovaInstance.get<PageResult<TaskInfo>>(
|
||||
'/workflow/instance/pageByCurrent',
|
||||
{ params },
|
||||
);
|
||||
@@ -93,7 +93,7 @@ export function pageByCurrent(params?: PageQuery) {
|
||||
* @returns 流程图,流程记录
|
||||
*/
|
||||
export function flowInfo(businessId: string) {
|
||||
return requestClient.get<FlowInfoResponse>(
|
||||
return alovaInstance.get<FlowInfoResponse>(
|
||||
`/workflow/instance/flowHisTaskList/${businessId}`,
|
||||
);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ export function flowInfo(businessId: string) {
|
||||
* @returns Map<string,any>
|
||||
*/
|
||||
export function instanceVariable(instanceId: string) {
|
||||
return requestClient.get<FlowInstanceVariableResp>(
|
||||
return alovaInstance.get<FlowInstanceVariableResp>(
|
||||
`/workflow/instance/instanceVariable/${instanceId}`,
|
||||
);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export function workflowInstanceInvalid(data: {
|
||||
comment?: string;
|
||||
id: string;
|
||||
}) {
|
||||
return requestClient.postWithMsg<void>('/workflow/instance/invalid', data);
|
||||
return alovaInstance.postWithMsg<void>('/workflow/instance/invalid', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ export function updateFlowVariable(data: {
|
||||
key: string;
|
||||
value: any;
|
||||
}) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
return alovaInstance.putWithMsg<void>(
|
||||
'/workflow/instance/updateVariable',
|
||||
data,
|
||||
);
|
||||
|
||||
@@ -2,24 +2,24 @@ import type { Spel } from './model';
|
||||
|
||||
import type { ID, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
export function spelList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<Spel>>('/workflow/spel/list', { params });
|
||||
return alovaInstance.get<PageResult<Spel>>('/workflow/spel/list', { params });
|
||||
}
|
||||
|
||||
export function spelInfo(id: ID) {
|
||||
return requestClient.get<Spel>(`/workflow/spel/${id}`);
|
||||
return alovaInstance.get<Spel>(`/workflow/spel/${id}`);
|
||||
}
|
||||
|
||||
export function spelAdd(data: Partial<Spel>) {
|
||||
return requestClient.postWithMsg<Spel>('/workflow/spel', data);
|
||||
return alovaInstance.postWithMsg<Spel>('/workflow/spel', data);
|
||||
}
|
||||
|
||||
export function spelUpdate(data: Partial<Spel>) {
|
||||
return requestClient.putWithMsg<Spel>('/workflow/spel', data);
|
||||
return alovaInstance.putWithMsg<Spel>('/workflow/spel', data);
|
||||
}
|
||||
|
||||
export function spelDelete(ids: ID[]) {
|
||||
return requestClient.deleteWithMsg<Spel>(`/workflow/spel/${ids}`);
|
||||
return alovaInstance.deleteWithMsg<Spel>(`/workflow/spel/${ids}`);
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ import type {
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
import { alovaInstance } from '#/utils/http';
|
||||
|
||||
/**
|
||||
* 启动任务
|
||||
* @param data
|
||||
*/
|
||||
export function startWorkFlow(data: StartWorkFlowReqData) {
|
||||
return requestClient.post<{
|
||||
return alovaInstance.post<{
|
||||
processInstanceId: string;
|
||||
taskId: string;
|
||||
}>('/workflow/task/startWorkFlow', data);
|
||||
@@ -27,7 +27,7 @@ export function startWorkFlow(data: StartWorkFlowReqData) {
|
||||
* @param data
|
||||
*/
|
||||
export function completeTask(data: CompleteTaskReqData) {
|
||||
return requestClient.postWithMsg<void>('/workflow/task/completeTask', data);
|
||||
return alovaInstance.postWithMsg<void>('/workflow/task/completeTask', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ export function completeTask(data: CompleteTaskReqData) {
|
||||
* @param params
|
||||
*/
|
||||
export function pageByTaskWait(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TaskInfo>>(
|
||||
return alovaInstance.get<PageResult<TaskInfo>>(
|
||||
'/workflow/task/pageByTaskWait',
|
||||
{ params },
|
||||
);
|
||||
@@ -46,7 +46,7 @@ export function pageByTaskWait(params?: PageQuery) {
|
||||
* @param params
|
||||
*/
|
||||
export function pageByTaskFinish(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TaskInfo>>(
|
||||
return alovaInstance.get<PageResult<TaskInfo>>(
|
||||
'/workflow/task/pageByTaskFinish',
|
||||
{ params },
|
||||
);
|
||||
@@ -57,7 +57,7 @@ export function pageByTaskFinish(params?: PageQuery) {
|
||||
* @param params
|
||||
*/
|
||||
export function pageByAllTaskWait(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TaskInfo>>(
|
||||
return alovaInstance.get<PageResult<TaskInfo>>(
|
||||
'/workflow/task/pageByAllTaskWait',
|
||||
{ params },
|
||||
);
|
||||
@@ -68,7 +68,7 @@ export function pageByAllTaskWait(params?: PageQuery) {
|
||||
* @param params
|
||||
*/
|
||||
export function pageByAllTaskFinish(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TaskInfo>>(
|
||||
return alovaInstance.get<PageResult<TaskInfo>>(
|
||||
'/workflow/task/pageByAllTaskFinish',
|
||||
{ params },
|
||||
);
|
||||
@@ -79,7 +79,7 @@ export function pageByAllTaskFinish(params?: PageQuery) {
|
||||
* @param params
|
||||
*/
|
||||
export function pageByTaskCopy(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TaskInfo>>(
|
||||
return alovaInstance.get<PageResult<TaskInfo>>(
|
||||
'/workflow/task/pageByTaskCopy',
|
||||
{ params },
|
||||
);
|
||||
@@ -91,14 +91,14 @@ export function pageByTaskCopy(params?: PageQuery) {
|
||||
* @returns info
|
||||
*/
|
||||
export function getTaskByTaskId(taskId: string) {
|
||||
return requestClient.get<TaskInfo>(`/workflow/task/getTask/${taskId}`);
|
||||
return alovaInstance.get<TaskInfo>(`/workflow/task/getTask/${taskId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 终止任务
|
||||
*/
|
||||
export function terminationTask(data: { comment?: string; taskId: string }) {
|
||||
return requestClient.postWithMsg<void>(
|
||||
return alovaInstance.postWithMsg<void>(
|
||||
'/workflow/task/terminationTask',
|
||||
data,
|
||||
);
|
||||
@@ -113,7 +113,7 @@ export function taskOperation(
|
||||
taskOperationData: TaskOperationData,
|
||||
taskOperation: TaskOperationType,
|
||||
) {
|
||||
return requestClient.postWithMsg<void>(
|
||||
return alovaInstance.postWithMsg<void>(
|
||||
`/workflow/task/taskOperation/${taskOperation}`,
|
||||
taskOperationData,
|
||||
);
|
||||
@@ -125,7 +125,7 @@ export function taskOperation(
|
||||
* @param userId 办理人id
|
||||
*/
|
||||
export function updateAssignee(taskIdList: IDS, userId: ID) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
return alovaInstance.putWithMsg<void>(
|
||||
`/workflow/task/updateAssignee/${userId}`,
|
||||
taskIdList,
|
||||
);
|
||||
@@ -136,7 +136,7 @@ export function updateAssignee(taskIdList: IDS, userId: ID) {
|
||||
* @param data 参数
|
||||
*/
|
||||
export function backProcess(data: any) {
|
||||
return requestClient.postWithMsg<void>('/workflow/task/backProcess', data);
|
||||
return alovaInstance.postWithMsg<void>('/workflow/task/backProcess', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +145,7 @@ export function backProcess(data: any) {
|
||||
* @param nodeCode 当前节点编码
|
||||
*/
|
||||
export function getBackTaskNode(taskId: string, nodeCode: string) {
|
||||
return requestClient.get<{ nodeCode: string; nodeName: string }[]>(
|
||||
return alovaInstance.get<{ nodeCode: string; nodeName: string }[]>(
|
||||
`/workflow/task/getBackTaskNode/${taskId}/${nodeCode}`,
|
||||
);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ export function getBackTaskNode(taskId: string, nodeCode: string) {
|
||||
* @param taskId 任务id
|
||||
*/
|
||||
export function currentTaskAllUser(taskId: ID) {
|
||||
return requestClient.get<any>(`/workflow/task/currentTaskAllUser/${taskId}`);
|
||||
return alovaInstance.get<any>(`/workflow/task/currentTaskAllUser/${taskId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ export function currentTaskAllUser(taskId: ID) {
|
||||
* @returns NextNodeInfo
|
||||
*/
|
||||
export function getNextNodeList(data: { taskId: string }) {
|
||||
return requestClient.post<NextNodeInfo[]>(
|
||||
return alovaInstance.post<NextNodeInfo[]>(
|
||||
'/workflow/task/getNextNodeList',
|
||||
data,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user