style: 修复 lint 错误

pull/76/head
dhb52 2025-04-19 16:59:43 +08:00
parent c97469f5d5
commit bc78f0feb8
240 changed files with 3867 additions and 2243 deletions

View File

@ -26,6 +26,7 @@
"#/*": "./src/*"
},
"dependencies": {
"@tinymce/tinymce-vue": "catalog:",
"@vben/access": "workspace:*",
"@vben/common-ui": "workspace:*",
"@vben/constants": "workspace:*",
@ -40,7 +41,6 @@
"@vben/styles": "workspace:*",
"@vben/types": "workspace:*",
"@vben/utils": "workspace:*",
"@tinymce/tinymce-vue": "catalog:",
"@vueuse/core": "catalog:",
"ant-design-vue": "catalog:",
"crypto-js": "catalog:",

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -115,7 +115,9 @@ export type ComponentType =
| 'DatePicker'
| 'DefaultButton'
| 'Divider'
| 'FileUpload'
| 'IconPicker'
| 'ImageUpload'
| 'Input'
| 'InputNumber'
| 'InputPassword'
@ -125,16 +127,14 @@ export type ComponentType =
| 'RadioGroup'
| 'RangePicker'
| 'Rate'
| 'RichTextarea'
| 'Select'
| 'Space'
| 'Switch'
| 'Textarea'
| 'RichTextarea'
| 'TimePicker'
| 'TreeSelect'
| 'Upload'
| 'FileUpload'
| 'ImageUpload'
| BaseFormComponentType;
async function initComponentAdapter() {

View File

@ -1,3 +1,5 @@
import type { Recordable } from '@vben/types';
import { h } from 'vue';
import { IconifyIcon } from '@vben/icons';
@ -6,12 +8,11 @@ import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
import { isFunction, isString } from '@vben/utils';
import { Button, Image, Popconfirm, Switch } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag';
import { $t } from '#/locales';
import { useVbenForm } from './form';
import type { Recordable } from '@vben/types';
import { $t } from '#/locales';
setupVbenVxeTable({
configVxeTable: (vxeUI) => {
@ -162,10 +163,10 @@ setupVbenVxeTable({
return presets[opt]
? { code: opt, ...presets[opt], ...defaultProps }
: {
code: opt,
text: $te(`common.${opt}`) ? $t(`common.${opt}`) : opt,
...defaultProps,
};
code: opt,
text: $te(`common.${opt}`) ? $t(`common.${opt}`) : opt,
...defaultProps,
};
} else {
return { ...defaultProps, ...presets[opt.code], ...opt };
}
@ -188,10 +189,10 @@ setupVbenVxeTable({
icon: undefined,
onClick: listen
? () =>
attrs?.onClick?.({
code: opt.code,
row,
})
attrs?.onClick?.({
code: opt.code,
row,
})
: undefined,
},
{

View File

@ -15,12 +15,17 @@ export namespace BpmCategoryApi {
/** 查询流程分类分页 */
export async function getCategoryPage(params: PageParam) {
return requestClient.get<PageResult<BpmCategoryApi.CategoryVO>>('/bpm/category/page', { params });
return requestClient.get<PageResult<BpmCategoryApi.CategoryVO>>(
'/bpm/category/page',
{ params },
);
}
/** 查询流程分类详情 */
export async function getCategory(id: number) {
return requestClient.get<BpmCategoryApi.CategoryVO>(`/bpm/category/get?id=${id}`);
return requestClient.get<BpmCategoryApi.CategoryVO>(
`/bpm/category/get?id=${id}`,
);
}
/** 新增流程分类 */

View File

@ -1,6 +1,7 @@
import { baseRequestClient, requestClient } from '#/api/request';
import type { AuthPermissionInfo } from '@vben/types';
import { baseRequestClient, requestClient } from '#/api/request';
export namespace AuthApi {
/** 登录接口参数 */
export interface LoginParams {
@ -41,9 +42,9 @@ export namespace AuthApi {
/** 注册接口参数 */
export interface RegisterParams {
username: string
password: string
captchaVerification: string
username: string;
password: string;
captchaVerification: string;
}
/** 重置密码接口参数 */
@ -68,16 +69,22 @@ export async function loginApi(data: AuthApi.LoginParams) {
/** 刷新 accessToken */
export async function refreshTokenApi(refreshToken: string) {
return baseRequestClient.post(`/system/auth/refresh-token?refreshToken=${refreshToken}`);
return baseRequestClient.post(
`/system/auth/refresh-token?refreshToken=${refreshToken}`,
);
}
/** 退出登录 */
export async function logoutApi(accessToken: string) {
return baseRequestClient.post('/system/auth/logout', {}, {
headers: {
Authorization: `Bearer ${accessToken}`,
}
});
return baseRequestClient.post(
'/system/auth/logout',
{},
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
},
);
}
/** 获取权限信息 */
@ -96,7 +103,9 @@ export async function getTenantSimpleList() {
/** 使用租户域名,获得租户信息 */
export async function getTenantByWebsite(website: string) {
return requestClient.get<AuthApi.TenantResult>(`/system/tenant/get-by-website?website=${website}`);
return requestClient.get<AuthApi.TenantResult>(
`/system/tenant/get-by-website?website=${website}`,
);
}
/** 获取验证码 */
@ -111,23 +120,23 @@ export async function checkCaptcha(data: any) {
/** 获取登录验证码 */
export const sendSmsCode = (data: AuthApi.SmsCodeParams) => {
return requestClient.post('/system/auth/send-sms-code', data )
}
return requestClient.post('/system/auth/send-sms-code', data);
};
/** 短信验证码登录 */
export const smsLogin = (data: AuthApi.SmsLoginParams) => {
return requestClient.post('/system/auth/sms-login', data)
}
return requestClient.post('/system/auth/sms-login', data);
};
/** 注册 */
export const register = (data: AuthApi.RegisterParams) => {
return requestClient.post('/system/auth/register', data)
}
return requestClient.post('/system/auth/register', data);
};
/** 通过短信重置密码 */
export const smsResetPassword = (data: AuthApi.ResetPasswordParams) => {
return requestClient.post('/system/auth/reset-password', data)
}
return requestClient.post('/system/auth/reset-password', data);
};
/** 社交授权的跳转 */
export const socialAuthRedirect = (type: number, redirectUri: string) => {
@ -137,9 +146,12 @@ export const socialAuthRedirect = (type: number, redirectUri: string) => {
redirectUri,
},
});
}
};
/** 社交快捷登录 */
export const socialLogin = (data: AuthApi.SocialLoginParams) => {
return requestClient.post<AuthApi.LoginResult>('/system/auth/social-login', data);
}
return requestClient.post<AuthApi.LoginResult>(
'/system/auth/social-login',
data,
);
};

View File

@ -32,11 +32,13 @@ export namespace InfraApiAccessLogApi {
export function getApiAccessLogPage(params: PageParam) {
return requestClient.get<PageResult<InfraApiAccessLogApi.SystemApiAccessLog>>(
'/infra/api-access-log/page',
{ params }
{ params },
);
}
/** 导出 API 访问日志 */
export function exportApiAccessLog(params: any) {
return requestClient.download('/infra/api-access-log/export-excel', { params });
return requestClient.download('/infra/api-access-log/export-excel', {
params,
});
}

View File

@ -36,16 +36,20 @@ export namespace InfraApiErrorLogApi {
export function getApiErrorLogPage(params: PageParam) {
return requestClient.get<PageResult<InfraApiErrorLogApi.SystemApiErrorLog>>(
'/infra/api-error-log/page',
{ params }
{ params },
);
}
/** 更新 API 错误日志的处理状态 */
export function updateApiErrorLogStatus(id: number, processStatus: number) {
return requestClient.put(`/infra/api-error-log/update-status?id=${id}&processStatus=${processStatus}`);
return requestClient.put(
`/infra/api-error-log/update-status?id=${id}&processStatus=${processStatus}`,
);
}
/** 导出 API 错误日志 */
export function exportApiErrorLog(params: any) {
return requestClient.download('/infra/api-error-log/export-excel', { params });
return requestClient.download('/infra/api-error-log/export-excel', {
params,
});
}

View File

@ -79,21 +79,30 @@ export namespace InfraCodegenApi {
/** 查询列表代码生成表定义 */
export function getCodegenTableList(dataSourceConfigId: number) {
return requestClient.get<InfraCodegenApi.CodegenTable[]>('/infra/codegen/table/list?', {
params: { dataSourceConfigId },
});
return requestClient.get<InfraCodegenApi.CodegenTable[]>(
'/infra/codegen/table/list?',
{
params: { dataSourceConfigId },
},
);
}
/** 查询列表代码生成表定义 */
export function getCodegenTablePage(params: PageParam) {
return requestClient.get<PageResult<InfraCodegenApi.CodegenTable>>('/infra/codegen/table/page', { params });
return requestClient.get<PageResult<InfraCodegenApi.CodegenTable>>(
'/infra/codegen/table/page',
{ params },
);
}
/** 查询详情代码生成表定义 */
export function getCodegenTable(tableId: number) {
return requestClient.get<InfraCodegenApi.CodegenDetail>('/infra/codegen/detail', {
params: { tableId },
});
return requestClient.get<InfraCodegenApi.CodegenDetail>(
'/infra/codegen/detail',
{
params: { tableId },
},
);
}
/** 修改代码生成表定义 */
@ -110,9 +119,12 @@ export function syncCodegenFromDB(tableId: number) {
/** 预览生成代码 */
export function previewCodegen(tableId: number) {
return requestClient.get<InfraCodegenApi.CodegenPreview[]>('/infra/codegen/preview', {
params: { tableId },
});
return requestClient.get<InfraCodegenApi.CodegenPreview[]>(
'/infra/codegen/preview',
{
params: { tableId },
},
);
}
/** 下载生成代码 */
@ -124,11 +136,16 @@ export function downloadCodegen(tableId: number) {
/** 获得表定义 */
export function getSchemaTableList(params: any) {
return requestClient.get<InfraCodegenApi.DatabaseTable[]>('/infra/codegen/db/table/list', { params });
return requestClient.get<InfraCodegenApi.DatabaseTable[]>(
'/infra/codegen/db/table/list',
{ params },
);
}
/** 基于数据库的表结构,创建代码生成器的表定义 */
export function createCodegenList(data: InfraCodegenApi.CodegenCreateListReqVO) {
export function createCodegenList(
data: InfraCodegenApi.CodegenCreateListReqVO,
) {
return requestClient.post('/infra/codegen/create-list', data);
}

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace InfraConfigApi {
/** 参数配置信息 */
export interface InfraConfig {
@ -18,19 +19,26 @@ export namespace InfraConfigApi {
/** 查询参数列表 */
export function getConfigPage(params: PageParam) {
return requestClient.get<PageResult<InfraConfigApi.InfraConfig>>('/infra/config/page', {
params
});
return requestClient.get<PageResult<InfraConfigApi.InfraConfig>>(
'/infra/config/page',
{
params,
},
);
}
/** 查询参数详情 */
export function getConfig(id: number) {
return requestClient.get<InfraConfigApi.InfraConfig>(`/infra/config/get?id=${id}`);
return requestClient.get<InfraConfigApi.InfraConfig>(
`/infra/config/get?id=${id}`,
);
}
/** 根据参数键名查询参数值 */
export function getConfigKey(configKey: string) {
return requestClient.get<string>(`/infra/config/get-value-by-key?key=${configKey}`);
return requestClient.get<string>(
`/infra/config/get-value-by-key?key=${configKey}`,
);
}
/** 新增参数 */
@ -51,6 +59,6 @@ export function deleteConfig(id: number) {
/** 导出参数 */
export function exportConfig(params: any) {
return requestClient.download('/infra/config/export', {
params
params,
});
}

View File

@ -14,25 +14,33 @@ export namespace InfraDataSourceConfigApi {
/** 查询数据源配置列表 */
export function getDataSourceConfigList() {
return requestClient.get<InfraDataSourceConfigApi.InfraDataSourceConfig[]>('/infra/data-source-config/list');
return requestClient.get<InfraDataSourceConfigApi.InfraDataSourceConfig[]>(
'/infra/data-source-config/list',
);
}
/** 查询数据源配置详情 */
export function getDataSourceConfig(id: number) {
return requestClient.get<InfraDataSourceConfigApi.InfraDataSourceConfig>(`/infra/data-source-config/get?id=${id}`);
return requestClient.get<InfraDataSourceConfigApi.InfraDataSourceConfig>(
`/infra/data-source-config/get?id=${id}`,
);
}
/** 新增数据源配置 */
export function createDataSourceConfig(data: InfraDataSourceConfigApi.InfraDataSourceConfig) {
export function createDataSourceConfig(
data: InfraDataSourceConfigApi.InfraDataSourceConfig,
) {
return requestClient.post('/infra/data-source-config/create', data);
}
/** 修改数据源配置 */
export function updateDataSourceConfig(data: InfraDataSourceConfigApi.InfraDataSourceConfig) {
export function updateDataSourceConfig(
data: InfraDataSourceConfigApi.InfraDataSourceConfig,
) {
return requestClient.put('/infra/data-source-config/update', data);
}
/** 删除数据源配置 */
export function deleteDataSourceConfig(id: number) {
return requestClient.delete(`/infra/data-source-config/delete?id=${id}`);
}
}

View File

@ -16,12 +16,17 @@ export namespace Demo01ContactApi {
/** 查询示例联系人分页 */
export function getDemo01ContactPage(params: PageParam) {
return requestClient.get<PageResult<Demo01ContactApi.Demo01Contact>>('/infra/demo01-contact/page', { params });
return requestClient.get<PageResult<Demo01ContactApi.Demo01Contact>>(
'/infra/demo01-contact/page',
{ params },
);
}
/** 查询示例联系人详情 */
export function getDemo01Contact(id: number) {
return requestClient.get<Demo01ContactApi.Demo01Contact>(`/infra/demo01-contact/get?id=${id}`);
return requestClient.get<Demo01ContactApi.Demo01Contact>(
`/infra/demo01-contact/get?id=${id}`,
);
}
/** 新增示例联系人 */

View File

@ -12,12 +12,17 @@ export namespace Demo02CategoryApi {
/** 查询示例分类列表 */
export function getDemo02CategoryList(params: any) {
return requestClient.get<Demo02CategoryApi.Demo02Category[]>('/infra/demo02-category/list', { params });
return requestClient.get<Demo02CategoryApi.Demo02Category[]>(
'/infra/demo02-category/list',
{ params },
);
}
/** 查询示例分类详情 */
export function getDemo02Category(id: number) {
return requestClient.get<Demo02CategoryApi.Demo02Category>(`/infra/demo02-category/get?id=${id}`);
return requestClient.get<Demo02CategoryApi.Demo02Category>(
`/infra/demo02-category/get?id=${id}`,
);
}
/** 新增示例分类 */

View File

@ -32,12 +32,17 @@ export namespace Demo03StudentApi {
/** 查询学生分页 */
export function getDemo03StudentPage(params: PageParam) {
return requestClient.get<PageResult<Demo03StudentApi.Demo03Student>>('/infra/demo03-student/page', { params });
return requestClient.get<PageResult<Demo03StudentApi.Demo03Student>>(
'/infra/demo03-student/page',
{ params },
);
}
/** 查询学生详情 */
export function getDemo03Student(id: number) {
return requestClient.get<Demo03StudentApi.Demo03Student>(`/infra/demo03-student/get?id=${id}`);
return requestClient.get<Demo03StudentApi.Demo03Student>(
`/infra/demo03-student/get?id=${id}`,
);
}
/** 新增学生 */

View File

@ -31,12 +31,17 @@ export namespace Demo03StudentApi {
/** 查询学生分页 */
export function getDemo03StudentPage(params: PageParam) {
return requestClient.get<PageResult<Demo03StudentApi.Demo03Student>>('/infra/demo03-student/page', { params });
return requestClient.get<PageResult<Demo03StudentApi.Demo03Student>>(
'/infra/demo03-student/page',
{ params },
);
}
/** 查询学生详情 */
export function getDemo03Student(id: number) {
return requestClient.get<Demo03StudentApi.Demo03Student>(`/infra/demo03-student/get?id=${id}`);
return requestClient.get<Demo03StudentApi.Demo03Student>(
`/infra/demo03-student/get?id=${id}`,
);
}
/** 新增学生 */

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace InfraFileConfigApi {
/** 文件客户端配置 */
export interface FileClientConfig {
@ -32,14 +33,19 @@ export namespace InfraFileConfigApi {
/** 查询文件配置列表 */
export function getFileConfigPage(params: PageParam) {
return requestClient.get<PageResult<InfraFileConfigApi.InfraFileConfig>>('/infra/file-config/page', {
params
});
return requestClient.get<PageResult<InfraFileConfigApi.InfraFileConfig>>(
'/infra/file-config/page',
{
params,
},
);
}
/** 查询文件配置详情 */
export function getFileConfig(id: number) {
return requestClient.get<InfraFileConfigApi.InfraFileConfig>(`/infra/file-config/get?id=${id}`);
return requestClient.get<InfraFileConfigApi.InfraFileConfig>(
`/infra/file-config/get?id=${id}`,
);
}
/** 更新文件配置为主配置 */

View File

@ -1,6 +1,6 @@
import type { AxiosRequestConfig, PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import type { AxiosRequestConfig } from '@vben/request';
/** Axios 上传进度事件 */
export type AxiosProgressEvent = AxiosRequestConfig['onUploadProgress'];
@ -34,9 +34,12 @@ export namespace InfraFileApi {
/** 查询文件列表 */
export function getFilePage(params: PageParam) {
return requestClient.get<PageResult<InfraFileApi.InfraFile>>('/infra/file/page', {
params
});
return requestClient.get<PageResult<InfraFileApi.InfraFile>>(
'/infra/file/page',
{
params,
},
);
}
/** 删除文件 */
@ -46,9 +49,12 @@ export function deleteFile(id: number) {
/** 获取文件预签名地址 */
export function getFilePresignedUrl(path: string) {
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>('/infra/file/presigned-url', {
params: { path }
});
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>(
'/infra/file/presigned-url',
{
params: { path },
},
);
}
/** 创建文件 */
@ -57,6 +63,9 @@ export function createFile(data: InfraFileApi.InfraFile) {
}
/** 上传文件 */
export function uploadFile(data: InfraFileApi.FileUploadReqVO, onUploadProgress?: AxiosProgressEvent) {
export function uploadFile(
data: InfraFileApi.FileUploadReqVO,
onUploadProgress?: AxiosProgressEvent,
) {
return requestClient.upload('/infra/file/upload', data, { onUploadProgress });
}

View File

@ -22,12 +22,17 @@ export namespace InfraJobLogApi {
/** 查询任务日志列表 */
export function getJobLogPage(params: PageParam) {
return requestClient.get<PageResult<InfraJobLogApi.InfraJobLog>>('/infra/job-log/page', { params });
return requestClient.get<PageResult<InfraJobLogApi.InfraJobLog>>(
'/infra/job-log/page',
{ params },
);
}
/** 查询任务日志详情 */
export function getJobLog(id: number) {
return requestClient.get<InfraJobLogApi.InfraJobLog>(`/infra/job-log/get?id=${id}`);
return requestClient.get<InfraJobLogApi.InfraJobLog>(
`/infra/job-log/get?id=${id}`,
);
}
/** 导出定时任务日志 */

View File

@ -20,7 +20,10 @@ export namespace InfraJobApi {
/** 查询任务列表 */
export function getJobPage(params: PageParam) {
return requestClient.get<PageResult<InfraJobApi.InfraJob>>('/infra/job/page', { params });
return requestClient.get<PageResult<InfraJobApi.InfraJob>>(
'/infra/job/page',
{ params },
);
}
/** 查询任务详情 */
@ -52,7 +55,7 @@ export function exportJob(params: any) {
export function updateJobStatus(id: number, status: number) {
const params = {
id,
status
status,
};
return requestClient.put('/infra/job/update-status', { params });
}

View File

@ -1,13 +1,6 @@
import { requestClient } from '#/api/request';
export namespace InfraRedisApi {
/** Redis 监控信息 */
export interface InfraRedisMonitorInfo {
info: InfraRedisInfo;
dbSize: number;
commandStats: InfraRedisCommandStats[];
}
/** Redis 信息 */
export interface InfraRedisInfo {
io_threaded_reads_processed: string;
@ -180,9 +173,18 @@ export namespace InfraRedisApi {
calls: number;
usec: number;
}
/** Redis 监控信息 */
export interface InfraRedisMonitorInfo {
info: InfraRedisInfo;
dbSize: number;
commandStats: InfraRedisCommandStats[];
}
}
/** 获取 Redis 监控信息 */
export function getRedisMonitorInfo() {
return requestClient.get<InfraRedisApi.InfraRedisMonitorInfo>('/infra/redis/get-monitor-info');
return requestClient.get<InfraRedisApi.InfraRedisMonitorInfo>(
'/infra/redis/get-monitor-info',
);
}

View File

@ -19,7 +19,10 @@ import { useAuthStore } from '#/store';
import { refreshTokenApi } from './core';
const { apiURL, tenantEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
const { apiURL, tenantEnable } = useAppConfig(
import.meta.env,
import.meta.env.PROD,
);
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
const client = new RequestClient({
@ -76,7 +79,9 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
config.headers.Authorization = formatToken(accessStore.accessToken);
config.headers['Accept-Language'] = preferences.app.locale;
// 添加租户编号
config.headers['tenant-id'] = tenantEnable ? accessStore.tenantId : undefined;
config.headers['tenant-id'] = tenantEnable
? accessStore.tenantId
: undefined;
return config;
},
});
@ -130,7 +135,9 @@ baseRequestClient.addRequestInterceptor({
fulfilled: (config) => {
const accessStore = useAccessStore();
// 添加租户编号
config.headers['tenant-id'] = tenantEnable? accessStore.tenantId : undefined;
config.headers['tenant-id'] = tenantEnable
? accessStore.tenantId
: undefined;
return config;
},
});

View File

@ -18,7 +18,9 @@ export namespace SystemDeptApi {
/** 查询部门(精简)列表 */
export async function getSimpleDeptList() {
return requestClient.get<SystemDeptApi.SystemDept[]>('/system/dept/simple-list');
return requestClient.get<SystemDeptApi.SystemDept[]>(
'/system/dept/simple-list',
);
}
/** 查询部门列表 */
@ -28,7 +30,9 @@ export async function getDeptList() {
/** 查询部门详情 */
export async function getDept(id: number) {
return requestClient.get<SystemDeptApi.SystemDept>(`/system/dept/get?id=${id}`);
return requestClient.get<SystemDeptApi.SystemDept>(
`/system/dept/get?id=${id}`,
);
}
/** 新增部门 */

View File

@ -3,16 +3,16 @@ import { requestClient } from '#/api/request';
export namespace SystemDictDataApi {
/** 字典数据 */
export type SystemDictData = {
id?: number;
colorType: string;
createTime: Date;
cssClass: string;
dictType: string;
id?: number;
label: string;
remark: string;
sort?: number;
status: number;
value: string;
createTime: Date;
};
}

View File

@ -3,12 +3,12 @@ import { requestClient } from '#/api/request';
export namespace SystemDictTypeApi {
/** 字典类型 */
export type SystemDictType = {
createTime: Date;
id?: number;
name: string;
remark: string;
status: number;
type: string;
createTime: Date;
};
}

View File

@ -21,8 +21,9 @@ export namespace SystemLoginLogApi {
/** 查询登录日志列表 */
export function getLoginLogPage(params: PageParam) {
return requestClient.get<PageResult<SystemLoginLogApi.SystemLoginLog>>('/system/login-log/page',
{ params }
return requestClient.get<PageResult<SystemLoginLogApi.SystemLoginLog>>(
'/system/login-log/page',
{ params },
);
}

View File

@ -23,22 +23,28 @@ export namespace SystemMailAccountApi {
export function getMailAccountPage(params: PageParam) {
return requestClient.get<PageResult<SystemMailAccountApi.SystemMailAccount>>(
'/system/mail-account/page',
{ params }
{ params },
);
}
/** 查询邮箱账号详情 */
export function getMailAccount(id: number) {
return requestClient.get<SystemMailAccountApi.SystemMailAccount>(`/system/mail-account/get?id=${id}`);
return requestClient.get<SystemMailAccountApi.SystemMailAccount>(
`/system/mail-account/get?id=${id}`,
);
}
/** 新增邮箱账号 */
export function createMailAccount(data: SystemMailAccountApi.SystemMailAccount) {
export function createMailAccount(
data: SystemMailAccountApi.SystemMailAccount,
) {
return requestClient.post('/system/mail-account/create', data);
}
/** 修改邮箱账号 */
export function updateMailAccount(data: SystemMailAccountApi.SystemMailAccount) {
export function updateMailAccount(
data: SystemMailAccountApi.SystemMailAccount,
) {
return requestClient.put('/system/mail-account/update', data);
}
@ -49,5 +55,7 @@ export function deleteMailAccount(id: number) {
/** 获得邮箱账号精简列表 */
export function getSimpleMailAccountList() {
return requestClient.get<SystemMailAccountApi.SystemMailAccount[]>('/system/mail-account/simple-list');
return requestClient.get<SystemMailAccountApi.SystemMailAccount[]>(
'/system/mail-account/simple-list',
);
}

View File

@ -29,13 +29,15 @@ export namespace SystemMailLogApi {
export function getMailLogPage(params: PageParam) {
return requestClient.get<PageResult<SystemMailLogApi.SystemMailLog>>(
'/system/mail-log/page',
{ params }
{ params },
);
}
/** 查询邮件日志详情 */
export function getMailLog(id: number) {
return requestClient.get<SystemMailLogApi.SystemMailLog>(`/system/mail-log/get?id=${id}`);
return requestClient.get<SystemMailLogApi.SystemMailLog>(
`/system/mail-log/get?id=${id}`,
);
}
/** 重新发送邮件 */

View File

@ -28,24 +28,29 @@ export namespace SystemMailTemplateApi {
/** 查询邮件模版列表 */
export function getMailTemplatePage(params: PageParam) {
return requestClient.get<PageResult<SystemMailTemplateApi.SystemMailTemplate>>(
'/system/mail-template/page',
{ params }
);
return requestClient.get<
PageResult<SystemMailTemplateApi.SystemMailTemplate>
>('/system/mail-template/page', { params });
}
/** 查询邮件模版详情 */
export function getMailTemplate(id: number) {
return requestClient.get<SystemMailTemplateApi.SystemMailTemplate>(`/system/mail-template/get?id=${id}`);
return requestClient.get<SystemMailTemplateApi.SystemMailTemplate>(
`/system/mail-template/get?id=${id}`,
);
}
/** 新增邮件模版 */
export function createMailTemplate(data: SystemMailTemplateApi.SystemMailTemplate) {
export function createMailTemplate(
data: SystemMailTemplateApi.SystemMailTemplate,
) {
return requestClient.post('/system/mail-template/create', data);
}
/** 修改邮件模版 */
export function updateMailTemplate(data: SystemMailTemplateApi.SystemMailTemplate) {
export function updateMailTemplate(
data: SystemMailTemplateApi.SystemMailTemplate,
) {
return requestClient.put('/system/mail-template/update', data);
}

View File

@ -23,17 +23,23 @@ export namespace SystemMenuApi {
/** 查询菜单(精简)列表 */
export async function getSimpleMenusList() {
return requestClient.get<SystemMenuApi.SystemMenu[]>('/system/menu/simple-list');
return requestClient.get<SystemMenuApi.SystemMenu[]>(
'/system/menu/simple-list',
);
}
/** 查询菜单列表 */
export async function getMenuList(params?: Record<string, any>) {
return requestClient.get<SystemMenuApi.SystemMenu[]>('/system/menu/list', { params });
return requestClient.get<SystemMenuApi.SystemMenu[]>('/system/menu/list', {
params,
});
}
/** 获取菜单详情 */
export async function getMenu(id: number) {
return requestClient.get<SystemMenuApi.SystemMenu>(`/system/menu/get?id=${id}`);
return requestClient.get<SystemMenuApi.SystemMenu>(
`/system/menu/get?id=${id}`,
);
}
/** 新增菜单 */

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace SystemNoticeApi {
/** 公告信息 */
export interface SystemNotice {
@ -17,12 +18,17 @@ export namespace SystemNoticeApi {
/** 查询公告列表 */
export function getNoticePage(params: PageParam) {
return requestClient.get<PageResult<SystemNoticeApi.SystemNotice>>('/system/notice/page', { params });
return requestClient.get<PageResult<SystemNoticeApi.SystemNotice>>(
'/system/notice/page',
{ params },
);
}
/** 查询公告详情 */
export function getNotice(id: number) {
return requestClient.get<SystemNoticeApi.SystemNotice>(`/system/notice/get?id=${id}`);
return requestClient.get<SystemNoticeApi.SystemNotice>(
`/system/notice/get?id=${id}`,
);
}
/** 新增公告 */

View File

@ -22,18 +22,16 @@ export namespace SystemNotifyMessageApi {
/** 查询站内信消息列表 */
export function getNotifyMessagePage(params: PageParam) {
return requestClient.get<PageResult<SystemNotifyMessageApi.SystemNotifyMessage>>(
'/system/notify-message/page',
{ params },
);
return requestClient.get<
PageResult<SystemNotifyMessageApi.SystemNotifyMessage>
>('/system/notify-message/page', { params });
}
/** 获得我的站内信分页 */
export function getMyNotifyMessagePage(params: PageParam) {
return requestClient.get<PageResult<SystemNotifyMessageApi.SystemNotifyMessage>>(
'/system/notify-message/my-page',
{ params },
);
return requestClient.get<
PageResult<SystemNotifyMessageApi.SystemNotifyMessage>
>('/system/notify-message/my-page', { params });
}
/** 批量标记已读 */
@ -48,7 +46,9 @@ export function updateAllNotifyMessageRead() {
/** 获取当前用户的最新站内信列表 */
export function getUnreadNotifyMessageList() {
return requestClient.get<SystemNotifyMessageApi.SystemNotifyMessage[]>('/system/notify-message/get-unread-list');
return requestClient.get<SystemNotifyMessageApi.SystemNotifyMessage[]>(
'/system/notify-message/get-unread-list',
);
}
/** 获得当前用户的未读站内信数量 */

View File

@ -26,24 +26,29 @@ export namespace SystemNotifyTemplateApi {
/** 查询站内信模板列表 */
export function getNotifyTemplatePage(params: PageParam) {
return requestClient.get<PageResult<SystemNotifyTemplateApi.SystemNotifyTemplate>>(
'/system/notify-template/page',
{ params },
);
return requestClient.get<
PageResult<SystemNotifyTemplateApi.SystemNotifyTemplate>
>('/system/notify-template/page', { params });
}
/** 查询站内信模板详情 */
export function getNotifyTemplate(id: number) {
return requestClient.get<SystemNotifyTemplateApi.SystemNotifyTemplate>(`/system/notify-template/get?id=${id}`);
return requestClient.get<SystemNotifyTemplateApi.SystemNotifyTemplate>(
`/system/notify-template/get?id=${id}`,
);
}
/** 新增站内信模板 */
export function createNotifyTemplate(data: SystemNotifyTemplateApi.SystemNotifyTemplate) {
export function createNotifyTemplate(
data: SystemNotifyTemplateApi.SystemNotifyTemplate,
) {
return requestClient.post('/system/notify-template/create', data);
}
/** 修改站内信模板 */
export function updateNotifyTemplate(data: SystemNotifyTemplateApi.SystemNotifyTemplate) {
export function updateNotifyTemplate(
data: SystemNotifyTemplateApi.SystemNotifyTemplate,
) {
return requestClient.put('/system/notify-template/update', data);
}
@ -54,10 +59,14 @@ export function deleteNotifyTemplate(id: number) {
/** 导出站内信模板 */
export function exportNotifyTemplate(params: any) {
return requestClient.download('/system/notify-template/export-excel', { params });
return requestClient.download('/system/notify-template/export-excel', {
params,
});
}
/** 发送站内信 */
export function sendNotify(data: SystemNotifyTemplateApi.SystemNotifySendReqVO) {
export function sendNotify(
data: SystemNotifyTemplateApi.SystemNotifySendReqVO,
) {
return requestClient.post('/system/notify-template/send-notify', data);
}

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace SystemOAuth2ClientApi {
/** OAuth2.0 客户端信息 */
export interface SystemOAuth2Client {
@ -27,23 +28,29 @@ export namespace SystemOAuth2ClientApi {
/** 查询 OAuth2.0 客户端列表 */
export function getOAuth2ClientPage(params: PageParam) {
return requestClient.get<PageResult<SystemOAuth2ClientApi.SystemOAuth2Client>>('/system/oauth2-client/page',
{ params }
);
return requestClient.get<
PageResult<SystemOAuth2ClientApi.SystemOAuth2Client>
>('/system/oauth2-client/page', { params });
}
/** 查询 OAuth2.0 客户端详情 */
export function getOAuth2Client(id: number) {
return requestClient.get<SystemOAuth2ClientApi.SystemOAuth2Client>(`/system/oauth2-client/get?id=${id}`);
return requestClient.get<SystemOAuth2ClientApi.SystemOAuth2Client>(
`/system/oauth2-client/get?id=${id}`,
);
}
/** 新增 OAuth2.0 客户端 */
export function createOAuth2Client(data: SystemOAuth2ClientApi.SystemOAuth2Client) {
export function createOAuth2Client(
data: SystemOAuth2ClientApi.SystemOAuth2Client,
) {
return requestClient.post('/system/oauth2-client/create', data);
}
/** 修改 OAuth2.0 客户端 */
export function updateOAuth2Client(data: SystemOAuth2ClientApi.SystemOAuth2Client) {
export function updateOAuth2Client(
data: SystemOAuth2ClientApi.SystemOAuth2Client,
) {
return requestClient.put('/system/oauth2-client/update', data);
}

View File

@ -3,8 +3,8 @@ import { requestClient } from '#/api/request';
/** OAuth2.0 授权信息响应 */
export interface OAuth2OpenAuthorizeInfoRespVO {
client: {
name: string;
logo: string;
name: string;
};
scopes: {
key: string;
@ -14,7 +14,9 @@ export interface OAuth2OpenAuthorizeInfoRespVO {
/** 获得授权信息 */
export function getAuthorize(clientId: string) {
return requestClient.get<OAuth2OpenAuthorizeInfoRespVO>(`/system/oauth2/authorize?clientId=${clientId}`);
return requestClient.get<OAuth2OpenAuthorizeInfoRespVO>(
`/system/oauth2/authorize?clientId=${clientId}`,
);
}
/** 发起授权 */
@ -25,7 +27,7 @@ export function authorize(
state: string,
autoApprove: boolean,
checkedScopes: string[],
uncheckedScopes: string[]
uncheckedScopes: string[],
) {
// 构建 scopes
const scopes: Record<string, boolean> = {};
@ -35,19 +37,19 @@ export function authorize(
for (const scope of uncheckedScopes) {
scopes[scope] = false;
}
// 发起请求
return requestClient.post<string>('/system/oauth2/authorize', null, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/x-www-form-urlencoded',
},
params: {
response_type: responseType,
client_id: clientId,
redirect_uri: redirectUri,
state: state,
state,
auto_approve: autoApprove,
scope: JSON.stringify(scopes)
}
scope: JSON.stringify(scopes),
},
});
}
}

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace SystemOAuth2TokenApi {
/** OAuth2.0 令牌信息 */
export interface SystemOAuth2Token {
@ -17,12 +18,17 @@ export namespace SystemOAuth2TokenApi {
/** 查询 OAuth2.0 令牌列表 */
export function getOAuth2TokenPage(params: PageParam) {
return requestClient.get<PageResult<SystemOAuth2TokenApi.SystemOAuth2Token>>('/system/oauth2-token/page', {
params
});
return requestClient.get<PageResult<SystemOAuth2TokenApi.SystemOAuth2Token>>(
'/system/oauth2-token/page',
{
params,
},
);
}
/** 删除 OAuth2.0 令牌 */
export function deleteOAuth2Token(accessToken: string) {
return requestClient.delete(`/system/oauth2-token/delete?accessToken=${accessToken}`);
return requestClient.delete(
`/system/oauth2-token/delete?accessToken=${accessToken}`,
);
}

View File

@ -27,8 +27,9 @@ export namespace SystemOperateLogApi {
/** 查询操作日志列表 */
export function getOperateLogPage(params: PageParam) {
return requestClient.get<PageResult<SystemOperateLogApi.SystemOperateLog>>('/system/operate-log/page',
{ params }
return requestClient.get<PageResult<SystemOperateLogApi.SystemOperateLog>>(
'/system/operate-log/page',
{ params },
);
}

View File

@ -1,5 +1,6 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
import type {PageParam, PageResult} from '@vben/request';
export namespace SystemPostApi {
/** 岗位信息 */
@ -16,19 +17,26 @@ export namespace SystemPostApi {
/** 查询岗位列表 */
export function getPostPage(params: PageParam) {
return requestClient.get<PageResult<SystemPostApi.SystemPost>>('/system/post/page', {
params
});
return requestClient.get<PageResult<SystemPostApi.SystemPost>>(
'/system/post/page',
{
params,
},
);
}
/** 获取岗位精简信息列表 */
export function getSimplePostList() {
return requestClient.get<SystemPostApi.SystemPost[]>('/system/post/simple-list');
return requestClient.get<SystemPostApi.SystemPost[]>(
'/system/post/simple-list',
);
}
/** 查询岗位详情 */
/** 查询岗位详情 */
export function getPost(id: number) {
return requestClient.get<SystemPostApi.SystemPost>(`/system/post/get?id=${id}`);
return requestClient.get<SystemPostApi.SystemPost>(
`/system/post/get?id=${id}`,
);
}
/** 新增岗位 */
@ -49,6 +57,6 @@ export function deletePost(id: number) {
/** 导出岗位 */
export function exportPost(params: any) {
return requestClient.download('/system/post/export', {
params
params,
});
}

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace SystemRoleApi {
/** 角色信息 */
export interface SystemRole {
@ -18,17 +19,24 @@ export namespace SystemRoleApi {
/** 查询角色列表 */
export function getRolePage(params: PageParam) {
return requestClient.get<PageResult<SystemRoleApi.SystemRole>>('/system/role/page', { params });
return requestClient.get<PageResult<SystemRoleApi.SystemRole>>(
'/system/role/page',
{ params },
);
}
/** 查询角色(精简)列表 */
export function getSimpleRoleList() {
return requestClient.get<SystemRoleApi.SystemRole[]>('/system/role/simple-list');
return requestClient.get<SystemRoleApi.SystemRole[]>(
'/system/role/simple-list',
);
}
/** 查询角色详情 */
export function getRole(id: number) {
return requestClient.get<SystemRoleApi.SystemRole>(`/system/role/get?id=${id}`);
return requestClient.get<SystemRoleApi.SystemRole>(
`/system/role/get?id=${id}`,
);
}
/** 新增角色 */

View File

@ -27,12 +27,16 @@ export function getSmsChannelPage(params: PageParam) {
/** 获得短信渠道精简列表 */
export function getSimpleSmsChannelList() {
return requestClient.get<SystemSmsChannelApi.SystemSmsChannel[]>('/system/sms-channel/simple-list');
return requestClient.get<SystemSmsChannelApi.SystemSmsChannel[]>(
'/system/sms-channel/simple-list',
);
}
/** 查询短信渠道详情 */
export function getSmsChannel(id: number) {
return requestClient.get<SystemSmsChannelApi.SystemSmsChannel>(`/system/sms-channel/get?id=${id}`);
return requestClient.get<SystemSmsChannelApi.SystemSmsChannel>(
`/system/sms-channel/get?id=${id}`,
);
}
/** 新增短信渠道 */

View File

@ -33,7 +33,10 @@ export namespace SystemSmsLogApi {
/** 查询短信日志列表 */
export function getSmsLogPage(params: PageParam) {
return requestClient.get<PageResult<SystemSmsLogApi.SystemSmsLog>>('/system/sms-log/page', { params });
return requestClient.get<PageResult<SystemSmsLogApi.SystemSmsLog>>(
'/system/sms-log/page',
{ params },
);
}
/** 导出短信日志 */

View File

@ -37,16 +37,22 @@ export function getSmsTemplatePage(params: PageParam) {
/** 查询短信模板详情 */
export function getSmsTemplate(id: number) {
return requestClient.get<SystemSmsTemplateApi.SystemSmsTemplate>(`/system/sms-template/get?id=${id}`);
return requestClient.get<SystemSmsTemplateApi.SystemSmsTemplate>(
`/system/sms-template/get?id=${id}`,
);
}
/** 新增短信模板 */
export function createSmsTemplate(data: SystemSmsTemplateApi.SystemSmsTemplate) {
export function createSmsTemplate(
data: SystemSmsTemplateApi.SystemSmsTemplate,
) {
return requestClient.post('/system/sms-template/create', data);
}
/** 修改短信模板 */
export function updateSmsTemplate(data: SystemSmsTemplateApi.SystemSmsTemplate) {
export function updateSmsTemplate(
data: SystemSmsTemplateApi.SystemSmsTemplate,
) {
return requestClient.put('/system/sms-template/update', data);
}
@ -57,7 +63,9 @@ export function deleteSmsTemplate(id: number) {
/** 导出短信模板 */
export function exportSmsTemplate(params: any) {
return requestClient.download('/system/sms-template/export-excel', { params });
return requestClient.download('/system/sms-template/export-excel', {
params,
});
}
/** 发送短信 */

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace SystemSocialClientApi {
/** 社交客户端信息 */
export interface SystemSocialClient {
@ -18,23 +19,29 @@ export namespace SystemSocialClientApi {
/** 查询社交客户端列表 */
export function getSocialClientPage(params: PageParam) {
return requestClient.get<PageResult<SystemSocialClientApi.SystemSocialClient>>('/system/social-client/page',
{ params }
);
return requestClient.get<
PageResult<SystemSocialClientApi.SystemSocialClient>
>('/system/social-client/page', { params });
}
/** 查询社交客户端详情 */
export function getSocialClient(id: number) {
return requestClient.get<SystemSocialClientApi.SystemSocialClient>(`/system/social-client/get?id=${id}`);
return requestClient.get<SystemSocialClientApi.SystemSocialClient>(
`/system/social-client/get?id=${id}`,
);
}
/** 新增社交客户端 */
export function createSocialClient(data: SystemSocialClientApi.SystemSocialClient) {
export function createSocialClient(
data: SystemSocialClientApi.SystemSocialClient,
) {
return requestClient.post('/system/social-client/create', data);
}
/** 修改社交客户端 */
export function updateSocialClient(data: SystemSocialClientApi.SystemSocialClient) {
export function updateSocialClient(
data: SystemSocialClientApi.SystemSocialClient,
) {
return requestClient.put('/system/social-client/update', data);
}

View File

@ -1,6 +1,7 @@
import { requestClient } from '#/api/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace SystemSocialUserApi {
/** 社交用户信息 */
export interface SystemSocialUser {
@ -21,12 +22,15 @@ export namespace SystemSocialUserApi {
/** 查询社交用户列表 */
export function getSocialUserPage(params: PageParam) {
return requestClient.get<PageResult<SystemSocialUserApi.SystemSocialUser>>('/system/social-user/page',
{ params }
return requestClient.get<PageResult<SystemSocialUserApi.SystemSocialUser>>(
'/system/social-user/page',
{ params },
);
}
/** 查询社交用户详情 */
export function getSocialUser(id: number) {
return requestClient.get<SystemSocialUserApi.SystemSocialUser>(`/system/social-user/get?id=${id}`);
return requestClient.get<SystemSocialUserApi.SystemSocialUser>(
`/system/social-user/get?id=${id}`,
);
}

View File

@ -19,10 +19,9 @@ export namespace SystemTenantPackageApi {
/** 租户套餐列表 */
export function getTenantPackagePage(params: PageParam) {
return requestClient.get<PageResult<SystemTenantPackageApi.SystemTenantPackage>>(
'/system/tenant-package/page',
{ params }
);
return requestClient.get<
PageResult<SystemTenantPackageApi.SystemTenantPackage>
>('/system/tenant-package/page', { params });
}
/** 查询租户套餐详情 */
@ -31,12 +30,16 @@ export function getTenantPackage(id: number) {
}
/** 新增租户套餐 */
export function createTenantPackage(data: SystemTenantPackageApi.SystemTenantPackage) {
export function createTenantPackage(
data: SystemTenantPackageApi.SystemTenantPackage,
) {
return requestClient.post('/system/tenant-package/create', data);
}
/** 修改租户套餐 */
export function updateTenantPackage(data: SystemTenantPackageApi.SystemTenantPackage) {
export function updateTenantPackage(
data: SystemTenantPackageApi.SystemTenantPackage,
) {
return requestClient.put('/system/tenant-package/update', data);
}
@ -47,5 +50,7 @@ export function deleteTenantPackage(id: number) {
/** 获取租户套餐精简信息列表 */
export function getTenantPackageList() {
return requestClient.get<SystemTenantPackageApi.SystemTenantPackage[]>('/system/tenant-package/get-simple-list');
return requestClient.get<SystemTenantPackageApi.SystemTenantPackage[]>(
'/system/tenant-package/get-simple-list',
);
}

View File

@ -19,17 +19,24 @@ export namespace SystemTenantApi {
/** 租户列表 */
export function getTenantPage(params: PageParam) {
return requestClient.get<PageResult<SystemTenantApi.SystemTenant>>('/system/tenant/page', { params });
return requestClient.get<PageResult<SystemTenantApi.SystemTenant>>(
'/system/tenant/page',
{ params },
);
}
/** 获取租户精简信息列表 */
export function getSimpleTenantList() {
return requestClient.get<SystemTenantApi.SystemTenant[]>('/system/tenant/simple-list');
return requestClient.get<SystemTenantApi.SystemTenant[]>(
'/system/tenant/simple-list',
);
}
/** 查询租户详情 */
export function getTenant(id: number) {
return requestClient.get<SystemTenantApi.SystemTenant>(`/system/tenant/get?id=${id}`,);
return requestClient.get<SystemTenantApi.SystemTenant>(
`/system/tenant/get?id=${id}`,
);
}
/** 新增租户 */

View File

@ -1,4 +1,4 @@
import type {PageParam, PageResult} from '@vben/request';
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
@ -23,12 +23,17 @@ export namespace SystemUserApi {
/** 查询用户管理列表 */
export function getUserPage(params: PageParam) {
return requestClient.get<PageResult<SystemUserApi.SystemUser>>('/system/user/page', { params });
return requestClient.get<PageResult<SystemUserApi.SystemUser>>(
'/system/user/page',
{ params },
);
}
/** 查询用户详情 */
export function getUser(id: number) {
return requestClient.get<SystemUserApi.SystemUser>(`/system/user/get?id=${id}`);
return requestClient.get<SystemUserApi.SystemUser>(
`/system/user/get?id=${id}`,
);
}
/** 新增用户 */
@ -60,7 +65,7 @@ export function importUserTemplate() {
export function importUser(file: File, updateSupport: boolean) {
return requestClient.upload('/system/user/import', {
file,
updateSupport
updateSupport,
});
}
@ -76,5 +81,7 @@ export function updateUserStatus(id: number, status: number) {
/** 获取用户精简信息列表 */
export function getSimpleUserList() {
return requestClient.get<SystemUserApi.SystemUser[]>('/system/user/simple-list');
return requestClient.get<SystemUserApi.SystemUser[]>(
'/system/user/simple-list',
);
}

View File

@ -1,57 +1,71 @@
<script setup lang="ts">
// TODO @ src
import { computed, defineProps } from 'vue'
import { Tag } from 'ant-design-vue'
import { computed } from 'vue';
import { Tag } from 'ant-design-vue';
// import { isHexColor } from '@/utils/color' // TODO @ cssClass https://gitee.com/yudaocode/yudao-ui-admin-vben/blob/v2.4.1/src/components/DictTag/src/DictTag.vue#L60
import { getDictObj } from '#/utils/dict'
import { getDictObj } from '#/utils/dict';
interface DictTagProps {
/**
* 字典类型
*/
type: string
type: string;
/**
* 字典值
*/
value: any
value: any;
/**
* 图标
*/
icon?: string
icon?: string;
}
const props = defineProps<DictTagProps>()
const props = defineProps<DictTagProps>();
/** 获取字典标签 */
const dictTag = computed(() => {
//
if (!props.type || props.value === undefined || props.value === null) {
return null
return null;
}
//
const dict = getDictObj(props.type, String(props.value))
const dict = getDictObj(props.type, String(props.value));
if (!dict) {
return null
return null;
}
//
let colorType = dict.colorType
if (colorType === 'primary') {
colorType = 'processing'
} else if (colorType === 'danger') {
colorType = 'error'
} else if (colorType === 'info') {
colorType = 'default'
} else if (!colorType) {
colorType = 'default'
let colorType = dict.colorType;
switch (colorType) {
case 'danger': {
colorType = 'error';
break;
}
case 'info': {
colorType = 'default';
break;
}
case 'primary': {
colorType = 'processing';
break;
}
default: {
if (!colorType) {
colorType = 'default';
}
}
}
return {
label: dict.label || '',
colorType
}
})
colorType,
};
});
</script>
<template>

View File

@ -1,3 +1 @@
import DictTag from './dict-tag.vue'
export { DictTag }
export { default as DictTag } from './dict-tag.vue';

View File

@ -1,6 +1,7 @@
<script lang="ts" setup>
// TODO @ src
import { computed } from 'vue';
import { Alert, Typography } from 'ant-design-vue';
export interface DocAlertProps {
@ -28,12 +29,7 @@ const isEnabled = computed(() => {
</script>
<template>
<Alert
v-if="isEnabled"
type="info"
show-icon
class="mb-2 rounded"
>
<Alert v-if="isEnabled" type="info" show-icon class="mb-2 rounded">
<template #message>
<Typography.Link @click="goToUrl">
{{ title }}文档地址{{ url }}

View File

@ -1,3 +1 @@
import DocAlert from './doc-alert.vue'
export { DocAlert }
export { default as DocAlert } from './doc-alert.vue';

View File

@ -1,35 +1,41 @@
<script setup lang="ts">
// TODO @ src
import { onMounted, ref } from 'vue'
import { onMounted, ref } from 'vue';
interface IFrameProps {
/**
* iframe 的源地址
*/
src: string
src: string;
}
const props = defineProps<IFrameProps>()
const props = defineProps<IFrameProps>();
const loading = ref(true)
const height = ref('')
const frameRef = ref<HTMLElement | null>(null)
const loading = ref(true);
const height = ref('');
const frameRef = ref<HTMLElement | null>(null);
function init() {
height.value = `${document.documentElement.clientHeight - 94.5}px`
loading.value = false
height.value = `${document.documentElement.clientHeight - 94.5}px`;
loading.value = false;
}
onMounted(() => {
setTimeout(() => {
init()
}, 300)
})
init();
}, 300);
});
// TODO @使 vben
</script>
<template>
<div v-loading="loading" :style="`height:${height}`">
<iframe ref="frameRef" :src="props.src" style="width: 100%; height: 100%" frameborder="no" scrolling="auto" />
<iframe
ref="frameRef"
:src="props.src"
style="width: 100%; height: 100%"
frameborder="no"
scrolling="auto"
></iframe>
</div>
</template>

View File

@ -1,3 +1 @@
import IFrame from './iframe.vue'
export { IFrame }
export { default as IFrame } from './iframe.vue';

View File

@ -1,11 +1,8 @@
<script lang="ts" setup>
import type { Editor as EditorType } from 'tinymce/tinymce';
import type { IPropTypes } from '@tinymce/tinymce-vue/lib/cjs/main/ts/components/EditorPropTypes';
type InitOptions = IPropTypes['init'];
import type { PropType } from 'vue';
import type { Editor as EditorType } from 'tinymce/tinymce';
import Editor from '@tinymce/tinymce-vue';
import ImgUpload from './img-upload.vue';
import type { PropType } from 'vue';
import {
computed,
@ -21,12 +18,21 @@ import {
} from 'vue';
import { preferences, usePreferences } from '@vben/preferences';
import { buildShortUUID, isNumber } from '@vben/utils';
import Editor from '@tinymce/tinymce-vue';
import { isNumber, buildShortUUID } from '@vben/utils';
import { bindHandlers } from './helper';
import { plugins as defaultPlugins, toolbar as defaultToolbar } from './tinymce';
import { useUpload } from '#/components/upload/use-upload';
import { bindHandlers } from './helper';
import ImgUpload from './img-upload.vue';
import {
plugins as defaultPlugins,
toolbar as defaultToolbar,
} from './tinymce';
type InitOptions = IPropTypes['init'];
defineOptions({ inheritAttrs: false });
const props = defineProps({
@ -151,11 +157,11 @@ const initOptions = computed((): InitOptions => {
const { httpRequest } = useUpload();
httpRequest(file)
.then((url) => {
console.log('tinymce 上传图片成功:', url);
// console.log('tinymce :', url);
resolve(url);
})
.catch((error) => {
console.error('tinymce 上传图片失败:', error);
// console.error('tinymce :', error);
reject(error.message);
});
});
@ -300,8 +306,8 @@ function handleError(name: string) {
if (!editor) {
return;
}
const content = editor?.getContent()?? '';
const val = content?.replace(getUploadingImgName(name), '')?? '';
const content = editor?.getContent() ?? '';
const val = content?.replace(getUploadingImgName(name), '') ?? '';
setValue(editor, val);
}
</script>
@ -349,4 +355,4 @@ function handleError(name: string) {
:deep(.tox-promotion) {
display: none !important;
}
</style>
</style>

View File

@ -1,10 +1,12 @@
<script lang="ts" setup>
import type { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { Upload, Button } from 'ant-design-vue';
import { computed, ref } from 'vue';
import { $t } from '@vben/locales';
import { computed, ref } from 'vue';
import { Button, Upload } from 'ant-design-vue';
import { useUpload } from '#/components/upload/use-upload';
defineOptions({ name: 'TinymceImageUpload' });
@ -14,7 +16,8 @@ const props = defineProps({
default: false,
type: Boolean,
},
fullscreen: { //
fullscreen: {
//
default: false,
type: Boolean,
},
@ -45,7 +48,7 @@ async function customRequest(info: UploadRequestOption<any>) {
try {
const url = await httpRequest(file);
emit('done', name, url);
} catch (e) {
} catch {
emit('error', name);
} finally {
uploading.value = false;

View File

@ -1,15 +1,19 @@
<script lang="ts" setup>
import type { UploadFile, UploadProps } from 'ant-design-vue';
import type { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import type { AxiosProgressEvent } from '#/api/infra/file';
import type { AxiosResponse } from '@vben/request';
import { CloudUpload } from '@vben/icons';
import { message, Upload, Button } from 'ant-design-vue';
import type { AxiosProgressEvent } from '#/api/infra/file';
import { $t } from '@vben/locales';
import { ref, toRefs, watch } from 'vue';
import { CloudUpload } from '@vben/icons';
import { $t } from '@vben/locales';
import { isFunction, isObject, isString } from '@vben/utils';
import { Button, message, Upload } from 'ant-design-vue';
import { checkFileType } from './helper';
import { UploadResultStatus } from './typing';
import { useUpload, useUploadType } from './use-upload';
@ -36,7 +40,7 @@ const props = withDefaults(
resultField?: string;
//
showDescription?: boolean;
value?: string[] | string;
value?: string | string[];
}>(),
{
value: () => [],

View File

@ -3,7 +3,7 @@ export function checkFileType(file: File, accepts: string[]) {
return true;
}
const newTypes = accepts.join('|');
const reg = new RegExp('\\.(' + newTypes + ')$', 'i');
const reg = new RegExp(`${String.raw`\.(` + newTypes})$`, 'i');
return reg.test(file.name);
}
@ -12,6 +12,9 @@ export function checkFileType(file: File, accepts: string[]) {
*/
export const defaultImageAccepts = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
export function checkImgType(file: File, accepts: string[] = defaultImageAccepts) {
export function checkImgType(
file: File,
accepts: string[] = defaultImageAccepts,
) {
return checkFileType(file, accepts);
}
}

View File

@ -1,19 +1,25 @@
<script lang="ts" setup>
import type { UploadFile, UploadProps } from 'ant-design-vue';
import type { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import type { AxiosProgressEvent } from '#/api/infra/file';
import type { AxiosResponse } from '@vben/request';
import { CloudUpload } from '@vben/icons';
import { message, Upload, Modal } from 'ant-design-vue';
import type { AxiosProgressEvent } from '#/api/infra/file';
import { $t } from '@vben/locales';
import { ref, toRefs, watch } from 'vue';
import { CloudUpload } from '@vben/icons';
import { $t } from '@vben/locales';
import { isFunction, isObject, isString } from '@vben/utils';
import { message, Modal, Upload } from 'ant-design-vue';
import { checkImgType, defaultImageAccepts } from './helper';
import { UploadResultStatus } from './typing';
import { useUpload, useUploadType } from './use-upload';
type ListType = 'picture' | 'picture-card' | 'text';
defineOptions({ name: 'ImageUpload', inheritAttrs: false });
const props = withDefaults(
@ -37,7 +43,7 @@ const props = withDefaults(
resultField?: string;
//
showDescription?: boolean;
value?: string[] | string;
value?: string | string[];
}>(),
{
value: () => [],
@ -54,7 +60,6 @@ const props = withDefaults(
},
);
const emit = defineEmits(['change', 'update:value', 'delete']);
type ListType = 'picture' | 'picture-card' | 'text';
const { accept, helpText, maxNumber, maxSize } = toRefs(props);
const isInnerOperate = ref<boolean>(false);
const { getStringAccept } = useUploadType({
@ -231,7 +236,10 @@ function getValue() {
@preview="handlePreview"
@remove="handleRemove"
>
<div v-if="fileList && fileList.length < maxNumber" class="flex flex-col items-center justify-center">
<div
v-if="fileList && fileList.length < maxNumber"
class="flex flex-col items-center justify-center"
>
<CloudUpload />
<div class="mt-2">{{ $t('ui.upload.imgUpload') }}</div>
</div>
@ -241,7 +249,7 @@ function getValue() {
class="mt-2 flex flex-wrap items-center text-[14px]"
>
请上传不超过
<div class="mx-1 font-bold text-primary">{{ maxSize }}MB</div>
<div class="text-primary mx-1 font-bold">{{ maxSize }}MB</div>
<div class="text-primary mx-1 font-bold">{{ accept.join('/') }}</div>
格式文件

View File

@ -1,11 +1,25 @@
import type { Ref } from 'vue';
import type { AxiosProgressEvent, InfraFileApi } from '#/api/infra/file';
import { computed, unref } from 'vue';
import { $t } from '@vben/locales';
import CryptoJS from 'crypto-js'
import axios from 'axios'
import { uploadFile, getFilePresignedUrl, createFile } from '#/api/infra/file';
import axios from 'axios';
import CryptoJS from 'crypto-js';
import { createFile, getFilePresignedUrl, uploadFile } from '#/api/infra/file';
/**
*
*/
enum UPLOAD_TYPE {
// 客户端直接上传只支持S3服务
CLIENT = 'client',
// 客户端发送到后端上传
SERVER = 'server',
}
export function useUploadType({
acceptRef,
@ -66,48 +80,54 @@ export function useUploadType({
// TODO @芋艿:目前保持和 admin-vue3 一致,后续可能重构
export const useUpload = () => {
// 后端上传地址
const uploadUrl = getUploadUrl()
const uploadUrl = getUploadUrl();
// 是否使用前端直连上传
const isClientUpload = UPLOAD_TYPE.CLIENT === import.meta.env.VITE_UPLOAD_TYPE
const isClientUpload =
UPLOAD_TYPE.CLIENT === import.meta.env.VITE_UPLOAD_TYPE;
// 重写ElUpload上传方法
const httpRequest = async (file: File, onUploadProgress?: AxiosProgressEvent) => {
const httpRequest = async (
file: File,
onUploadProgress?: AxiosProgressEvent,
) => {
// 模式一:前端上传
if (isClientUpload) {
// 1.1 生成文件名称
const fileName = await generateFileName(file)
const fileName = await generateFileName(file);
// 1.2 获取文件预签名地址
const presignedInfo = await getFilePresignedUrl(fileName)
const presignedInfo = await getFilePresignedUrl(fileName);
// 1.3 上传文件
return axios
.put(presignedInfo.uploadUrl, file, {
headers: {
'Content-Type': file.type
}
'Content-Type': file.type,
},
})
.then(() => {
// 1.4. 记录文件信息到后端(异步)
createFile0(presignedInfo, fileName, file)
createFile0(presignedInfo, fileName, file);
// 通知成功,数据格式保持与后端上传的返回结果一致
return { data: presignedInfo.url }
})
return { data: presignedInfo.url };
});
} else {
// 模式二:后端上传
return uploadFile({ file }, onUploadProgress);
}
}
};
return {
uploadUrl,
httpRequest
}
}
httpRequest,
};
};
/**
* URL
*/
export const getUploadUrl = (): string => {
return import.meta.env.VITE_BASE_URL + import.meta.env.VITE_GLOB_API_URL + '/infra/file/upload'
}
return `${
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_GLOB_API_URL
}/infra/file/upload`;
};
/**
*
@ -116,17 +136,21 @@ export const getUploadUrl = (): string => {
* @param name
* @param file
*/
function createFile0(vo: InfraFileApi.FilePresignedUrlRespVO, name: string, file: File) {
function createFile0(
vo: InfraFileApi.FilePresignedUrlRespVO,
name: string,
file: File,
) {
const fileVO = {
configId: vo.configId,
url: vo.url,
path: name,
name: file.name,
type: file.type,
size: file.size
}
createFile(fileVO)
return fileVO
size: file.size,
};
createFile(fileVO);
return fileVO;
}
/**
@ -136,21 +160,11 @@ function createFile0(vo: InfraFileApi.FilePresignedUrlRespVO, name: string, file
*/
async function generateFileName(file: File) {
// 读取文件内容
const data = await file.arrayBuffer()
const wordArray = CryptoJS.lib.WordArray.create(data)
const data = await file.arrayBuffer();
const wordArray = CryptoJS.lib.WordArray.create(data);
// 计算SHA256
const sha256 = CryptoJS.SHA256(wordArray).toString()
const sha256 = CryptoJS.SHA256(wordArray).toString();
// 拼接后缀
const ext = file.name.substring(file.name.lastIndexOf('.'))
return `${sha256}${ext}`
}
/**
*
*/
enum UPLOAD_TYPE {
// 客户端直接上传只支持S3服务
CLIENT = 'client',
// 客户端发送到后端上传
SERVER = 'server'
const ext = file.name.slice(Math.max(0, file.name.lastIndexOf('.')));
return `${sha256}${ext}`;
}

View File

@ -5,11 +5,11 @@ import type {
import { generateAccessible } from '@vben/access';
import { preferences } from '@vben/preferences';
import { BasicLayout, IFrameView } from '#/layouts';
import { useAccessStore } from '@vben/stores';
import { convertServerMenuToRouteRecordStringComponent } from '@vben/utils';
import { BasicLayout, IFrameView } from '#/layouts';
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
async function generateAccess(options: GenerateMenuAndRoutesOptions) {

View File

@ -92,7 +92,8 @@ const coreRoutes: RouteRecordRaw[] = [
{
name: 'SocialLogin',
path: 'social-login',
component: () => import('#/views/_core/authentication/social-login.vue'),
component: () =>
import('#/views/_core/authentication/social-login.vue'),
meta: {
title: $t('page.auth.login'),
},
@ -104,7 +105,7 @@ const coreRoutes: RouteRecordRaw[] = [
meta: {
title: $t('page.auth.login'),
},
}
},
],
},
];

View File

@ -44,4 +44,4 @@ const componentKeys: string[] = Object.keys(
const path = v.replace('../../views/', '/');
return path.endsWith('.vue') ? path.slice(0, -4) : path;
});
export { accessRoutes, coreRouteNames, routes, componentKeys };
export { accessRoutes, componentKeys, coreRouteNames, routes };

View File

@ -1,4 +1,6 @@
import type { AuthPermissionInfo, Recordable, UserInfo} from '@vben/types';
import type { AuthPermissionInfo, Recordable, UserInfo } from '@vben/types';
import type { AuthApi } from '#/api';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
@ -9,7 +11,14 @@ import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores';
import { notification } from 'ant-design-vue';
import { defineStore } from 'pinia';
import { type AuthApi, getAuthPermissionInfoApi, loginApi, logoutApi, smsLogin, register, socialLogin } from '#/api';
import {
getAuthPermissionInfoApi,
loginApi,
logoutApi,
register,
smsLogin,
socialLogin,
} from '#/api';
import { $t } from '#/locales';
export const useAuthStore = defineStore('auth', () => {
@ -27,7 +36,7 @@ export const useAuthStore = defineStore('auth', () => {
* @param onSuccess
*/
async function authLogin(
type: 'mobile' | 'username' | 'register' | 'social',
type: 'mobile' | 'register' | 'social' | 'username',
params: Recordable<any>,
onSuccess?: () => Promise<void> | void,
) {
@ -35,10 +44,27 @@ export const useAuthStore = defineStore('auth', () => {
let userInfo: null | UserInfo = null;
try {
loginLoading.value = true;
const { accessToken, refreshToken } = type === 'mobile' ? await smsLogin(params as AuthApi.SmsLoginParams)
: type === 'register' ? await register(params as AuthApi.RegisterParams)
: type === 'social' ? await socialLogin(params as AuthApi.SocialLoginParams)
: await loginApi(params);
let data: AuthApi.LoginResult;
switch (type) {
case 'mobile': {
data = await smsLogin(params as AuthApi.SmsLoginParams);
break;
}
case 'register': {
data = await register(params as AuthApi.RegisterParams);
break;
}
case 'social': {
data = await socialLogin(params as AuthApi.SocialLoginParams);
break;
}
default: {
data = await loginApi(params);
break;
}
}
const { accessToken, refreshToken } = data;
// 如果成功获取到 accessToken
if (accessToken) {

View File

@ -9,14 +9,14 @@
// 全局通用状态枚举
export const CommonStatusEnum = {
ENABLE: 0, // 开启
DISABLE: 1 // 禁用
}
DISABLE: 1, // 禁用
};
// 全局用户类型枚举
export const UserTypeEnum = {
MEMBER: 1, // 会员
ADMIN: 2 // 管理员
}
ADMIN: 2, // 管理员
};
// ========== SYSTEM 模块 ==========
/**
@ -25,16 +25,16 @@ export const UserTypeEnum = {
export const SystemMenuTypeEnum = {
DIR: 1, // 目录
MENU: 2, // 菜单
BUTTON: 3 // 按钮
}
BUTTON: 3, // 按钮
};
/**
*
*/
export const SystemRoleTypeEnum = {
SYSTEM: 1, // 内置角色
CUSTOM: 2 // 自定义角色
}
CUSTOM: 2, // 自定义角色
};
/**
*
@ -44,8 +44,8 @@ export const SystemDataScopeEnum = {
DEPT_CUSTOM: 2, // 指定部门数据权限
DEPT_ONLY: 3, // 部门数据权限
DEPT_AND_CHILD: 4, // 部门及以下数据权限
DEPT_SELF: 5 // 仅本人数据权限
}
DEPT_SELF: 5, // 仅本人数据权限
};
/**
*
@ -55,15 +55,15 @@ export const SystemUserSocialTypeEnum = {
title: '钉钉',
type: 20,
source: 'dingtalk',
img: 'https://s1.ax1x.com/2022/05/22/OzMDRs.png'
img: 'https://s1.ax1x.com/2022/05/22/OzMDRs.png',
},
WECHAT_ENTERPRISE: {
title: '企业微信',
type: 30,
source: 'wechat_enterprise',
img: 'https://s1.ax1x.com/2022/05/22/OzMrzn.png'
}
}
img: 'https://s1.ax1x.com/2022/05/22/OzMrzn.png',
},
};
// ========== INFRA 模块 ==========
/**
@ -72,8 +72,8 @@ export const SystemUserSocialTypeEnum = {
export const InfraCodegenTemplateTypeEnum = {
CRUD: 1, // 基础 CRUD
TREE: 2, // 树形 CRUD
SUB: 15 // 主子表 CRUD
}
SUB: 15, // 主子表 CRUD
};
/**
*
@ -81,8 +81,8 @@ export const InfraCodegenTemplateTypeEnum = {
export const InfraJobStatusEnum = {
INIT: 0, // 初始化中
NORMAL: 1, // 运行中
STOP: 2 // 暂停运行
}
STOP: 2, // 暂停运行
};
/**
* API
@ -90,8 +90,8 @@ export const InfraJobStatusEnum = {
export const InfraApiErrorLogProcessStatusEnum = {
INIT: 0, // 未处理
DONE: 1, // 已处理
IGNORE: 2 // 已忽略
}
IGNORE: 2, // 已忽略
};
// ========== PAY 模块 ==========
/**
@ -100,78 +100,78 @@ export const InfraApiErrorLogProcessStatusEnum = {
export const PayChannelEnum = {
WX_PUB: {
code: 'wx_pub',
name: '微信 JSAPI 支付'
name: '微信 JSAPI 支付',
},
WX_LITE: {
code: 'wx_lite',
name: '微信小程序支付'
name: '微信小程序支付',
},
WX_APP: {
code: 'wx_app',
name: '微信 APP 支付'
name: '微信 APP 支付',
},
WX_NATIVE: {
code: 'wx_native',
name: '微信 Native 支付'
name: '微信 Native 支付',
},
WX_WAP: {
code: 'wx_wap',
name: '微信 WAP 网站支付'
name: '微信 WAP 网站支付',
},
WX_BAR: {
code: 'wx_bar',
name: '微信条码支付'
name: '微信条码支付',
},
ALIPAY_PC: {
code: 'alipay_pc',
name: '支付宝 PC 网站支付'
name: '支付宝 PC 网站支付',
},
ALIPAY_WAP: {
code: 'alipay_wap',
name: '支付宝 WAP 网站支付'
name: '支付宝 WAP 网站支付',
},
ALIPAY_APP: {
code: 'alipay_app',
name: '支付宝 APP 支付'
name: '支付宝 APP 支付',
},
ALIPAY_QR: {
code: 'alipay_qr',
name: '支付宝扫码支付'
name: '支付宝扫码支付',
},
ALIPAY_BAR: {
code: 'alipay_bar',
name: '支付宝条码支付'
name: '支付宝条码支付',
},
WALLET: {
code: 'wallet',
name: '钱包支付'
name: '钱包支付',
},
MOCK: {
code: 'mock',
name: '模拟支付'
}
}
name: '模拟支付',
},
};
/**
*
*/
export const PayDisplayModeEnum = {
URL: {
mode: 'url'
mode: 'url',
},
IFRAME: {
mode: 'iframe'
mode: 'iframe',
},
FORM: {
mode: 'form'
mode: 'form',
},
QR_CODE: {
mode: 'qr_code'
mode: 'qr_code',
},
APP: {
mode: 'app'
}
}
mode: 'app',
},
};
/**
*
@ -179,8 +179,8 @@ export const PayDisplayModeEnum = {
export const PayType = {
WECHAT: 'WECHAT',
ALIPAY: 'ALIPAY',
MOCK: 'MOCK'
}
MOCK: 'MOCK',
};
/**
*
@ -188,17 +188,17 @@ export const PayType = {
export const PayOrderStatusEnum = {
WAITING: {
status: 0,
name: '未支付'
name: '未支付',
},
SUCCESS: {
status: 10,
name: '已支付'
name: '已支付',
},
CLOSED: {
status: 20,
name: '未支付'
}
}
name: '未支付',
},
};
// ========== MALL - 商品模块 ==========
/**
@ -207,17 +207,17 @@ export const PayOrderStatusEnum = {
export const ProductSpuStatusEnum = {
RECYCLE: {
status: -1,
name: '回收站'
name: '回收站',
},
DISABLE: {
status: 0,
name: '下架'
name: '下架',
},
ENABLE: {
status: 1,
name: '上架'
}
}
name: '上架',
},
};
// ========== MALL - 营销模块 ==========
/**
@ -226,13 +226,13 @@ export const ProductSpuStatusEnum = {
export const CouponTemplateValidityTypeEnum = {
DATE: {
type: 1,
name: '固定日期可用'
name: '固定日期可用',
},
TERM: {
type: 2,
name: '领取之后可用'
}
}
name: '领取之后可用',
},
};
/**
*
@ -240,17 +240,17 @@ export const CouponTemplateValidityTypeEnum = {
export const CouponTemplateTakeTypeEnum = {
USER: {
type: 1,
name: '直接领取'
name: '直接领取',
},
ADMIN: {
type: 2,
name: '指定发放'
name: '指定发放',
},
REGISTER: {
type: 3,
name: '新人券'
}
}
name: '新人券',
},
};
/**
*
@ -258,17 +258,17 @@ export const CouponTemplateTakeTypeEnum = {
export const PromotionProductScopeEnum = {
ALL: {
scope: 1,
name: '通用劵'
name: '通用劵',
},
SPU: {
scope: 2,
name: '商品劵'
name: '商品劵',
},
CATEGORY: {
scope: 3,
name: '品类劵'
}
}
name: '品类劵',
},
};
/**
*
@ -276,13 +276,13 @@ export const PromotionProductScopeEnum = {
export const PromotionConditionTypeEnum = {
PRICE: {
type: 10,
name: '满 N 元'
name: '满 N 元',
},
COUNT: {
type: 20,
name: '满 N 件'
}
}
name: '满 N 件',
},
};
/**
*
@ -290,13 +290,13 @@ export const PromotionConditionTypeEnum = {
export const PromotionDiscountTypeEnum = {
PRICE: {
type: 1,
name: '满减'
name: '满减',
},
PERCENT: {
type: 2,
name: '折扣'
}
}
name: '折扣',
},
};
// ========== MALL - 交易模块 ==========
/**
@ -305,89 +305,89 @@ export const PromotionDiscountTypeEnum = {
export const BrokerageBindModeEnum = {
ANYTIME: {
mode: 1,
name: '首次绑定'
name: '首次绑定',
},
REGISTER: {
mode: 2,
name: '注册绑定'
name: '注册绑定',
},
OVERRIDE: {
mode: 3,
name: '覆盖绑定'
}
}
name: '覆盖绑定',
},
};
/**
*
*/
export const BrokerageEnabledConditionEnum = {
ALL: {
condition: 1,
name: '人人分销'
name: '人人分销',
},
ADMIN: {
condition: 2,
name: '指定分销'
}
}
name: '指定分销',
},
};
/**
*
*/
export const BrokerageRecordBizTypeEnum = {
ORDER: {
type: 1,
name: '获得推广佣金'
name: '获得推广佣金',
},
WITHDRAW: {
type: 2,
name: '提现申请'
}
}
name: '提现申请',
},
};
/**
*
*/
export const BrokerageWithdrawStatusEnum = {
AUDITING: {
status: 0,
name: '审核中'
name: '审核中',
},
AUDIT_SUCCESS: {
status: 10,
name: '审核通过'
name: '审核通过',
},
AUDIT_FAIL: {
status: 20,
name: '审核不通过'
name: '审核不通过',
},
WITHDRAW_SUCCESS: {
status: 11,
name: '提现成功'
name: '提现成功',
},
WITHDRAW_FAIL: {
status: 21,
name: '提现失败'
}
}
name: '提现失败',
},
};
/**
*
*/
export const BrokerageWithdrawTypeEnum = {
WALLET: {
type: 1,
name: '钱包'
name: '钱包',
},
BANK: {
type: 2,
name: '银行卡'
name: '银行卡',
},
WECHAT: {
type: 3,
name: '微信'
name: '微信',
},
ALIPAY: {
type: 4,
name: '支付宝'
}
}
name: '支付宝',
},
};
/**
*
@ -395,38 +395,38 @@ export const BrokerageWithdrawTypeEnum = {
export const DeliveryTypeEnum = {
EXPRESS: {
type: 1,
name: '快递发货'
name: '快递发货',
},
PICK_UP: {
type: 2,
name: '到店自提'
}
}
name: '到店自提',
},
};
/**
* -
*/
export const TradeOrderStatusEnum = {
UNPAID: {
status: 0,
name: '待支付'
name: '待支付',
},
UNDELIVERED: {
status: 10,
name: '待发货'
name: '待发货',
},
DELIVERED: {
status: 20,
name: '已发货'
name: '已发货',
},
COMPLETED: {
status: 30,
name: '已完成'
name: '已完成',
},
CANCELED: {
status: 40,
name: '已取消'
}
}
name: '已取消',
},
};
// ========== ERP - 企业资源计划 ==========
@ -436,31 +436,31 @@ export const ErpBizType = {
PURCHASE_RETURN: 12,
SALE_ORDER: 20,
SALE_OUT: 21,
SALE_RETURN: 22
}
SALE_RETURN: 22,
};
// ========== BPM 模块 ==========
export const BpmModelType = {
BPMN: 10, // BPMN 设计器
SIMPLE: 20 // 简易设计器
}
SIMPLE: 20, // 简易设计器
};
export const BpmModelFormType = {
NORMAL: 10, // 流程表单
CUSTOM: 20 // 业务表单
}
CUSTOM: 20, // 业务表单
};
export const BpmProcessInstanceStatus = {
NOT_START: -1, // 未开始
RUNNING: 1, // 审批中
APPROVE: 2, // 审批通过
REJECT: 3, // 审批不通过
CANCEL: 4 // 已取消
}
CANCEL: 4, // 已取消
};
export const BpmAutoApproveType = {
NONE: 0, // 不自动通过
APPROVE_ALL: 1, // 仅审批一次,后续重复的审批节点均自动通过
APPROVE_SEQUENT: 2, // 仅针对连续审批的节点自动通过
}
};

View File

@ -7,7 +7,10 @@ export function getRangePickerDefaultProps() {
return {
showTime: {
format: 'HH:mm:ss',
defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')],
defaultValue: [
dayjs('00:00:00', 'HH:mm:ss'),
dayjs('23:59:59', 'HH:mm:ss'),
],
},
valueFormat: 'YYYY-MM-DD HH:mm:ss',
format: 'YYYY-MM-DD HH:mm:ss',

View File

@ -17,7 +17,7 @@ const dictStore = useDictStore();
*/
function getDictLabel(dictType: string, value: any) {
const dictObj = dictStore.getDictData(dictType, value);
return isObject(dictObj)? dictObj.label : '';
return isObject(dictObj) ? dictObj.label : '';
}
/**
@ -205,4 +205,4 @@ enum DICT_TYPE {
TRADE_ORDER_TYPE = 'trade_order_type', // 订单 - 类型
USER_TYPE = 'user_type',
}
export { DICT_TYPE, getDictObj, getDictLabel, getDictOptions };
export { DICT_TYPE, getDictLabel, getDictObj, getDictOptions };

View File

@ -16,7 +16,7 @@ export const handleTree = (
data: TreeNode[],
id: string = 'id',
parentId: string = 'parentId',
children: string = 'children'
children: string = 'children',
): TreeNode[] => {
if (!Array.isArray(data)) {
console.warn('data must be an array');
@ -25,10 +25,10 @@ export const handleTree = (
const config = {
id,
parentId,
childrenList: children
childrenList: children,
};
const childrenListMap: Record<string | number, TreeNode[]> = {};
const nodeIds: Record<string | number, TreeNode> = {};
const childrenListMap: Record<number | string, TreeNode[]> = {};
const nodeIds: Record<number | string, TreeNode> = {};
const tree: TreeNode[] = [];
// 1. 数据预处理
@ -67,4 +67,4 @@ export const handleTree = (
}
return tree;
}
};

View File

@ -9,10 +9,9 @@ const MOBILE_REGEX = /(?:0|86|\+86)?1[3-9]\d{9}/;
* @param value
* @returns
*/
export function isMobile(value?: string | null): boolean {
export function isMobile(value?: null | string): boolean {
if (!value) {
return false;
}
return MOBILE_REGEX.test(value);
}

View File

@ -2,21 +2,25 @@
import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref, onMounted } from 'vue';
import type { AuthApi } from '#/api';
import { computed, onMounted, ref } from 'vue';
import { AuthenticationCodeLogin, z } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { type AuthApi, sendSmsCode } from '#/api';
import { useAppConfig } from '@vben/hooks';
import { $t } from '@vben/locales';
import { useAccessStore } from '@vben/stores';
import { message } from 'ant-design-vue';
import { getTenantSimpleList, getTenantByWebsite } from '#/api/core/auth';
import { useAccessStore } from '@vben/stores';
import { sendSmsCode } from '#/api';
import { getTenantByWebsite, getTenantSimpleList } from '#/api/core/auth';
import { useAuthStore } from '#/store';
const { tenantEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
defineOptions({ name: 'CodeLogin' });
const { tenantEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
const authStore = useAuthStore();
const accessStore = useAccessStore();
@ -37,7 +41,7 @@ const fetchTenantList = async () => {
tenantList.value = await getTenantSimpleList();
// > store >
let tenantId: number | null = null;
let tenantId: null | number = null;
const websiteTenant = await websiteTenantPromise;
if (websiteTenant?.id) {
tenantId = websiteTenant.id;
@ -80,7 +84,10 @@ const formSchema = computed((): VbenFormSchema[] => {
rules: z
.number()
.nullable()
.refine((val) => val != null && val > 0, $t('authentication.tenantTip'))
.refine(
(val) => val !== null && val > 0,
$t('authentication.tenantTip'),
)
.default(null),
dependencies: {
triggerFields: ['tenantId'],
@ -140,7 +147,7 @@ const formSchema = computed((): VbenFormSchema[] => {
} finally {
loading.value = false;
}
}
},
},
fieldName: 'code',
label: $t('authentication.code'),

View File

@ -2,18 +2,21 @@
import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref, onMounted, h } from 'vue';
import type { AuthApi } from '#/api';
import { AuthenticationForgetPassword, z } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { type AuthApi, sendSmsCode, smsResetPassword } from '#/api';
import { useAppConfig } from '@vben/hooks';
import { message } from 'ant-design-vue';
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { getTenantSimpleList, getTenantByWebsite } from '#/api/core/auth';
import { AuthenticationForgetPassword, z } from '@vben/common-ui';
import { useAppConfig } from '@vben/hooks';
import { $t } from '@vben/locales';
import { useAccessStore } from '@vben/stores';
import { message } from 'ant-design-vue';
import { sendSmsCode, smsResetPassword } from '#/api';
import { getTenantByWebsite, getTenantSimpleList } from '#/api/core/auth';
defineOptions({ name: 'ForgetPassword' });
const { tenantEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
@ -36,7 +39,7 @@ const fetchTenantList = async () => {
tenantList.value = await getTenantSimpleList();
// > store >
let tenantId: number | null = null;
let tenantId: null | number = null;
const websiteTenant = await websiteTenantPromise;
if (websiteTenant?.id) {
tenantId = websiteTenant.id;
@ -79,7 +82,10 @@ const formSchema = computed((): VbenFormSchema[] => {
rules: z
.number()
.nullable()
.refine((val) => val != null && val > 0, $t('authentication.tenantTip'))
.refine(
(val) => val !== null && val > 0,
$t('authentication.tenantTip'),
)
.default(null),
dependencies: {
triggerFields: ['tenantId'],
@ -139,7 +145,7 @@ const formSchema = computed((): VbenFormSchema[] => {
} finally {
loading.value = false;
}
}
},
},
fieldName: 'code',
label: $t('authentication.code'),

View File

@ -1,24 +1,32 @@
<script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui';
import { type AuthApi, checkCaptcha, getCaptcha, socialAuthRedirect } from '#/api/core/auth';
import type { AuthApi } from '#/api/core/auth';
import { computed, onMounted, ref } from 'vue';
import { AuthenticationLogin, Verification, z } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { useAppConfig } from '@vben/hooks';
import { useAuthStore } from '#/store';
import { useAccessStore } from '@vben/stores';
import { useRoute } from 'vue-router';
import { getTenantSimpleList, getTenantByWebsite } from '#/api/core/auth';
import {message} from 'ant-design-vue';
import { AuthenticationLogin, Verification, z } from '@vben/common-ui';
import { useAppConfig } from '@vben/hooks';
import { $t } from '@vben/locales';
import { useAccessStore } from '@vben/stores';
const { tenantEnable, captchaEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
import {
checkCaptcha,
getCaptcha,
getTenantByWebsite,
getTenantSimpleList,
socialAuthRedirect,
} from '#/api/core/auth';
import { useAuthStore } from '#/store';
defineOptions({ name: 'Login' });
const { tenantEnable, captchaEnable } = useAppConfig(
import.meta.env,
import.meta.env.PROD,
);
const { query } = useRoute();
const authStore = useAuthStore();
const accessStore = useAccessStore();
@ -40,7 +48,7 @@ const fetchTenantList = async () => {
tenantList.value = await getTenantSimpleList();
// > store >
let tenantId: number | null = null;
let tenantId: null | number = null;
const websiteTenant = await websiteTenantPromise;
if (websiteTenant?.id) {
tenantId = websiteTenant.id;
@ -72,7 +80,7 @@ const handleLogin = async (values: any) => {
//
await authStore.authLogin('username', values);
}
};
/** 验证码通过,执行登录 */
const handleVerifySuccess = async ({ captchaVerification }: any) => {
@ -95,13 +103,14 @@ const handleThirdLogin = async (type: number) => {
try {
// redirectUri
// tricky: typeredirect encode social-login.vue#getUrlValue() 使
const redirectUri =
location.origin +
'/auth/social-login?' +
encodeURIComponent(`type=${type}&redirect=${redirect || '/'}`)
const redirectUri = `${
location.origin
}/auth/social-login?${encodeURIComponent(
`type=${type}&redirect=${redirect || '/'}`,
)}`;
//
window.location.href = await socialAuthRedirect(type, redirectUri)
window.location.href = await socialAuthRedirect(type, redirectUri);
} catch (error) {
console.error('第三方登录处理失败:', error);
}
@ -128,7 +137,10 @@ const formSchema = computed((): VbenFormSchema[] => {
rules: z
.number()
.nullable()
.refine((val) => val != null && val > 0, $t('authentication.tenantTip'))
.refine(
(val) => val !== null && val > 0,
$t('authentication.tenantTip'),
)
.default(null),
dependencies: {
triggerFields: ['tenantId'],

View File

@ -1,21 +1,30 @@
<script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui';
import { type AuthApi, checkCaptcha, getCaptcha } from '#/api/core/auth';
import type { AuthApi } from '#/api/core/auth';
import { computed, h, onMounted, ref } from 'vue';
import { AuthenticationRegister, Verification, z } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { useAppConfig } from '@vben/hooks';
import { $t } from '@vben/locales';
import { useAccessStore } from '@vben/stores';
import { useAuthStore } from '#/store';
import { getTenantSimpleList, getTenantByWebsite } from '#/api/core/auth';
const { tenantEnable, captchaEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
import {
checkCaptcha,
getCaptcha,
getTenantByWebsite,
getTenantSimpleList,
} from '#/api/core/auth';
import { useAuthStore } from '#/store';
defineOptions({ name: 'Register' });
const { tenantEnable, captchaEnable } = useAppConfig(
import.meta.env,
import.meta.env.PROD,
);
const loading = ref(false);
const registerRef = ref();
const verifyRef = ref();
@ -36,7 +45,7 @@ const fetchTenantList = async () => {
tenantList.value = await getTenantSimpleList();
// > store >
let tenantId: number | null = null;
let tenantId: null | number = null;
const websiteTenant = await websiteTenantPromise;
if (websiteTenant?.id) {
tenantId = websiteTenant.id;
@ -103,7 +112,10 @@ const formSchema = computed((): VbenFormSchema[] => {
rules: z
.number()
.nullable()
.refine((val) => val != null && val > 0, $t('authentication.tenantTip'))
.refine(
(val) => val !== null && val > 0,
$t('authentication.tenantTip'),
)
.default(null),
dependencies: {
triggerFields: ['tenantId'],

View File

@ -1,23 +1,31 @@
<script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui';
import { type AuthApi, checkCaptcha, getCaptcha } from '#/api/core/auth';
import type { AuthApi } from '#/api/core/auth';
import { computed, onMounted, ref } from 'vue';
import { AuthenticationLogin, Verification, z } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { useAppConfig } from '@vben/hooks';
import { useAuthStore } from '#/store';
import { useAccessStore } from '@vben/stores';
import { useRoute, useRouter } from 'vue-router';
import { getTenantSimpleList, getTenantByWebsite } from '#/api/core/auth';
import { AuthenticationLogin, Verification, z } from '@vben/common-ui';
import { useAppConfig } from '@vben/hooks';
import { $t } from '@vben/locales';
import { useAccessStore } from '@vben/stores';
const { tenantEnable, captchaEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
import {
checkCaptcha,
getCaptcha,
getTenantByWebsite,
getTenantSimpleList,
} from '#/api/core/auth';
import { useAuthStore } from '#/store';
defineOptions({ name: 'SocialLogin' });
const { tenantEnable, captchaEnable } = useAppConfig(
import.meta.env,
import.meta.env.PROD,
);
const authStore = useAuthStore();
const accessStore = useAccessStore();
const { query } = useRoute();
@ -41,7 +49,7 @@ const fetchTenantList = async () => {
tenantList.value = await getTenantSimpleList();
// > store >
let tenantId: number | null = null;
let tenantId: null | number = null;
const websiteTenant = await websiteTenantPromise;
if (websiteTenant?.id) {
tenantId = websiteTenant.id;
@ -74,8 +82,8 @@ const tryLogin = async () => {
await router.replace({
query: {
...query,
redirect: encodeURIComponent(redirect)
}
redirect: encodeURIComponent(redirect),
},
});
}
@ -85,7 +93,7 @@ const tryLogin = async () => {
code: socialCode,
state: socialState,
});
}
};
/** 处理登录 */
const handleLogin = async (values: any) => {
@ -102,7 +110,7 @@ const handleLogin = async (values: any) => {
socialCode,
socialState,
});
}
};
/** 验证码通过,执行登录 */
const handleVerifySuccess = async ({ captchaVerification }: any) => {
@ -121,8 +129,8 @@ const handleVerifySuccess = async ({ captchaVerification }: any) => {
/** tricky: 配合 login.vue 中redirectUri 需要对参数进行 encode需要在回调后进行decode */
function getUrlValue(key: string): string {
const url = new URL(decodeURIComponent(location.href))
return url.searchParams.get(key) ?? ''
const url = new URL(decodeURIComponent(location.href));
return url.searchParams.get(key) ?? '';
}
/** 组件挂载时获取租户信息 */
@ -148,7 +156,10 @@ const formSchema = computed((): VbenFormSchema[] => {
rules: z
.number()
.nullable()
.refine((val) => val != null && val > 0, $t('authentication.tenantTip'))
.refine(
(val) => val !== null && val > 0,
$t('authentication.tenantTip'),
)
.default(null),
dependencies: {
triggerFields: ['tenantId'],

View File

@ -1,11 +1,12 @@
<script lang="ts" setup>
import type { VbenFormSchema } from '#/adapter/form';
import { computed, onMounted, reactive, ref } from 'vue';
import { useRoute } from 'vue-router';
import { AuthenticationAuthTitle, VbenButton } from '@vben/common-ui';
import { useVbenForm } from '#/adapter/form';
import { computed, reactive, ref, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { authorize, getAuthorize } from '#/api/system/oauth2/open';
defineOptions({ name: 'SSOLogin' });
@ -14,7 +15,7 @@ const { query } = useRoute(); // 路由参数
const client = ref({
name: '',
logo: ''
logo: '',
}); //
const queryParams = reactive({
@ -22,7 +23,7 @@ const queryParams = reactive({
clientId: '',
redirectUri: '',
state: '',
scopes: [] as string[] // query
scopes: [] as string[], // query
}); // URL client_idscope
const loading = ref(false); //
@ -30,7 +31,7 @@ const loading = ref(false); // 表单是否提交中
/** 初始化授权信息 */
const init = async () => {
//
if (typeof query.client_id === 'undefined') {
if (query.client_id === undefined) {
return;
}
//
@ -60,15 +61,20 @@ const init = async () => {
let scopes;
// params.scope scopes
if (queryParams.scopes.length > 0) {
scopes = data.scopes.filter(scope => queryParams.scopes.includes(scope.key));
scopes = data.scopes.filter((scope) =>
queryParams.scopes.includes(scope.key),
);
// params.scope 使 scopes
} else {
scopes = data.scopes;
queryParams.scopes = scopes.map(scope => scope.key);
queryParams.scopes = scopes.map((scope) => scope.key);
}
// 2.
formApi.setFieldValue('scopes', scopes.filter(scope => scope.value).map(scope => scope.key));
formApi.setFieldValue(
'scopes',
scopes.filter((scope) => scope.value).map((scope) => scope.key),
);
};
/** 处理授权的提交 */
@ -78,8 +84,11 @@ const handleSubmit = async (approved: boolean) => {
let uncheckedScopes: string[];
if (approved) {
//
checkedScopes = (await formApi.getValues()).scopes;
uncheckedScopes = queryParams.scopes.filter((item) => checkedScopes.indexOf(item) === -1);
const { scopes } = await formApi.getValues();
checkedScopes = scopes;
uncheckedScopes = queryParams.scopes.filter(
(item) => !checkedScopes.includes(item),
);
} else {
//
checkedScopes = [];
@ -101,7 +110,11 @@ const handleSubmit = async (approved: boolean) => {
};
/** 调用授权 API 接口 */
const doAuthorize = (autoApprove: boolean, checkedScopes: string[], uncheckedScopes: string[]) => {
const doAuthorize = (
autoApprove: boolean,
checkedScopes: string[],
uncheckedScopes: string[],
) => {
return authorize(
queryParams.responseType,
queryParams.clientId,
@ -109,7 +122,7 @@ const doAuthorize = (autoApprove: boolean, checkedScopes: string[], uncheckedSco
queryParams.state,
autoApprove,
checkedScopes,
uncheckedScopes
uncheckedScopes,
);
};
@ -118,12 +131,15 @@ const formatScope = (scope: string) => {
// scope 便
// demo "system_oauth2_scope" scope
switch (scope) {
case 'user.read':
case 'user.read': {
return '访问你的个人信息';
case 'user.write':
}
case 'user.write': {
return '修改你的个人信息';
default:
}
default: {
return scope;
}
}
};
@ -134,11 +150,11 @@ const formSchema = computed((): VbenFormSchema[] => {
label: '授权范围',
component: 'CheckboxGroup',
componentProps: {
options: queryParams.scopes.map(scope => ({
options: queryParams.scopes.map((scope) => ({
label: formatScope(scope),
value: scope
value: scope,
})),
class: 'flex flex-col gap-2'
class: 'flex flex-col gap-2',
},
},
];
@ -158,7 +174,7 @@ const [Form, formApi] = useVbenForm(
/** 初始化 */
onMounted(() => {
init();
})
});
</script>
<template>

View File

@ -3,6 +3,7 @@ import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { BpmCategoryApi } from '#/api/bpm/category';
import { useAccess } from '@vben/access';
import { z } from '#/adapter/form';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';

View File

@ -1,16 +1,20 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { BpmCategoryApi } from '#/api/bpm/category';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, message } from 'ant-design-vue';
import Form from './modules/form.vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteCategory, getCategoryPage } from '#/api/bpm/category';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,

View File

@ -1,12 +1,18 @@
<script lang="ts" setup>
import type { BpmCategoryApi } from '#/api/bpm/category';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { computed, ref } from 'vue';
import { useVbenForm } from '#/adapter/form';
import {createCategory, getCategory, updateCategory } from '#/api/bpm/category';
import {
createCategory,
getCategory,
updateCategory,
} from '#/api/bpm/category';
import { $t } from '#/locales';
import { useFormSchema } from '../data';

View File

@ -2,10 +2,11 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraApiAccessLogApi } from '#/api/infra/api-access-log';
import {DICT_TYPE, getDictOptions} from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
import { useAccess } from '@vben/access';
import { getRangePickerDefaultProps } from '#/utils/date';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
const { hasAccessByCodes } = useAccess();
/** 列表的搜索表单 */
@ -125,9 +126,7 @@ export function useGridColumns<T = InfraApiAccessLogApi.SystemApiAccessLog>(
title: '操作结果',
minWidth: 150,
formatter: ({ row }) => {
return row.resultCode === 0
? '成功'
: `失败(${row.resultMsg})`;
return row.resultCode === 0 ? '成功' : `失败(${row.resultMsg})`;
},
},
{

View File

@ -1,19 +1,26 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { InfraApiAccessLogApi } from '#/api/infra/api-access-log';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button } from 'ant-design-vue';
import { Download } from '@vben/icons';
import Detail from './modules/detail.vue';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { Button } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { exportApiAccessLog, getApiAccessLogPage } from '#/api/infra/api-access-log';
import {
exportApiAccessLog,
getApiAccessLogPage,
} from '#/api/infra/api-access-log';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { downloadByData } from '#/utils/download';
import { useGridColumns, useGridFormSchema } from './data';
import Detail from './modules/detail.vue';
const [DetailModal, detailModalApi] = useVbenModal({
connectedComponent: Detail,
@ -86,11 +93,16 @@ const [Grid, gridApi] = useVbenVxeGrid({
<DetailModal @success="onRefresh" />
<Grid table-title="API 访">
<template #toolbar-tools>
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['infra:api-access-log:export']">
<Button
type="primary"
class="ml-2"
@click="onExport"
v-access:code="['infra:api-access-log:export']"
>
<Download class="size-5" />
{{ $t('ui.actionTitle.export') }}
</Button>
</template>
</Grid>
</Page>
</template>
</template>

View File

@ -1,12 +1,14 @@
<script lang="ts" setup>
import type { InfraApiAccessLogApi } from '#/api/infra/api-access-log';
import { useVbenModal } from '@vben/common-ui';
import { Descriptions } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag';
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { formatDateTime } from '@vben/utils';
import { Descriptions } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE } from '#/utils/dict';
const formData = ref<InfraApiAccessLogApi.SystemApiAccessLog>();
@ -32,8 +34,19 @@ const [Modal, modalApi] = useVbenModal({
</script>
<template>
<Modal title="API 访问日志详情" class="w-1/2" :show-cancel-button="false" :show-confirm-button="false">
<Descriptions bordered :column="1" size="middle" class="mx-4" :label-style="{ width: '110px' }">
<Modal
title="API 访问日志详情"
class="w-1/2"
:show-cancel-button="false"
:show-confirm-button="false"
>
<Descriptions
bordered
:column="1"
size="middle"
class="mx-4"
:label-style="{ width: '110px' }"
>
<Descriptions.Item label="日志编号">
{{ formData?.id }}
</Descriptions.Item>
@ -63,9 +76,12 @@ const [Modal, modalApi] = useVbenModal({
{{ formData?.responseBody }}
</Descriptions.Item>
<Descriptions.Item label="请求时间">
{{ formatDateTime(formData?.beginTime || '') }} ~ {{ formatDateTime(formData?.endTime || '') }}
{{ formatDateTime(formData?.beginTime || '') }} ~
{{ formatDateTime(formData?.endTime || '') }}
</Descriptions.Item>
<Descriptions.Item label="请求耗时">
{{ formData?.duration }} ms
</Descriptions.Item>
<Descriptions.Item label="请求耗时">{{ formData?.duration }} ms</Descriptions.Item>
<Descriptions.Item label="操作结果">
<div v-if="formData?.resultCode === 0"></div>
<div v-else-if="formData?.resultCode > 0">
@ -79,7 +95,10 @@ const [Modal, modalApi] = useVbenModal({
{{ formData?.operateName }}
</Descriptions.Item>
<Descriptions.Item label="操作类型">
<DictTag :type="DICT_TYPE.INFRA_OPERATE_TYPE" :value="formData?.operateType" />
<DictTag
:type="DICT_TYPE.INFRA_OPERATE_TYPE"
:value="formData?.operateType"
/>
</Descriptions.Item>
</Descriptions>
</Modal>

View File

@ -2,10 +2,11 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraApiErrorLogApi } from '#/api/infra/api-error-log';
import {DICT_TYPE, getDictOptions} from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
import { useAccess } from '@vben/access';
import { InfraApiErrorLogProcessStatusEnum } from '#/utils/constants';
import { getRangePickerDefaultProps } from '#/utils/date';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
const { hasAccessByCodes } = useAccess();
@ -54,7 +55,10 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '处理状态',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS, 'number'),
options: getDictOptions(
DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS,
'number',
),
allowClear: true,
placeholder: '请选择处理状态',
},
@ -145,16 +149,20 @@ export function useGridColumns<T = InfraApiErrorLogApi.SystemApiErrorLog>(
code: 'done',
text: '已处理',
show: (row: InfraApiErrorLogApi.SystemApiErrorLog) => {
return row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT &&
hasAccessByCodes(['infra:api-error-log:update-status']);
return (
row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT &&
hasAccessByCodes(['infra:api-error-log:update-status'])
);
},
},
{
code: 'ignore',
text: '已忽略',
show: (row: InfraApiErrorLogApi.SystemApiErrorLog) => {
return row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT &&
hasAccessByCodes(['infra:api-error-log:update-status']);
return (
row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT &&
hasAccessByCodes(['infra:api-error-log:update-status'])
);
},
},
],

View File

@ -1,20 +1,28 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { InfraApiErrorLogApi } from '#/api/infra/api-error-log';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, message, Modal } from 'ant-design-vue';
import { Download } from '@vben/icons';
import Detail from './modules/detail.vue';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { Button, message, Modal } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { exportApiErrorLog, getApiErrorLogPage, updateApiErrorLogStatus } from '#/api/infra/api-error-log';
import { downloadByData } from '#/utils/download';
import {
exportApiErrorLog,
getApiErrorLogPage,
updateApiErrorLogStatus,
} from '#/api/infra/api-error-log';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { InfraApiErrorLogProcessStatusEnum } from '#/utils/constants';
import { downloadByData } from '#/utils/download';
import { useGridColumns, useGridFormSchema } from './data';
import Detail from './modules/detail.vue';
const [DetailModal, detailModalApi] = useVbenModal({
connectedComponent: Detail,
@ -50,7 +58,7 @@ async function onProcess(id: number, processStatus: number) {
key: 'action_process_msg',
});
onRefresh();
}
},
});
}
@ -112,11 +120,16 @@ const [Grid, gridApi] = useVbenVxeGrid({
<DetailModal @success="onRefresh" />
<Grid table-title="API ">
<template #toolbar-tools>
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['infra:api-error-log:export']">
<Button
type="primary"
class="ml-2"
@click="onExport"
v-access:code="['infra:api-error-log:export']"
>
<Download class="size-5" />
{{ $t('ui.actionTitle.export') }}
</Button>
</template>
</Grid>
</Page>
</template>
</template>

View File

@ -1,12 +1,14 @@
<script lang="ts" setup>
import type { InfraApiErrorLogApi } from '#/api/infra/api-error-log';
import { useVbenModal } from '@vben/common-ui';
import { Descriptions, Input } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag';
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { formatDateTime } from '@vben/utils';
import { Descriptions, Input } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE } from '#/utils/dict';
const formData = ref<InfraApiErrorLogApi.SystemApiErrorLog>();
@ -32,8 +34,19 @@ const [Modal, modalApi] = useVbenModal({
</script>
<template>
<Modal title="API错误日志详情" class="w-1/2" :show-cancel-button="false" :show-confirm-button="false">
<Descriptions bordered :column="1" size="middle" class="mx-4" :label-style="{ width: '110px' }">
<Modal
title="API错误日志详情"
class="w-1/2"
:show-cancel-button="false"
:show-confirm-button="false"
>
<Descriptions
bordered
:column="1"
size="middle"
class="mx-4"
:label-style="{ width: '110px' }"
>
<Descriptions.Item label="日志编号">
{{ formData?.id }}
</Descriptions.Item>
@ -68,7 +81,7 @@ const [Modal, modalApi] = useVbenModal({
<Descriptions.Item v-if="formData?.exceptionStackTrace" label="异常堆栈">
<Input.TextArea
:value="formData?.exceptionStackTrace"
:autoSize="{ maxRows: 20 }"
:auto-size="{ maxRows: 20 }"
readonly
/>
</Descriptions.Item>

View File

@ -1,21 +1,23 @@
import type { ComputedRef } from 'vue';
import type { Recordable } from '@vben/types';
import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraCodegenApi } from '#/api/infra/codegen';
import type { SystemMenuApi } from '#/api/system/menu';
import type { Recordable } from '@vben/types';
import type { ComputedRef } from 'vue';
import { h } from 'vue';
import { useAccess } from '@vben/access';
import { IconifyIcon } from '@vben/icons';
import { $t } from '@vben/locales';
import { getDataSourceConfigList } from '#/api/infra/data-source-config';
import { getMenuList } from '#/api/system/menu';
import { getRangePickerDefaultProps } from '#/utils/date';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { handleTree } from '#/utils/tree';
import { h } from 'vue';
import { useAccess } from '@vben/access';
import { $t } from '@vben/locales';
const { hasAccessByCodes } = useAccess();
@ -130,7 +132,10 @@ export function useGenerationInfoBaseFormSchema(): VbenFormSchema[] {
fieldName: 'templateType',
label: '生成模板',
componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE, 'number'),
options: getDictOptions(
DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE,
'number',
),
class: 'w-full',
},
rules: 'selectRequired',
@ -233,7 +238,9 @@ export function useGenerationInfoBaseFormSchema(): VbenFormSchema[] {
}
/** 树表信息 schema */
export function useGenerationInfoTreeFormSchema(columns: InfraCodegenApi.CodegenColumn[] = []): VbenFormSchema[] {
export function useGenerationInfoTreeFormSchema(
columns: InfraCodegenApi.CodegenColumn[] = [],
): VbenFormSchema[] {
return [
{
component: 'Divider',

View File

@ -1,17 +1,19 @@
<script lang="ts" setup>
import type { InfraCodegenApi } from '#/api/infra/codegen';
import BasicInfo from '../modules/basic-info.vue';
import ColumnInfo from '../modules/column-info.vue';
import GenerationInfo from '../modules/generation-info.vue';
import { ref, unref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { Button, message, Steps } from 'ant-design-vue';
import { getCodegenTable, updateCodegenTable } from '#/api/infra/codegen';
import { $t } from '#/locales';
import { ref, unref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import BasicInfo from '../modules/basic-info.vue';
import ColumnInfo from '../modules/column-info.vue';
import GenerationInfo from '../modules/generation-info.vue';
const route = useRoute();
const router = useRouter();
@ -66,7 +68,10 @@ const submitForm = async () => {
const basicInfo = await basicInfoRef.value?.getValues();
const columns = columnInfoRef.value?.getData() || unref(formData).columns;
const generateInfo = await generateInfoRef.value?.getValues();
await updateCodegenTable({ table: { ...unref(formData).table, ...basicInfo, ...generateInfo }, columns });
await updateCodegenTable({
table: { ...unref(formData).table, ...basicInfo, ...generateInfo },
columns,
});
//
message.success({
content: $t('ui.actionMessage.operationSuccess'),
@ -117,15 +122,33 @@ getDetail();
<template>
<Page auto-content-height v-loading="loading">
<div class="flex h-[95%] flex-col rounded-md bg-white p-4 dark:bg-[#1f1f1f] dark:text-gray-300">
<Steps type="navigation" v-model:current="currentStep" class="mb-8 rounded shadow-sm dark:bg-[#141414]">
<Steps.Step v-for="(step, index) in steps" :key="index" :title="step.title" />
<div
class="flex h-[95%] flex-col rounded-md bg-white p-4 dark:bg-[#1f1f1f] dark:text-gray-300"
>
<Steps
type="navigation"
v-model:current="currentStep"
class="mb-8 rounded shadow-sm dark:bg-[#141414]"
>
<Steps.Step
v-for="(step, index) in steps"
:key="index"
:title="step.title"
/>
</Steps>
<div class="flex-1 overflow-auto py-4">
<!-- 根据当前步骤显示对应的组件 -->
<BasicInfo v-show="currentStep === 0" ref="basicInfoRef" :table="formData.table" />
<ColumnInfo v-show="currentStep === 1" ref="columnInfoRef" :columns="formData.columns" />
<BasicInfo
v-show="currentStep === 0"
ref="basicInfoRef"
:table="formData.table"
/>
<ColumnInfo
v-show="currentStep === 1"
ref="columnInfoRef"
:columns="formData.columns"
/>
<GenerationInfo
v-show="currentStep === 2"
ref="generateInfoRef"
@ -136,7 +159,9 @@ getDetail();
<div class="mt-4 flex justify-end space-x-2">
<Button v-show="currentStep > 0" @click="prevStep"></Button>
<Button v-show="currentStep < steps.length - 1" @click="nextStep"></Button>
<Button v-show="currentStep < steps.length - 1" @click="nextStep">
下一步
</Button>
<Button type="primary" :loading="loading" @click="submitForm">
保存
</Button>

View File

@ -1,29 +1,42 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { InfraCodegenApi } from '#/api/infra/codegen';
import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config';
import { DocAlert } from '#/components/doc-alert';
import ImportTable from './modules/import-table.vue';
import PreviewCode from './modules/preview-code.vue';
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteCodegenTable, downloadCodegen, getCodegenTablePage, syncCodegenFromDB } from '#/api/infra/codegen';
import {
deleteCodegenTable,
downloadCodegen,
getCodegenTablePage,
syncCodegenFromDB,
} from '#/api/infra/codegen';
import { getDataSourceConfigList } from '#/api/infra/data-source-config';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { computed, ref } from 'vue';
import { useGridColumns, useGridFormSchema } from './data';
import { useRouter } from 'vue-router';
import ImportTable from './modules/import-table.vue';
import PreviewCode from './modules/preview-code.vue';
const router = useRouter();
const dataSourceConfigList = ref<InfraDataSourceConfigApi.InfraDataSourceConfig[]>([]);
const dataSourceConfigList = ref<
InfraDataSourceConfigApi.InfraDataSourceConfig[]
>([]);
const getDataSourceConfigName = computed(
() => (cellValue: number) => dataSourceConfigList.value.find((item) => item.id === cellValue)?.name || '',
() => (cellValue: number) =>
dataSourceConfigList.value.find((item) => item.id === cellValue)?.name ||
'',
);
const [ImportModal, importModalApi] = useVbenModal({
@ -120,16 +133,19 @@ async function onGenerate(row: InfraCodegenApi.CodegenTable) {
}
/** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<InfraCodegenApi.CodegenTable>) {
function onActionClick({
code,
row,
}: OnActionClickParams<InfraCodegenApi.CodegenTable>) {
switch (code) {
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
case 'generate': {
onGenerate(row);
break;
@ -188,16 +204,29 @@ initDataSourceConfig();
</script>
<template>
<Page auto-content-height>
<DocAlert title="代码生成(单表)" url="https://doc.iocoder.cn/new-feature/" />
<DocAlert title="代码生成(树表)" url="https://doc.iocoder.cn/new-feature/tree/" />
<DocAlert title="代码生成(主子表)" url="https://doc.iocoder.cn/new-feature/master-sub/" />
<DocAlert
title="代码生成(单表)"
url="https://doc.iocoder.cn/new-feature/"
/>
<DocAlert
title="代码生成(树表)"
url="https://doc.iocoder.cn/new-feature/tree/"
/>
<DocAlert
title="代码生成(主子表)"
url="https://doc.iocoder.cn/new-feature/master-sub/"
/>
<DocAlert title="单元测试" url="https://doc.iocoder.cn/unit-test/" />
<ImportModal @success="onRefresh" />
<PreviewModal />
<Grid table-title="">
<template #toolbar-tools>
<Button type="primary" @click="onImport" v-access:code="['infra:codegen:create']">
<Button
type="primary"
@click="onImport"
v-access:code="['infra:codegen:create']"
>
<Plus class="size-5" />
导入
</Button>

View File

@ -1,9 +1,10 @@
<script lang="ts" setup>
import type { InfraCodegenApi } from '#/api/infra/codegen';
import { useVbenForm } from '#/adapter/form';
import { watch } from 'vue';
import { useVbenForm } from '#/adapter/form';
import { useBasicInfoFormSchema } from '../data';
const props = defineProps<{

View File

@ -2,11 +2,12 @@
import type { InfraCodegenApi } from '#/api/infra/codegen';
import type { SystemDictTypeApi } from '#/api/system/dict/type';
import { nextTick, onMounted, ref, watch } from 'vue';
import { Checkbox, Input, Select } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getSimpleDictTypeList } from '#/api/system/dict/type';
import { nextTick, onMounted, ref, watch } from 'vue';
import { useCodegenColumnTableColumns } from '../data';
@ -71,7 +72,11 @@ onMounted(async () => {
<!-- Java 类型 -->
<template #javaType="{ row, column }">
<Select v-model:value="row.javaType" style="width: 100%">
<Select.Option v-for="option in column.params.options" :key="option.value" :value="option.value">
<Select.Option
v-for="option in column.params.options"
:key="option.value"
:value="option.value"
>
{{ option.label }}
</Select.Option>
</Select>
@ -101,7 +106,11 @@ onMounted(async () => {
<!-- 查询方式 -->
<template #listOperationCondition="{ row, column }">
<Select v-model:value="row.listOperationCondition" class="w-full">
<Select.Option v-for="option in column.params.options" :key="option.value" :value="option.value">
<Select.Option
v-for="option in column.params.options"
:key="option.value"
:value="option.value"
>
{{ option.label }}
</Select.Option>
</Select>
@ -115,7 +124,11 @@ onMounted(async () => {
<!-- 显示类型 -->
<template #htmlType="{ row, column }">
<Select v-model:value="row.htmlType" class="w-full">
<Select.Option v-for="option in column.params.options" :key="option.value" :value="option.value">
<Select.Option
v-for="option in column.params.options"
:key="option.value"
:value="option.value"
>
{{ option.label }}
</Select.Option>
</Select>
@ -123,8 +136,17 @@ onMounted(async () => {
<!-- 字典类型 -->
<template #dictType="{ row }">
<Select v-model:value="row.dictType" class="w-full" allow-clear show-search>
<Select.Option v-for="option in dictTypeOptions" :key="option.type" :value="option.type">
<Select
v-model:value="row.dictType"
class="w-full"
allow-clear
show-search
>
<Select.Option
v-for="option in dictTypeOptions"
:key="option.type"
:value="option.type"
>
{{ option.name }}
</Select.Option>
</Select>

View File

@ -1,12 +1,13 @@
<script lang="ts" setup>
import type { InfraCodegenApi } from '#/api/infra/codegen';
import { computed, ref, watch } from 'vue';
import { isEmpty } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { getCodegenTableList } from '#/api/infra/codegen';
import { InfraCodegenTemplateTypeEnum } from '#/utils/constants';
import { computed, ref, watch } from 'vue';
import { isEmpty } from '@vben/utils';
import {
useGenerationInfoBaseFormSchema,
@ -23,8 +24,12 @@ const tables = ref<InfraCodegenApi.CodegenTable[]>([]);
/** 计算当前模板类型 */
const currentTemplateType = ref<number>();
const isTreeTable = computed(() => currentTemplateType.value === InfraCodegenTemplateTypeEnum.TREE);
const isSubTable = computed(() => currentTemplateType.value === InfraCodegenTemplateTypeEnum.SUB);
const isTreeTable = computed(
() => currentTemplateType.value === InfraCodegenTemplateTypeEnum.TREE,
);
const isSubTable = computed(
() => currentTemplateType.value === InfraCodegenTemplateTypeEnum.SUB,
);
/** 基础表单实例 */
const [BaseForm, baseFormApi] = useVbenForm({
@ -34,7 +39,10 @@ const [BaseForm, baseFormApi] = useVbenForm({
schema: useGenerationInfoBaseFormSchema(),
handleValuesChange: (values) => {
//
if (values.templateType !== undefined && values.templateType !== currentTemplateType.value) {
if (
values.templateType !== undefined &&
values.templateType !== currentTemplateType.value
) {
currentTemplateType.value = values.templateType;
}
},

View File

@ -2,16 +2,19 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraCodegenApi } from '#/api/infra/codegen';
import { reactive } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { createCodegenList, getSchemaTableList } from '#/api/infra/codegen';
import { reactive } from 'vue';
import { $t } from '@vben/locales';
import { useImportTableColumns, useImportTableFormSchema } from '#/views/infra/codegen/data';
import {
useImportTableColumns,
useImportTableFormSchema,
} from '#/views/infra/codegen/data';
/** 定义组件事件 */
const emit = defineEmits<{
@ -63,7 +66,11 @@ const [Grid] = useVbenVxeGrid({
},
} as VxeTableGridOptions<InfraCodegenApi.DatabaseTable>,
gridEvents: {
checkboxChange: ({ records }: { records: InfraCodegenApi.DatabaseTable[] }) => {
checkboxChange: ({
records,
}: {
records: InfraCodegenApi.DatabaseTable[];
}) => {
formData.tableNames = records.map((item) => item.name);
},
},

View File

@ -7,14 +7,13 @@
// TODO @vben2.0 CodeEditor
import type { InfraCodegenApi } from '#/api/infra/codegen';
import { useVbenModal } from '@vben/common-ui';
import { Copy } from '@vben/icons';
import { Button, DirectoryTree, message, Tabs } from 'ant-design-vue';
import { previewCodegen } from '#/api/infra/codegen';
import { h, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Copy } from '@vben/icons';
import { useClipboard } from '@vueuse/core';
import { Button, DirectoryTree, message, Tabs } from 'ant-design-vue';
import hljs from 'highlight.js/lib/core';
import java from 'highlight.js/lib/languages/java';
import javascript from 'highlight.js/lib/languages/javascript';
@ -22,6 +21,8 @@ import sql from 'highlight.js/lib/languages/sql';
import typescript from 'highlight.js/lib/languages/typescript';
import xml from 'highlight.js/lib/languages/xml';
import { previewCodegen } from '#/api/infra/codegen';
/** 注册代码高亮语言 */
hljs.registerLanguage('java', java);
hljs.registerLanguage('xml', xml);
@ -74,7 +75,9 @@ const removeCodeMapKey = (targetKey: any) => {
/** 复制代码 */
const copyCode = async () => {
const { copy } = useClipboard();
const file = previewFiles.value.find((item) => item.filePath === activeKey.value);
const file = previewFiles.value.find(
(item) => item.filePath === activeKey.value,
);
if (file) {
await copy(file.code);
message.success('复制成功');
@ -125,7 +128,18 @@ const handleFiles = (data: InfraCodegenApi.CodegenPreview[]): FileNode[] => {
let packagePath = '';
while (cursor < paths.length) {
const nextPath = paths[cursor] || '';
if (['controller', 'convert', 'dal', 'dataobject', 'enums', 'mysql', 'service', 'vo'].includes(nextPath)) {
if (
[
'controller',
'convert',
'dal',
'dataobject',
'enums',
'mysql',
'service',
'vo',
].includes(nextPath)
) {
break;
}
packagePath = packagePath ? `${packagePath}.${nextPath}` : nextPath;
@ -216,21 +230,38 @@ const [Modal, modalApi] = useVbenModal({
<div class="flex h-full" v-loading="loading">
<!-- 文件树 -->
<div class="w-1/3 border-r border-gray-200 pr-4 dark:border-gray-700">
<DirectoryTree v-model:active-key="activeKey" @select="handleNodeClick" :tree-data="fileTree" />
<DirectoryTree
v-model:active-key="activeKey"
@select="handleNodeClick"
:tree-data="fileTree"
/>
</div>
<!-- 代码预览 -->
<div class="w-2/3 pl-4">
<Tabs v-model:active-key="activeKey" hide-add type="editable-card" @edit="removeCodeMapKey">
<Tabs.TabPane v-for="key in codeMap.keys()" :key="key" :tab="key.split('/').pop()">
<Tabs
v-model:active-key="activeKey"
hide-add
type="editable-card"
@edit="removeCodeMapKey"
>
<Tabs.TabPane
v-for="key in codeMap.keys()"
:key="key"
:tab="key.split('/').pop()"
>
<div class="h-[calc(100%-40px)] overflow-auto">
<pre class="overflow-auto rounded-md bg-gray-50 p-4 text-gray-800 dark:bg-gray-800 dark:text-gray-200">
<pre
class="overflow-auto rounded-md bg-gray-50 p-4 text-gray-800 dark:bg-gray-800 dark:text-gray-200"
>
<!-- eslint-disable-next-line vue/no-v-html -->
<code v-html="codeMap.get(activeKey)" class="code-highlight"></code>
</pre>
</div>
</Tabs.TabPane>
<template #rightExtra>
<Button type="primary" ghost @click="copyCode" :icon="h(Copy)"> 复制代码 </Button>
<Button type="primary" ghost @click="copyCode" :icon="h(Copy)">
复制代码
</Button>
</template>
</Tabs>
</div>

View File

@ -2,10 +2,11 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraConfigApi } from '#/api/infra/config';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
import { useAccess } from '@vben/access';
import { getRangePickerDefaultProps } from '#/utils/date';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
const { hasAccessByCodes } = useAccess();
/** 新增/修改的表单 */
@ -73,7 +74,7 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'Textarea',
componentProps: {
placeholder: '请输入备注',
}
},
},
];
}
@ -88,7 +89,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
componentProps: {
placeholder: '请输入参数名称',
clearable: true,
}
},
},
{
fieldName: 'key',
@ -97,7 +98,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
componentProps: {
placeholder: '请输入参数键名',
clearable: true,
}
},
},
{
fieldName: 'type',

View File

@ -1,18 +1,23 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { InfraConfigApi } from '#/api/infra/config';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, message } from 'ant-design-vue';
import { Plus, Download } from '@vben/icons';
import Form from './modules/form.vue';
import { Download, Plus } from '@vben/icons';
import { Button, message } from 'ant-design-vue';
import { $t } from '#/locales';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getConfigPage, deleteConfig, exportConfig } from '#/api/infra/config';
import { useGridColumns, useGridFormSchema } from './data';
import { deleteConfig, exportConfig, getConfigPage } from '#/api/infra/config';
import { $t } from '#/locales';
import { downloadByData } from '#/utils/download';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
@ -53,7 +58,7 @@ async function onDelete(row: InfraConfigApi.InfraConfig) {
key: 'action_process_msg',
});
onRefresh();
} catch (error) {
} catch {
hideLoading();
}
}
@ -64,20 +69,20 @@ function onActionClick({
row,
}: OnActionClickParams<InfraConfigApi.InfraConfig>) {
switch (code) {
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
}
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema()
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(onActionClick),
@ -110,11 +115,20 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" />
<Grid table-title="">
<template #toolbar-tools>
<Button type="primary" @click="onCreate" v-access:code="['infra:config:create']">
<Button
type="primary"
@click="onCreate"
v-access:code="['infra:config:create']"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['参数']) }}
</Button>
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['infra:config:export']">
<Button
type="primary"
class="ml-2"
@click="onExport"
v-access:code="['infra:config:export']"
>
<Download class="size-5" />
{{ $t('ui.actionTitle.export') }}
</Button>

View File

@ -1,13 +1,15 @@
<script lang="ts" setup>
import type { InfraConfigApi } from '#/api/infra/config';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { $t } from '#/locales';
import { computed, ref } from 'vue';
import { useVbenForm } from '#/adapter/form';
import { createConfig, updateConfig, getConfig } from '#/api/infra/config';
import { createConfig, getConfig, updateConfig } from '#/api/infra/config';
import { $t } from '#/locales';
import { useFormSchema } from '../data';

View File

@ -58,9 +58,9 @@ export function useFormSchema(): VbenFormSchema[] {
}
/** 列表的字段 */
export function useGridColumns<T = InfraDataSourceConfigApi.InfraDataSourceConfig>(
onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] {
export function useGridColumns<
T = InfraDataSourceConfigApi.InfraDataSourceConfig,
>(onActionClick: OnActionClickFn<T>): VxeTableGridOptions['columns'] {
return [
{
field: 'id',

View File

@ -1,18 +1,27 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, message } from 'ant-design-vue';
import { Plus, } from '@vben/icons';
import Form from './modules/form.vue';
import { $t } from '#/locales';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getDataSourceConfigList, deleteDataSourceConfig } from '#/api/infra/data-source-config';
import { useGridColumns } from './data';
import { onMounted } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteDataSourceConfig,
getDataSourceConfigList,
} from '#/api/infra/data-source-config';
import { $t } from '#/locales';
import { useGridColumns } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
@ -42,7 +51,7 @@ async function onDelete(row: InfraDataSourceConfigApi.InfraDataSourceConfig) {
key: 'action_process_msg',
});
await handleLoadData();
} catch (error) {
} catch {
hideLoading();
}
}
@ -53,14 +62,14 @@ function onActionClick({
row,
}: OnActionClickParams<InfraDataSourceConfigApi.InfraDataSourceConfig>) {
switch (code) {
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
}
}
@ -77,8 +86,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
proxyConfig: {
ajax: {
query: getDataSourceConfigList
}
query: getDataSourceConfigList,
},
},
} as VxeTableGridOptions<InfraDataSourceConfigApi.InfraDataSourceConfig>,
});
@ -104,11 +113,15 @@ onMounted(() => {
<FormModal @success="onRefresh" />
<Grid table-title="">
<template #toolbar-tools>
<Button type="primary" @click="onCreate" v-access:code="['infra:data-source-config:create']">
<Button
type="primary"
@click="onCreate"
v-access:code="['infra:data-source-config:create']"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['数据源']) }}
</Button>
</template>
</Grid>
</Page>
</template>
</template>

View File

@ -1,13 +1,19 @@
<script lang="ts" setup>
import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { $t } from '#/locales';
import { computed, ref } from 'vue';
import { useVbenForm } from '#/adapter/form';
import { createDataSourceConfig, updateDataSourceConfig, getDataSourceConfig } from '#/api/infra/data-source-config';
import {
createDataSourceConfig,
getDataSourceConfig,
updateDataSourceConfig,
} from '#/api/infra/data-source-config';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
@ -33,9 +39,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
//
const data = (await formApi.getValues()) as InfraDataSourceConfigApi.InfraDataSourceConfig;
const data =
(await formApi.getValues()) as InfraDataSourceConfigApi.InfraDataSourceConfig;
try {
await (formData.value?.id ? updateDataSourceConfig(data) : createDataSourceConfig(data));
await (formData.value?.id
? updateDataSourceConfig(data)
: createDataSourceConfig(data));
//
await modalApi.close();
emit('success');
@ -52,7 +61,8 @@ const [Modal, modalApi] = useVbenModal({
return;
}
//
const data = modalApi.getData<InfraDataSourceConfigApi.InfraDataSourceConfig>();
const data =
modalApi.getData<InfraDataSourceConfigApi.InfraDataSourceConfig>();
if (!data || !data.id) {
return;
}

View File

@ -1,13 +1,14 @@
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn } from '#/adapter/vxe-table';
import type { Demo01ContactApi } from '#/api/infra/demo/demo01';
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
import { useAccess } from '@vben/access';
import { getRangePickerDefaultProps } from '#/utils/date';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { useAccess } from '@vben/access';
const { hasAccessByCodes } = useAccess();
/** 新增/修改的表单 */

View File

@ -1,19 +1,28 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { Demo01ContactApi } from '#/api/infra/demo/demo01';
import Form from './modules/form.vue';
import { h } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteDemo01Contact, exportDemo01Contact, getDemo01ContactPage } from '#/api/infra/demo/demo01';
import {
deleteDemo01Contact,
exportDemo01Contact,
getDemo01ContactPage,
} from '#/api/infra/demo/demo01';
import { $t } from '#/locales';
import { downloadByData } from '#/utils/download';
import { h } from 'vue';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
@ -61,7 +70,10 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
}
/** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<Demo01ContactApi.Demo01Contact>) {
function onActionClick({
code,
row,
}: OnActionClickParams<Demo01ContactApi.Demo01Contact>) {
switch (code) {
case 'delete': {
onDelete(row);
@ -114,7 +126,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
<Grid table-title="">
<template #toolbar-tools>
<Button :icon="h(Plus)" type="primary" @click="onCreate" v-access:code="['infra:demo01-contact:create']">
<Button
:icon="h(Plus)"
type="primary"
@click="onCreate"
v-access:code="['infra:demo01-contact:create']"
>
{{ $t('ui.actionTitle.create', ['示例联系人']) }}
</Button>
<Button

View File

@ -1,20 +1,28 @@
<script lang="ts" setup>
import type { Demo01ContactApi } from '#/api/infra/demo/demo01';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { createDemo01Contact, getDemo01Contact, updateDemo01Contact } from '#/api/infra/demo/demo01';
import {
createDemo01Contact,
getDemo01Contact,
updateDemo01Contact,
} from '#/api/infra/demo/demo01';
import { $t } from '#/locales';
import { computed, ref } from 'vue';
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<Demo01ContactApi.Demo01Contact>();
const getTitle = computed(() => {
return formData.value?.id ? $t('ui.actionTitle.edit', ['示例联系人']) : $t('ui.actionTitle.create', ['示例联系人']);
return formData.value?.id
? $t('ui.actionTitle.edit', ['示例联系人'])
: $t('ui.actionTitle.create', ['示例联系人']);
});
const [Form, formApi] = useVbenForm({
@ -33,7 +41,9 @@ const [Modal, modalApi] = useVbenModal({
//
const data = (await formApi.getValues()) as Demo01ContactApi.Demo01Contact;
try {
await (formData.value?.id ? updateDemo01Contact(data) : createDemo01Contact(data));
await (formData.value?.id
? updateDemo01Contact(data)
: createDemo01Contact(data));
//
await modalApi.close();
emit('success');

Some files were not shown because too many files have changed in this diff Show More