refactor: type/注释优化 去除大量any

This commit is contained in:
dap
2025-01-10 14:02:21 +08:00
parent 6e3b468303
commit 9f6bee86f0
81 changed files with 710 additions and 367 deletions

View File

@@ -3,13 +3,15 @@
* 可用于 vben-form、vben-modal、vben-drawer 等组件使用, * 可用于 vben-form、vben-modal、vben-drawer 等组件使用,
*/ */
import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue'; import type { Component, SetupContext } from 'vue';
import { Tinymce as RichTextarea } from '#/components/tinymce'; import type { BaseFormComponentType } from '@vben/common-ui';
import { FileUpload, ImageUpload } from '#/components/upload';
import { h } from 'vue';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { import {
AutoComplete, AutoComplete,
Button, Button,
@@ -34,7 +36,9 @@ import {
TreeSelect, TreeSelect,
Upload, Upload,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { h } from 'vue';
import { Tinymce as RichTextarea } from '#/components/tinymce';
import { FileUpload, ImageUpload } from '#/components/upload';
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = <T extends Component>(
component: T, component: T,

View File

@@ -1,10 +1,13 @@
import type { VxeGridDefines, VxeGridPropTypes } from '@vben/plugins/vxe-table';
import type { Ref } from 'vue'; import type { Ref } from 'vue';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table'; import type { VxeGridDefines, VxeGridPropTypes } from '@vben/plugins/vxe-table';
import { Button, Image } from 'ant-design-vue';
import { h } from 'vue'; import { h } from 'vue';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
import { Button, Image } from 'ant-design-vue';
import { useVbenForm } from './form'; import { useVbenForm } from './form';
setupVbenVxeTable({ setupVbenVxeTable({

View File

@@ -38,4 +38,5 @@ export interface PageQuery {
orderByColumn?: string; orderByColumn?: string;
pageNum?: number; pageNum?: number;
pageSize?: number; pageSize?: number;
[key: string]: any;
} }

View File

@@ -19,7 +19,7 @@ export interface MenuMeta {
* @param name 菜单名 * @param name 菜单名
* @param path 菜单路径 * @param path 菜单路径
* @param hidden 是否隐藏 * @param hidden 是否隐藏
* @param component 组件名称 Laout * @param component 组件名称 Layout
* @param alwaysShow 总是显示 * @param alwaysShow 总是显示
* @param query 路由参数(json形式) * @param query 路由参数(json形式)
* @param meta 路由信息 * @param meta 路由信息

View File

@@ -17,6 +17,11 @@ export function onlineDeviceList() {
return requestClient.get<PageResult<OnlineUser>>(Api.root); return requestClient.get<PageResult<OnlineUser>>(Api.root);
} }
/**
* 这里的分页参数无效 返回的是全部的分页
* @param params 请求参数
* @returns 结果
*/
export function onlineList(params?: PageQuery) { export function onlineList(params?: PageQuery) {
return requestClient.get<PageResult<OnlineUser>>(Api.onlineList, { params }); return requestClient.get<PageResult<OnlineUser>>(Api.onlineList, { params });
} }

View File

@@ -12,20 +12,36 @@ enum Api {
root = '/monitor/operlog', root = '/monitor/operlog',
} }
/**
* 操作日志分页
* @param params 查询参数
* @returns 分页结果
*/
export function operLogList(params?: PageQuery) { export function operLogList(params?: PageQuery) {
return requestClient.get<PageResult<OperationLog>>(Api.operLogList, { return requestClient.get<PageResult<OperationLog>>(Api.operLogList, {
params, params,
}); });
} }
/**
* 删除操作日志
* @param operIds id/ids
*/
export function operLogDelete(operIds: IDS) { export function operLogDelete(operIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${operIds}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${operIds}`);
} }
/**
* 清空全部分页日志
*/
export function operLogClean() { export function operLogClean() {
return requestClient.deleteWithMsg<void>(Api.operLogClean); return requestClient.deleteWithMsg<void>(Api.operLogClean);
} }
export function operLogExport(data: any) { /**
* 导出操作日志
* @param data 查询参数
*/
export function operLogExport(data: Partial<OperationLog>) {
return commonExport(Api.operLogExport, data); return commonExport(Api.operLogExport, data);
} }

View File

@@ -12,30 +12,60 @@ enum Api {
root = '/system/client', root = '/system/client',
} }
/**
* 查询客户端分页列表
* @param params 请求参数
* @returns 列表
*/
export function clientList(params?: PageQuery) { export function clientList(params?: PageQuery) {
return requestClient.get<PageResult<Client>>(Api.clientList, { params }); return requestClient.get<PageResult<Client>>(Api.clientList, { params });
} }
export function clientExport(data: any) { /**
* 导出客户端excel
* @param data 请求参数
*/
export function clientExport(data: Partial<Client>) {
return commonExport(Api.clientExport, data); return commonExport(Api.clientExport, data);
} }
/**
* 客户端详情
* @param id id
* @returns 详情
*/
export function clientInfo(id: ID) { export function clientInfo(id: ID) {
return requestClient.get<Client>(`${Api.root}/${id}`); return requestClient.get<Client>(`${Api.root}/${id}`);
} }
export function clientAdd(data: any) { /**
* 客户端新增
* @param data 参数
*/
export function clientAdd(data: Partial<Client>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
export function clientUpdate(data: any) { /**
* 客户端修改
* @param data 参数
*/
export function clientUpdate(data: Partial<Client>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
/**
* 客户端状态修改
* @param data 状态
*/
export function clientChangeStatus(data: any) { export function clientChangeStatus(data: any) {
return requestClient.putWithMsg<void>(Api.clientChangeStatus, data); return requestClient.putWithMsg<void>(Api.clientChangeStatus, data);
} }
/**
* 客户端删除
* @param ids id集合
*/
export function clientRemove(ids: IDS) { export function clientRemove(ids: IDS) {
return requestClient.deleteWithMsg(`${Api.root}/${ids}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${ids}`);
} }

View File

@@ -1,4 +1,4 @@
import type { Config } from './model'; import type { SysConfig } from './model';
import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
@@ -13,15 +13,24 @@ enum Api {
root = '/system/config', root = '/system/config',
} }
/**
* 系统参数分页列表
* @param params 请求参数
* @returns 列表
*/
export function configList(params?: PageQuery) { export function configList(params?: PageQuery) {
return requestClient.get<PageResult<Config>>(Api.configList, { params }); return requestClient.get<PageResult<SysConfig>>(Api.configList, { params });
} }
export function configInfo(configId: ID) { export function configInfo(configId: ID) {
return requestClient.get<Config>(`${Api.root}/${configId}`); return requestClient.get<SysConfig>(`${Api.root}/${configId}`);
} }
export function configExport(data: any) { /**
* 导出
* @param data 参数
*/
export function configExport(data: Partial<SysConfig>) {
return commonExport(Api.configExport, data); return commonExport(Api.configExport, data);
} }
@@ -33,14 +42,26 @@ export function configRefreshCache() {
return requestClient.deleteWithMsg<void>(Api.configRefreshCache); return requestClient.deleteWithMsg<void>(Api.configRefreshCache);
} }
export function configUpdate(data: any) { /**
* 更新系统配置
* @param data 参数
*/
export function configUpdate(data: Partial<SysConfig>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
export function configAdd(data: any) { /**
* 新增系统配置
* @param data 参数
*/
export function configAdd(data: Partial<SysConfig>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
/**
* 删除配置
* @param configIds ids
*/
export function configRemove(configIds: IDS) { export function configRemove(configIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${configIds}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${configIds}`);
} }

View File

@@ -1,4 +1,4 @@
export interface Config { export interface SysConfig {
configId: number; configId: number;
configName: string; configName: string;
configKey: string; configKey: string;

View File

@@ -10,7 +10,11 @@ enum Api {
root = '/system/dept', root = '/system/dept',
} }
export function deptList(params?: any) { /**
* 部门列表
* @returns list
*/
export function deptList(params?: { deptName?: string; status?: string }) {
return requestClient.get<Dept[]>(Api.deptList, { params }); return requestClient.get<Dept[]>(Api.deptList, { params });
} }
@@ -23,15 +27,28 @@ export function deptNodeList(deptId: ID) {
return requestClient.get<Dept[]>(`${Api.deptNodeInfo}/${deptId}`); return requestClient.get<Dept[]>(`${Api.deptNodeInfo}/${deptId}`);
} }
/**
* 部门详情
* @param deptId 部门id
* @returns 部门信息
*/
export function deptInfo(deptId: ID) { export function deptInfo(deptId: ID) {
return requestClient.get<Dept>(`${Api.root}/${deptId}`); return requestClient.get<Dept>(`${Api.root}/${deptId}`);
} }
export function deptAdd(data: any) { /**
* 部门新增
* @param data 参数
*/
export function deptAdd(data: Partial<Dept>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
export function deptUpdate(data: any) { /**
* 部门更新
* @param data 参数
*/
export function deptUpdate(data: Partial<Dept>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }

View File

@@ -34,7 +34,7 @@ export function dictDataList(params?: PageQuery) {
* @param data 表单参数 * @param data 表单参数
* @returns blob * @returns blob
*/ */
export function dictDataExport(data: any) { export function dictDataExport(data: Partial<DictData>) {
return commonExport(Api.dictDataExport, data); return commonExport(Api.dictDataExport, data);
} }
@@ -52,7 +52,7 @@ export function dictDataRemove(dictIds: IDS) {
* @param data 表单参数 * @param data 表单参数
* @returns void * @returns void
*/ */
export function dictDataAdd(data: any) { export function dictDataAdd(data: Partial<DictData>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
@@ -61,7 +61,7 @@ export function dictDataAdd(data: any) {
* @param data 表单参数 * @param data 表单参数
* @returns void * @returns void
*/ */
export function dictDataUpdate(data: any) { export function dictDataUpdate(data: Partial<DictData>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }

View File

@@ -27,7 +27,7 @@ export function dictTypeList(params?: PageQuery) {
* @param data 表单参数 * @param data 表单参数
* @returns blob * @returns blob
*/ */
export function dictTypeExport(data: any) { export function dictTypeExport(data: Partial<DictType>) {
return commonExport(Api.dictTypeExport, data); return commonExport(Api.dictTypeExport, data);
} }
@@ -53,7 +53,7 @@ export function refreshDictTypeCache() {
* @param data 表单参数 * @param data 表单参数
* @returns void * @returns void
*/ */
export function dictTypeAdd(data: any) { export function dictTypeAdd(data: Partial<DictType>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
@@ -62,7 +62,7 @@ export function dictTypeAdd(data: any) {
* @param data 表单参数 * @param data 表单参数
* @returns void * @returns void
*/ */
export function dictTypeUpdate(data: any) { export function dictTypeUpdate(data: Partial<DictType>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
@@ -76,6 +76,7 @@ export function dictTypeInfo(dictId: ID) {
} }
/** /**
* 这个在ele用到 v5用不上
* 下拉框 返回值和list一样 * 下拉框 返回值和list一样
* @returns options * @returns options
*/ */

View File

@@ -1,6 +1,6 @@
import type { ID, IDS } from '#/api/common'; import type { Menu, MenuOption, MenuQuery, MenuResp } from './model';
import type { Menu, MenuOption, MenuResp } from './model'; import type { ID, IDS } from '#/api/common';
import { requestClient } from '#/api/request'; import { requestClient } from '#/api/request';
@@ -12,22 +12,44 @@ enum Api {
tenantPackageMenuTreeselect = '/system/menu/tenantPackageMenuTreeselect', tenantPackageMenuTreeselect = '/system/menu/tenantPackageMenuTreeselect',
} }
export function menuList(params?: any) { /**
* 菜单列表
* @param params 参数
* @returns 列表
*/
export function menuList(params?: MenuQuery) {
return requestClient.get<Menu[]>(Api.menuList, { params }); return requestClient.get<Menu[]>(Api.menuList, { params });
} }
/**
* 菜单详情
* @param menuId 菜单id
* @returns 菜单详情
*/
export function menuInfo(menuId: ID) { export function menuInfo(menuId: ID) {
return requestClient.get<Menu>(`${Api.root}/${menuId}`); return requestClient.get<Menu>(`${Api.root}/${menuId}`);
} }
export function menuAdd(data: any) { /**
* 菜单新增
* @param data 参数
*/
export function menuAdd(data: Partial<Menu>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
export function menuUpdate(data: any) { /**
* 菜单更新
* @param data 参数
*/
export function menuUpdate(data: Partial<Menu>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
/**
* 菜单删除
* @param menuIds ids
*/
export function menuRemove(menuIds: IDS) { export function menuRemove(menuIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${menuIds}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${menuIds}`);
} }

View File

@@ -46,3 +46,12 @@ export interface MenuResp {
checkedKeys: number[]; checkedKeys: number[];
menus: MenuOption[]; menus: MenuOption[];
} }
/**
* 菜单表单查询
*/
export interface MenuQuery {
menuName?: string;
visible?: string;
status?: string;
}

View File

@@ -9,22 +9,44 @@ enum Api {
root = '/system/notice', root = '/system/notice',
} }
/**
* 通知公告分页
* @param params 分页参数
* @returns 分页结果
*/
export function noticeList(params?: PageQuery) { export function noticeList(params?: PageQuery) {
return requestClient.get<Notice[]>(Api.noticeList, { params }); return requestClient.get<Notice[]>(Api.noticeList, { params });
} }
/**
* 通知公告详情
* @param noticeId id
* @returns 详情
*/
export function noticeInfo(noticeId: ID) { export function noticeInfo(noticeId: ID) {
return requestClient.get<Notice>(`${Api.root}/${noticeId}`); return requestClient.get<Notice>(`${Api.root}/${noticeId}`);
} }
export function noticeAdd(data: any) { /**
* 通知公告新增
* @param data 参数
*/
export function noticeAdd(data: Partial<Notice>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
/**
* 通知公告更新
* @param data 参数
*/
export function noticeUpdate(data: any) { export function noticeUpdate(data: any) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
/**
* 通知公告删除
* @param noticeIds ids
*/
export function noticeRemove(noticeIds: IDS) { export function noticeRemove(noticeIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${noticeIds}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${noticeIds}`);
} }

View File

@@ -21,12 +21,12 @@ export function ossConfigInfo(ossConfigId: ID) {
} }
// 添加新的OSS配置 // 添加新的OSS配置
export function ossConfigAdd(data: any) { export function ossConfigAdd(data: Partial<OssConfig>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
// 更新现有的OSS配置 // 更新现有的OSS配置
export function ossConfigUpdate(data: any) { export function ossConfigUpdate(data: Partial<OssConfig>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }

View File

@@ -1,7 +1,7 @@
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
import type { OssFile } from './model'; import type { OssFile } from './model';
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
import { ContentTypeEnum } from '#/api/helper'; import { ContentTypeEnum } from '#/api/helper';
import { requestClient } from '#/api/request'; import { requestClient } from '#/api/request';
@@ -13,20 +13,30 @@ enum Api {
root = '/resource/oss', root = '/resource/oss',
} }
/**
* 文件list
* @param params 参数
* @returns 分页
*/
export function ossList(params?: PageQuery) { export function ossList(params?: PageQuery) {
return requestClient.get<PageResult<OssFile>>(Api.ossList, { params }); return requestClient.get<PageResult<OssFile>>(Api.ossList, { params });
} }
/**
* 查询文件信息 返回为数组
* @param ossIds id数组
* @returns 信息数组
*/
export function ossInfo(ossIds: IDS) { export function ossInfo(ossIds: IDS) {
return requestClient.get<OssFile[]>(`${Api.ossInfo}/${ossIds}`); return requestClient.get<OssFile[]>(`${Api.ossInfo}/${ossIds}`);
} }
/** /**
* @deprecated * @deprecated 使用apps/web-antd/src/api/core/upload.ts uploadApi方法
* @param file 文件 * @param file 文件
* @returns void * @returns void
*/ */
export function ossUpload(file: any) { export function ossUpload(file: Blob | File) {
const formData = new FormData(); const formData = new FormData();
formData.append('file', file); formData.append('file', file);
return requestClient.postWithMsg(Api.ossUpload, formData, { return requestClient.postWithMsg(Api.ossUpload, formData, {
@@ -48,6 +58,11 @@ export function ossDownload(ossId: ID) {
}); });
} }
/**
* 删除文件
* @param ossIds id数组
* @returns void
*/
export function ossRemove(ossIds: IDS) { export function ossRemove(ossIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${ossIds}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${ossIds}`);
} }

View File

@@ -21,26 +21,56 @@ export function postList(params?: PageQuery) {
return requestClient.get<Post[]>(Api.postList, { params }); return requestClient.get<Post[]>(Api.postList, { params });
} }
export function postExport(data: any) { /**
* 导出岗位信息
* @param data 请求参数
* @returns blob
*/
export function postExport(data: Partial<Post>) {
return commonExport(Api.postExport, data); return commonExport(Api.postExport, data);
} }
/**
* 查询岗位信息
* @param postId id
* @returns 岗位信息
*/
export function postInfo(postId: ID) { export function postInfo(postId: ID) {
return requestClient.get<Post>(`${Api.root}/${postId}`); return requestClient.get<Post>(`${Api.root}/${postId}`);
} }
export function postAdd(data: any) { /**
* 岗位新增
* @param data 参数
* @returns void
*/
export function postAdd(data: Partial<Post>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
export function postUpdate(data: any) { /**
* 岗位更新
* @param data 参数
* @returns void
*/
export function postUpdate(data: Partial<Post>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
/**
* 岗位删除
* @param postIds ids
* @returns void
*/
export function postRemove(postIds: IDS) { export function postRemove(postIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${postIds}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${postIds}`);
} }
/**
* 根据部门id获取岗位下拉列表
* @param deptId 部门id
* @returns 岗位
*/
export function postOptionSelect(deptId: ID) { export function postOptionSelect(deptId: ID) {
return requestClient.get<Post[]>(Api.postSelect, { params: { deptId } }); return requestClient.get<Post[]>(Api.postSelect, { params: { deptId } });
} }

View File

@@ -1,3 +1,4 @@
import type { User } from '../user/model';
import type { DeptResp, Role } from './model'; import type { DeptResp, Role } from './model';
import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
@@ -20,30 +21,65 @@ enum Api {
root = '/system/role', root = '/system/role',
} }
/**
* 查询角色分页列表
* @param params 搜索条件
* @returns 分页列表
*/
export function roleList(params?: PageQuery) { export function roleList(params?: PageQuery) {
return requestClient.get<PageResult<Role>>(Api.roleList, { params }); return requestClient.get<PageResult<Role>>(Api.roleList, { params });
} }
export function roleExport(data: any) { /**
* 导出角色信息
* @param data 查询参数
* @returns blob
*/
export function roleExport(data: Partial<Role>) {
return commonExport(Api.roleExport, data); return commonExport(Api.roleExport, data);
} }
/**
* 查询角色信息
* @param roleId 角色id
* @returns 角色信息
*/
export function roleInfo(roleId: ID) { export function roleInfo(roleId: ID) {
return requestClient.get<Role>(`${Api.root}/${roleId}`); return requestClient.get<Role>(`${Api.root}/${roleId}`);
} }
export function roleAdd(data: any) { /**
* 角色新增
* @param data 参数
* @returns void
*/
export function roleAdd(data: Partial<Role>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
export function roleUpdate(data: any) { /**
* 角色更新
* @param data 参数
* @returns void
*/
export function roleUpdate(data: Partial<Role>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
export function roleChangeStatus(data: any) { /**
* 修改角色状态
* @param data 参数
* @returns void
*/
export function roleChangeStatus(data: Partial<Role>) {
return requestClient.putWithMsg<void>(Api.roleChangeStatus, data); return requestClient.putWithMsg<void>(Api.roleChangeStatus, data);
} }
/**
* 角色删除
* @param roleIds ids
* @returns void
*/
export function roleRemove(roleIds: IDS) { export function roleRemove(roleIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${roleIds}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${roleIds}`);
} }
@@ -57,12 +93,20 @@ export function roleDataScope(data: any) {
return requestClient.putWithMsg<void>(Api.roleDataScope, data); return requestClient.putWithMsg<void>(Api.roleDataScope, data);
} }
/**
* @deprecated 全局并没有用到这个方法
*/
export function roleOptionSelect(params?: any) { export function roleOptionSelect(params?: any) {
return requestClient.get(Api.roleOptionSelect, { params }); return requestClient.get(Api.roleOptionSelect, { params });
} }
export function roleAllocatedList(params: any) { /**
return requestClient.get(Api.roleAllocatedList, { params }); * 已分配角色的用户分页
* @param params 请求参数
* @returns 分页
*/
export function roleAllocatedList(params?: PageQuery) {
return requestClient.get<PageResult<User>>(Api.roleAllocatedList, { params });
} }
/** /**
@@ -71,28 +115,26 @@ export function roleAllocatedList(params: any) {
* @returns void * @returns void
*/ */
export function roleUnallocatedList(params: any) { export function roleUnallocatedList(params: any) {
return requestClient.get(Api.roleUnallocatedList, { params }); return requestClient.get<PageResult<User>>(Api.roleUnallocatedList, {
params,
});
} }
/** /**
* 取消授权 * 取消用户角色授权
* @param data {userId: 2, roleId: "2"}
* @returns void * @returns void
*/ */
export function roleAuthCancel(data: any) { export function roleAuthCancel(data: { roleId: ID; userId: ID }) {
return requestClient.putWithMsg<void>(Api.roleAuthCancel, data); return requestClient.putWithMsg<void>(Api.roleAuthCancel, data);
} }
/** /**
* 批量取消授权 * 批量取消授权
* @param roleId * @param roleId 角色ID
* @param userIds * @param userIds 用户ID集合
* @returns void * @returns void
*/ */
export function roleAuthCancelAll( export function roleAuthCancelAll(roleId: ID, userIds: IDS) {
roleId: number | string,
userIds: number[] | string[],
) {
return requestClient.putWithMsg<void>( return requestClient.putWithMsg<void>(
`${Api.roleAuthCancelAll}?roleId=${roleId}&userIds=${userIds.join(',')}`, `${Api.roleAuthCancelAll}?roleId=${roleId}&userIds=${userIds.join(',')}`,
); );
@@ -100,21 +142,18 @@ export function roleAuthCancelAll(
/** /**
* 批量授权用户 * 批量授权用户
* @param roleId * @param roleId 角色ID
* @param userIds * @param userIds 用户ID集合
* @returns void * @returns void
*/ */
export function roleSelectAll( export function roleSelectAll(roleId: ID, userIds: IDS) {
roleId: number | string,
userIds: number[] | string[],
) {
return requestClient.putWithMsg<void>( return requestClient.putWithMsg<void>(
`${Api.roleAuthSelectAll}?roleId=${roleId}&userIds=${userIds.join(',')}`, `${Api.roleAuthSelectAll}?roleId=${roleId}&userIds=${userIds.join(',')}`,
); );
} }
/** /**
* 部门树 * 根据角色id获取部门树
* @param roleId 角色id * @param roleId 角色id
* @returns DeptResp * @returns DeptResp
*/ */

View File

@@ -1,5 +1,7 @@
import type { SocialInfo } from './model'; import type { SocialInfo } from './model';
import type { ID } from '#/api/common';
import { requestClient } from '#/api/request'; import { requestClient } from '#/api/request';
enum Api { enum Api {
@@ -15,6 +17,9 @@ export function socialList() {
return requestClient.get<SocialInfo[]>(Api.socialList); return requestClient.get<SocialInfo[]>(Api.socialList);
} }
export function socialInfo(id: number | string) { /**
* @deprecated 并没有用到这个方法
*/
export function socialInfo(id: ID) {
return requestClient.get(`${Api.root}/${id}`); return requestClient.get(`${Api.root}/${id}`);
} }

View File

@@ -13,37 +13,75 @@ enum Api {
root = '/system/tenant/package', root = '/system/tenant/package',
} }
/**
* 租户套餐分页列表
* @param params 请求参数
* @returns 分页列表
*/
export function packageList(params?: PageQuery) { export function packageList(params?: PageQuery) {
return requestClient.get<PageResult<TenantPackage>>(Api.packageList, { return requestClient.get<PageResult<TenantPackage>>(Api.packageList, {
params, params,
}); });
} }
// 下拉框 /**
* 租户套餐下拉框
* @returns 下拉框
*/
export function packageSelectList() { export function packageSelectList() {
return requestClient.get<TenantPackage[]>(Api.packageSelectList); return requestClient.get<TenantPackage[]>(Api.packageSelectList);
} }
export function packageExport(data: any) { /**
* 租户套餐导出
* @param data 参数
* @returns blob
*/
export function packageExport(data: Partial<TenantPackage>) {
return commonExport(Api.packageExport, data); return commonExport(Api.packageExport, data);
} }
/**
* 租户套餐信息
* @param id id
* @returns 信息
*/
export function packageInfo(id: ID) { export function packageInfo(id: ID) {
return requestClient.get<TenantPackage>(`${Api.root}/${id}`); return requestClient.get<TenantPackage>(`${Api.root}/${id}`);
} }
export function packageAdd(data: any) { /**
* 租户套餐新增
* @param data data
* @returns void
*/
export function packageAdd(data: Partial<TenantPackage>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
export function packageUpdate(data: any) { /**
* 租户套餐更新
* @param data data
* @returns void
*/
export function packageUpdate(data: Partial<TenantPackage>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
export function packageChangeStatus(data: any) { /**
return requestClient.putWithMsg(Api.packageChangeStatus, data); * 租户套餐状态变更
* @param data data
* @returns void
*/
export function packageChangeStatus(data: Partial<TenantPackage>) {
return requestClient.putWithMsg<void>(Api.packageChangeStatus, data);
} }
/**
* 租户套餐移除
* @param ids ids
* @returns void
*/
export function packageRemove(ids: IDS) { export function packageRemove(ids: IDS) {
return requestClient.deleteWithMsg(`${Api.root}/${ids}`); return requestClient.deleteWithMsg<void>(`${Api.root}/${ids}`);
} }

View File

@@ -16,14 +16,29 @@ enum Api {
tenantSyncPackage = '/system/tenant/syncTenantPackage', tenantSyncPackage = '/system/tenant/syncTenantPackage',
} }
/**
* 查询租户分页列表
* @param params 参数
* @returns 分页
*/
export function tenantList(params?: PageQuery) { export function tenantList(params?: PageQuery) {
return requestClient.get<Tenant[]>(Api.tenantList, { params }); return requestClient.get<Tenant[]>(Api.tenantList, { params });
} }
export function tenantExport(data: any) { /**
* 租户导出
* @param data data
* @returns void
*/
export function tenantExport(data: Partial<Tenant>) {
return commonExport(Api.tenantExport, data); return commonExport(Api.tenantExport, data);
} }
/**
* 查询租户信息
* @param id id
* @returns 租户信息
*/
export function tenantInfo(id: ID) { export function tenantInfo(id: ID) {
return requestClient.get<Tenant>(`${Api.root}/${id}`); return requestClient.get<Tenant>(`${Api.root}/${id}`);
} }
@@ -33,18 +48,33 @@ export function tenantInfo(id: ID) {
* @param data data * @param data data
* @returns void * @returns void
*/ */
export function tenantAdd(data: any) { export function tenantAdd(data: Partial<Tenant>) {
return requestClient.postWithMsg<void>(Api.root, data, { encrypt: true }); return requestClient.postWithMsg<void>(Api.root, data, { encrypt: true });
} }
export function tenantUpdate(data: any) { /**
* 租户更新
* @param data data
* @returns void
*/
export function tenantUpdate(data: Partial<Tenant>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
export function tenantStatusChange(data: any) { /**
* 租户状态更新
* @param data data
* @returns void
*/
export function tenantStatusChange(data: Partial<Tenant>) {
return requestClient.putWithMsg(Api.tenantStatus, data); return requestClient.putWithMsg(Api.tenantStatus, data);
} }
/**
* 租户删除
* @param ids ids
* @returns void
*/
export function tenantRemove(ids: IDS) { export function tenantRemove(ids: IDS) {
return requestClient.deleteWithMsg(`${Api.root}/${ids}`); return requestClient.deleteWithMsg(`${Api.root}/${ids}`);
} }
@@ -70,17 +100,12 @@ export function tenantDynamicClear() {
* 租户套餐同步 * 租户套餐同步
* @param tenantId 租户id * @param tenantId 租户id
* @param packageId 套餐id * @param packageId 套餐id
* @param showMsg 是否显示成功信息
* @returns void * @returns void
*/ */
export function tenantSyncPackage( export function tenantSyncPackage(tenantId: string, packageId: string) {
tenantId: string,
packageId: string,
showMsg = true,
) {
return requestClient.get<void>(Api.tenantSyncPackage, { return requestClient.get<void>(Api.tenantSyncPackage, {
params: { packageId, tenantId }, params: { packageId, tenantId },
successMessageMode: showMsg ? 'message' : 'none', successMessageMode: 'message',
}); });
} }

View File

@@ -9,7 +9,7 @@ export interface Tenant {
id: number; id: number;
intro: string; intro: string;
licenseNumber?: any; licenseNumber?: any;
packageId?: string; packageId: string;
remark?: string; remark?: string;
status: string; status: string;
tenantId: string; tenantId: string;

View File

@@ -38,7 +38,7 @@ export function userList(params?: PageQuery) {
* @param data data * @param data data
* @returns blob * @returns blob
*/ */
export function userExport(data: any) { export function userExport(data: Partial<User>) {
return commonExport(Api.userExport, data); return commonExport(Api.userExport, data);
} }
@@ -91,7 +91,7 @@ export function findUserInfo(userId?: ID) {
* @param data data * @param data data
* @returns void * @returns void
*/ */
export function userAdd(data: any) { export function userAdd(data: Partial<User>) {
return requestClient.postWithMsg<void>(Api.root, data); return requestClient.postWithMsg<void>(Api.root, data);
} }
@@ -100,7 +100,7 @@ export function userAdd(data: any) {
* @param data data * @param data data
* @returns void * @returns void
*/ */
export function userUpdate(data: any) { export function userUpdate(data: Partial<User>) {
return requestClient.putWithMsg<void>(Api.root, data); return requestClient.putWithMsg<void>(Api.root, data);
} }
@@ -109,7 +109,7 @@ export function userUpdate(data: any) {
* @param data data * @param data data
* @returns void * @returns void
*/ */
export function userStatusChange(data: any) { export function userStatusChange(data: Partial<User>) {
return requestClient.putWithMsg<void>(Api.userStatusChange, data); return requestClient.putWithMsg<void>(Api.userStatusChange, data);
} }

View File

@@ -1,6 +1,6 @@
import type { GenInfo } from './model'; import type { GenInfo } from './model';
import type { ID, IDS } from '#/api/common'; import type { ID, IDS, PageQuery } from '#/api/common';
import { ContentTypeEnum } from '#/api/helper'; import { ContentTypeEnum } from '#/api/helper';
import { requestClient } from '#/api/request'; import { requestClient } from '#/api/request';
@@ -19,7 +19,7 @@ enum Api {
syncDb = '/tool/gen/synchDb', syncDb = '/tool/gen/synchDb',
} }
// 查询代码生成列表 // 查询代码生成列表
export function generatedList(params: any) { export function generatedList(params?: PageQuery) {
return requestClient.get(Api.generatedList, { params }); return requestClient.get(Api.generatedList, { params });
} }
@@ -29,7 +29,7 @@ export function genInfo(tableId: ID) {
} }
// 查询数据库列表 // 查询数据库列表
export function readyToGenList(params: any) { export function readyToGenList(params?: PageQuery) {
return requestClient.get(Api.readyToGenList, { params }); return requestClient.get(Api.readyToGenList, { params });
} }
@@ -63,6 +63,7 @@ export function editSave(data: any) {
export function genRemove(tableIds: IDS) { export function genRemove(tableIds: IDS) {
return requestClient.deleteWithMsg(`${Api.root}/${tableIds}`); return requestClient.deleteWithMsg(`${Api.root}/${tableIds}`);
} }
// 预览代码 // 预览代码
export function previewCode(tableId: ID) { export function previewCode(tableId: ID) {
return requestClient.get<{ [key: string]: string }>( return requestClient.get<{ [key: string]: string }>(

View File

@@ -95,7 +95,6 @@ export function getTaskByTaskId(taskId: string) {
/** /**
* 终止任务 * 终止任务
* @param data
*/ */
export function terminationTask(data: { comment?: string; taskId: string }) { export function terminationTask(data: { comment?: string; taskId: string }) {
return requestClient.postWithMsg<void>( return requestClient.postWithMsg<void>(

View File

@@ -1,20 +1,18 @@
<script lang="ts"> <script lang="ts">
import type { EChartsOption } from 'echarts'; import type { PropType } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import { defineComponent, onActivated, onMounted, ref, watch } from 'vue'; import { defineComponent, onActivated, onMounted, ref, watch } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
export default defineComponent({ export default defineComponent({
components: { EchartsUI }, components: { EchartsUI },
props: { props: {
data: { data: {
default: () => [], default: () => [],
type: Array, type: Array as PropType<{ name: string; value: string }[]>,
}, },
}, },
setup(props, { expose }) { setup(props, { expose }) {
@@ -41,6 +39,7 @@ export default defineComponent({
*/ */
onActivated(() => resize(false)); onActivated(() => resize(false));
type EChartsOption = Parameters<typeof renderEcharts>['0'];
function setEchartsOption(data: any[]) { function setEchartsOption(data: any[]) {
const option: EChartsOption = { const option: EChartsOption = {
series: [ series: [

View File

@@ -1,13 +1,9 @@
<script lang="ts"> <script lang="ts">
import type { EChartsOption } from 'echarts'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { defineComponent, onActivated, onMounted, ref, watch } from 'vue'; import { defineComponent, onActivated, onMounted, ref, watch } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
export default defineComponent({ export default defineComponent({
components: { EchartsUI }, components: { EchartsUI },
@@ -38,6 +34,13 @@ export default defineComponent({
// 从其他页面切换回来会有一个奇怪的动画效果 需要调用resize // 从其他页面切换回来会有一个奇怪的动画效果 需要调用resize
onActivated(resize); onActivated(resize);
/**
* 获取最近的十的幂次
* 该函数用于寻找大于给定数字num的最近的10的幂次
* 主要解决的问题是确定一个数附近较大的十的幂次,这在某些算法中很有用
*
* @param num {number} 输入的数字,用于寻找最近的十的幂次
*/
function getNearestPowerOfTen(num: number) { function getNearestPowerOfTen(num: number) {
let power = 10; let power = 10;
while (power <= num) { while (power <= num) {
@@ -46,6 +49,7 @@ export default defineComponent({
return power; return power;
} }
type EChartsOption = Parameters<typeof renderEcharts>['0'];
function setEchartsOption(value: string) { function setEchartsOption(value: string) {
// x10 // x10
const formattedValue = Math.floor(Number.parseFloat(value)); const formattedValue = Math.floor(Number.parseFloat(value));

View File

@@ -1,13 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PropType } from 'vue';
import type { RedisInfo } from '#/api/monitor/cache'; import type { RedisInfo } from '#/api/monitor/cache';
import type { DescItem } from '#/components/description';
import { onMounted, type PropType, watch } from 'vue'; import { onMounted, watch } from 'vue';
import { import { Description, useDescription } from '#/components/description';
type DescItem,
Description,
useDescription,
} from '#/components/description';
interface IRedisInfo extends RedisInfo { interface IRedisInfo extends RedisInfo {
dbSize: string; dbSize: string;

View File

@@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { RedisInfo } from '#/api/monitor/cache';
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
@@ -6,13 +8,16 @@ import { CommandLineIcon, MemoryIcon, RedisIcon } from '@vben/icons';
import { Button, Card, Col, Row } from 'ant-design-vue'; import { Button, Card, Col, Row } from 'ant-design-vue';
import { redisCacheInfo, type RedisInfo } from '#/api/monitor/cache'; import { redisCacheInfo } from '#/api/monitor/cache';
import { CommandChart, MemoryChart, RedisDescription } from './components'; import { CommandChart, MemoryChart, RedisDescription } from './components';
const baseSpan = { lg: 12, md: 24, sm: 24, xl: 12, xs: 24 }; const baseSpan = { lg: 12, md: 24, sm: 24, xl: 12, xs: 24 };
const chartData = reactive<{ command: any[]; memory: string }>({ const chartData = reactive<{
command: { name: string; value: string }[];
memory: string;
}>({
command: [], command: [],
memory: '0', memory: '0',
}); });
@@ -39,6 +44,7 @@ async function loadInfo() {
chartData.memory = usedMemory; chartData.memory = usedMemory;
// 命令统计 // 命令统计
chartData.command = ret.commandStats; chartData.command = ret.commandStats;
console.log(chartData.command);
// redis信息 // redis信息
redisInfo.value = { ...ret.info, dbSize: String(ret.dbSize) }; redisInfo.value = { ...ret.info, dbSize: String(ret.dbSize) };
} catch (error) { } catch (error) {

View File

@@ -1,11 +1,11 @@
import type { VNode } from 'vue';
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { DescItem } from '#/components/description'; import type { DescItem } from '#/components/description';
import type { VNode } from 'vue';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { type FormSchemaGetter } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { renderBrowserIcon, renderDict, renderOsIcon } from '#/utils/render'; import { renderBrowserIcon, renderDict, renderOsIcon } from '#/utils/render';
@@ -68,7 +68,9 @@ export const columns: VxeGridProps['columns'] = [
field: 'os', field: 'os',
slots: { slots: {
default: ({ row }) => { default: ({ row }) => {
// Windows 10 or Windows Server 2016 太长了 分割一下 详情依旧能看到详细的 /**
* Windows 10 or Windows Server 2016 太长了 分割一下 详情依旧能看到详细的
*/
let value = row.os; let value = row.os;
if (value) { if (value) {
const split = value.split(' or '); const split = value.split(' or ');

View File

@@ -1,19 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { LoginLog } from '#/api/monitor/logininfo/model';
import { ref } from 'vue'; import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridDefines,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
loginInfoClean, loginInfoClean,
loginInfoExport, loginInfoExport,
@@ -82,9 +80,9 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions, formOptions,
gridOptions, gridOptions,
gridEvents: { gridEvents: {
checkboxChange: (e: VxeGridDefines.CheckboxChangeEventParams) => { checkboxChange: (e) => {
const records = e.$grid.getCheckboxRecords(); const records = e.$grid.getCheckboxRecords();
canUnlock.value = records.length === 1 && records[0]?.status === '1'; canUnlock.value = records.length === 1 && records[0]!.status === '1';
}, },
}, },
}); });
@@ -93,7 +91,7 @@ const [LoginInfoModal, modalApi] = useVbenModal({
connectedComponent: loginInfoModal, connectedComponent: loginInfoModal,
}); });
function handlePreview(record: Recordable<any>) { function handlePreview(record: LoginLog) {
modalApi.setData(record); modalApi.setData(record);
modalApi.open(); modalApi.open();
} }
@@ -107,14 +105,14 @@ function handleClear() {
}); });
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: LoginLog) {
await loginInfoRemove(row.infoId); await loginInfoRemove([row.infoId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.infoId); const ids = rows.map((row: LoginLog) => row.infoId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,10 +1,10 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { VNode } from 'vue'; import type { VNode } from 'vue';
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { type FormSchemaGetter } from '#/adapter/form';
import { renderBrowserIcon, renderOsIcon } from '#/utils/render'; import { renderBrowserIcon, renderOsIcon } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [

View File

@@ -1,12 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import { Page, type VbenFormProps } from '@vben/common-ui'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { OnlineUser } from '#/api/monitor/online/model';
import { Page } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Popconfirm } from 'ant-design-vue'; import { Popconfirm } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { forceLogout, onlineList } from '#/api/monitor/online'; import { forceLogout, onlineList } from '#/api/monitor/online';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
@@ -51,7 +54,7 @@ const gridOptions: VxeGridProps = {
const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions }); const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions });
async function handleForceOffline(row: Recordable<any>) { async function handleForceOffline(row: OnlineUser) {
await forceLogout(row.tokenId); await forceLogout(row.tokenId);
await tableApi.query(); await tableApi.query();
} }

View File

@@ -1,3 +1,4 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { DescItem } from '#/components/description'; import type { DescItem } from '#/components/description';
@@ -5,7 +6,6 @@ import { DictEnum } from '@vben/constants';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';
import { type FormSchemaGetter } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { import {
renderDict, renderDict,

View File

@@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { PageQuery } from '#/api/common';
import type { OperationLog } from '#/api/monitor/operlog/model'; import type { OperationLog } from '#/api/monitor/operlog/model';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenDrawer } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { Modal, Space } from 'ant-design-vue'; import { Modal, Space } from 'ant-design-vue';
@@ -12,7 +14,6 @@ import {
addSortParams, addSortParams,
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked, vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { import {
operLogClean, operLogClean,
@@ -61,7 +62,7 @@ const gridOptions: VxeGridProps<OperationLog> = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page, sorts }, formValues = {}) => { query: async ({ page, sorts }, formValues = {}) => {
const params: any = { const params: PageQuery = {
pageNum: page.currentPage, pageNum: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
...formValues, ...formValues,
@@ -102,7 +103,7 @@ const [OperationPreviewDrawer, drawerApi] = useVbenDrawer({
* 预览 * 预览
* @param record 操作日志记录 * @param record 操作日志记录
*/ */
function handlePreview(record: Recordable<any>) { function handlePreview(record: OperationLog) {
drawerApi.setData({ record }); drawerApi.setData({ record });
drawerApi.open(); drawerApi.open();
} }
@@ -123,7 +124,7 @@ function handleClear() {
*/ */
async function handleDelete() { async function handleDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.operId); const ids = rows.map((row: OperationLog) => row.operId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { OperationLog } from '#/api/monitor/operlog/model';
import { useVbenDrawer } from '@vben/common-ui'; import { useVbenDrawer } from '@vben/common-ui';
@@ -20,7 +20,7 @@ function handleOpenChange(open: boolean) {
if (!open) { if (!open) {
return null; return null;
} }
const { record } = drawerApi.getData() as { record: Recordable<any> }; const { record } = drawerApi.getData() as { record: OperationLog };
setDescProps({ data: record }, true); setDescProps({ data: record }, true);
} }
</script> </script>

View File

@@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VbenFormProps } from '@vben/common-ui'; import type { VbenFormProps } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Client } from '#/api/system/client/model';
import { useAccess } from '@vben/access'; import { useAccess } from '@vben/access';
import { Page, useVbenDrawer } from '@vben/common-ui'; import { Page, useVbenDrawer } from '@vben/common-ui';
@@ -42,7 +42,7 @@ const gridOptions: VxeGridProps = {
reserve: true, reserve: true,
// 点击行选中 // 点击行选中
// trigger: 'row', // trigger: 'row',
checkMethod: (row: any) => row?.id !== 1, checkMethod: ({ row }) => (row as Client)?.id !== 1,
}, },
columns, columns,
height: 'auto', height: 'auto',
@@ -80,19 +80,19 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: Client) {
drawerApi.setData({ id: record.id }); drawerApi.setData({ id: record.id });
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: Client) {
await clientRemove(row.id); await clientRemove([row.id]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.id); const ids = rows.map((row: Client) => row.id);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,9 +1,9 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { type FormSchemaGetter } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render'; import { renderDict } from '#/utils/render';

View File

@@ -1,16 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { SysConfig } from '#/api/system/config/model';
import { Page, useVbenModal } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
configExport, configExport,
configList, configList,
@@ -83,19 +82,19 @@ function handleAdd() {
modalApi.open(); modalApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: SysConfig) {
modalApi.setData({ id: record.configId }); modalApi.setData({ id: record.configId });
modalApi.open(); modalApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: SysConfig) {
await configRemove(row.configId); await configRemove([row.configId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.configId); const ids = rows.map((row: SysConfig) => row.configId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,9 +1,10 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { type FormSchemaGetter, z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render'; import { renderDict } from '#/utils/render';

View File

@@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Dept } from '#/api/system/dept/model';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenDrawer } from '@vben/common-ui'; import { useVbenDrawer } from '@vben/common-ui';
@@ -43,7 +45,7 @@ const [BasicForm, formApi] = useVbenForm({
}); });
async function getDeptTree(deptId?: number | string, exclude = false) { async function getDeptTree(deptId?: number | string, exclude = false) {
let ret: any[] = []; let ret: Dept[] = [];
ret = await (!deptId || exclude ? deptList({}) : deptNodeList(deptId)); ret = await (!deptId || exclude ? deptList({}) : deptNodeList(deptId));
const treeData = listToTree(ret, { id: 'deptId', pid: 'parentId' }); const treeData = listToTree(ret, { id: 'deptId', pid: 'parentId' });
// 添加部门名称 如 xx-xx-xx // 添加部门名称 如 xx-xx-xx

View File

@@ -1,14 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Dept } from '#/api/system/dept/model';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenDrawer } from '@vben/common-ui';
import { eachTree, getVxePopupContainer } from '@vben/utils'; import { eachTree, getVxePopupContainer } from '@vben/utils';
import { Popconfirm, Space } from 'ant-design-vue'; import { Popconfirm, Space } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deptList, deptRemove } from '#/api/system/dept'; import { deptList, deptRemove } from '#/api/system/dept';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
@@ -74,7 +77,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions, formOptions,
gridOptions, gridOptions,
gridEvents: { gridEvents: {
cellDblclick: (e: any) => { cellDblclick: (e) => {
const { row = {} } = e; const { row = {} } = e;
if (!row?.children) { if (!row?.children) {
return; return;
@@ -84,7 +87,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
row.expand = !isExpanded; row.expand = !isExpanded;
}, },
// 需要监听使用箭头展开的情况 否则展开/折叠的数据不一致 // 需要监听使用箭头展开的情况 否则展开/折叠的数据不一致
toggleTreeExpand: (e: any) => { toggleTreeExpand: (e) => {
const { row = {}, expanded } = e; const { row = {}, expanded } = e;
row.expand = expanded; row.expand = expanded;
}, },
@@ -99,18 +102,18 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
function handleSubAdd(row: Recordable<any>) { function handleSubAdd(row: Dept) {
const { deptId } = row; const { deptId } = row;
drawerApi.setData({ id: deptId, update: false }); drawerApi.setData({ id: deptId, update: false });
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: Dept) {
drawerApi.setData({ id: record.deptId, update: true }); drawerApi.setData({ id: record.deptId, update: true });
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: Dept) {
await deptRemove(row.deptId); await deptRemove(row.deptId);
await tableApi.query(); await tableApi.query();
} }

View File

@@ -1,5 +1,6 @@
import type { FormSchemaGetter } from '#/adapter/form'; import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { DictData } from '#/api/system/dict/dict-data-model';
import { renderDictTag } from '#/utils/render'; import { renderDictTag } from '#/utils/render';
@@ -18,8 +19,8 @@ export const columns: VxeGridProps['columns'] = [
field: 'cssClass', field: 'cssClass',
slots: { slots: {
default: ({ row }) => { default: ({ row }) => {
const { dictValue } = row; const { dictValue } = row as DictData;
return renderDictTag(dictValue, [row as any]); return renderDictTag(dictValue, row);
}, },
}, },
}, },

View File

@@ -1,18 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { PageQuery } from '#/api/common';
import type { DictData } from '#/api/system/dict/dict-data-model';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { useVbenDrawer } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
dictDataExport, dictDataExport,
dictDataList, dictDataList,
@@ -53,7 +53,7 @@ const gridOptions: VxeGridProps = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, formValues = {}) => { query: async ({ page }, formValues = {}) => {
const params: any = { const params: PageQuery = {
pageNum: page.currentPage, pageNum: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
...formValues, ...formValues,
@@ -87,7 +87,7 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: DictData) {
drawerApi.setData({ drawerApi.setData({
dictType: dictType.value, dictType: dictType.value,
dictCode: record.dictCode, dictCode: record.dictCode,
@@ -95,14 +95,14 @@ async function handleEdit(record: Recordable<any>) {
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: DictData) {
await dictDataRemove(row.dictCode); await dictDataRemove([row.dictCode]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.dictCode); const ids = rows.map((row: DictData) => row.dictCode);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,12 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, type PropType } from 'vue'; import type { RadioChangeEvent } from 'ant-design-vue';
import { import type { PropType } from 'vue';
Input,
type RadioChangeEvent, import { computed } from 'vue';
RadioGroup,
Select, import { Input, RadioGroup, Select } from 'ant-design-vue';
} from 'ant-design-vue';
import { tagSelectOptions } from '#/components/dict'; import { tagSelectOptions } from '#/components/dict';

View File

@@ -1,6 +1,7 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { type FormSchemaGetter, z } from '#/adapter/form'; import { z } from '#/adapter/form';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {

View File

@@ -1,18 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { DictType } from '#/api/system/dict/dict-type-model';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
dictTypeExport, dictTypeExport,
dictTypeList, dictTypeList,
@@ -73,7 +72,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions, formOptions,
gridOptions, gridOptions,
gridEvents: { gridEvents: {
cellClick: (e: any) => { cellClick: (e) => {
const { row } = e; const { row } = e;
if (lastDictType.value === row.dictType) { if (lastDictType.value === row.dictType) {
return; return;
@@ -92,19 +91,19 @@ function handleAdd() {
modalApi.open(); modalApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: DictType) {
modalApi.setData({ id: record.dictId }); modalApi.setData({ id: record.dictId });
modalApi.open(); modalApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: DictType) {
await dictTypeRemove(row.dictId); await dictTypeRemove([row.dictId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.dictId); const ids = rows.map((row: DictType) => row.dictId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,3 +1,4 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { h } from 'vue'; import { h } from 'vue';
@@ -7,7 +8,7 @@ import { FolderIcon, MenuIcon, OkButtonIcon, VbenIcon } from '@vben/icons';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { type FormSchemaGetter, z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render'; import { renderDict } from '#/utils/render';

View File

@@ -1,16 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Menu } from '#/api/system/menu/model';
import { computed } from 'vue'; import { computed } from 'vue';
import { useAccess } from '@vben/access'; import { useAccess } from '@vben/access';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Fallback, Page, useVbenDrawer } from '@vben/common-ui';
import { Fallback } from '@vben/common-ui';
import { eachTree, getVxePopupContainer } from '@vben/utils'; import { eachTree, getVxePopupContainer } from '@vben/utils';
import { Popconfirm, Space } from 'ant-design-vue'; import { Popconfirm, Space } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { menuList, menuRemove } from '#/api/system/menu'; import { menuList, menuRemove } from '#/api/system/menu';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
@@ -74,7 +76,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions, formOptions,
gridOptions, gridOptions,
gridEvents: { gridEvents: {
cellDblclick: (e: any) => { cellDblclick: (e) => {
const { row = {} } = e; const { row = {} } = e;
if (!row?.children) { if (!row?.children) {
return; return;
@@ -84,7 +86,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
row.expand = !isExpanded; row.expand = !isExpanded;
}, },
// 需要监听使用箭头展开的情况 否则展开/折叠的数据不一致 // 需要监听使用箭头展开的情况 否则展开/折叠的数据不一致
toggleTreeExpand: (e: any) => { toggleTreeExpand: (e) => {
const { row = {}, expanded } = e; const { row = {}, expanded } = e;
row.expand = expanded; row.expand = expanded;
}, },
@@ -99,19 +101,19 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
function handleSubAdd(row: Recordable<any>) { function handleSubAdd(row: Menu) {
const { menuId } = row; const { menuId } = row;
drawerApi.setData({ id: menuId, update: false }); drawerApi.setData({ id: menuId, update: false });
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: Menu) {
drawerApi.setData({ id: record.menuId, update: true }); drawerApi.setData({ id: record.menuId, update: true });
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: Menu) {
await menuRemove(row.menuId); await menuRemove([row.menuId]);
await tableApi.query(); await tableApi.query();
} }

View File

@@ -1,9 +1,9 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { type FormSchemaGetter } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render'; import { renderDict } from '#/utils/render';

View File

@@ -1,16 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Notice } from '#/api/system/notice/model';
import { Page, useVbenModal } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { noticeList, noticeRemove } from '#/api/system/notice'; import { noticeList, noticeRemove } from '#/api/system/notice';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
@@ -72,19 +71,19 @@ function handleAdd() {
modalApi.open(); modalApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: Notice) {
modalApi.setData({ id: record.noticeId }); modalApi.setData({ id: record.noticeId });
modalApi.open(); modalApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: Notice) {
await noticeRemove(row.noticeId); await noticeRemove([row.noticeId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.noticeId); const ids = rows.map((row: Notice) => row.noticeId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,10 +1,11 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';
import { type FormSchemaGetter, z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
const accessPolicyOptions = [ const accessPolicyOptions = [

View File

@@ -1,17 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { OssConfig } from '#/api/system/oss-config/model';
import { useAccess } from '@vben/access'; import { useAccess } from '@vben/access';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenDrawer } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
ossConfigChangeStatus, ossConfigChangeStatus,
ossConfigList, ossConfigList,
@@ -78,19 +77,19 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: OssConfig) {
drawerApi.setData({ id: record.ossConfigId }); drawerApi.setData({ id: record.ossConfigId });
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: OssConfig) {
await ossConfigRemove(row.ossConfigId); await ossConfigRemove([row.ossConfigId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.ossConfigId); const ids = rows.map((row: OssConfig) => row.ossConfigId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,7 +1,6 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { type FormSchemaGetter } from '#/adapter/form';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Input', component: 'Input',

View File

@@ -1,10 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { PageQuery } from '#/api/common';
import type { OssFile } from '#/api/system/oss/model';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
@@ -22,7 +26,6 @@ import {
addSortParams, addSortParams,
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked, vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { configInfoByKey } from '#/api/system/config'; import { configInfoByKey } from '#/api/system/config';
import { ossDownload, ossList, ossRemove } from '#/api/system/oss'; import { ossDownload, ossList, ossRemove } from '#/api/system/oss';
@@ -67,7 +70,7 @@ const gridOptions: VxeGridProps = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page, sorts }, formValues = {}) => { query: async ({ page, sorts }, formValues = {}) => {
const params: any = { const params: PageQuery = {
pageNum: page.currentPage, pageNum: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
...formValues, ...formValues,
@@ -101,7 +104,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
}, },
}); });
async function handleDownload(row: Recordable<any>) { async function handleDownload(row: OssFile) {
const hideLoading = message.loading($t('pages.common.downloadLoading'), 0); const hideLoading = message.loading($t('pages.common.downloadLoading'), 0);
try { try {
const data = await ossDownload(row.ossId); const data = await ossDownload(row.ossId);
@@ -111,14 +114,14 @@ async function handleDownload(row: Recordable<any>) {
} }
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: OssFile) {
await ossRemove(row.ossId); await ossRemove([row.ossId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.ossId); const ids = rows.map((row: OssFile) => row.ossId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,9 +1,9 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { type FormSchemaGetter } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render'; import { renderDict } from '#/utils/render';

View File

@@ -1,18 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Post } from '#/api/system/post/model';
import { ref } from 'vue'; import { ref } from 'vue';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenDrawer } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { postExport, postList, postRemove } from '#/api/system/post'; import { postExport, postList, postRemove } from '#/api/system/post';
import { commonDownloadExcel } from '#/utils/file/download'; import { commonDownloadExcel } from '#/utils/file/download';
import DeptTree from '#/views/system/user/dept-tree.vue'; import DeptTree from '#/views/system/user/dept-tree.vue';
@@ -93,19 +92,19 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: Post) {
drawerApi.setData({ id: record.postId }); drawerApi.setData({ id: record.postId });
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: Post) {
await postRemove(row.postId); await postRemove([row.postId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.postId); const ids = rows.map((row: Post) => row.postId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,7 +1,6 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { type FormSchemaGetter } from '#/adapter/form';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Input', component: 'Input',

View File

@@ -1,18 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { User } from '#/api/system/user/model';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenDrawer } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
roleAllocatedList, roleAllocatedList,
roleAuthCancel, roleAuthCancel,
@@ -85,7 +84,7 @@ function handleAdd() {
/** /**
* 取消授权 一条记录 * 取消授权 一条记录
*/ */
async function handleAuthCancel(record: Recordable<any>) { async function handleAuthCancel(record: User) {
await roleAuthCancel({ userId: record.userId, roleId }); await roleAuthCancel({ userId: record.userId, roleId });
await tableApi.query(); await tableApi.query();
} }
@@ -95,7 +94,7 @@ async function handleAuthCancel(record: Recordable<any>) {
*/ */
function handleMultipleAuthCancel() { function handleMultipleAuthCancel() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.userId); const ids = rows.map((row: User) => row.userId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,9 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { useVbenDrawer } from '@vben/common-ui';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { roleSelectAll, roleUnallocatedList } from '#/api/system/role'; import { roleSelectAll, roleUnallocatedList } from '#/api/system/role';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';

View File

@@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VbenFormProps } from '@vben/common-ui'; import type { VbenFormProps } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Role } from '#/api/system/role/model';
import { computed } from 'vue'; import { computed } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@@ -98,19 +98,19 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: Role) {
drawerApi.setData({ id: record.roleId }); drawerApi.setData({ id: record.roleId });
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: Role) {
await roleRemove(row.roleId); await roleRemove([row.roleId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.roleId); const ids = rows.map((row: Role) => row.roleId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',
@@ -136,13 +136,13 @@ const [RoleAuthModal, authModalApi] = useVbenModal({
connectedComponent: roleAuthModal, connectedComponent: roleAuthModal,
}); });
function handleAuthEdit(record: Recordable<any>) { function handleAuthEdit(record: Role) {
authModalApi.setData({ id: record.roleId }); authModalApi.setData({ id: record.roleId });
authModalApi.open(); authModalApi.open();
} }
const router = useRouter(); const router = useRouter();
function handleAssignRole(record: Recordable<any>) { function handleAssignRole(record: Role) {
router.push(`/system/role-assign/${record.roleId}`); router.push(`/system/role-assign/${record.roleId}`);
} }
</script> </script>

View File

@@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { DeptOption } from '#/api/system/role/model';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
@@ -23,7 +25,7 @@ const [BasicForm, formApi] = useVbenForm({
showDefaultActions: false, showDefaultActions: false,
}); });
const deptTree = ref<any[]>([]); const deptTree = ref<DeptOption[]>([]);
async function setupDeptTree(id: number | string) { async function setupDeptTree(id: number | string) {
const resp = await roleDeptTree(id); const resp = await roleDeptTree(id);
formApi.setFieldValue('deptIds', resp.checkedKeys); formApi.setFieldValue('deptIds', resp.checkedKeys);

View File

@@ -1,10 +1,11 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { type FormSchemaGetter, z } from '#/adapter/form'; import { z } from '#/adapter/form';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {

View File

@@ -1,20 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Tenant } from '#/api/system/tenant/model';
import { computed } from 'vue'; import { computed } from 'vue';
import { useAccess } from '@vben/access'; import { useAccess } from '@vben/access';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Fallback, Page, useVbenDrawer } from '@vben/common-ui';
import { Fallback } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
dictSyncTenant, dictSyncTenant,
tenantExport, tenantExport,
@@ -87,20 +85,20 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: Tenant) {
drawerApi.setData({ id: record.id }); drawerApi.setData({ id: record.id });
drawerApi.open(); drawerApi.open();
} }
async function handleSync(record: Recordable<any>) { async function handleSync(record: Tenant) {
const { tenantId, packageId } = record; const { tenantId, packageId } = record;
await tenantSyncPackage(tenantId, packageId); await tenantSyncPackage(tenantId, packageId);
await tableApi.query(); await tableApi.query();
} }
const tenantStore = useTenantStore(); const tenantStore = useTenantStore();
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: Tenant) {
await tenantRemove(row.id); await tenantRemove([row.id]);
await tableApi.query(); await tableApi.query();
// 重新加载租户信息 // 重新加载租户信息
tenantStore.initTenant(); tenantStore.initTenant();
@@ -108,7 +106,7 @@ async function handleDelete(row: Recordable<any>) {
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.id); const ids = rows.map((row: Tenant) => row.id);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,7 +1,6 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { type FormSchemaGetter } from '#/adapter/form';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Input', component: 'Input',

View File

@@ -1,20 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { TenantPackage } from '#/api/system/tenant-package/model';
import { computed } from 'vue'; import { computed } from 'vue';
import { useAccess } from '@vben/access'; import { useAccess } from '@vben/access';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { Fallback, Page, useVbenDrawer } from '@vben/common-ui';
import { Fallback } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
packageChangeStatus, packageChangeStatus,
packageExport, packageExport,
@@ -83,19 +81,19 @@ function handleAdd() {
drawerApi.open(); drawerApi.open();
} }
async function handleEdit(record: Recordable<any>) { async function handleEdit(record: TenantPackage) {
drawerApi.setData({ id: record.packageId }); drawerApi.setData({ id: record.packageId });
drawerApi.open(); drawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: TenantPackage) {
await packageRemove(row.packageId); await packageRemove([row.packageId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.packageId); const ids = rows.map((row: TenantPackage) => row.packageId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',

View File

@@ -1,6 +1,8 @@
import type { PropType } from 'vue';
import type { Menu } from '#/api/system/menu/model'; import type { Menu } from '#/api/system/menu/model';
import { computed, defineComponent, type PropType } from 'vue'; import { computed, defineComponent } from 'vue';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';

View File

@@ -1,9 +1,10 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { type FormSchemaGetter, z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [

View File

@@ -1,7 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PropType } from 'vue';
import type { DeptTree } from '#/api/system/user/model'; import type { DeptTree } from '#/api/system/user/model';
import { onMounted, type PropType, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { SyncOutlined } from '@ant-design/icons-vue'; import { SyncOutlined } from '@ant-design/icons-vue';
import { Empty, InputSearch, Skeleton, Tree } from 'ant-design-vue'; import { Empty, InputSearch, Skeleton, Tree } from 'ant-design-vue';

View File

@@ -1,15 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { User } from '#/api/system/user/model';
import { ref } from 'vue'; import { ref } from 'vue';
import { useAccess } from '@vben/access'; import { useAccess } from '@vben/access';
import { import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
Page,
useVbenDrawer,
useVbenModal,
type VbenFormProps,
} from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
@@ -24,8 +22,7 @@ import {
Space, Space,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
import { vxeCheckboxChecked } from '#/adapter/vxe-table';
import { import {
userExport, userExport,
userList, userList,
@@ -137,19 +134,19 @@ function handleAdd() {
userDrawerApi.open(); userDrawerApi.open();
} }
function handleEdit(row: Recordable<any>) { function handleEdit(row: User) {
userDrawerApi.setData({ id: row.userId }); userDrawerApi.setData({ id: row.userId });
userDrawerApi.open(); userDrawerApi.open();
} }
async function handleDelete(row: Recordable<any>) { async function handleDelete(row: User) {
await userRemove(row.userId); await userRemove([row.userId]);
await tableApi.query(); await tableApi.query();
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: any) => row.userId); const ids = rows.map((row: User) => row.userId);
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',
@@ -170,7 +167,7 @@ function handleDownloadExcel() {
const [UserInfoModal, userInfoModalApi] = useVbenModal({ const [UserInfoModal, userInfoModalApi] = useVbenModal({
connectedComponent: userInfoModal, connectedComponent: userInfoModal,
}); });
function handleUserInfo(row: Recordable<any>) { function handleUserInfo(row: User) {
userInfoModalApi.setData({ userId: row.userId }); userInfoModalApi.setData({ userId: row.userId });
userInfoModalApi.open(); userInfoModalApi.open();
} }
@@ -179,7 +176,7 @@ const [UserResetPwdModal, userResetPwdModalApi] = useVbenModal({
connectedComponent: userResetPwdModal, connectedComponent: userResetPwdModal,
}); });
function handleResetPwd(record: Recordable<any>) { function handleResetPwd(record: User) {
userResetPwdModalApi.setData({ record }); userResetPwdModalApi.setData({ record });
userResetPwdModalApi.open(); userResetPwdModalApi.open();
} }

View File

@@ -1,6 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Role } from '#/api/system/user/model'; import type { Role } from '#/api/system/user/model';
import { computed, h, onMounted, ref } from 'vue';
import { useVbenDrawer } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils';
import { Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { configInfoByKey } from '#/api/system/config'; import { configInfoByKey } from '#/api/system/config';
import { postOptionSelect } from '#/api/system/post'; import { postOptionSelect } from '#/api/system/post';
@@ -11,11 +19,6 @@ import {
userUpdate, userUpdate,
} from '#/api/system/user'; } from '#/api/system/user';
import { authScopeOptions } from '#/views/system/role/data'; import { authScopeOptions } from '#/views/system/role/data';
import { useVbenDrawer } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils';
import { Tag } from 'ant-design-vue';
import { computed, h, onMounted, ref } from 'vue';
import { drawerSchema } from './data'; import { drawerSchema } from './data';

View File

@@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { User } from '#/api/system/user/model';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { findUserInfo } from '#/api/system/user'; import { findUserInfo } from '#/api/system/user';
@@ -39,8 +41,12 @@ async function handleOpenChange(open: boolean) {
.filter((item) => roleIds.includes(item.roleId)) .filter((item) => roleIds.includes(item.roleId))
.map((item) => item.roleName); .map((item) => item.roleName);
(user as any).postNames = postNames; interface UserWithNames extends User {
(user as any).roleNames = roleNames; postNames: string[];
roleNames: string[];
}
(user as UserWithNames).postNames = postNames;
(user as UserWithNames).roleNames = roleNames;
// 赋值 // 赋值
setDescProps({ data: user }); setDescProps({ data: user });

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { ResetPwdParam, User } from '#/api/system/user/model';
import { useVbenModal, z } from '@vben/common-ui'; import { useVbenModal, z } from '@vben/common-ui';
@@ -68,7 +68,7 @@ async function handleOpenChange(open: boolean) {
if (!open) { if (!open) {
return null; return null;
} }
const { record } = modalApi.getData() as { record: Recordable<any> }; const { record } = modalApi.getData() as { record: User };
setDescProps({ data: record }, true); setDescProps({ data: record }, true);
await formApi.setValues({ userId: record.userId }); await formApi.setValues({ userId: record.userId });
} }
@@ -81,7 +81,7 @@ async function handleSubmit() {
return; return;
} }
const data = await formApi.getValues(); const data = await formApi.getValues();
await userResetPassword(data as any); await userResetPassword(data as ResetPwdParam);
emit('reload'); emit('reload');
handleCancel(); handleCancel();
} catch (error) { } catch (error) {

View File

@@ -1,14 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import type { Key } from 'ant-design-vue/es/vc-tree/interface'; import type { Key } from 'ant-design-vue/es/vc-tree/interface';
import { type Component, markRaw, ref } from 'vue'; import type { Component } from 'vue';
import { import type { LanguageSupport } from '@vben/common-ui';
CodeMirror, import type { Recordable } from '@vben/types';
type LanguageSupport,
useVbenModal, import { markRaw, ref } from 'vue';
} from '@vben/common-ui';
import { CodeMirror, useVbenModal } from '@vben/common-ui';
import { import {
DefaultFileIcon, DefaultFileIcon,
FolderIcon, FolderIcon,

View File

@@ -1,7 +1,6 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { type FormSchemaGetter } from '#/adapter/form';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Select', component: 'Select',

View File

@@ -1,7 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Ref } from 'vue';
import type { Column, GenInfo } from '#/api/tool/gen/model'; import type { Column, GenInfo } from '#/api/tool/gen/model';
import { inject, onMounted, type Ref } from 'vue'; import { inject, onMounted } from 'vue';
import { useVbenForm } from '@vben/common-ui'; import { useVbenForm } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';

View File

@@ -1,6 +1,8 @@
import type { FormSchemaGetter } from '#/adapter/form';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { type FormSchemaGetter, z } from '#/adapter/form'; import { z } from '#/adapter/form';
export const formSchema: FormSchemaGetter = () => [ export const formSchema: FormSchemaGetter = () => [
{ {

View File

@@ -1,12 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Ref } from 'vue';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { GenInfo } from '#/api/tool/gen/model'; import type { GenInfo } from '#/api/tool/gen/model';
import { inject, type Ref, unref } from 'vue'; import { inject, unref } from 'vue';
import { message, Space } from 'ant-design-vue'; import { message, Space } from 'ant-design-vue';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { editSave } from '#/api/tool/gen'; import { editSave } from '#/api/tool/gen';
import { toCurrentStep } from '../mitt'; import { toCurrentStep } from '../mitt';

View File

@@ -1,20 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VbenFormProps } from '@vben/common-ui';
import type { Recordable } from '@vben/types'; import type { Recordable } from '@vben/types';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { message, Modal, Popconfirm, Space } from 'ant-design-vue'; import { message, Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { import {
batchGenCode, batchGenCode,
generatedList, generatedList,

View File

@@ -1,7 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { useVbenModal, type VbenFormProps } from '@vben/common-ui'; import type { VbenFormProps } from '@vben/common-ui';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { useVbenModal } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
getDataSourceNames, getDataSourceNames,
importTable, importTable,