diff --git a/backend/app/api/v1/schemas/system/dept_schema.py b/backend/app/api/v1/schemas/system/dept_schema.py index a40d8a8d..f516a421 100644 --- a/backend/app/api/v1/schemas/system/dept_schema.py +++ b/backend/app/api/v1/schemas/system/dept_schema.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- -from typing import Optional -from pydantic import BaseModel, ConfigDict, Field, model_validator +from typing import Any, Optional +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator, validator from app.core.base_schema import BaseSchema from app.core.validator import DateTimeStr +from app.core.logger import logger class DeptCreateSchema(BaseModel): """部门创建模型""" @@ -14,12 +15,12 @@ class DeptCreateSchema(BaseModel): parent_id: Optional[int] = Field(default=None, ge=0, description="父部门ID") description: Optional[str] = Field(default=None, max_length=500, description="备注说明") - @classmethod @model_validator(mode='after') - def validate_fields(cls, data): - if not data.name or len(data.name.strip()) == 0: + def validate_fields(self): + if not self.name or len(self.name.strip()) == 0: raise ValueError("部门名称不能为空") - return data + self.name = self.name.replace(" ", "") + return self class DeptUpdateSchema(DeptCreateSchema): diff --git a/backend/app/config/.env.dev b/backend/app/config/.env.dev index 344fcaf0..12e0ee63 100644 --- a/backend/app/config/.env.dev +++ b/backend/app/config/.env.dev @@ -5,7 +5,7 @@ ENVIRONMENT = "dev" # 服务器配置 -SERVER_HOST = 'localhost' # 允许访问的IP地址 +SERVER_HOST = '0.0.0.0' # 允许访问的IP地址 SERVER_PORT = 8000 # 服务端口 RELOAD = True # 是否自动重启 WORKERS = 1 # 启动进程数 diff --git a/backend/dev_sql.db b/backend/dev_sql.db index 7fffb97c..2423d6f8 100644 Binary files a/backend/dev_sql.db and b/backend/dev_sql.db differ diff --git a/frontend/src/components/TopTags/index.vue b/frontend/src/components/TopTags/index.vue index 86074d04..3ffbc75f 100644 --- a/frontend/src/components/TopTags/index.vue +++ b/frontend/src/components/TopTags/index.vue @@ -19,7 +19,6 @@ \ No newline at end of file + diff --git a/frontend/src/views/monitor/online/index.vue b/frontend/src/views/monitor/online/index.vue index 93101f9e..78bab964 100644 --- a/frontend/src/views/monitor/online/index.vue +++ b/frontend/src/views/monitor/online/index.vue @@ -1,26 +1,23 @@