20260726225220
This commit is contained in:
1 parent
e3c7c6f8da
commit
a8478d60ed
170 files changed
+6786
-1678
No files matched your search
@@ -79,6 +79,44 @@ export function pageDataApi({
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询登录日志(只读列表)。
|
||||
* 通过通用分页接口加载 s_log_login 表,支持按账号(模糊)、登录结果、登录时间范围筛选。
|
||||
* @param {object} options
|
||||
* @param {string} [options.account] 账号关键字
|
||||
* @param {0|1} [options.result] 登录结果:1 成功 / 0 失败
|
||||
* @param {[Dayjs, Dayjs]} [options.range] 登录时间范围(antdv RangePicker 的 dayjs 值)
|
||||
* @param {number} [options.pageNo=1]
|
||||
* @param {number} [options.pageSize=20]
|
||||
* @returns {Promise<ApiResult<{rows: object[], total: number}>>} 分页响应。
|
||||
*/
|
||||
export function pageLoginLogApi({ account, result, range, pageNo = 1, pageSize = 20 } = {}) {
|
||||
const conditions = [];
|
||||
if (account && account.trim()) {
|
||||
const safe = account.trim().replace(/'/g, "''");
|
||||
conditions.push(`b_account LIKE N'%${safe}%'`);
|
||||
}
|
||||
if (result === 1 || result === 0) {
|
||||
conditions.push(`b_login_result = ${result}`);
|
||||
}
|
||||
if (Array.isArray(range) && range.length === 2 && range[0] && range[1]) {
|
||||
const fmt = (v) =>
|
||||
v && typeof v.format === "function"
|
||||
? v.format("YYYY-MM-DD")
|
||||
: new Date(v).toISOString().slice(0, 10);
|
||||
conditions.push(`b_login_time >= '${fmt(range[0])} 00:00:00'`);
|
||||
conditions.push(`b_login_time <= '${fmt(range[1])} 23:59:59'`);
|
||||
}
|
||||
const searchCondition = conditions.length ? conditions.join(" AND ") : null;
|
||||
return pageDataApi({
|
||||
viewName: "s_log_login",
|
||||
orderBy: "b_login_time DESC",
|
||||
searchCondition,
|
||||
pageNo,
|
||||
pageSize,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 在同一事务中保存一个或多个表的数据变更。
|
||||
* @param {{table: string, key_field: string, inserts?: object[], updates?: object[], deletes?: object[]}[]} requests 保存配置,不能为空数组。
|
||||
|
||||
@@ -33,7 +33,7 @@ function isAuthenticationError(code) {
|
||||
function handleUnauthorized(code) {
|
||||
const authStore = useAuthStore();
|
||||
authStore.clearSession();
|
||||
redirectToLogin(code === SESSION_REPLACED_CODE ? "session-replaced" : undefined);
|
||||
redirectToLogin(code === SESSION_REPLACED_CODE ? "session-replaced" : "expired");
|
||||
}
|
||||
|
||||
http.interceptors.request.use((config) => {
|
||||
|
||||
Reference in new issue
Block a user