feat: 优化库位树UI层级颜色,并将入库页面库位输入升级为级联选择器
This commit is contained in:
@ -168,10 +168,14 @@ class SysWarehouseLocation(db.Model):
|
||||
level = db.Column(db.Integer, default=0) # 层级深度,顶级为0
|
||||
is_enabled = db.Column(db.Boolean, default=True)
|
||||
created_at = db.Column(db.DateTime, default=datetime.now)
|
||||
updated_at = db.Column(db.DateTime, default=datetime.now, onupdate=datetime.now)
|
||||
# 注意:数据库表中没有 updated_at 字段,不要添加!
|
||||
|
||||
# 自关联
|
||||
children = db.relationship('SysWarehouseLocation', backref=db.backref('parent', remote_side=[id]), lazy='dynamic')
|
||||
# 自关联 - 使用 backref 定义父节点的反向引用
|
||||
children = db.relationship(
|
||||
'SysWarehouseLocation',
|
||||
backref=db.backref('parent', remote_side=[id]),
|
||||
lazy='dynamic'
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
@ -181,6 +185,5 @@ class SysWarehouseLocation(db.Model):
|
||||
'full_path': self.full_path,
|
||||
'level': self.level,
|
||||
'is_enabled': self.is_enabled,
|
||||
'created_at': self.created_at.isoformat() if self.created_at else None,
|
||||
'updated_at': self.updated_at.isoformat() if self.updated_at else None
|
||||
'created_at': self.created_at.isoformat() if self.created_at else None
|
||||
}
|
||||
Reference in New Issue
Block a user