From e7ebbf5479f4adba5ee30d2692999b555592899a Mon Sep 17 00:00:00 2001 From: zhangtao <9480807882@qq.com> Date: Sat, 26 Jul 2025 11:51:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F=E5=8F=8A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 重构定时任务表单布局 fix: 修复用户导入组件按钮顺序 style: 统一对话框按钮顺序 feat: 添加用户头像默认显示 refactor: 移除表格列筛选功能 feat: 添加vue3-cron-plus-picker类型定义 fix: 修正日志处理时间显示格式 style: 优化IntervalTab组件布局 --- .../v1/models/system/operation_log_model.py | 2 +- .../v1/schemas/system/operation_log_schema.py | 2 +- .../api/v1/services/system/user_service.py | 9 +- backend/app/core/router_class.py | 2 +- backend/env/.env.dev | 2 +- frontend/.editorconfig | 15 --- frontend/src/api/system/log.ts | 2 +- frontend/src/components/IntervalTab/index.vue | 66 +++++-------- frontend/src/enums/api/result.enum.ts | 2 +- .../NavBar/components/NavbarActions.vue | 7 +- frontend/src/plugins/index.ts | 3 + frontend/src/settings.ts | 5 +- frontend/src/types/components.d.ts | 1 + frontend/src/types/vue3-cron-plus-picker.d.ts | 20 ++++ frontend/src/views/current/profile.vue | 10 +- frontend/src/views/monitor/job/index.vue | 99 ++++++++----------- frontend/src/views/system/config/index.vue | 2 +- frontend/src/views/system/dept/index.vue | 2 +- .../system/dict/components/DataDrawer.vue | 66 ++++--------- frontend/src/views/system/dict/index.vue | 2 +- frontend/src/views/system/log/index.vue | 62 +++--------- frontend/src/views/system/notice/index.vue | 12 +-- frontend/src/views/system/position/index.vue | 2 +- frontend/src/views/system/role/index.vue | 3 +- .../views/system/user/components/DeptTree.vue | 2 +- .../system/user/components/UserImport.vue | 2 +- frontend/src/views/system/user/index.vue | 76 ++++++-------- frontend/vite.config.ts | 2 +- 28 files changed, 190 insertions(+), 290 deletions(-) delete mode 100644 frontend/.editorconfig create mode 100644 frontend/src/types/vue3-cron-plus-picker.d.ts diff --git a/backend/app/api/v1/models/system/operation_log_model.py b/backend/app/api/v1/models/system/operation_log_model.py index 26b2902a..006d08c4 100644 --- a/backend/app/api/v1/models/system/operation_log_model.py +++ b/backend/app/api/v1/models/system/operation_log_model.py @@ -23,7 +23,7 @@ class OperationLogModel(ModelBase): request_browser = Column(String(64), nullable=True, comment="浏览器") response_code = Column(Integer, nullable=True, comment="响应状态码") response_json = Column(Text, nullable=True, comment="响应体") - process_time = Column(Float, nullable=True, comment="处理时间") + process_time = Column(String(20), nullable=True, comment="处理时间") # 审计字段 description = Column(Text, nullable=True, comment="备注说明") diff --git a/backend/app/api/v1/schemas/system/operation_log_schema.py b/backend/app/api/v1/schemas/system/operation_log_schema.py index 1044278b..d6728aff 100644 --- a/backend/app/api/v1/schemas/system/operation_log_schema.py +++ b/backend/app/api/v1/schemas/system/operation_log_schema.py @@ -18,7 +18,7 @@ class OperationLogCreateSchema(BaseModel): request_browser: Optional[str] = Field(default=None, description="请求浏览器") response_code: Optional[int] = Field(default=None, description="响应状态码") response_json: Optional[str] = Field(default=None, description="响应 JSON 数据") - process_time: Optional[float] = Field(default=None, description="处理时间") + process_time: Optional[str] = Field(default=None, description="处理时间") description: Optional[str] = Field(default=None, max_length=255, description="备注") creator_id: Optional[int] = Field(default=None, description="创建人ID") diff --git a/backend/app/api/v1/services/system/user_service.py b/backend/app/api/v1/services/system/user_service.py index 67ace72d..cd93668a 100644 --- a/backend/app/api/v1/services/system/user_service.py +++ b/backend/app/api/v1/services/system/user_service.py @@ -414,13 +414,16 @@ class UserService: # 定义字段映射 mapping_dict = { 'id': '用户编号', + 'avatar': '头像', 'username': '用户名称', 'name': '用户昵称', 'dept_name': '部门', - 'email': '邮箱地址', - 'mobile': '手机号码', + 'email': '邮箱', + 'mobile': '手机号', 'gender': '性别', 'status': '状态', + 'is_superuser': '是否超级管理员', + 'last_login': '最后登录时间', 'description': '备注', 'created_at': '创建时间', 'updated_at': '更新时间', @@ -431,7 +434,7 @@ class UserService: # 复制数据并转换 data = user_list.copy() for item in data: - item['status'] = '正常' if item.get('status') else '停用' + item['status'] = '启用' if item.get('status') else '停用' gender = item.get('gender') item['gender'] = '男' if gender == 1 else ('女' if gender == 2 else '未知') diff --git a/backend/app/core/router_class.py b/backend/app/core/router_class.py index 37159b3e..8f1b5a17 100644 --- a/backend/app/core/router_class.py +++ b/backend/app/core/router_class.py @@ -57,7 +57,7 @@ class OperationLogRoute(APIRoute): payload = str(oper_param) response_data = response.body if "application/json" in response.headers.get("Content-Type", "") else b"{}" - process_time = time.time() - start_time + process_time = f"{(time.time() - start_time):.4f}s" # 获取当前用户ID,如果是登录接口则为空 log_type = 1 # 1:登录日志 2:操作日志 diff --git a/backend/env/.env.dev b/backend/env/.env.dev index 7cfac2ab..4c4b3218 100644 --- a/backend/env/.env.dev +++ b/backend/env/.env.dev @@ -29,7 +29,7 @@ ROOT_PATH = "/api/v1" # API路由前缀 DEMO_ENABLE = False # 是否启用演示模式 # 数据库配置 -DB_DRIVER = "mysql" # sqlite、mysql +DB_DRIVER = "sqlite" # sqlite、mysql # SQLite配置 SQLITE_DB_NAME = "dev_sql.db" diff --git a/frontend/.editorconfig b/frontend/.editorconfig deleted file mode 100644 index 00ee2de4..00000000 --- a/frontend/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -# http://editorconfig.org -root = true - -# 表示所有文件适用 -[*] -charset = utf-8 # 设置文件字符集为 utf-8 -end_of_line = lf # 控制换行类型(lf | cr | crlf) -indent_style = space # 缩进风格(tab | space) -indent_size = 2 # 缩进大小 -insert_final_newline = true # 始终在文件末尾插入一个新行 - -# 表示仅 md 文件适用以下规则 -[*.md] -max_line_length = off # 关闭最大行长度限制 -trim_trailing_whitespace = false # 关闭末尾空格修剪 diff --git a/frontend/src/api/system/log.ts b/frontend/src/api/system/log.ts index 5da00e5a..bdaf1d7a 100644 --- a/frontend/src/api/system/log.ts +++ b/frontend/src/api/system/log.ts @@ -58,7 +58,7 @@ export interface LogTable { response_code?: number; request_payload?: string; response_json?: string; - process_time?: number; + process_time?: string; description?: string; created_at?: string; updated_at?: string; diff --git a/frontend/src/components/IntervalTab/index.vue b/frontend/src/components/IntervalTab/index.vue index abf6fa32..c078d1a9 100644 --- a/frontend/src/components/IntervalTab/index.vue +++ b/frontend/src/components/IntervalTab/index.vue @@ -1,43 +1,31 @@ - - - - - - {{ second }} - - - - - - - {{min}} - - - - - - - {{hour}} - - - - - - - {{day}} - - - - - - - {{week}} - - - - - + + + + {{ second }} + + + + + {{min}} + + + + + {{hour}} + + + + + {{day}} + + + + + {{week}} + + +