refactor: 重构 API 层目录结构 & 样式模块化拆分
- API 层按业务域拆分(api/auth/, api/file/, api/system/*) - 类型定义从 types/api/ 移入对应 api 模块内(就近原则) - 公共类型统一为 api/common.ts,移除冗余类型重导出 - 样式文件按职责拆分(base/, layout/, vendors/),移除 common.scss - 移除失效的单元测试文件
This commit is contained in:
1 parent
3a27da6607
commit
3fedf4943d
107 files changed
+464
-8264
No files matched your search
@@ -29,12 +29,6 @@ Thumbs.db
|
|||||||
.eslintcache
|
.eslintcache
|
||||||
.stylelintcache
|
.stylelintcache
|
||||||
|
|
||||||
# Test coverage
|
|
||||||
coverage/
|
|
||||||
*.lcov
|
|
||||||
.vitest/
|
|
||||||
test-results/
|
|
||||||
|
|
||||||
# Lock files (use pnpm)
|
# Lock files (use pnpm)
|
||||||
package-lock.json
|
package-lock.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
npx --no-install commitlint --edit $1
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
npm run lint:lint-staged
|
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vue3-element-admin",
|
"name": "vue3-element-admin",
|
||||||
"description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板,vue-element-admin 的 Vue3 版本",
|
"description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板,vue-element-admin 的 Vue3 版本",
|
||||||
"version": "4.3.0",
|
"version": "4.4.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Generated
-6410
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,5 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { LoginRequest, LoginResponse, CaptchaInfo } from "@/types/api/auth";
|
import type { LoginRequest, LoginResponse, CaptchaInfo } from "./types";
|
||||||
|
|
||||||
const AUTH_BASE_URL = "/api/v1/auth";
|
const AUTH_BASE_URL = "/api/v1/auth";
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ const AuthAPI = {
|
|||||||
captchaCode: data.captchaCode,
|
captchaCode: data.captchaCode,
|
||||||
};
|
};
|
||||||
|
|
||||||
// tenantId is optional — include only when provided (multi-tenant feature)
|
// tenantId 可选,仅在提供时包含(多租户功能)
|
||||||
if (typeof data.tenantId !== "undefined") {
|
if (typeof data.tenantId !== "undefined") {
|
||||||
payload.tenantId = data.tenantId;
|
payload.tenantId = data.tenantId;
|
||||||
}
|
}
|
||||||
@@ -64,3 +64,6 @@ const AuthAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default AuthAPI;
|
export default AuthAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { GeneratorPreviewItem, TableQueryParams, TableItem, GenConfigForm } from "@/types/api";
|
import type { GeneratorPreviewItem, TableQueryParams, TableItem, GenConfigForm } from "./types";
|
||||||
|
|
||||||
const GENERATOR_BASE_URL = "/api/v1/codegen";
|
const GENERATOR_BASE_URL = "/api/v1/codegen";
|
||||||
|
|
||||||
@@ -101,4 +101,5 @@ const GeneratorAPI = {
|
|||||||
|
|
||||||
export default GeneratorAPI;
|
export default GeneratorAPI;
|
||||||
|
|
||||||
/** 代码生成预览对象 */
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* CodeGen 代码生成类型定义
|
* CodeGen 代码生成类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 代码生成预览对象 */
|
/** 代码生成预览对象 */
|
||||||
export interface GeneratorPreviewItem {
|
export interface GeneratorPreviewItem {
|
||||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { FileInfo } from "@/types/api";
|
import type { FileInfo } from "./types";
|
||||||
|
|
||||||
const FileAPI = {
|
const FileAPI = {
|
||||||
/** 上传文件 (传入 FormData,上传进度回调) */
|
/** 上传文件 (传入 FormData,上传进度回调) */
|
||||||
@@ -58,3 +58,6 @@ const FileAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default FileAPI;
|
export default FileAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { ConfigQueryParams, ConfigForm, ConfigItem } from "@/types/api";
|
import type { ConfigQueryParams, ConfigForm, ConfigItem } from "./types";
|
||||||
|
|
||||||
const CONFIG_BASE_URL = "/api/v1/configs";
|
const CONFIG_BASE_URL = "/api/v1/configs";
|
||||||
|
|
||||||
@@ -38,3 +38,6 @@ const ConfigAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default ConfigAPI;
|
export default ConfigAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Config 配置类型定义
|
* Config 配置类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 配置分页查询参数 */
|
/** 配置分页查询参数 */
|
||||||
export interface ConfigQueryParams extends BaseQueryParams {
|
export interface ConfigQueryParams extends BaseQueryParams {
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { DeptQueryParams, DeptItem, DeptForm, OptionItem } from "@/types/api";
|
import type { DeptQueryParams, DeptItem, DeptForm } from "./types";
|
||||||
|
import type { OptionItem } from "@/api/common";
|
||||||
|
|
||||||
const DEPT_BASE_URL = "/api/v1/depts";
|
const DEPT_BASE_URL = "/api/v1/depts";
|
||||||
|
|
||||||
@@ -35,3 +36,6 @@ const DeptAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default DeptAPI;
|
export default DeptAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
File renamed without changes.
@@ -7,8 +7,8 @@ import type {
|
|||||||
DictItem,
|
DictItem,
|
||||||
DictItemForm,
|
DictItemForm,
|
||||||
DictItemOption,
|
DictItemOption,
|
||||||
OptionItem,
|
} from "./types";
|
||||||
} from "@/types/api";
|
import type { OptionItem } from "@/api/common";
|
||||||
|
|
||||||
const DICT_BASE_URL = "/api/v1/dicts";
|
const DICT_BASE_URL = "/api/v1/dicts";
|
||||||
|
|
||||||
@@ -96,9 +96,9 @@ const DictAPI = {
|
|||||||
params: queryParams,
|
params: queryParams,
|
||||||
}).then((data) => ({
|
}).then((data) => ({
|
||||||
...data,
|
...data,
|
||||||
list: (data.list ?? []).map((item) => ({
|
list: (data.list ?? []).map((item: DictItem & { tagType?: string }) => ({
|
||||||
...item,
|
...item,
|
||||||
tagType: decodeDictTagType((item as any).tagType),
|
tagType: decodeDictTagType(item.tagType),
|
||||||
})),
|
})),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
@@ -153,3 +153,6 @@ const DictAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default DictAPI;
|
export default DictAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Dict 字典类型定义
|
* Dict 字典类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 字典分页查询参数 */
|
/** 字典分页查询参数 */
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type {
|
import type {
|
||||||
LogQueryParams,
|
LogQueryParams,
|
||||||
LogItem,
|
LogItem,
|
||||||
VisitTrendQueryParams,
|
VisitTrendQueryParams,
|
||||||
VisitTrendDetail,
|
VisitTrendDetail,
|
||||||
VisitStatsDetail,
|
VisitStatsDetail,
|
||||||
} from "@/types/api";
|
} from "./types";
|
||||||
|
|
||||||
const LOG_BASE_URL = "/api/v1/logs";
|
const LOG_BASE_URL = "/api/v1/logs";
|
||||||
|
|
||||||
@@ -38,3 +38,6 @@ const LogAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default LogAPI;
|
export default LogAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Log 日志类型定义
|
* Log 日志类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 日志分页查询参数 */
|
/** 日志分页查询参数 */
|
||||||
export interface LogQueryParams extends BaseQueryParams {
|
export interface LogQueryParams extends BaseQueryParams {
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { MenuQueryParams, MenuItem, MenuForm, RouteItem, OptionItem } from "@/types/api";
|
import type { MenuQueryParams, MenuItem, MenuForm, RouteItem } from "./types";
|
||||||
|
import type { OptionItem } from "@/api/common";
|
||||||
|
|
||||||
const MENU_BASE_URL = "/api/v1/menus";
|
const MENU_BASE_URL = "/api/v1/menus";
|
||||||
|
|
||||||
@@ -43,3 +44,6 @@ const MenuAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default MenuAPI;
|
export default MenuAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { NoticeQueryParams, NoticeForm, NoticeItem, NoticeDetail } from "@/types/api";
|
import type { NoticeQueryParams, NoticeForm, NoticeItem, NoticeDetail } from "./types";
|
||||||
|
|
||||||
const NOTICE_BASE_URL = "/api/v1/notices";
|
const NOTICE_BASE_URL = "/api/v1/notices";
|
||||||
|
|
||||||
@@ -55,3 +55,6 @@ const NoticeAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default NoticeAPI;
|
export default NoticeAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Notice 通知类型定义
|
* Notice 通知类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 通知分页查询参数 */
|
/** 通知分页查询参数 */
|
||||||
export interface NoticeQueryParams extends BaseQueryParams {
|
export interface NoticeQueryParams extends BaseQueryParams {
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { RoleQueryParams, RoleItem, RoleForm, OptionItem } from "@/types/api";
|
import type { RoleQueryParams, RoleItem, RoleForm } from "./types";
|
||||||
|
import type { OptionItem } from "@/api/common";
|
||||||
|
|
||||||
const ROLE_BASE_URL = "/api/v1/roles";
|
const ROLE_BASE_URL = "/api/v1/roles";
|
||||||
|
|
||||||
@@ -47,3 +48,6 @@ const RoleAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default RoleAPI;
|
export default RoleAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Role 角色类型定义
|
* Role 角色类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 角色分页查询参数 */
|
/** 角色分页查询参数 */
|
||||||
export interface RoleQueryParams extends BaseQueryParams {
|
export interface RoleQueryParams extends BaseQueryParams {
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { OptionItem, PageResult } from "@/types/api";
|
import type { TenantPlanForm, TenantPlanItem, TenantPlanQueryParams } from "./types";
|
||||||
import type {
|
import type { OptionItem } from "@/api/common";
|
||||||
TenantPlanForm,
|
|
||||||
TenantPlanItem,
|
|
||||||
TenantPlanQueryParams,
|
|
||||||
} from "@/types/api/tenant-plan";
|
|
||||||
|
|
||||||
const TENANT_PLAN_BASE_URL = "/api/v1/tenant-plans";
|
const TENANT_PLAN_BASE_URL = "/api/v1/tenant-plans";
|
||||||
|
|
||||||
@@ -68,3 +64,6 @@ const TenantPlanAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default TenantPlanAPI;
|
export default TenantPlanAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Tenant Plan 租户套餐类型定义
|
* Tenant Plan 租户套餐类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 租户套餐分页查询参数 */
|
/** 租户套餐分页查询参数 */
|
||||||
export interface TenantPlanQueryParams extends BaseQueryParams {
|
export interface TenantPlanQueryParams extends BaseQueryParams {
|
||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
TenantCreateResult,
|
TenantCreateResult,
|
||||||
TenantQueryParams,
|
TenantQueryParams,
|
||||||
TenantItem,
|
TenantItem,
|
||||||
} from "@/types/api";
|
} from "./types";
|
||||||
|
|
||||||
const TENANT_BASE_URL = "/api/v1/tenants";
|
const TENANT_BASE_URL = "/api/v1/tenants";
|
||||||
|
|
||||||
@@ -118,3 +118,6 @@ const TenantAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default TenantAPI;
|
export default TenantAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Tenant 租户类型定义
|
* Tenant 租户类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 租户信息 */
|
/** 租户信息 */
|
||||||
export interface TenantInfo {
|
export interface TenantInfo {
|
||||||
@@ -10,8 +10,8 @@ import type {
|
|||||||
PasswordVerifyForm,
|
PasswordVerifyForm,
|
||||||
MobileUpdateForm,
|
MobileUpdateForm,
|
||||||
EmailUpdateForm,
|
EmailUpdateForm,
|
||||||
OptionItem,
|
} from "./types";
|
||||||
} from "@/types/api";
|
import type { OptionItem, ExcelResult } from "@/api/common";
|
||||||
|
|
||||||
const USER_BASE_URL = "/api/v1/users";
|
const USER_BASE_URL = "/api/v1/users";
|
||||||
|
|
||||||
@@ -240,3 +240,6 @@ const UserAPI = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default UserAPI;
|
export default UserAPI;
|
||||||
|
|
||||||
|
// 重导出类型
|
||||||
|
export * from "./types";
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* User 用户类型定义
|
* User 用户类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "./common";
|
import type { BaseQueryParams } from "@/api/common";
|
||||||
|
|
||||||
/** 登录用户信息 */
|
/** 登录用户信息 */
|
||||||
export interface UserInfo {
|
export interface UserInfo {
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from "@/types/api";
|
|
||||||
@@ -4,7 +4,7 @@ import type PageContent from "./PageContent.vue";
|
|||||||
import type PageModal from "./PageModal.vue";
|
import type PageModal from "./PageModal.vue";
|
||||||
import type PageSearch from "./PageSearch.vue";
|
import type PageSearch from "./PageSearch.vue";
|
||||||
import type { CSSProperties } from "vue";
|
import type { CSSProperties } from "vue";
|
||||||
import type { PageResult } from "@/types/api/common";
|
import type { PageResult } from "@/api/common";
|
||||||
|
|
||||||
export type PageSearchInstance = InstanceType<typeof PageSearch>;
|
export type PageSearchInstance = InstanceType<typeof PageSearch>;
|
||||||
export type PageContentInstance = InstanceType<typeof PageContent>;
|
export type PageContentInstance = InstanceType<typeof PageContent>;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* 通知中心逻辑
|
* 通知中心逻辑
|
||||||
*/
|
*/
|
||||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||||
import type { NoticeItem, NoticeDetail, NoticeQueryParams } from "@/types/api";
|
import type { NoticeItem, NoticeDetail, NoticeQueryParams } from "@/api/system/notice";
|
||||||
import NoticeAPI from "@/api/system/notice";
|
import NoticeAPI from "@/api/system/notice";
|
||||||
import { useSse } from "@/composables";
|
import { useSse } from "@/composables";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<div :class="{ hidden: hidden }" class="pagination">
|
<div :class="{ hidden: hidden }" class="p-3 flex justify-end">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
v-model:page-size="pageSize"
|
v-model:page-size="pageSize"
|
||||||
@@ -79,13 +79,3 @@ function handleCurrentChange(val: number) {
|
|||||||
emit("pagination", { page: val, limit: pageSize.value });
|
emit("pagination", { page: val, limit: pageSize.value });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.pagination {
|
|
||||||
padding: 12px;
|
|
||||||
|
|
||||||
&.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -54,7 +54,7 @@ import {
|
|||||||
} from "element-plus";
|
} from "element-plus";
|
||||||
|
|
||||||
import FileAPI from "@/api/file";
|
import FileAPI from "@/api/file";
|
||||||
import type { FileInfo } from "@/types/api";
|
import type { FileInfo } from "@/api/file";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { UploadRawFile, UploadRequestOptions, UploadUserFile } from "element-plus";
|
import { UploadRawFile, UploadRequestOptions, UploadUserFile } from "element-plus";
|
||||||
import FileAPI from "@/api/file";
|
import FileAPI from "@/api/file";
|
||||||
import type { FileInfo } from "@/types/api";
|
import type { FileInfo } from "@/api/file";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { UploadRawFile, UploadRequestOptions } from "element-plus";
|
import { UploadRawFile, UploadRequestOptions } from "element-plus";
|
||||||
import FileAPI from "@/api/file";
|
import FileAPI from "@/api/file";
|
||||||
import type { FileInfo } from "@/types/api";
|
import type { FileInfo } from "@/api/file";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import DictAPI from "@/api/system/dict";
|
import DictAPI from "@/api/system/dict";
|
||||||
import type { DictItemOption } from "@/types/api";
|
import type { DictItemOption } from "@/api/system/dict";
|
||||||
import { STORAGE_KEYS } from "@/constants";
|
import { STORAGE_KEYS } from "@/constants";
|
||||||
|
|
||||||
export const useDictStore = defineStore("dict", () => {
|
export const useDictStore = defineStore("dict", () => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import router from "@/router";
|
|||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
|
||||||
import MenuAPI from "@/api/system/menu";
|
import MenuAPI from "@/api/system/menu";
|
||||||
import { RouteItem } from "@/types";
|
import type { RouteItem } from "@/api/system/menu";
|
||||||
const modules = import.meta.glob("../../views/**/**.vue");
|
const modules = import.meta.glob("../../views/**/**.vue");
|
||||||
const Layout = () => import("../../layouts/index.vue");
|
const Layout = () => import("../../layouts/index.vue");
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import TenantAPI from "@/api/system/tenant";
|
import TenantAPI from "@/api/system/tenant";
|
||||||
import type { TenantInfo } from "@/types/api";
|
import type { TenantInfo } from "@/api/system/tenant";
|
||||||
import { STORAGE_KEYS } from "@/constants";
|
import { STORAGE_KEYS } from "@/constants";
|
||||||
import AuthAPI from "@/api/auth";
|
import AuthAPI from "@/api/auth";
|
||||||
import { AuthStorage } from "@/utils/auth";
|
import { AuthStorage } from "@/utils/auth";
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { store } from "@/store";
|
|||||||
|
|
||||||
import AuthAPI from "@/api/auth";
|
import AuthAPI from "@/api/auth";
|
||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
import type { LoginRequest, UserInfo } from "@/types/api";
|
import type { LoginRequest } from "@/api/auth";
|
||||||
|
import type { UserInfo } from "@/api/system/user";
|
||||||
|
|
||||||
import { AuthStorage } from "@/utils/auth";
|
import { AuthStorage } from "@/utils/auth";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
// 全局基础重置:补充 UnoCSS 预设未覆盖的项目级样式
|
/**
|
||||||
|
* 全局基础重置样式
|
||||||
|
* 补充 UnoCSS 预设未覆盖的项目级样式
|
||||||
|
*/
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -1,24 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* 项目主题变量
|
* 主题变量定义
|
||||||
*
|
* 只放 :root、html.dark、html.sidebar-color-blue 等定义真实颜色的 CSS 变量
|
||||||
* 结构:
|
|
||||||
* 1. SCSS 变量 - 布局尺寸(供 JS 导出和组件使用)
|
|
||||||
* 2. CSS 变量 - 侧边栏/菜单主题色
|
|
||||||
* 3. 主题模式 - 深蓝侧边栏、暗黑模式
|
|
||||||
* 4. 无障碍模式 - 色弱模式
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// 1. SCSS 变量 - 布局尺寸
|
// 默认主题(浅色 + 白色侧边栏)
|
||||||
// ============================================
|
|
||||||
|
|
||||||
$sidebar-width: 210px;
|
|
||||||
$sidebar-width-collapsed: 54px;
|
|
||||||
$navbar-height: 50px;
|
|
||||||
$tags-view-height: 34px;
|
|
||||||
|
|
||||||
// ============================================
|
|
||||||
// 2. CSS 变量 - 默认主题(浅色 + 白色侧边栏)
|
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
@@ -33,19 +19,10 @@ $tags-view-height: 34px;
|
|||||||
--sidebar-logo-text-color: #303133;
|
--sidebar-logo-text-color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SCSS 变量映射(供组件使用)
|
|
||||||
$menu-background: var(--menu-background);
|
|
||||||
$menu-text: var(--menu-text);
|
|
||||||
$menu-active-text: var(--menu-active-text);
|
|
||||||
$menu-hover: var(--menu-hover);
|
|
||||||
$sidebar-logo-background: var(--sidebar-logo-background);
|
|
||||||
$sidebar-logo-text-color: var(--sidebar-logo-text-color);
|
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// 3. 主题模式
|
// 深蓝色侧边栏主题
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
// 浅色主题 - 深蓝色侧边栏
|
|
||||||
html.sidebar-color-blue {
|
html.sidebar-color-blue {
|
||||||
--menu-background: #304156;
|
--menu-background: #304156;
|
||||||
--menu-text: #bfcbd9;
|
--menu-text: #bfcbd9;
|
||||||
@@ -55,7 +32,10 @@ html.sidebar-color-blue {
|
|||||||
--sidebar-logo-text-color: #fff;
|
--sidebar-logo-text-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================
|
||||||
// 暗黑主题
|
// 暗黑主题
|
||||||
|
// ============================================
|
||||||
|
|
||||||
html.dark {
|
html.dark {
|
||||||
--menu-background: var(--el-bg-color-overlay);
|
--menu-background: var(--el-bg-color-overlay);
|
||||||
--menu-text: #fff;
|
--menu-text: #fff;
|
||||||
@@ -71,7 +51,7 @@ html.dark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// 4. 无障碍模式
|
// 无障碍模式
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
// 色弱模式
|
// 色弱模式
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* SCSS 变量定义
|
||||||
|
* 只放数学变量和 CSS 变量映射
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// 布局尺寸变量
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
$sidebar-width: 210px;
|
||||||
|
$sidebar-width-collapsed: 54px;
|
||||||
|
$navbar-height: 50px;
|
||||||
|
$tags-view-height: 34px;
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// CSS 变量映射(供组件和 SCSS 使用)
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
$menu-background: var(--menu-background);
|
||||||
|
$menu-text: var(--menu-text);
|
||||||
|
$menu-active-text: var(--menu-active-text);
|
||||||
|
$menu-hover: var(--menu-hover);
|
||||||
|
$sidebar-logo-background: var(--sidebar-logo-background);
|
||||||
|
$sidebar-logo-text-color: var(--sidebar-logo-text-color);
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
/* 全局业务通用样式 */
|
|
||||||
|
|
||||||
.app-container {
|
|
||||||
padding: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 进度条颜色 */
|
|
||||||
#nprogress .bar {
|
|
||||||
background-color: var(--el-color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 弹出菜单统一使用主题变量(简化 hover 色) */
|
|
||||||
.el-menu--popup {
|
|
||||||
--el-menu-bg-color: var(--menu-background);
|
|
||||||
--el-menu-text-color: var(--menu-text);
|
|
||||||
--el-menu-active-color: var(--menu-active-text);
|
|
||||||
--el-menu-hover-bg-color: var(--menu-hover);
|
|
||||||
|
|
||||||
background-color: var(--menu-background);
|
|
||||||
|
|
||||||
.el-menu-item,
|
|
||||||
.el-sub-menu__title {
|
|
||||||
color: var(--menu-text) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-menu-item:hover,
|
|
||||||
.el-sub-menu__title:hover {
|
|
||||||
color: var(--menu-active-text) !important;
|
|
||||||
background-color: var(--menu-hover) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-menu-item.is-active {
|
|
||||||
color: var(--menu-active-text) !important;
|
|
||||||
background-color: var(--menu-hover) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
混合布局左侧菜单 hover 样式
|
|
||||||
============================================ */
|
|
||||||
.layout-mix .layout__sidebar--left .el-menu {
|
|
||||||
.el-menu-item {
|
|
||||||
&:hover {
|
|
||||||
background-color: var(--el-fill-color-light) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-sub-menu__title {
|
|
||||||
&:hover {
|
|
||||||
background-color: var(--el-fill-color-light) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 深色或深蓝侧边栏的 hover 样式 */
|
|
||||||
html.dark .layout-mix .layout__sidebar--left .el-menu,
|
|
||||||
html.sidebar-color-blue .layout-mix .layout__sidebar--left .el-menu {
|
|
||||||
.el-menu-item,
|
|
||||||
.el-sub-menu__title {
|
|
||||||
&:hover {
|
|
||||||
background-color: var(--menu-hover) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Top layout: let horizontal menu fill the remaining header space */
|
|
||||||
.layout-top .layout__header-left .el-menu--horizontal,
|
|
||||||
.layout-mix .layout__header-menu .el-menu--horizontal {
|
|
||||||
display: flex;
|
|
||||||
flex: 1 1 0% !important;
|
|
||||||
align-items: center;
|
|
||||||
width: 100% !important;
|
|
||||||
min-width: 0 !important;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 窄屏隐藏菜单文字,仅保留图标 */
|
|
||||||
.hideSidebar {
|
|
||||||
&.layout-top .layout__header .el-menu--horizontal,
|
|
||||||
&.layout-mix .layout__header .el-menu--horizontal {
|
|
||||||
.el-menu-item,
|
|
||||||
.el-sub-menu__title {
|
|
||||||
.menu-title,
|
|
||||||
span:not([class*="i-svg"]):not(.el-icon) {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.layout-mix .layout__sidebar--left .el-menu {
|
|
||||||
.el-menu-item,
|
|
||||||
.el-sub-menu__title {
|
|
||||||
.menu-title,
|
|
||||||
span:not([class*="i-svg"]):not(.el-icon) {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 全局筛选区域 */
|
|
||||||
.filter-section {
|
|
||||||
padding: 8px 12px 0;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
background-color: var(--el-bg-color-overlay);
|
|
||||||
border: 1px solid var(--el-border-color-light);
|
|
||||||
border-radius: 4px;
|
|
||||||
|
|
||||||
.search-buttons {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-form-item {
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表格区域 */
|
|
||||||
.table-section {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
|
|
||||||
&__toolbar {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
|
|
||||||
&--actions,
|
|
||||||
&--tools {
|
|
||||||
display: flex;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__content {
|
|
||||||
margin: 8px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-pagination {
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
// Element Plus 变量覆盖(必须在最前面)
|
|
||||||
@use "./element-plus-vars";
|
|
||||||
|
|
||||||
$border: 1px solid var(--el-border-color-light);
|
|
||||||
|
|
||||||
/* el-dialog */
|
|
||||||
.el-dialog {
|
|
||||||
.el-dialog__header {
|
|
||||||
padding: 15px 20px;
|
|
||||||
margin: 0;
|
|
||||||
border-bottom: $border;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-dialog__body {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-dialog__footer {
|
|
||||||
padding: 15px;
|
|
||||||
border-top: $border;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* el-drawer */
|
|
||||||
.el-drawer {
|
|
||||||
.el-drawer__header {
|
|
||||||
padding: 15px 20px;
|
|
||||||
margin: 0;
|
|
||||||
color: inherit;
|
|
||||||
border-bottom: $border;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-drawer__body {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-drawer__footer {
|
|
||||||
padding: 15px;
|
|
||||||
border-top: $border;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 抽屉和对话框底部按钮区域
|
|
||||||
.dialog-footer {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
+16
-10
@@ -1,13 +1,19 @@
|
|||||||
// 1. 基础重置
|
/**
|
||||||
@use "./reset";
|
* 样式总入口
|
||||||
|
* 严格按照 ITCSS 架构顺序导入
|
||||||
|
*/
|
||||||
|
|
||||||
// 2. 主题变量
|
// 1. 基础层
|
||||||
@use "./variables" as *;
|
@use "./base/variables" as *;
|
||||||
|
@use "./base/theme";
|
||||||
|
@use "./base/reset";
|
||||||
|
|
||||||
// 3. UI 框架适配
|
// 2. 第三方适配层
|
||||||
@use "./element-plus";
|
@use "./vendors/element-plus";
|
||||||
@use "./vxe-table";
|
@use "./vendors/element-plus-override";
|
||||||
@use "./wangeditor";
|
@use "./vendors/vxe-table";
|
||||||
|
@use "./vendors/wangeditor";
|
||||||
|
@use "./vendors/nprogress";
|
||||||
|
|
||||||
// 4. 业务通用样式
|
// 3. 布局层
|
||||||
@use "./common";
|
@use "./layout/layout";
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* 全局标准布局样式
|
||||||
|
*/
|
||||||
|
|
||||||
|
.page-container {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-aside {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-main {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-search {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
/* 覆盖 el-card 内部 padding */
|
||||||
|
.el-card__body {
|
||||||
|
padding: 12px 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-content {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-toolbar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
&__left,
|
||||||
|
&__right {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 混合布局左侧菜单 hover 样式 */
|
||||||
|
.layout-mix .layout__sidebar--left .el-menu {
|
||||||
|
.el-menu-item:hover,
|
||||||
|
.el-sub-menu__title:hover {
|
||||||
|
background-color: var(--el-fill-color-light) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 深色或深蓝侧边栏的 hover 样式 */
|
||||||
|
html.dark .layout-mix .layout__sidebar--left .el-menu,
|
||||||
|
html.sidebar-color-blue .layout-mix .layout__sidebar--left .el-menu {
|
||||||
|
.el-menu-item:hover,
|
||||||
|
.el-sub-menu__title:hover {
|
||||||
|
background-color: var(--menu-hover) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 顶部布局菜单填充空间 */
|
||||||
|
.layout-top .layout__header-left .el-menu--horizontal,
|
||||||
|
.layout-mix .layout__header-menu .el-menu--horizontal {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 1 0% !important;
|
||||||
|
align-items: center;
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 0 !important;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 窄屏隐藏菜单文字,仅保留图标 */
|
||||||
|
.hideSidebar {
|
||||||
|
&.layout-top .layout__header .el-menu--horizontal,
|
||||||
|
&.layout-mix .layout__header .el-menu--horizontal {
|
||||||
|
.el-menu-item,
|
||||||
|
.el-sub-menu__title {
|
||||||
|
.menu-title,
|
||||||
|
span:not([class*="i-svg"]):not(.el-icon) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.layout-mix .layout__sidebar--left .el-menu {
|
||||||
|
.el-menu-item,
|
||||||
|
.el-sub-menu__title {
|
||||||
|
.menu-title,
|
||||||
|
span:not([class*="i-svg"]):not(.el-icon) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
/* stylelint-disable property-no-unknown */
|
/* stylelint-disable property-no-unknown */
|
||||||
|
|
||||||
// 通过 SCSS 变量导出给 JS/TS 使用的模块文件
|
// 通过 SCSS 变量导出给 JS/TS 使用的模块文件
|
||||||
// 注意:依赖 src/styles/variables.scss 中定义的 SCSS 变量
|
// 注意:依赖 src/styles/base/_variables.scss 中定义的 SCSS 变量
|
||||||
|
|
||||||
|
@use "./base/variables" as *;
|
||||||
|
|
||||||
:export {
|
:export {
|
||||||
sidebar-width: $sidebar-width;
|
sidebar-width: $sidebar-width;
|
||||||
|
|||||||
+75
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* Element Plus 组件样式定制
|
||||||
|
*/
|
||||||
|
|
||||||
|
$border: 1px solid var(--el-border-color-light);
|
||||||
|
|
||||||
|
/* el-dialog */
|
||||||
|
.el-dialog {
|
||||||
|
.el-dialog__header {
|
||||||
|
padding: 15px 20px;
|
||||||
|
margin: 0;
|
||||||
|
border-bottom: $border;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog__footer {
|
||||||
|
padding: 15px;
|
||||||
|
border-top: $border;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* el-drawer */
|
||||||
|
.el-drawer {
|
||||||
|
.el-drawer__header {
|
||||||
|
padding: 15px 20px;
|
||||||
|
margin: 0;
|
||||||
|
color: inherit;
|
||||||
|
border-bottom: $border;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-drawer__body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-drawer__footer {
|
||||||
|
padding: 15px;
|
||||||
|
border-top: $border;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 抽屉和对话框底部按钮区域 */
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹出菜单统一使用主题变量 */
|
||||||
|
.el-menu--popup {
|
||||||
|
--el-menu-bg-color: var(--menu-background);
|
||||||
|
--el-menu-text-color: var(--menu-text);
|
||||||
|
--el-menu-active-color: var(--menu-active-text);
|
||||||
|
--el-menu-hover-bg-color: var(--menu-hover);
|
||||||
|
|
||||||
|
background-color: var(--menu-background);
|
||||||
|
|
||||||
|
.el-menu-item,
|
||||||
|
.el-sub-menu__title {
|
||||||
|
color: var(--menu-text) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu-item:hover,
|
||||||
|
.el-sub-menu__title:hover {
|
||||||
|
color: var(--menu-active-text) !important;
|
||||||
|
background-color: var(--menu-hover) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu-item.is-active {
|
||||||
|
color: var(--menu-active-text) !important;
|
||||||
|
background-color: var(--menu-hover) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Element Plus 变量覆盖
|
* Element Plus 主题变量覆盖
|
||||||
*
|
* 必须在组件样式之前导入
|
||||||
* 此文件用于覆盖 Element Plus 的默认主题变量
|
|
||||||
* 需要在 element-plus.scss 中导入,而不是在 variables.scss 中
|
|
||||||
*/
|
*/
|
||||||
@forward "element-plus/theme-chalk/src/common/var.scss" with (
|
@forward "element-plus/theme-chalk/src/common/var.scss" with (
|
||||||
$colors: (
|
$colors: (
|
||||||
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* NProgress 进度条样式
|
||||||
|
*/
|
||||||
|
|
||||||
|
#nprogress .bar {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* API 类型统一导出
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from "./auth";
|
|
||||||
export * from "./common";
|
|
||||||
|
|
||||||
// System 模块
|
|
||||||
export * from "./user";
|
|
||||||
export * from "./role";
|
|
||||||
export * from "./menu";
|
|
||||||
export * from "./dept";
|
|
||||||
export * from "./dict";
|
|
||||||
export * from "./config";
|
|
||||||
export * from "./log";
|
|
||||||
export * from "./notice";
|
|
||||||
export * from "./tenant";
|
|
||||||
export * from "./tenant-plan";
|
|
||||||
|
|
||||||
// 其他模块
|
|
||||||
export * from "./file";
|
|
||||||
export * from "./codegen";
|
|
||||||
@@ -2,5 +2,4 @@
|
|||||||
* 类型统一导出
|
* 类型统一导出
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from "./api";
|
|
||||||
export * from "./ui";
|
export * from "./ui";
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<!-- 搜索区域 -->
|
<!-- 搜索区域 -->
|
||||||
<div class="search-container">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item prop="keywords" label="关键字">
|
<el-form-item prop="keywords" label="关键字">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleQuery">
|
<el-button type="primary" @click="handleQuery">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Search />
|
<Search />
|
||||||
@@ -27,16 +27,15 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-card">
|
<el-card class="page-content" shadow="never">
|
||||||
<el-table
|
<el-table
|
||||||
ref="dataTableRef"
|
ref="dataTableRef"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="pageData"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
border
|
border
|
||||||
class="data-table__content"
|
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="表名" prop="tableName" min-width="100" />
|
<el-table-column label="表名" prop="tableName" min-width="100" />
|
||||||
@@ -531,7 +530,7 @@ import type {
|
|||||||
TableQueryParams,
|
TableQueryParams,
|
||||||
TableItem,
|
TableItem,
|
||||||
GeneratorPreviewItem,
|
GeneratorPreviewItem,
|
||||||
} from "@/api/types";
|
} from "@/api/codegen";
|
||||||
import { ElLoading } from "element-plus";
|
import { ElLoading } from "element-plus";
|
||||||
|
|
||||||
import DictAPI from "@/api/system/dict";
|
import DictAPI from "@/api/system/dict";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative p-6">
|
<div class="relative p-5">
|
||||||
<!-- github 角标 -->
|
<!-- github 角标 -->
|
||||||
<github-corner class="absolute top-0 right-0 z-1 border-0" />
|
<github-corner class="absolute top-0 right-0 z-1 border-0" />
|
||||||
|
|
||||||
<el-card shadow="never" class="mt-2">
|
<el-card shadow="never">
|
||||||
<div class="flex flex-wrap">
|
<div class="flex flex-wrap">
|
||||||
<!-- 左侧问候语区域 -->
|
<!-- 左侧问候语区域 -->
|
||||||
<div class="flex-1 flex items-start">
|
<div class="flex-1 flex items-start">
|
||||||
@@ -383,7 +383,7 @@ import { dayjs } from "element-plus";
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import LogAPI from "@/api/system/log";
|
import LogAPI from "@/api/system/log";
|
||||||
import type { VisitStatsDetail, VisitTrendDetail } from "@/types/api";
|
import type { VisitStatsDetail, VisitTrendDetail } from "@/api/system/log";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import { formatGrowthRate } from "@/utils";
|
import { formatGrowthRate } from "@/utils";
|
||||||
import { useTransition, useDateFormat } from "@vueuse/core";
|
import { useTransition, useDateFormat } from "@vueuse/core";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- 接口文档 -->
|
<!-- 接口文档 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<iframe
|
<iframe
|
||||||
src="https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5"
|
src="https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5"
|
||||||
width="100%"
|
width="100%"
|
||||||
@@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
/** 关闭tag标签 */
|
/** 关闭tag标签 */
|
||||||
.app-container {
|
.page-container {
|
||||||
/* 50px = navbar = 50px */
|
/* 50px = navbar = 50px */
|
||||||
height: calc(100vh - 50px);
|
height: calc(100vh - 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 开启tag标签 */
|
/** 开启tag标签 */
|
||||||
.hasTagsView {
|
.hasTagsView {
|
||||||
.app-container {
|
.page-container {
|
||||||
/* 84px = navbar + tags-view = 50px + 34px */
|
/* 84px = navbar + tags-view = 50px + 34px */
|
||||||
height: calc(100vh - 84px);
|
height: calc(100vh - 84px);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- 文件上传组件示例 -->
|
<!-- 文件上传组件示例 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/auto-opreation-column.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/auto-opreation-column.vue"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container h-full flex flex-1 flex-col">
|
<div class="page-container h-full flex flex-1 flex-col">
|
||||||
<div class="mb-10">
|
<div class="mb-10">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/curd-demo.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/curd-demo.vue"
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
import DeptAPI from "@/api/system/dept";
|
import DeptAPI from "@/api/system/dept";
|
||||||
import RoleAPI from "@/api/system/role";
|
import RoleAPI from "@/api/system/role";
|
||||||
import type { UserForm, UserQueryParams, UserItem } from "@/types/api";
|
import type { UserForm, UserQueryParams, UserItem } from "@/api/system/user";
|
||||||
import type { IObject, IModalConfig, IContentConfig, ISearchConfig } from "@/components/CURD/types";
|
import type { IObject, IModalConfig, IContentConfig, ISearchConfig } from "@/components/CURD/types";
|
||||||
import { DeviceEnum } from "@/enums/settings";
|
import { DeviceEnum } from "@/enums/settings";
|
||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
@@ -585,7 +585,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.app-container {
|
.page-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
import type { UserForm } from "@/types/api";
|
import type { UserForm } from "@/api/system/user";
|
||||||
import type { IModalConfig } from "@/components/CURD/types";
|
import type { IModalConfig } from "@/components/CURD/types";
|
||||||
import { deptArr, roleArr } from "./options";
|
import { deptArr, roleArr } from "./options";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
import RoleAPI from "@/api/system/role";
|
import RoleAPI from "@/api/system/role";
|
||||||
import type { UserQueryParams, UserItem } from "@/types/api";
|
import type { UserQueryParams, UserItem } from "@/api/system/user";
|
||||||
import type { IContentConfig } from "@/components/CURD/types";
|
import type { IContentConfig } from "@/components/CURD/types";
|
||||||
|
|
||||||
const contentConfig: IContentConfig<UserQueryParams, UserItem> = {
|
const contentConfig: IContentConfig<UserQueryParams, UserItem> = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
import type { UserForm } from "@/types/api";
|
import type { UserForm } from "@/api/system/user";
|
||||||
import type { IModalConfig } from "@/components/CURD/types";
|
import type { IModalConfig } from "@/components/CURD/types";
|
||||||
import { DeviceEnum } from "@/enums/settings";
|
import { DeviceEnum } from "@/enums/settings";
|
||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { UserForm } from "@/types/api";
|
import type { UserForm } from "@/api/system/user";
|
||||||
import type { IModalConfig } from "@/components/CURD/types";
|
import type { IModalConfig } from "@/components/CURD/types";
|
||||||
import { deptArr } from "../config/options";
|
import { deptArr } from "../config/options";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container h-full flex flex-1 flex-col">
|
<div class="page-container h-full flex flex-1 flex-col">
|
||||||
<div class="flex-x-between mb-10">
|
<div class="flex-x-between mb-10">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/curd/index.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/curd/index.vue"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
import { useDictStoreHook } from "@/store/modules/dict";
|
import { useDictStoreHook } from "@/store/modules/dict";
|
||||||
import { useDateFormat } from "@vueuse/core";
|
import { useDateFormat } from "@vueuse/core";
|
||||||
import DictAPI from "@/api/system/dict";
|
import DictAPI from "@/api/system/dict";
|
||||||
import type { DictItemForm } from "@/types/api";
|
import type { DictItemForm } from "@/api/system/dict";
|
||||||
import { useDictSync, DictMessage } from "@/composables";
|
import { useDictSync, DictMessage } from "@/composables";
|
||||||
|
|
||||||
// 性别字典编码
|
// 性别字典编码
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- 字典组件示例 -->
|
<!-- 字典组件示例 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/dictionary.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/dictionary.vue"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
@@ -71,7 +71,7 @@ const userList = ref([
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container {
|
.page-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
||||||
.el-card {
|
.el-card {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- 图标选择器示例 -->
|
<!-- 图标选择器示例 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/icon-selector.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/icon-selector.vue"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<iframe src="https://juejin.cn/post/7228990409909108793" frameborder="0" />
|
<iframe src="https://juejin.cn/post/7228990409909108793" frameborder="0" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
/** 关闭tag标签 */
|
/** 关闭tag标签 */
|
||||||
.app-container {
|
.page-container {
|
||||||
/* 50px = navbar = 50px */
|
/* 50px = navbar = 50px */
|
||||||
height: calc(100vh - 50px);
|
height: calc(100vh - 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 开启tag标签 */
|
/** 开启tag标签 */
|
||||||
.hasTagsView {
|
.hasTagsView {
|
||||||
.app-container {
|
.page-container {
|
||||||
/* 84px = navbar + tags-view = 50px + 34px */
|
/* 84px = navbar + tags-view = 50px + 34px */
|
||||||
height: calc(100vh - 84px);
|
height: calc(100vh - 84px);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div flex flex-col gap-20px>
|
<div flex flex-col gap-20px>
|
||||||
<MultiLevel1 />
|
<MultiLevel1 />
|
||||||
<MultiLevel2 />
|
<MultiLevel2 />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div flex flex-col gap-20px>
|
<div flex flex-col gap-20px>
|
||||||
<MultiLevel1 />
|
<MultiLevel1 />
|
||||||
<MultiLevel2 />
|
<MultiLevel2 />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- 列表选择器示例 -->
|
<!-- 列表选择器示例 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/table-select/index.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/table-select/index.vue"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<!-- 基础用法 -->
|
<!-- 基础用法 -->
|
||||||
<TextScroll text="这是一条基础的滚动公告,默认向左滚动" typewriter />
|
<TextScroll text="这是一条基础的滚动公告,默认向左滚动" typewriter />
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ import TextScroll from "@/components/TextScroll/index.vue";
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container {
|
.page-container {
|
||||||
:deep(.text-scroll-container) {
|
:deep(.text-scroll-container) {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- 文件上传组件示例 -->
|
<!-- 文件上传组件示例 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/upload.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/upload.vue"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<vxe-grid ref="xGrid" v-bind="gridOptions" v-on="gridEvents">
|
<vxe-grid ref="xGrid" v-bind="gridOptions" v-on="gridEvents">
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- wangEditor富文本编辑器示例 -->
|
<!-- wangEditor富文本编辑器示例 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-link
|
<el-link
|
||||||
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/wang-editor.vue"
|
href="https://gitee.com/youlaiorg/vue3-element-admin/blob/master/src/views/demo/wang-editor.vue"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { FormInstance } from "element-plus";
|
import type { FormInstance } from "element-plus";
|
||||||
import AuthAPI from "@/api/auth";
|
import AuthAPI from "@/api/auth";
|
||||||
import type { LoginRequest } from "@/types/api";
|
import type { LoginRequest } from "@/api/auth";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { useUserStore } from "@/store";
|
import { useUserStore } from "@/store";
|
||||||
import { AuthStorage } from "@/utils/auth";
|
import { AuthStorage } from "@/utils/auth";
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ import type { FormInstance } from "element-plus";
|
|||||||
import { Lock } from "@element-plus/icons-vue";
|
import { Lock } from "@element-plus/icons-vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import AuthAPI from "@/api/auth";
|
import AuthAPI from "@/api/auth";
|
||||||
import type { LoginRequest } from "@/types/api";
|
import type { LoginRequest } from "@/api/auth";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ import type {
|
|||||||
MobileUpdateForm,
|
MobileUpdateForm,
|
||||||
EmailUpdateForm,
|
EmailUpdateForm,
|
||||||
UserProfileForm,
|
UserProfileForm,
|
||||||
} from "@/types/api";
|
} from "@/api/system/user";
|
||||||
|
|
||||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue";
|
import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue";
|
||||||
import FileAPI from "@/api/file";
|
import FileAPI from "@/api/file";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<!-- 搜索区域 -->
|
<!-- 搜索区域 -->
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item label="通知标题" prop="title">
|
<el-form-item label="通知标题" prop="title">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleQuery">
|
<el-button type="primary" @click="handleQuery">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Search />
|
<Search />
|
||||||
@@ -27,15 +27,14 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<el-table
|
<el-table
|
||||||
ref="dataTableRef"
|
ref="dataTableRef"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="pageData"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
class="table-section__content"
|
|
||||||
>
|
>
|
||||||
<el-table-column type="index" label="序号" width="60" />
|
<el-table-column type="index" label="序号" width="60" />
|
||||||
<el-table-column label="通知标题" prop="title" min-width="200" />
|
<el-table-column label="通知标题" prop="title" min-width="200" />
|
||||||
@@ -115,7 +114,7 @@ defineOptions({
|
|||||||
|
|
||||||
import { onMounted, reactive, ref } from "vue";
|
import { onMounted, reactive, ref } from "vue";
|
||||||
import NoticeAPI from "@/api/system/notice";
|
import NoticeAPI from "@/api/system/notice";
|
||||||
import type { NoticeDetail, NoticeItem, NoticeQueryParams } from "@/types/api";
|
import type { NoticeDetail, NoticeItem, NoticeQueryParams } from "@/api/system/notice";
|
||||||
|
|
||||||
const queryFormRef = ref();
|
const queryFormRef = ref();
|
||||||
const pageData = ref<NoticeItem[]>([]);
|
const pageData = ref<NoticeItem[]>([]);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item label="关键字" prop="keywords">
|
<el-form-item label="关键字" prop="keywords">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -11,16 +11,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPerm="['sys:config:create']"
|
v-hasPerm="['sys:config:create']"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -45,7 +45,6 @@
|
|||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="pageData"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
class="table-section__content"
|
|
||||||
border
|
border
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
@@ -139,7 +138,7 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
import ConfigAPI from "@/api/system/config";
|
import ConfigAPI from "@/api/system/config";
|
||||||
import type { ConfigItem, ConfigForm, ConfigQueryParams } from "@/types/api";
|
import type { ConfigItem, ConfigForm, ConfigQueryParams } from "@/api/system/config";
|
||||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from "element-plus";
|
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from "element-plus";
|
||||||
import { useDebounceFn } from "@vueuse/core";
|
import { useDebounceFn } from "@vueuse/core";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item label="关键字" prop="keywords">
|
<el-form-item label="关键字" prop="keywords">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -17,18 +17,18 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button class="filter-item" type="primary" icon="search" @click="handleQuery">
|
<el-button class="filter-item" type="primary" icon="search" @click="handleQuery">
|
||||||
搜索
|
搜索
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPerm="['sys:dept:create']"
|
v-hasPerm="['sys:dept:create']"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -55,7 +55,6 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||||
class="table-section__content"
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
@@ -163,7 +162,7 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
import DeptAPI from "@/api/system/dept";
|
import DeptAPI from "@/api/system/dept";
|
||||||
import type { DeptItem, DeptForm, DeptQueryParams } from "@/types/api";
|
import type { DeptItem, DeptForm, DeptQueryParams } from "@/api/system/dept";
|
||||||
import type { FormInstance, FormRules } from "element-plus";
|
import type { FormInstance, FormRules } from "element-plus";
|
||||||
|
|
||||||
// 表单引用
|
// 表单引用
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item label="关键字" prop="keywords">
|
<el-form-item label="关键字" prop="keywords">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -11,16 +11,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="never" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button type="success" icon="plus" @click="openDialog()">新增</el-button>
|
<el-button type="success" icon="plus" @click="openDialog()">新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import DictAPI from "@/api/system/dict";
|
import DictAPI from "@/api/system/dict";
|
||||||
import type { DictItemQueryParams, DictItem, DictItemForm } from "@/types/api";
|
import type { DictItemQueryParams, DictItem, DictItemForm } from "@/api/system/dict";
|
||||||
import type { FormInstance, FormRules } from "element-plus";
|
import type { FormInstance, FormRules } from "element-plus";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item label="关键字" prop="keywords">
|
<el-form-item label="关键字" prop="keywords">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -11,16 +11,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button type="success" icon="plus" @click="handleCreateClick()">新增</el-button>
|
<el-button type="success" icon="plus" @click="handleCreateClick()">新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
@@ -38,7 +38,6 @@
|
|||||||
highlight-current-row
|
highlight-current-row
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
border
|
border
|
||||||
class="table-section__content"
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
@@ -135,7 +134,7 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
import DictAPI from "@/api/system/dict";
|
import DictAPI from "@/api/system/dict";
|
||||||
import type { DictTypeQueryParams, DictTypeItem, DictTypeForm } from "@/types/api";
|
import type { DictTypeQueryParams, DictTypeItem, DictTypeForm } from "@/api/system/dict";
|
||||||
import type { FormInstance, FormRules } from "element-plus";
|
import type { FormInstance, FormRules } from "element-plus";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="auto">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="auto">
|
||||||
<el-form-item prop="keywords" label="关键字">
|
<el-form-item prop="keywords" label="关键字">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -24,20 +24,19 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="data-table">
|
<el-card class="page-content" shadow="never">
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="pageData"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
border
|
border
|
||||||
class="data-table__content"
|
|
||||||
>
|
>
|
||||||
<el-table-column label="操作标题" prop="title" min-width="180" show-overflow-tooltip />
|
<el-table-column label="操作标题" prop="title" min-width="180" show-overflow-tooltip />
|
||||||
<el-table-column label="状态" prop="status" width="80" align="center">
|
<el-table-column label="状态" prop="status" width="80" align="center">
|
||||||
@@ -117,7 +116,7 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
import LogAPI from "@/api/system/log";
|
import LogAPI from "@/api/system/log";
|
||||||
import type { LogItem, LogQueryParams } from "@/types/api";
|
import type { LogItem, LogQueryParams } from "@/api/system/log";
|
||||||
import type { FormInstance, TagProps } from "element-plus";
|
import type { FormInstance, TagProps } from "element-plus";
|
||||||
|
|
||||||
function getMethodTagType(method: string): TagProps["type"] {
|
function getMethodTagType(method: string): TagProps["type"] {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item label="关键字" prop="keywords">
|
<el-form-item label="关键字" prop="keywords">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -11,16 +11,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPerm="['sys:menu:create']"
|
v-hasPerm="['sys:menu:create']"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -41,7 +41,6 @@
|
|||||||
children: 'children',
|
children: 'children',
|
||||||
hasChildren: 'hasChildren',
|
hasChildren: 'hasChildren',
|
||||||
}"
|
}"
|
||||||
class="table-section__content"
|
|
||||||
@row-click="handleRowClick"
|
@row-click="handleRowClick"
|
||||||
>
|
>
|
||||||
<el-table-column label="菜单名称" min-width="200">
|
<el-table-column label="菜单名称" min-width="200">
|
||||||
@@ -361,7 +360,7 @@
|
|||||||
import { useAppStore } from "@/store/modules/app";
|
import { useAppStore } from "@/store/modules/app";
|
||||||
import { DeviceEnum } from "@/enums/settings";
|
import { DeviceEnum } from "@/enums/settings";
|
||||||
import MenuAPI from "@/api/system/menu";
|
import MenuAPI from "@/api/system/menu";
|
||||||
import type { MenuQueryParams, MenuForm, MenuItem } from "@/types/api";
|
import type { MenuQueryParams, MenuForm, MenuItem } from "@/api/system/menu";
|
||||||
import type { FormInstance, FormRules } from "element-plus";
|
import type { FormInstance, FormRules } from "element-plus";
|
||||||
import { MenuScopeEnum, MenuTypeEnum } from "@/enums/business";
|
import { MenuScopeEnum, MenuTypeEnum } from "@/enums/business";
|
||||||
import { isTenantEnabled } from "@/utils/tenant";
|
import { isTenantEnabled } from "@/utils/tenant";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-suffix=":">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-suffix=":">
|
||||||
<el-form-item label="标题" prop="title">
|
<el-form-item label="标题" prop="title">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -24,16 +24,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery()">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery()">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery()">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery()">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPerm="['sys:notice:create']"
|
v-hasPerm="['sys:notice:create']"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -59,7 +59,6 @@
|
|||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="pageData"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
class="table-section__content"
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
@@ -278,7 +277,7 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
import NoticeAPI from "@/api/system/notice";
|
import NoticeAPI from "@/api/system/notice";
|
||||||
import type { NoticeItem, NoticeForm, NoticeQueryParams, NoticeDetail } from "@/types/api";
|
import type { NoticeItem, NoticeForm, NoticeQueryParams, NoticeDetail } from "@/api/system/notice";
|
||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
import type { FormInstance, FormRules } from "element-plus";
|
import type { FormInstance, FormRules } from "element-plus";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<!-- 搜索区域 -->
|
<!-- 搜索区域 -->
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item prop="keywords" label="关键字">
|
<el-form-item prop="keywords" label="关键字">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -12,16 +12,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button type="success" icon="plus" @click="handleCreateClick()">新增</el-button>
|
<el-button type="success" icon="plus" @click="handleCreateClick()">新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
:data="roleList"
|
:data="roleList"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
border
|
border
|
||||||
class="table-section__content"
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
@@ -234,7 +233,7 @@ import { useAppStore } from "@/store/modules/app";
|
|||||||
import { DeviceEnum } from "@/enums/settings";
|
import { DeviceEnum } from "@/enums/settings";
|
||||||
|
|
||||||
import RoleAPI from "@/api/system/role";
|
import RoleAPI from "@/api/system/role";
|
||||||
import type { RoleItem, RoleForm, RoleQueryParams } from "@/types/api";
|
import type { RoleItem, RoleForm, RoleQueryParams } from "@/api/system/role";
|
||||||
import MenuAPI from "@/api/system/menu";
|
import MenuAPI from "@/api/system/menu";
|
||||||
import DeptAPI from "@/api/system/dept";
|
import DeptAPI from "@/api/system/dept";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item prop="keywords" label="关键字">
|
<el-form-item prop="keywords" label="关键字">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -18,16 +18,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPerm="['sys:tenant:create']"
|
v-hasPerm="['sys:tenant:create']"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -53,7 +53,6 @@
|
|||||||
:data="pageData"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
border
|
border
|
||||||
class="table-section__content"
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@@ -362,12 +361,12 @@ import TenantAPI from "@/api/system/tenant";
|
|||||||
import TenantPlanAPI from "@/api/system/tenant-plan";
|
import TenantPlanAPI from "@/api/system/tenant-plan";
|
||||||
import MenuAPI from "@/api/system/menu";
|
import MenuAPI from "@/api/system/menu";
|
||||||
import type {
|
import type {
|
||||||
OptionItem,
|
|
||||||
TenantCreateForm,
|
TenantCreateForm,
|
||||||
TenantForm,
|
TenantForm,
|
||||||
TenantQueryParams,
|
TenantQueryParams,
|
||||||
TenantItem,
|
TenantItem,
|
||||||
} from "@/types/api";
|
} from "@/api/system/tenant";
|
||||||
|
import type { OptionItem } from "@/api/common";
|
||||||
import { MenuScopeEnum } from "@/enums/business";
|
import { MenuScopeEnum } from "@/enums/business";
|
||||||
import { isPlatformTenantId } from "@/utils/tenant";
|
import { isPlatformTenantId } from "@/utils/tenant";
|
||||||
|
|
||||||
@@ -487,7 +486,7 @@ function fetchData(): void {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
TenantAPI.getPage(queryParams)
|
TenantAPI.getPage(queryParams)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
pageData.value = data.list.map((item) => ({
|
pageData.value = data.list.map((item: TenantItem) => ({
|
||||||
...item,
|
...item,
|
||||||
planId: item.planId != null ? Number(item.planId) : undefined,
|
planId: item.planId != null ? Number(item.planId) : undefined,
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<div class="filter-section">
|
<el-card class="page-search" shadow="never">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item label="关键字" prop="keywords">
|
<el-form-item label="关键字" prop="keywords">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -18,16 +18,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card class="page-content" shadow="never">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPerm="['sys:tenant-plan:create']"
|
v-hasPerm="['sys:tenant-plan:create']"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -45,7 +45,6 @@
|
|||||||
:data="pageData"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
border
|
border
|
||||||
class="table-section__content"
|
|
||||||
>
|
>
|
||||||
<el-table-column type="index" label="序号" width="60" />
|
<el-table-column type="index" label="序号" width="60" />
|
||||||
<el-table-column label="套餐名称" prop="name" min-width="120" />
|
<el-table-column label="套餐名称" prop="name" min-width="120" />
|
||||||
@@ -223,8 +222,8 @@ import type {
|
|||||||
TenantPlanForm,
|
TenantPlanForm,
|
||||||
TenantPlanItem,
|
TenantPlanItem,
|
||||||
TenantPlanQueryParams,
|
TenantPlanQueryParams,
|
||||||
OptionItem,
|
} from "@/api/system/tenant-plan";
|
||||||
} from "@/types/api";
|
import type { OptionItem } from "@/api/common";
|
||||||
import { MenuScopeEnum } from "@/enums/business";
|
import { MenuScopeEnum } from "@/enums/business";
|
||||||
|
|
||||||
// 表单引用
|
// 表单引用
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<!-- 用户管理 -->
|
<!-- 用户管理 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="page-container">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<!-- 部门树 -->
|
<!-- 部门树 -->
|
||||||
<el-col :lg="4" :xs="24" class="mb-[12px]">
|
<el-col :lg="4" :xs="24" class="page-aside">
|
||||||
<UserDeptTree v-model="queryParams.deptId" @node-click="handleQuery" />
|
<UserDeptTree v-model="queryParams.deptId" @node-click="handleQuery" />
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<!-- 用户列表 -->
|
<!-- 用户列表 -->
|
||||||
<el-col :lg="20" :xs="24">
|
<el-col :lg="20" :xs="24" class="page-main">
|
||||||
<!-- 搜索区域 -->
|
<!-- 搜索区域 -->
|
||||||
<div class="filter-section">
|
<el-card shadow="never" class="page-search">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="auto">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="auto">
|
||||||
<el-form-item label="关键字" prop="keywords">
|
<el-form-item label="关键字" prop="keywords">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -45,16 +45,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item class="search-buttons">
|
<el-form-item>
|
||||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="hover" class="table-section">
|
<el-card shadow="never" class="page-content">
|
||||||
<div class="table-section__toolbar">
|
<div class="page-toolbar">
|
||||||
<div class="table-section__toolbar--actions">
|
<div class="page-toolbar__left">
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPerm="['sys:user:create']"
|
v-hasPerm="['sys:user:create']"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-section__toolbar--tools">
|
<div class="page-toolbar__right">
|
||||||
<el-button v-hasPerm="'sys:user:import'" icon="upload" @click="openImportDialog">
|
<el-button v-hasPerm="'sys:user:import'" icon="upload" @click="openImportDialog">
|
||||||
导入
|
导入
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -90,7 +90,6 @@
|
|||||||
border
|
border
|
||||||
stripe
|
stripe
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
class="table-section__content"
|
|
||||||
row-key="id"
|
row-key="id"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
@@ -245,7 +244,7 @@
|
|||||||
import { computed, onMounted, reactive, ref } from "vue";
|
import { computed, onMounted, reactive, ref } from "vue";
|
||||||
import { useDebounceFn } from "@vueuse/core";
|
import { useDebounceFn } from "@vueuse/core";
|
||||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from "element-plus";
|
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from "element-plus";
|
||||||
import type { UserForm, UserQueryParams, UserItem } from "@/types/api";
|
import type { UserForm, UserQueryParams, UserItem } from "@/api/system/user";
|
||||||
import { downloadFile } from "@/utils";
|
import { downloadFile } from "@/utils";
|
||||||
import UserAPI from "@/api/system/user";
|
import UserAPI from "@/api/system/user";
|
||||||
import DeptAPI from "@/api/system/dept";
|
import DeptAPI from "@/api/system/dept";
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach } from "vitest";
|
|
||||||
import { mount } from "@vue/test-utils";
|
|
||||||
import Pagination from "@/components/Pagination/index.vue";
|
|
||||||
import ElementPlus from "element-plus";
|
|
||||||
|
|
||||||
describe("Pagination 组件", () => {
|
|
||||||
const createWrapper = (props = {}) => {
|
|
||||||
return mount(Pagination, {
|
|
||||||
props: {
|
|
||||||
page: 1,
|
|
||||||
limit: 10,
|
|
||||||
total: 100,
|
|
||||||
...props,
|
|
||||||
},
|
|
||||||
global: {
|
|
||||||
plugins: [ElementPlus],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("渲染", () => {
|
|
||||||
it("应该正确渲染分页组件", () => {
|
|
||||||
const wrapper = createWrapper();
|
|
||||||
expect(wrapper.exists()).toBe(true);
|
|
||||||
expect(wrapper.find(".pagination").exists()).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该在 hidden 为 true 时隐藏分页", () => {
|
|
||||||
const wrapper = createWrapper({ hidden: true });
|
|
||||||
expect(wrapper.find(".pagination").classes()).toContain("hidden");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该在 hidden 为 false 时显示分页", () => {
|
|
||||||
const wrapper = createWrapper({ hidden: false });
|
|
||||||
expect(wrapper.find(".pagination").classes()).not.toContain("hidden");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("Props", () => {
|
|
||||||
it("应该接收 total 属性", () => {
|
|
||||||
const wrapper = createWrapper({ total: 200 });
|
|
||||||
expect(wrapper.props("total")).toBe(200);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该接收 pageSizes 属性", () => {
|
|
||||||
const pageSizes = [5, 10, 20, 50];
|
|
||||||
const wrapper = createWrapper({ pageSizes });
|
|
||||||
expect(wrapper.props("pageSizes")).toEqual(pageSizes);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该使用默认的 pageSizes", () => {
|
|
||||||
const wrapper = createWrapper();
|
|
||||||
expect(wrapper.props("pageSizes")).toEqual([10, 20, 30, 50]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该接收 layout 属性", () => {
|
|
||||||
const layout = "prev, pager, next";
|
|
||||||
const wrapper = createWrapper({ layout });
|
|
||||||
expect(wrapper.props("layout")).toBe(layout);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该接收 background 属性", () => {
|
|
||||||
const wrapper = createWrapper({ background: false });
|
|
||||||
expect(wrapper.props("background")).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("事件", () => {
|
|
||||||
it("应该在页码改变时触发 pagination 事件", async () => {
|
|
||||||
const wrapper = createWrapper();
|
|
||||||
|
|
||||||
// 模拟页码改变
|
|
||||||
await wrapper.vm.handleCurrentChange(2);
|
|
||||||
|
|
||||||
expect(wrapper.emitted("pagination")).toBeTruthy();
|
|
||||||
expect(wrapper.emitted("pagination")?.[0]).toEqual([{ page: 2, limit: 10 }]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该在每页条数改变时触发 pagination 事件", async () => {
|
|
||||||
const wrapper = createWrapper();
|
|
||||||
|
|
||||||
// 模拟每页条数改变
|
|
||||||
await wrapper.vm.handleSizeChange(20);
|
|
||||||
|
|
||||||
expect(wrapper.emitted("pagination")).toBeTruthy();
|
|
||||||
expect(wrapper.emitted("pagination")?.[0]).toEqual([{ page: 1, limit: 20 }]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该在每页条数改变时重置页码为 1", async () => {
|
|
||||||
const wrapper = createWrapper({ page: 3 });
|
|
||||||
|
|
||||||
await wrapper.vm.handleSizeChange(20);
|
|
||||||
|
|
||||||
expect(wrapper.emitted("pagination")?.[0]).toEqual([{ page: 1, limit: 20 }]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("边界情况", () => {
|
|
||||||
it("应该在 total 为 0 时正常工作", () => {
|
|
||||||
const wrapper = createWrapper({ total: 0 });
|
|
||||||
expect(wrapper.exists()).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该在当前页超出范围时自动调整", async () => {
|
|
||||||
const wrapper = createWrapper({ page: 5, limit: 10, total: 100 });
|
|
||||||
|
|
||||||
// 修改 total 使当前页超出范围
|
|
||||||
await wrapper.setProps({ total: 20 });
|
|
||||||
|
|
||||||
// 应该触发 pagination 事件,页码调整为最后一页
|
|
||||||
expect(wrapper.emitted("pagination")).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach, vi } from "vitest";
|
|
||||||
import { useDictSync } from "@/composables/websocket/useDictSync";
|
|
||||||
import { useDictStore } from "@/store/modules/dict";
|
|
||||||
import { setActivePinia, createPinia } from "pinia";
|
|
||||||
|
|
||||||
// Mock useStomp
|
|
||||||
vi.mock("@/composables/websocket/useStomp", () => ({
|
|
||||||
useStomp: vi.fn(() => ({
|
|
||||||
isConnected: ref(false),
|
|
||||||
connect: vi.fn(),
|
|
||||||
disconnect: vi.fn(),
|
|
||||||
subscribe: vi.fn(() => "sub-id"),
|
|
||||||
unsubscribe: vi.fn(),
|
|
||||||
})),
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe("useDictSync", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
setActivePinia(createPinia());
|
|
||||||
localStorage.clear();
|
|
||||||
vi.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("初始化", () => {
|
|
||||||
it("应该创建字典同步实例", () => {
|
|
||||||
const dictSync = useDictSync();
|
|
||||||
expect(dictSync).toBeDefined();
|
|
||||||
expect(dictSync.initialize).toBeDefined();
|
|
||||||
expect(dictSync.cleanup).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该初始化 WebSocket 连接", () => {
|
|
||||||
const dictSync = useDictSync();
|
|
||||||
dictSync.initialize();
|
|
||||||
// 验证初始化逻辑(具体实现取决于 useDictSync 的内部逻辑)
|
|
||||||
expect(dictSync).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("清理", () => {
|
|
||||||
it("应该清理 WebSocket 连接", () => {
|
|
||||||
const dictSync = useDictSync();
|
|
||||||
dictSync.initialize();
|
|
||||||
dictSync.cleanup();
|
|
||||||
// 验证清理逻辑
|
|
||||||
expect(dictSync).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("字典同步", () => {
|
|
||||||
it("应该处理字典更新消息", () => {
|
|
||||||
const dictSync = useDictSync();
|
|
||||||
const dictStore = useDictStore();
|
|
||||||
|
|
||||||
dictSync.initialize();
|
|
||||||
|
|
||||||
// 模拟接收字典更新消息
|
|
||||||
// 注意:这里需要根据实际的消息格式来测试
|
|
||||||
expect(dictStore).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach } from "vitest";
|
|
||||||
import { useTableSelection } from "@/composables/table/useTableSelection";
|
|
||||||
|
|
||||||
describe("useTableSelection", () => {
|
|
||||||
let selection: ReturnType<typeof useTableSelection>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
selection = useTableSelection();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该初始化为空数组", () => {
|
|
||||||
expect(selection.selectedIds.value).toEqual([]);
|
|
||||||
expect(selection.selectedRows.value).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("handleSelectionChange()", () => {
|
|
||||||
it("应该更新选中的行", () => {
|
|
||||||
const rows = [
|
|
||||||
{ id: 1, name: "张三" },
|
|
||||||
{ id: 2, name: "李四" },
|
|
||||||
];
|
|
||||||
|
|
||||||
selection.handleSelectionChange(rows);
|
|
||||||
|
|
||||||
expect(selection.selectedRows.value).toEqual(rows);
|
|
||||||
expect(selection.selectedIds.value).toEqual([1, 2]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该处理空数组", () => {
|
|
||||||
selection.handleSelectionChange([]);
|
|
||||||
|
|
||||||
expect(selection.selectedRows.value).toEqual([]);
|
|
||||||
expect(selection.selectedIds.value).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该支持自定义 ID 字段", () => {
|
|
||||||
const customSelection = useTableSelection("userId");
|
|
||||||
const rows = [
|
|
||||||
{ userId: "u1", name: "张三" },
|
|
||||||
{ userId: "u2", name: "李四" },
|
|
||||||
];
|
|
||||||
|
|
||||||
customSelection.handleSelectionChange(rows);
|
|
||||||
|
|
||||||
expect(customSelection.selectedIds.value).toEqual(["u1", "u2"]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("clearSelection()", () => {
|
|
||||||
it("应该清空选中项", () => {
|
|
||||||
const rows = [{ id: 1, name: "张三" }];
|
|
||||||
selection.handleSelectionChange(rows);
|
|
||||||
|
|
||||||
selection.clearSelection();
|
|
||||||
|
|
||||||
expect(selection.selectedIds.value).toEqual([]);
|
|
||||||
expect(selection.selectedRows.value).toEqual([]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("hasSelection", () => {
|
|
||||||
it("有选中项时应该返回 true", () => {
|
|
||||||
const rows = [{ id: 1, name: "张三" }];
|
|
||||||
selection.handleSelectionChange(rows);
|
|
||||||
|
|
||||||
expect(selection.hasSelection.value).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("无选中项时应该返回 false", () => {
|
|
||||||
expect(selection.hasSelection.value).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("selectionCount", () => {
|
|
||||||
it("应该返回选中项数量", () => {
|
|
||||||
expect(selection.selectionCount.value).toBe(0);
|
|
||||||
|
|
||||||
const rows = [
|
|
||||||
{ id: 1, name: "张三" },
|
|
||||||
{ id: 2, name: "李四" },
|
|
||||||
{ id: 3, name: "王五" },
|
|
||||||
];
|
|
||||||
selection.handleSelectionChange(rows);
|
|
||||||
|
|
||||||
expect(selection.selectionCount.value).toBe(3);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach } from "vitest";
|
|
||||||
import { setActivePinia, createPinia } from "pinia";
|
|
||||||
import { useAppStore } from "@/store/modules/app";
|
|
||||||
import { DeviceEnum, SidebarStatus } from "@/enums";
|
|
||||||
|
|
||||||
describe("useAppStore", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
setActivePinia(createPinia());
|
|
||||||
localStorage.clear();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("侧边栏状态", () => {
|
|
||||||
it("应该切换侧边栏状态", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
const initialState = store.sidebar.opened;
|
|
||||||
|
|
||||||
store.toggleSidebar();
|
|
||||||
expect(store.sidebar.opened).toBe(!initialState);
|
|
||||||
|
|
||||||
store.toggleSidebar();
|
|
||||||
expect(store.sidebar.opened).toBe(initialState);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该关闭侧边栏", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
store.openSideBar();
|
|
||||||
expect(store.sidebar.opened).toBe(true);
|
|
||||||
|
|
||||||
store.closeSideBar();
|
|
||||||
expect(store.sidebar.opened).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该打开侧边栏", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
store.closeSideBar();
|
|
||||||
expect(store.sidebar.opened).toBe(false);
|
|
||||||
|
|
||||||
store.openSideBar();
|
|
||||||
expect(store.sidebar.opened).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该持久化侧边栏状态", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
store.openSideBar();
|
|
||||||
|
|
||||||
// 创建新的 store 实例模拟页面刷新
|
|
||||||
const newStore = useAppStore();
|
|
||||||
expect(newStore.sidebar.opened).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("设备类型", () => {
|
|
||||||
it("应该切换设备类型", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
|
|
||||||
store.toggleDevice(DeviceEnum.MOBILE);
|
|
||||||
expect(store.device).toBe(DeviceEnum.MOBILE);
|
|
||||||
|
|
||||||
store.toggleDevice(DeviceEnum.DESKTOP);
|
|
||||||
expect(store.device).toBe(DeviceEnum.DESKTOP);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该持久化设备类型", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
store.toggleDevice(DeviceEnum.MOBILE);
|
|
||||||
|
|
||||||
const newStore = useAppStore();
|
|
||||||
expect(newStore.device).toBe(DeviceEnum.MOBILE);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("组件尺寸", () => {
|
|
||||||
it("应该修改组件尺寸", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
|
|
||||||
store.changeSize("large");
|
|
||||||
expect(store.size).toBe("large");
|
|
||||||
|
|
||||||
store.changeSize("small");
|
|
||||||
expect(store.size).toBe("small");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该持久化组件尺寸", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
store.changeSize("large");
|
|
||||||
|
|
||||||
const newStore = useAppStore();
|
|
||||||
expect(newStore.size).toBe("large");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("语言设置", () => {
|
|
||||||
it("应该修改语言", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
|
|
||||||
store.changeLanguage("en");
|
|
||||||
expect(store.language).toBe("en");
|
|
||||||
|
|
||||||
store.changeLanguage("zh-cn");
|
|
||||||
expect(store.language).toBe("zh-cn");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该根据语言返回正确的 locale", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
|
|
||||||
store.changeLanguage("en");
|
|
||||||
expect(store.locale).toBeDefined();
|
|
||||||
|
|
||||||
store.changeLanguage("zh-cn");
|
|
||||||
expect(store.locale).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该持久化语言设置", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
store.changeLanguage("en");
|
|
||||||
|
|
||||||
const newStore = useAppStore();
|
|
||||||
expect(newStore.language).toBe("en");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("顶部菜单", () => {
|
|
||||||
it("应该激活顶部菜单", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
|
|
||||||
store.activeTopMenu("/dashboard");
|
|
||||||
expect(store.activeTopMenuPath).toBe("/dashboard");
|
|
||||||
|
|
||||||
store.activeTopMenu("/system");
|
|
||||||
expect(store.activeTopMenuPath).toBe("/system");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该持久化顶部菜单路径", () => {
|
|
||||||
const store = useAppStore();
|
|
||||||
store.activeTopMenu("/dashboard");
|
|
||||||
|
|
||||||
const newStore = useAppStore();
|
|
||||||
expect(newStore.activeTopMenuPath).toBe("/dashboard");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach, vi } from "vitest";
|
|
||||||
import { setActivePinia, createPinia } from "pinia";
|
|
||||||
import { useDictStore } from "@/store/modules/dict";
|
|
||||||
import DictAPI from "@/api/system/dict";
|
|
||||||
import type { DictItemOption } from "@/types/api";
|
|
||||||
|
|
||||||
// Mock DictAPI
|
|
||||||
vi.mock("@/api/system/dict", () => ({
|
|
||||||
default: {
|
|
||||||
getDictItems: vi.fn(),
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe("useDictStore", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
// 创建新的 Pinia 实例
|
|
||||||
setActivePinia(createPinia());
|
|
||||||
// 清理 localStorage
|
|
||||||
localStorage.clear();
|
|
||||||
// 重置所有 mock
|
|
||||||
vi.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("字典缓存", () => {
|
|
||||||
it("应该缓存字典数据", async () => {
|
|
||||||
const store = useDictStore();
|
|
||||||
const mockData: DictItemOption[] = [
|
|
||||||
{ value: "1", label: "选项1" },
|
|
||||||
{ value: "2", label: "选项2" },
|
|
||||||
];
|
|
||||||
|
|
||||||
vi.mocked(DictAPI.getDictItems).mockResolvedValue(mockData);
|
|
||||||
|
|
||||||
await store.loadDictItems("test_dict");
|
|
||||||
|
|
||||||
expect(store.getDictItems("test_dict")).toEqual(mockData);
|
|
||||||
expect(DictAPI.getDictItems).toHaveBeenCalledWith("test_dict");
|
|
||||||
expect(DictAPI.getDictItems).toHaveBeenCalledTimes(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该从缓存中获取字典数据,不重复请求", async () => {
|
|
||||||
const store = useDictStore();
|
|
||||||
const mockData: DictItemOption[] = [{ value: "1", label: "选项1" }];
|
|
||||||
|
|
||||||
vi.mocked(DictAPI.getDictItems).mockResolvedValue(mockData);
|
|
||||||
|
|
||||||
// 第一次加载
|
|
||||||
await store.loadDictItems("test_dict");
|
|
||||||
// 第二次加载(应该从缓存获取)
|
|
||||||
await store.loadDictItems("test_dict");
|
|
||||||
|
|
||||||
expect(DictAPI.getDictItems).toHaveBeenCalledTimes(1);
|
|
||||||
expect(store.getDictItems("test_dict")).toEqual(mockData);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该防止并发重复请求", async () => {
|
|
||||||
const store = useDictStore();
|
|
||||||
const mockData: DictItemOption[] = [{ value: "1", label: "选项1" }];
|
|
||||||
|
|
||||||
vi.mocked(DictAPI.getDictItems).mockResolvedValue(mockData);
|
|
||||||
|
|
||||||
// 同时发起多个请求
|
|
||||||
const promises = [
|
|
||||||
store.loadDictItems("test_dict"),
|
|
||||||
store.loadDictItems("test_dict"),
|
|
||||||
store.loadDictItems("test_dict"),
|
|
||||||
];
|
|
||||||
|
|
||||||
await Promise.all(promises);
|
|
||||||
|
|
||||||
// 应该只请求一次
|
|
||||||
expect(DictAPI.getDictItems).toHaveBeenCalledTimes(1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("字典操作", () => {
|
|
||||||
it("应该返回空数组当字典不存在时", () => {
|
|
||||||
const store = useDictStore();
|
|
||||||
expect(store.getDictItems("non_exist")).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该移除指定字典项", async () => {
|
|
||||||
const store = useDictStore();
|
|
||||||
const mockData: DictItemOption[] = [{ value: "1", label: "选项1" }];
|
|
||||||
|
|
||||||
vi.mocked(DictAPI.getDictItems).mockResolvedValue(mockData);
|
|
||||||
|
|
||||||
await store.loadDictItems("test_dict");
|
|
||||||
expect(store.getDictItems("test_dict")).toEqual(mockData);
|
|
||||||
|
|
||||||
store.removeDictItem("test_dict");
|
|
||||||
expect(store.getDictItems("test_dict")).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("应该清空所有字典缓存", async () => {
|
|
||||||
const store = useDictStore();
|
|
||||||
const mockData1: DictItemOption[] = [{ value: "1", label: "选项1" }];
|
|
||||||
const mockData2: DictItemOption[] = [{ value: "2", label: "选项2" }];
|
|
||||||
|
|
||||||
vi.mocked(DictAPI.getDictItems)
|
|
||||||
.mockResolvedValueOnce(mockData1)
|
|
||||||
.mockResolvedValueOnce(mockData2);
|
|
||||||
|
|
||||||
await store.loadDictItems("dict1");
|
|
||||||
await store.loadDictItems("dict2");
|
|
||||||
|
|
||||||
expect(store.getDictItems("dict1")).toEqual(mockData1);
|
|
||||||
expect(store.getDictItems("dict2")).toEqual(mockData2);
|
|
||||||
|
|
||||||
store.clearDictCache();
|
|
||||||
|
|
||||||
expect(store.getDictItems("dict1")).toEqual([]);
|
|
||||||
expect(store.getDictItems("dict2")).toEqual([]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("错误处理", () => {
|
|
||||||
it("应该处理请求失败的情况", async () => {
|
|
||||||
const store = useDictStore();
|
|
||||||
const error = new Error("Network error");
|
|
||||||
|
|
||||||
vi.mocked(DictAPI.getDictItems).mockRejectedValue(error);
|
|
||||||
|
|
||||||
await expect(store.loadDictItems("test_dict")).rejects.toThrow("Network error");
|
|
||||||
|
|
||||||
// 失败后应该允许重试
|
|
||||||
const mockData: DictItemOption[] = [{ value: "1", label: "选项1" }];
|
|
||||||
vi.mocked(DictAPI.getDictItems).mockResolvedValue(mockData);
|
|
||||||
|
|
||||||
await store.loadDictItems("test_dict");
|
|
||||||
expect(store.getDictItems("test_dict")).toEqual(mockData);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Loaded 100 of 107 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user