Skip to content

岗位管理

使用说明

主界面

用户与岗位是多对多关系

image-20250620164534039

编辑界面

  • 岗位名称:中文名称,不能重复
  • 岗位编码:英文名称,不能重复

image-20250620164638514

后端实现

目录

代码目录:mysite\myapp_system\post

模型

部门模型SystemPost

  • codename字段,加了unique=True属性,不能重复。
python
class SystemPost(BaseModel):
    id = models.BigAutoField(primary_key=True, db_comment="岗位ID", help_text="岗位ID")
    # 需要唯一
    code = models.CharField(
        max_length=64,
        unique=True,
        db_comment="岗位编码",
        help_text="岗位编码",
        error_messages={"unique": "岗位编码已存在"},
    )
    # 需要唯一
    name = models.CharField(
        max_length=50,
        unique=True,
        db_comment="岗位名称",
        help_text="岗位名称",
        error_messages={"unique": "岗位名称已存在"},
    )
    # ...

前端实现

目录

代码目录:src\views\system\post

sh
post
|-- PostForm.vue # 新增/编辑界面
`-- index.vue # 主界面