commit
807451bf2a
|
@ -49,3 +49,4 @@ vite.config.ts.*
|
|||
*.sln
|
||||
*.sw?
|
||||
.history
|
||||
.cursor
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { MOCK_CODES } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
import { defineEventHandler, readBody, setResponseStatus } from 'h3';
|
||||
import {
|
||||
clearRefreshTokenCookie,
|
||||
setRefreshTokenCookie,
|
||||
} from '~/utils/cookie-utils';
|
||||
import { generateAccessToken, generateRefreshToken } from '~/utils/jwt-utils';
|
||||
import { forbiddenResponse } from '~/utils/response';
|
||||
import { MOCK_USERS } from '~/utils/mock-data';
|
||||
import {
|
||||
forbiddenResponse,
|
||||
useResponseError,
|
||||
useResponseSuccess,
|
||||
} from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { password, username } = await readBody(event);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
import {
|
||||
clearRefreshTokenCookie,
|
||||
getRefreshTokenFromCookie,
|
||||
} from '~/utils/cookie-utils';
|
||||
import { useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const refreshToken = getRefreshTokenFromCookie(event);
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
import {
|
||||
clearRefreshTokenCookie,
|
||||
getRefreshTokenFromCookie,
|
||||
setRefreshTokenCookie,
|
||||
} from '~/utils/cookie-utils';
|
||||
import { verifyRefreshToken } from '~/utils/jwt-utils';
|
||||
import { generateAccessToken, verifyRefreshToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_USERS } from '~/utils/mock-data';
|
||||
import { forbiddenResponse } from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import { eventHandler, setHeader } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
|
||||
export default eventHandler(async (event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
if (!userinfo) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { MOCK_MENUS } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler(async (event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import { eventHandler, getQuery, setResponseStatus } from 'h3';
|
||||
import { useResponseError } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const { status } = getQuery(event);
|
||||
setResponseStatus(event, Number(status));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import {
|
||||
sleep,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import {
|
||||
sleep,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import {
|
||||
sleep,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { faker } from '@faker-js/faker';
|
||||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
const namesMap: Record<string, any> = {};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
const pathMap: Record<string, any> = { '/': 0 };
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { faker } from '@faker-js/faker';
|
||||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { getMenuIds, MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { faker } from '@faker-js/faker';
|
||||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
|
||||
import {
|
||||
sleep,
|
||||
unAuthorizedResponse,
|
||||
usePageResponseSuccess,
|
||||
} from '~/utils/response';
|
||||
|
||||
function generateMockDataList(count: number) {
|
||||
const dataList = [];
|
||||
|
@ -44,30 +49,69 @@ export default eventHandler(async (event) => {
|
|||
await sleep(600);
|
||||
|
||||
const { page, pageSize, sortBy, sortOrder } = getQuery(event);
|
||||
// 规范化分页参数,处理 string[]
|
||||
const pageRaw = Array.isArray(page) ? page[0] : page;
|
||||
const pageSizeRaw = Array.isArray(pageSize) ? pageSize[0] : pageSize;
|
||||
const pageNumber = Math.max(
|
||||
1,
|
||||
Number.parseInt(String(pageRaw ?? '1'), 10) || 1,
|
||||
);
|
||||
const pageSizeNumber = Math.min(
|
||||
100,
|
||||
Math.max(1, Number.parseInt(String(pageSizeRaw ?? '10'), 10) || 10),
|
||||
);
|
||||
const listData = structuredClone(mockData);
|
||||
if (sortBy && Reflect.has(listData[0], sortBy as string)) {
|
||||
|
||||
// 规范化 query 入参,兼容 string[]
|
||||
const sortKeyRaw = Array.isArray(sortBy) ? sortBy[0] : sortBy;
|
||||
const sortOrderRaw = Array.isArray(sortOrder) ? sortOrder[0] : sortOrder;
|
||||
// 检查 sortBy 是否是 listData 元素的合法属性键
|
||||
if (
|
||||
typeof sortKeyRaw === 'string' &&
|
||||
listData[0] &&
|
||||
Object.prototype.hasOwnProperty.call(listData[0], sortKeyRaw)
|
||||
) {
|
||||
// 定义数组元素的类型
|
||||
type ItemType = (typeof listData)[0];
|
||||
const sortKey = sortKeyRaw as keyof ItemType; // 将 sortBy 断言为合法键
|
||||
const isDesc = sortOrderRaw === 'desc';
|
||||
listData.sort((a, b) => {
|
||||
if (sortOrder === 'asc') {
|
||||
if (sortBy === 'price') {
|
||||
return (
|
||||
Number.parseFloat(a[sortBy as string]) -
|
||||
Number.parseFloat(b[sortBy as string])
|
||||
);
|
||||
const aValue = a[sortKey] as unknown;
|
||||
const bValue = b[sortKey] as unknown;
|
||||
|
||||
let result = 0;
|
||||
|
||||
if (typeof aValue === 'number' && typeof bValue === 'number') {
|
||||
result = aValue - bValue;
|
||||
} else if (aValue instanceof Date && bValue instanceof Date) {
|
||||
result = aValue.getTime() - bValue.getTime();
|
||||
} else if (typeof aValue === 'boolean' && typeof bValue === 'boolean') {
|
||||
if (aValue === bValue) {
|
||||
result = 0;
|
||||
} else {
|
||||
return a[sortBy as string] > b[sortBy as string] ? 1 : -1;
|
||||
result = aValue ? 1 : -1;
|
||||
}
|
||||
} else {
|
||||
if (sortBy === 'price') {
|
||||
return (
|
||||
Number.parseFloat(b[sortBy as string]) -
|
||||
Number.parseFloat(a[sortBy as string])
|
||||
);
|
||||
} else {
|
||||
return a[sortBy as string] < b[sortBy as string] ? 1 : -1;
|
||||
}
|
||||
const aStr = String(aValue);
|
||||
const bStr = String(bValue);
|
||||
const aNum = Number(aStr);
|
||||
const bNum = Number(bStr);
|
||||
result =
|
||||
Number.isFinite(aNum) && Number.isFinite(bNum)
|
||||
? aNum - bNum
|
||||
: aStr.localeCompare(bStr, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: 'base',
|
||||
});
|
||||
}
|
||||
|
||||
return isDesc ? -result : result;
|
||||
});
|
||||
}
|
||||
|
||||
return usePageResponseSuccess(page as string, pageSize as string, listData);
|
||||
return usePageResponseSuccess(
|
||||
String(pageNumber),
|
||||
String(pageSizeNumber),
|
||||
listData,
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
|
||||
export default defineEventHandler(() => 'Test get handler');
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
|
||||
export default defineEventHandler(() => 'Test post handler');
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
import { forbiddenResponse, sleep } from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
|
||||
export default defineEventHandler(() => {
|
||||
return `
|
||||
<h1>Hello Vben Admin</h1>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||
|
||||
import { deleteCookie, getCookie, setCookie } from 'h3';
|
||||
|
||||
export function clearRefreshTokenCookie(event: H3Event<EventHandlerRequest>) {
|
||||
deleteCookie(event, 'jwt', {
|
||||
httpOnly: true,
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||
|
||||
import type { UserInfo } from './mock-data';
|
||||
|
||||
import { getHeader } from 'h3';
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
import { UserInfo } from './mock-data';
|
||||
import { MOCK_USERS } from './mock-data';
|
||||
|
||||
// TODO: Replace with your own secret key
|
||||
const ACCESS_TOKEN_SECRET = 'access_token_secret';
|
||||
|
@ -31,12 +34,22 @@ export function verifyAccessToken(
|
|||
return null;
|
||||
}
|
||||
|
||||
const token = authHeader.split(' ')[1];
|
||||
const tokenParts = authHeader.split(' ');
|
||||
if (tokenParts.length !== 2) {
|
||||
return null;
|
||||
}
|
||||
const token = tokenParts[1] as string;
|
||||
try {
|
||||
const decoded = jwt.verify(token, ACCESS_TOKEN_SECRET) as UserPayload;
|
||||
const decoded = jwt.verify(
|
||||
token,
|
||||
ACCESS_TOKEN_SECRET,
|
||||
) as unknown as UserPayload;
|
||||
|
||||
const username = decoded.username;
|
||||
const user = MOCK_USERS.find((item) => item.username === username);
|
||||
if (!user) {
|
||||
return null;
|
||||
}
|
||||
const { password: _pwd, ...userinfo } = user;
|
||||
return userinfo;
|
||||
} catch {
|
||||
|
@ -50,7 +63,12 @@ export function verifyRefreshToken(
|
|||
try {
|
||||
const decoded = jwt.verify(token, REFRESH_TOKEN_SECRET) as UserPayload;
|
||||
const username = decoded.username;
|
||||
const user = MOCK_USERS.find((item) => item.username === username);
|
||||
const user = MOCK_USERS.find(
|
||||
(item) => item.username === username,
|
||||
) as UserInfo;
|
||||
if (!user) {
|
||||
return null;
|
||||
}
|
||||
const { password: _pwd, ...userinfo } = user;
|
||||
return userinfo;
|
||||
} catch {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||
|
||||
import { setResponseStatus } from 'h3';
|
||||
|
||||
export function useResponseSuccess<T = any>(data: T) {
|
||||
return {
|
||||
code: 0,
|
||||
|
|
|
@ -24,3 +24,12 @@ VITE_APP_BAIDU_CODE = e98f2eab6ceb8688bc6d8fc5332ff093
|
|||
|
||||
# GoView域名
|
||||
VITE_GOVIEW_URL='http://127.0.0.1:3000'
|
||||
|
||||
# API 加解密
|
||||
VITE_APP_API_ENCRYPT_ENABLE = true
|
||||
VITE_APP_API_ENCRYPT_HEADER = X-Api-Encrypt
|
||||
VITE_APP_API_ENCRYPT_ALGORITHM = AES
|
||||
VITE_APP_API_ENCRYPT_REQUEST_KEY = 52549111389893486934626385991395
|
||||
VITE_APP_API_ENCRYPT_RESPONSE_KEY = 96103715984234343991809655248883
|
||||
# VITE_APP_API_ENCRYPT_REQUEST_KEY = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCls2rIpnGdYnLFgz1XU13GbNQ5DloyPpvW00FPGjqn5Z6JpK+kDtVlnkhwR87iRrE5Vf2WNqRX6vzbLSgveIQY8e8oqGCb829myjf1MuI+ZzN4ghf/7tEYhZJGPI9AbfxFqBUzm+kR3/HByAI22GLT96WM26QiMK8n3tIP/yiLswIDAQAB
|
||||
# VITE_APP_API_ENCRYPT_RESPONSE_KEY = MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOH8IfIFxL/MR9XIg1UDv5z1fGXQI93E8wrU4iPFovL/sEt9uSgSkjyidC2O7N+m7EKtoN6b1u7cEwXSkwf3kfK0jdWLSQaNpX5YshqXCBzbDfugDaxuyYrNA4/tIMs7mzZAk0APuRXB35Dmupou7Yw7TFW/7QhQmGfzeEKULQvnAgMBAAECgYAw8LqlQGyQoPv5p3gRxEMOCfgL0JzD3XBJKztiRd35RDh40Nx1ejgjW4dPioFwGiVWd2W8cAGHLzALdcQT2KDJh+T/tsd4SPmI6uSBBK6Ff2DkO+kFFcuYvfclQQKqxma5CaZOSqhgenacmgTMFeg2eKlY3symV6JlFNu/IKU42QJBAOhxAK/Eq3e61aYQV2JSguhMR3b8NXJJRroRs/QHEanksJtl+M+2qhkC9nQVXBmBkndnkU/l2tYcHfSBlAyFySMCQQD445tgm/J2b6qMQmuUGQAYDN8FIkHjeKmha+l/fv0igWm8NDlBAem91lNDIPBUzHL1X1+pcts5bjmq99YdOnhtAkAg2J8dN3B3idpZDiQbC8fd5bGPmdI/pSUudAP27uzLEjr2qrE/QPPGdwm2m7IZFJtK7kK1hKio6u48t/bg0iL7AkEAuUUs94h+v702Fnym+jJ2CHEkXvz2US8UDs52nWrZYiM1o1y4tfSHm8H8bv8JCAa9GHyriEawfBraILOmllFdLQJAQSRZy4wmlaG48MhVXodB85X+VZ9krGXZ2TLhz7kz9iuToy53l9jTkESt6L5BfBDCVdIwcXLYgK+8KFdHN5W7HQ==
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vben/web-antd",
|
||||
"version": "5.5.8",
|
||||
"version": "5.5.9",
|
||||
"homepage": "https://vben.pro",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
"repository": {
|
||||
|
@ -47,7 +47,6 @@
|
|||
"@vueuse/integrations": "catalog:",
|
||||
"ant-design-vue": "catalog:",
|
||||
"cropperjs": "catalog:",
|
||||
"crypto-js": "catalog:",
|
||||
"dayjs": "catalog:",
|
||||
"highlight.js": "catalog:",
|
||||
"pinia": "catalog:",
|
||||
|
|
|
@ -64,7 +64,11 @@ export namespace AuthApi {
|
|||
|
||||
/** 登录 */
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data);
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data, {
|
||||
headers: {
|
||||
isEncrypt: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 刷新 accessToken */
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
RequestClient,
|
||||
} from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { createApiEncrypt } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
|
@ -21,6 +22,7 @@ import { refreshTokenApi } from './core';
|
|||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const tenantEnable = isTenantEnable();
|
||||
const apiEncrypt = createApiEncrypt(import.meta.env);
|
||||
|
||||
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
||||
const client = new RequestClient({
|
||||
|
@ -84,10 +86,46 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
|||
config.headers['visit-tenant-id'] = tenantEnable
|
||||
? accessStore.visitTenantId
|
||||
: undefined;
|
||||
|
||||
// 是否 API 加密
|
||||
if ((config.headers || {}).isEncrypt) {
|
||||
try {
|
||||
// 加密请求数据
|
||||
if (config.data) {
|
||||
config.data = apiEncrypt.encryptRequest(config.data);
|
||||
// 设置加密标识头
|
||||
config.headers[apiEncrypt.getEncryptHeader()] = 'true';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('请求数据加密失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
},
|
||||
});
|
||||
|
||||
// API 解密响应拦截器
|
||||
client.addResponseInterceptor({
|
||||
fulfilled: (response) => {
|
||||
// 检查是否需要解密响应数据
|
||||
const encryptHeader = apiEncrypt.getEncryptHeader();
|
||||
const isEncryptResponse =
|
||||
response.headers[encryptHeader] === 'true' ||
|
||||
response.headers[encryptHeader.toLowerCase()] === 'true';
|
||||
if (isEncryptResponse && typeof response.data === 'string') {
|
||||
try {
|
||||
// 解密响应数据
|
||||
response.data = apiEncrypt.decryptResponse(response.data);
|
||||
} catch (error) {
|
||||
console.error('响应数据解密失败:', error);
|
||||
throw new Error(`响应数据解密失败: ${(error as Error).message}`);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
},
|
||||
});
|
||||
|
||||
// 处理返回的响应数据格式
|
||||
client.addResponseInterceptor(
|
||||
defaultResponseInterceptor({
|
||||
|
|
|
@ -8,7 +8,9 @@ export namespace SystemMailLogApi {
|
|||
id: number;
|
||||
userId: number;
|
||||
userType: number;
|
||||
toMail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
accountId: number;
|
||||
fromMail: string;
|
||||
templateId: number;
|
||||
|
@ -32,15 +34,3 @@ export function getMailLogPage(params: PageParam) {
|
|||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询邮件日志详情 */
|
||||
export function getMailLog(id: number) {
|
||||
return requestClient.get<SystemMailLogApi.MailLog>(
|
||||
`/system/mail-log/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 重新发送邮件 */
|
||||
export function resendMail(id: number) {
|
||||
return requestClient.put(`/system/mail-log/resend?id=${id}`);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@ export namespace SystemMailTemplateApi {
|
|||
|
||||
/** 邮件发送信息 */
|
||||
export interface MailSendReq {
|
||||
mail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
templateCode: string;
|
||||
templateParams: Record<string, any>;
|
||||
}
|
||||
|
|
|
@ -359,7 +359,8 @@ async function saveConfig() {
|
|||
currentNode.value.signEnable = configForm.value.signEnable;
|
||||
// 审批意见
|
||||
currentNode.value.reasonRequire = configForm.value.reasonRequire;
|
||||
|
||||
// 跳过表达式
|
||||
currentNode.value.skipExpression = configForm.value.skipExpression;
|
||||
currentNode.value.showText = getShowText();
|
||||
drawerApi.close();
|
||||
return true;
|
||||
|
@ -443,7 +444,8 @@ function showUserTaskNodeConfig(node: SimpleFlowNode) {
|
|||
configForm.value.signEnable = node?.signEnable ?? false;
|
||||
// 7. 审批意见
|
||||
configForm.value.reasonRequire = node?.reasonRequire ?? false;
|
||||
|
||||
// 8. 跳过表达式
|
||||
configForm.value.skipExpression = node?.skipExpression ?? '';
|
||||
drawerApi.open();
|
||||
}
|
||||
|
||||
|
@ -850,7 +852,7 @@ onMounted(() => {
|
|||
label="流程表达式"
|
||||
name="expression"
|
||||
>
|
||||
<Textarea v-model:value="configForm.expression" clearable />
|
||||
<Textarea v-model:value="configForm.expression" allow-clear />
|
||||
</FormItem>
|
||||
<!-- 多人审批/办理 方式 -->
|
||||
<FormItem :label="`多人${nodeTypeName}方式`" name="approveMethod">
|
||||
|
@ -1117,6 +1119,16 @@ onMounted(() => {
|
|||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
<div>
|
||||
<Divider content-position="left">跳过表达式</Divider>
|
||||
<FormItem prop="skipExpression">
|
||||
<Textarea
|
||||
v-model:value="configForm.skipExpression"
|
||||
allow-clear
|
||||
:rows="2"
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
</TabPane>
|
||||
|
|
|
@ -602,6 +602,8 @@ export interface SimpleFlowNode {
|
|||
signEnable?: boolean;
|
||||
// 审批意见
|
||||
reasonRequire?: boolean;
|
||||
// 跳过表达式
|
||||
skipExpression?: string;
|
||||
// 触发器设置
|
||||
triggerSetting?: TriggerSetting;
|
||||
// 子流程
|
||||
|
|
|
@ -214,6 +214,7 @@ export type UserTaskFormType = {
|
|||
returnNodeId?: string;
|
||||
roleIds?: number[]; // 角色
|
||||
signEnable: boolean;
|
||||
skipExpression?: string; // 跳过表达式
|
||||
taskAssignListener?: {
|
||||
body: HttpRequestParam[];
|
||||
header: HttpRequestParam[];
|
||||
|
|
|
@ -979,11 +979,11 @@ export enum BpmTaskStatusEnum {
|
|||
* 审批通过
|
||||
*/
|
||||
APPROVE = 2,
|
||||
|
||||
/**
|
||||
* 审批通过中
|
||||
*/
|
||||
APPROVING = 7,
|
||||
|
||||
/**
|
||||
* 已取消
|
||||
*/
|
||||
|
@ -992,7 +992,6 @@ export enum BpmTaskStatusEnum {
|
|||
* 未开始
|
||||
*/
|
||||
NOT_START = -1,
|
||||
|
||||
/**
|
||||
* 审批不通过
|
||||
*/
|
||||
|
@ -1002,10 +1001,15 @@ export enum BpmTaskStatusEnum {
|
|||
* 已退回
|
||||
*/
|
||||
RETURN = 5,
|
||||
|
||||
/**
|
||||
* 审批中
|
||||
*/
|
||||
RUNNING = 1,
|
||||
/**
|
||||
* 跳过
|
||||
*/
|
||||
SKIP = -2,
|
||||
/**
|
||||
* 待审批
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { computed, provide, ref, watch } from 'vue';
|
||||
|
||||
import { CircleHelp } from '@vben/icons';
|
||||
|
||||
|
@ -146,7 +146,7 @@ function handleTaskAfterTriggerEnableChange(val: boolean | number | string) {
|
|||
: null;
|
||||
}
|
||||
|
||||
/** 表单选项 */
|
||||
/** 表单字段 */
|
||||
const formField = ref<Array<{ field: string; title: string }>>([]);
|
||||
const formFieldOptions4Title = computed(() => {
|
||||
const cloneFormField = formField.value.map((item) => {
|
||||
|
@ -178,6 +178,9 @@ const formFieldOptions4Summary = computed(() => {
|
|||
};
|
||||
});
|
||||
});
|
||||
const unParsedFormFields = ref<string[]>([]); // 未解析的表单字段
|
||||
// 暴露给子组件 HttpRequestSetting 使用
|
||||
provide('formFields', unParsedFormFields);
|
||||
|
||||
/** 兼容以前未配置更多设置的流程 */
|
||||
function initData() {
|
||||
|
@ -230,6 +233,7 @@ watch(
|
|||
const data = await FormApi.getFormDetail(newFormId);
|
||||
const result: Array<{ field: string; title: string }> = [];
|
||||
if (data.fields) {
|
||||
unParsedFormFields.value = data.fields;
|
||||
data.fields.forEach((fieldStr: string) => {
|
||||
parseFormFields(JSON.parse(fieldStr), result);
|
||||
});
|
||||
|
@ -237,6 +241,7 @@ watch(
|
|||
formField.value = result;
|
||||
} else {
|
||||
formField.value = [];
|
||||
unParsedFormFields.value = [];
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
|
|
|
@ -43,6 +43,8 @@ const statusIconMap: Record<
|
|||
string,
|
||||
{ animation?: string; color: string; icon: string }
|
||||
> = {
|
||||
// 跳过
|
||||
'-2': { color: '#909398', icon: 'mdi:skip-forward-outline' },
|
||||
// 审批未开始
|
||||
'-1': { color: '#909398', icon: 'mdi:clock-outline' },
|
||||
// 待审批
|
||||
|
@ -285,7 +287,12 @@ defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
|
|||
>
|
||||
<!-- 第一行:节点名称、时间 -->
|
||||
<div class="flex w-full">
|
||||
<div class="font-bold">{{ activity.name }}</div>
|
||||
<div class="font-bold">
|
||||
{{ activity.name }}
|
||||
<span v-if="activity.status === BpmTaskStatusEnum.SKIP">
|
||||
【跳过】
|
||||
</span>
|
||||
</div>
|
||||
<!-- 信息:时间 -->
|
||||
<div
|
||||
v-if="activity.status !== BpmTaskStatusEnum.NOT_START"
|
||||
|
|
|
@ -32,6 +32,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
});
|
||||
|
||||
/** 概览数据 */
|
||||
// TODO @nehc:应该是有 8 个小卡片,少了 4 个?
|
||||
const overviewItems = computed<AnalysisOverviewItem[]>(() => [
|
||||
{
|
||||
icon: SvgCardIcon,
|
||||
|
|
|
@ -35,6 +35,7 @@ function onRefresh() {
|
|||
gridApi.query();
|
||||
}
|
||||
|
||||
// TODO @nehc handleRowCheckboxChange 放的位置;
|
||||
const checkedIds = ref<number[]>([]);
|
||||
function handleRowCheckboxChange({
|
||||
records,
|
||||
|
@ -81,6 +82,7 @@ async function handleDelete(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
|||
}
|
||||
|
||||
/** 批量删除 */
|
||||
// TODO @nehc handleBatchDelete 是不是和别的模块,一个风格
|
||||
async function handleBatchDelete() {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting'),
|
||||
|
@ -89,6 +91,7 @@ async function handleBatchDelete() {
|
|||
});
|
||||
try {
|
||||
await deletePurchaseOrderList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess'),
|
||||
key: 'action_process_msg',
|
||||
|
@ -106,6 +109,7 @@ function handleUpdateStatus(
|
|||
row: ErpPurchaseOrderApi.PurchaseOrder,
|
||||
status: number,
|
||||
) {
|
||||
// TODO @nehc 是不是和别的模块,类似的 status 处理一个风格
|
||||
const hideLoading = message.loading({
|
||||
content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
|
||||
duration: 0,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script lang="ts" setup>
|
||||
// TODO @nehc:看看整个逻辑,和 erp 风格的主子表,能不能更统一一些;
|
||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
|
@ -25,6 +26,7 @@ const emit = defineEmits([
|
|||
'update:total-price',
|
||||
]);
|
||||
|
||||
// TODO @nehc:这种一次性的,是不是可以不定义哈?
|
||||
interface Props {
|
||||
items?: ErpPurchaseOrderApi.PurchaseOrderItem[];
|
||||
disabled?: boolean;
|
||||
|
@ -70,6 +72,7 @@ watch(
|
|||
await nextTick();
|
||||
tableData.value = [...items];
|
||||
await nextTick();
|
||||
// TODO @nehc:这里,是不是直接 await 下?
|
||||
gridApi.grid.reloadData(tableData.value);
|
||||
},
|
||||
{
|
||||
|
@ -92,6 +95,7 @@ watch(
|
|||
props.discountPercent === null
|
||||
? 0
|
||||
: erpPriceMultiply(totalPrice, props.discountPercent / 100);
|
||||
// TODO @nehc:这里的 idea 红色告警?
|
||||
const finalTotalPrice = totalPrice - discountPrice;
|
||||
|
||||
// 发送计算结果给父组件
|
||||
|
@ -122,6 +126,7 @@ function handleAdd() {
|
|||
stockCount: 0,
|
||||
remark: '',
|
||||
};
|
||||
// TODO @nehc:这里的红色告警哈?
|
||||
tableData.value.push(newRow);
|
||||
gridApi.grid.insertAt(newRow, -1);
|
||||
emit('update:items', [...tableData.value]);
|
||||
|
|
|
@ -71,6 +71,7 @@ const handleUpdateTotalPrice = (totalPrice: number) => {
|
|||
}
|
||||
};
|
||||
|
||||
// TODO @nehc:这里的注释使用 /** */ 和别的模块一致哈;
|
||||
/**
|
||||
* 创建或更新采购订单
|
||||
*/
|
||||
|
@ -82,6 +83,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
}
|
||||
await nextTick();
|
||||
|
||||
// TODO @nehc:应该不会不存在,直接校验,简洁一点!另外,可以看看别的模块,主子表的处理哈;
|
||||
const itemFormInstance = Array.isArray(itemFormRef.value)
|
||||
? itemFormRef.value[0]
|
||||
: itemFormRef.value;
|
||||
|
@ -93,6 +95,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
// TODO @nehc:这里的红色告警,看看怎么处理掉
|
||||
message.error(error.message || '子表单验证失败');
|
||||
return;
|
||||
}
|
||||
|
@ -148,6 +151,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 初始化空的表单数据
|
||||
formData.value = { items: [] } as ErpPurchaseOrderApi.PurchaseOrder;
|
||||
await nextTick();
|
||||
// TODO @nehc:看看有没办法简化
|
||||
const itemFormInstance = Array.isArray(itemFormRef.value)
|
||||
? itemFormRef.value[0]
|
||||
: itemFormRef.value;
|
||||
|
@ -160,7 +164,9 @@ const [Modal, modalApi] = useVbenModal({
|
|||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getPurchaseOrder(data.id);
|
||||
// 将字符串形式的文件URL转换为数组形式以适配FileUpload组件
|
||||
// 将字符串形式的文件 URL 转换为数组形式以适配 FileUpload 组件
|
||||
// TODO @nehc:这里的 idea 会有黄色告警,看看是不是简化下?
|
||||
// TODO @nehc:记忆中,好像不用数组的转换,可以在看看?
|
||||
if (
|
||||
formData.value.fileUrl &&
|
||||
typeof formData.value.fileUrl === 'string'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script lang="ts" setup>
|
||||
// TODO @nehc:这里的组件名
|
||||
import type { ErpStockInApi } from '#/api/erp/stock/in';
|
||||
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
|
|
|
@ -102,6 +102,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteCodegenTableList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -84,6 +84,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteConfigList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -66,6 +66,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo01ContactList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -76,6 +76,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -75,6 +75,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03CourseList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -75,6 +75,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03GradeList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -75,6 +75,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -78,6 +78,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -123,6 +123,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo01ContactList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -134,6 +134,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -81,6 +81,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03CourseList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -81,6 +81,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03GradeList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -130,6 +130,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -124,6 +124,7 @@ async function onDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -84,6 +84,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteFileList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -118,6 +118,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteFileConfigList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -130,6 +130,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteJobList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -93,6 +93,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDeptList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -90,6 +90,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDictDataList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -88,6 +88,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDictTypeList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -76,6 +76,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteMailAccountList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -88,8 +88,28 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'toMail',
|
||||
title: '收件邮箱',
|
||||
field: 'userType',
|
||||
title: '接收用户',
|
||||
width: 150,
|
||||
slots: { default: 'userInfo' },
|
||||
},
|
||||
{
|
||||
field: 'toMails',
|
||||
title: '接收信息',
|
||||
width: 300,
|
||||
formatter: ({ row }) => {
|
||||
const lines: string[] = [];
|
||||
if (row.toMails && row.toMails.length > 0) {
|
||||
lines.push(`收件:${row.toMails.join('、')}`);
|
||||
}
|
||||
if (row.ccMails && row.ccMails.length > 0) {
|
||||
lines.push(`抄送:${row.ccMails.join('、')}`);
|
||||
}
|
||||
if (row.bccMails && row.bccMails.length > 0) {
|
||||
lines.push(`密送:${row.bccMails.join('、')}`);
|
||||
}
|
||||
return lines.join('\n');
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'templateTitle',
|
||||
|
@ -136,21 +156,48 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
|||
label: '创建时间',
|
||||
content: (data) => formatDateTime(data?.createTime || '') as string,
|
||||
},
|
||||
{
|
||||
field: 'toMail',
|
||||
label: '收件邮箱',
|
||||
},
|
||||
{
|
||||
field: 'fromMail',
|
||||
label: '发送邮箱',
|
||||
},
|
||||
{
|
||||
field: 'userId',
|
||||
label: '用户编号',
|
||||
label: '接收用户',
|
||||
content: (data) => {
|
||||
if (data?.userType && data?.userId) {
|
||||
return h('div', [
|
||||
h(DictTag, {
|
||||
type: DICT_TYPE.USER_TYPE,
|
||||
value: data.userType,
|
||||
}),
|
||||
` (${data.userId})`,
|
||||
]);
|
||||
}
|
||||
return '无';
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'userType',
|
||||
label: '用户类型',
|
||||
field: 'toMails',
|
||||
label: '接收信息',
|
||||
content: (data) => {
|
||||
const lines: string[] = [];
|
||||
if (data?.toMails && data.toMails.length > 0) {
|
||||
lines.push(`收件:${data.toMails.join('、')}`);
|
||||
}
|
||||
if (data?.ccMails && data.ccMails.length > 0) {
|
||||
lines.push(`抄送:${data.ccMails.join('、')}`);
|
||||
}
|
||||
if (data?.bccMails && data.bccMails.length > 0) {
|
||||
lines.push(`密送:${data.bccMails.join('、')}`);
|
||||
}
|
||||
return h(
|
||||
'div',
|
||||
{
|
||||
style: { whiteSpace: 'pre-line' },
|
||||
},
|
||||
lines.join('\n'),
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'templateId',
|
||||
|
|
|
@ -6,6 +6,8 @@ import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
|||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getMailLogPage } from '#/api/system/mail/log';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { DICT_TYPE } from '#/utils';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Detail from './modules/detail.vue';
|
||||
|
@ -62,6 +64,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<DetailModal @success="onRefresh" />
|
||||
<Grid table-title="邮件日志列表">
|
||||
<template #userInfo="{ row }">
|
||||
<div v-if="row.userType && row.userId" class="flex items-center gap-1">
|
||||
<DictTag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />
|
||||
<span>({{ row.userId }})</span>
|
||||
</div>
|
||||
<div v-else>-</div>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
|
|
|
@ -121,13 +121,31 @@ export function useSendMailFormSchema(): VbenFormSchema[] {
|
|||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'mail',
|
||||
fieldName: 'toMails',
|
||||
label: '收件邮箱',
|
||||
component: 'Input',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入收件邮箱',
|
||||
placeholder: '请输入收件邮箱,每行一个邮箱地址',
|
||||
rows: 3,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'ccMails',
|
||||
label: '抄送邮箱',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入抄送邮箱,每行一个邮箱地址',
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'bccMails',
|
||||
label: '密送邮箱',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入密送邮箱,每行一个邮箱地址',
|
||||
rows: 2,
|
||||
},
|
||||
rules: z.string().email('请输入正确的邮箱'),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteMailTemplateList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -42,8 +42,17 @@ const [Modal, modalApi] = useVbenModal({
|
|||
paramsObj[param] = values[`param_${param}`];
|
||||
});
|
||||
}
|
||||
const parseEmails = (text: string): string[] => {
|
||||
if (!text) return [];
|
||||
return text
|
||||
.split('\n')
|
||||
.map((email) => email.trim())
|
||||
.filter((email) => email.length > 0);
|
||||
};
|
||||
const data: SystemMailTemplateApi.MailSendReq = {
|
||||
mail: values.mail,
|
||||
toMails: parseEmails(values.toMails || ''),
|
||||
ccMails: parseEmails(values.ccMails || ''),
|
||||
bccMails: parseEmails(values.bccMails || ''),
|
||||
templateCode: formData.value?.code || '',
|
||||
templateParams: paramsObj,
|
||||
};
|
||||
|
|
|
@ -77,6 +77,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteNoticeList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -94,6 +94,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteNotifyTemplateList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -83,6 +83,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deletePostList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -96,6 +96,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteRoleList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -87,6 +87,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteSmsChannelList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', ['短信渠道']),
|
||||
key: 'action_key_msg',
|
||||
|
|
|
@ -94,6 +94,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteSmsTemplateList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -95,6 +95,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteTenantList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -76,6 +76,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteTenantPackageList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -118,6 +118,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteUserList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -24,3 +24,12 @@ VITE_APP_BAIDU_CODE = b79d8f49e2d38b26503b92810b740f45
|
|||
|
||||
# GoView域名
|
||||
VITE_GOVIEW_URL='http://127.0.0.1:3000'
|
||||
|
||||
# API 加解密
|
||||
VITE_APP_API_ENCRYPT_ENABLE = true
|
||||
VITE_APP_API_ENCRYPT_HEADER = X-Api-Encrypt
|
||||
VITE_APP_API_ENCRYPT_ALGORITHM = AES
|
||||
VITE_APP_API_ENCRYPT_REQUEST_KEY = 52549111389893486934626385991395
|
||||
VITE_APP_API_ENCRYPT_RESPONSE_KEY = 96103715984234343991809655248883
|
||||
# VITE_APP_API_ENCRYPT_REQUEST_KEY = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCls2rIpnGdYnLFgz1XU13GbNQ5DloyPpvW00FPGjqn5Z6JpK+kDtVlnkhwR87iRrE5Vf2WNqRX6vzbLSgveIQY8e8oqGCb829myjf1MuI+ZzN4ghf/7tEYhZJGPI9AbfxFqBUzm+kR3/HByAI22GLT96WM26QiMK8n3tIP/yiLswIDAQAB
|
||||
# VITE_APP_API_ENCRYPT_RESPONSE_KEY = MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOH8IfIFxL/MR9XIg1UDv5z1fGXQI93E8wrU4iPFovL/sEt9uSgSkjyidC2O7N+m7EKtoN6b1u7cEwXSkwf3kfK0jdWLSQaNpX5YshqXCBzbDfugDaxuyYrNA4/tIMs7mzZAk0APuRXB35Dmupou7Yw7TFW/7QhQmGfzeEKULQvnAgMBAAECgYAw8LqlQGyQoPv5p3gRxEMOCfgL0JzD3XBJKztiRd35RDh40Nx1ejgjW4dPioFwGiVWd2W8cAGHLzALdcQT2KDJh+T/tsd4SPmI6uSBBK6Ff2DkO+kFFcuYvfclQQKqxma5CaZOSqhgenacmgTMFeg2eKlY3symV6JlFNu/IKU42QJBAOhxAK/Eq3e61aYQV2JSguhMR3b8NXJJRroRs/QHEanksJtl+M+2qhkC9nQVXBmBkndnkU/l2tYcHfSBlAyFySMCQQD445tgm/J2b6qMQmuUGQAYDN8FIkHjeKmha+l/fv0igWm8NDlBAem91lNDIPBUzHL1X1+pcts5bjmq99YdOnhtAkAg2J8dN3B3idpZDiQbC8fd5bGPmdI/pSUudAP27uzLEjr2qrE/QPPGdwm2m7IZFJtK7kK1hKio6u48t/bg0iL7AkEAuUUs94h+v702Fnym+jJ2CHEkXvz2US8UDs52nWrZYiM1o1y4tfSHm8H8bv8JCAa9GHyriEawfBraILOmllFdLQJAQSRZy4wmlaG48MhVXodB85X+VZ9krGXZ2TLhz7kz9iuToy53l9jTkESt6L5BfBDCVdIwcXLYgK+8KFdHN5W7HQ==
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vben/web-ele",
|
||||
"version": "5.5.8",
|
||||
"version": "5.5.9",
|
||||
"homepage": "https://vben.pro",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
"repository": {
|
||||
|
@ -45,7 +45,6 @@
|
|||
"@vben/utils": "workspace:*",
|
||||
"@vueuse/core": "catalog:",
|
||||
"cropperjs": "catalog:",
|
||||
"crypto-js": "catalog:",
|
||||
"dayjs": "catalog:",
|
||||
"element-plus": "catalog:",
|
||||
"highlight.js": "catalog:",
|
||||
|
|
|
@ -64,7 +64,11 @@ export namespace AuthApi {
|
|||
|
||||
/** 登录 */
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data);
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data, {
|
||||
headers: {
|
||||
isEncrypt: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 刷新 accessToken */
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
RequestClient,
|
||||
} from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { createApiEncrypt } from '@vben/utils';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
|
@ -21,6 +22,7 @@ import { refreshTokenApi } from './core';
|
|||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const tenantEnable = isTenantEnable();
|
||||
const apiEncrypt = createApiEncrypt(import.meta.env);
|
||||
|
||||
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
||||
const client = new RequestClient({
|
||||
|
@ -84,10 +86,46 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
|||
config.headers['visit-tenant-id'] = tenantEnable
|
||||
? accessStore.visitTenantId
|
||||
: undefined;
|
||||
|
||||
// 是否 API 加密
|
||||
if ((config.headers || {}).isEncrypt) {
|
||||
try {
|
||||
// 加密请求数据
|
||||
if (config.data) {
|
||||
config.data = apiEncrypt.encryptRequest(config.data);
|
||||
// 设置加密标识头
|
||||
config.headers[apiEncrypt.getEncryptHeader()] = 'true';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('请求数据加密失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
},
|
||||
});
|
||||
|
||||
// API 解密响应拦截器
|
||||
client.addResponseInterceptor({
|
||||
fulfilled: (response) => {
|
||||
// 检查是否需要解密响应数据
|
||||
const encryptHeader = apiEncrypt.getEncryptHeader();
|
||||
const isEncryptResponse =
|
||||
response.headers[encryptHeader] === 'true' ||
|
||||
response.headers[encryptHeader.toLowerCase()] === 'true';
|
||||
if (isEncryptResponse && typeof response.data === 'string') {
|
||||
try {
|
||||
// 解密响应数据
|
||||
response.data = apiEncrypt.decryptResponse(response.data);
|
||||
} catch (error) {
|
||||
console.error('响应数据解密失败:', error);
|
||||
throw new Error(`响应数据解密失败: ${(error as Error).message}`);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
},
|
||||
});
|
||||
|
||||
// 处理返回的响应数据格式
|
||||
client.addResponseInterceptor(
|
||||
defaultResponseInterceptor({
|
||||
|
|
|
@ -8,7 +8,9 @@ export namespace SystemMailLogApi {
|
|||
id: number;
|
||||
userId: number;
|
||||
userType: number;
|
||||
toMail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
accountId: number;
|
||||
fromMail: string;
|
||||
templateId: number;
|
||||
|
|
|
@ -20,7 +20,9 @@ export namespace SystemMailTemplateApi {
|
|||
|
||||
/** 邮件发送信息 */
|
||||
export interface MailSendReqVO {
|
||||
mail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
templateCode: string;
|
||||
templateParams: Record<string, any>;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ async function onDelete(row: InfraCodegenApi.CodegenTable) {
|
|||
async function onDeleteBatch() {
|
||||
await confirm('确定要批量删除该代码生成配置吗?');
|
||||
await deleteCodegenTableList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ async function onDelete(row: InfraConfigApi.Config) {
|
|||
async function onDeleteBatch() {
|
||||
await confirm('确定要批量删除该参数吗?');
|
||||
await deleteConfigList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ async function onDelete(row: InfraDataSourceConfigApi.DataSourceConfig) {
|
|||
async function onDeleteBatch() {
|
||||
await confirm('确定要批量删除该数据源吗?');
|
||||
await deleteDataSourceConfigList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo01ContactList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -70,6 +70,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -69,6 +69,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03CourseList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -69,6 +69,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03GradeList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -69,6 +69,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -64,6 +64,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
} finally {
|
||||
|
|
|
@ -121,6 +121,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo01ContactList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -133,6 +133,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -77,6 +77,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03CourseList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -77,6 +77,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03GradeList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -129,6 +129,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -122,6 +122,7 @@ async function handleDeleteBatch() {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03StudentList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
await getList();
|
||||
} finally {
|
||||
|
|
|
@ -79,6 +79,7 @@ async function onDelete(row: InfraFileApi.File) {
|
|||
async function onDeleteBatch() {
|
||||
await confirm('确定要批量删除该文件吗?');
|
||||
await deleteFileList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
onRefresh();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue