Merge branch 'dev' into order-delivery-reply
# Conflicts: # .env.shared # backend/app/api/chat.py # backend/app/core/config/settings.py # backend/app/models/user.py # backend/app/services/admin/permission_service.py # docs/demand.md # frontend/src/app/router/routes/workspace.routes.ts # frontend/src/features/admin/modules/users/components/UserFormModal.vue # frontend/src/features/admin/modules/users/composables/useUsersAdmin.ts # frontend/src/features/admin/types/user.types.ts # frontend/src/features/auth/stores/auth.store.ts # frontend/src/features/user/views/UserProfilePage.vue # frontend/src/locales/en/admin.json # frontend/src/locales/en/errors.json # frontend/src/locales/th/admin.json # frontend/src/locales/th/errors.json # frontend/src/locales/zh-CN/admin.json # frontend/src/locales/zh-CN/errors.json # frontend/src/locales/zh-TW/admin.json # frontend/src/locales/zh-TW/errors.json # frontend/src/shared/utils/auth.ts
This commit is contained in:
commit
616034a4cd
541 files changed
+43805
-14767
No files matched your search
@@ -221,6 +221,7 @@ from app.models.user import LoginAudit, User, UserDefaultAgent, UserFavoriteAgen
|
||||
from app.models.voucher_check import (
|
||||
VoucherCheckFileResult,
|
||||
VoucherCheckNotification,
|
||||
VoucherCheckNotifyConfig,
|
||||
VoucherCheckProfile,
|
||||
VoucherCheckRun,
|
||||
VoucherCheckSubject,
|
||||
@@ -420,6 +421,7 @@ __all__ = [
|
||||
'VoucherCheckSubject',
|
||||
'VoucherCheckFileResult',
|
||||
'VoucherCheckNotification',
|
||||
'VoucherCheckNotifyConfig',
|
||||
'ContractPaymentContract',
|
||||
'ContractPaymentAttachment',
|
||||
'ContractPaymentNode',
|
||||
|
||||
@@ -45,6 +45,8 @@ class ShippingCustomer(Base):
|
||||
index=True,
|
||||
)
|
||||
remark: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
||||
# 客户可用的 ODM ID 清单;为空表示不限定。生成发货 Excel 时用于收敛库存命中行。
|
||||
odm_ids: Mapped[Optional[list]] = mapped_column(JSON, nullable=True)
|
||||
created_by_id: Mapped[Optional[int]] = mapped_column(ForeignKey('users.id'), nullable=True)
|
||||
updated_by_id: Mapped[Optional[int]] = mapped_column(ForeignKey('users.id'), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(default=datetime.utcnow, index=True)
|
||||
|
||||
@@ -126,6 +126,8 @@ class ShippingNoticeLineInventoryMatch(Base):
|
||||
onupdate=datetime.utcnow,
|
||||
nullable=False,
|
||||
)
|
||||
# 整单 ODM ID 用户选择;写在当前匹配事实行上,随重匹配轮次自然失效。
|
||||
chosen_odm_id: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
|
||||
# T6: 行级实际源证据(决策 E1 硬约束)——用于幂等保护与跨源匹配审计。
|
||||
matched_file_no: Mapped[Optional[str]] = mapped_column(String(128), nullable=True, index=True)
|
||||
matched_row_index: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
||||
|
||||
@@ -29,7 +29,7 @@ class ShippingReceiptReportConfig(Base):
|
||||
inventory_source_id: Mapped[int] = mapped_column(
|
||||
ForeignKey('shipping_inventory_sources.id'), nullable=False, index=True,
|
||||
)
|
||||
enabled: Mapped[bool] = mapped_column(default=True, server_default=text('true'), nullable=False)
|
||||
# 收料不设独立启停:是否运行统一由库存站点 enabled 与本配置是否存在决定。
|
||||
# 收料文件解析规则(purpose='movement');定死领域字段端点。空则无法解析收料文件。
|
||||
parsing_profile_id: Mapped[Optional[int]] = mapped_column(
|
||||
ForeignKey('shipping_inventory_parsing_profiles.id'), nullable=True, index=True,
|
||||
@@ -40,10 +40,7 @@ class ShippingReceiptReportConfig(Base):
|
||||
query_parameters_json: Mapped[list[dict[str, Any]]] = mapped_column(
|
||||
JSON, default=list, server_default=text("'[]'"), nullable=False,
|
||||
)
|
||||
# DBS 可包含多个 Warehouse;Crane 固定 Inbound Details,保留空数组。
|
||||
warehouse_ids_json: Mapped[list[str]] = mapped_column(
|
||||
JSON, default=list, server_default=text("'[]'"), nullable=False,
|
||||
)
|
||||
# 与库存同构:Warehouse 是查询条件之一(支持多值),逐仓拆分在排程/触发时由该条件运行时派生,不单独持久化仓库清单。
|
||||
config_version: Mapped[int] = mapped_column(Integer, default=1, server_default=text('1'), nullable=False)
|
||||
created_by: Mapped[Optional[int]] = mapped_column(ForeignKey('users.id'), nullable=True)
|
||||
updated_by: Mapped[Optional[int]] = mapped_column(ForeignKey('users.id'), nullable=True)
|
||||
|
||||
@@ -109,7 +109,7 @@ class User(Base):
|
||||
返回当前用户的有效功能权限。
|
||||
|
||||
用途:统一为前端展示、登录态注入与后端业务校验提供同一份权限结果。
|
||||
核心逻辑:先按角色生成默认权限,再用用户显式配置覆盖,避免把培训、合同付款等业务权限硬编码在多个模块。
|
||||
核心逻辑:先按角色生成默认权限,再用用户显式配置覆盖,避免把培训等业务权限硬编码在多个模块。
|
||||
输出约束:仅返回布尔型权限键,缺失项自动回退到角色默认值。
|
||||
"""
|
||||
defaults = self._role_default_feature_permissions()
|
||||
@@ -127,7 +127,7 @@ class User(Base):
|
||||
保存用户显式配置的功能权限覆盖项。
|
||||
|
||||
用途:给管理后台用户编辑表单落库权限配置。
|
||||
核心逻辑:只持久化与角色默认值不同的权限,既保留“admin/hr 角色默认可见”的现有语义,也支持前端手动关闭或给普通用户单独授予。
|
||||
核心逻辑:只持久化与角色默认值不同的权限,既保留“admin/hr 角色默认可见”的现有语义,也支持前端手动关闭或给普通用户单独授予。合同付款预警改走 Agent 授权,不再占用功能权限键。
|
||||
参数约束:permissions 必须为 dict 或 None;未知键会被忽略。
|
||||
"""
|
||||
defaults = self._role_default_feature_permissions()
|
||||
@@ -149,10 +149,6 @@ class User(Base):
|
||||
"""判断当前用户是否可使用培训 HR 管理面板与接口。"""
|
||||
return self.has_feature_permission('training_hr_manage')
|
||||
|
||||
def can_access_contract_payment(self) -> bool:
|
||||
"""判断当前用户是否可查看合同付款预警工作台并触发同步/扫描。"""
|
||||
return self.has_feature_permission('contract_payment.access')
|
||||
|
||||
def set_password(self, password: str) -> None:
|
||||
"""设置密码哈希。"""
|
||||
self.password_hash = generate_password_hash(password)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"""
|
||||
backend/app/models/voucher_check.py
|
||||
|
||||
用途:立账凭证检核 ORM(Profile / 批次 / 主体 / 单文件结果 / 企微通知)。
|
||||
用途:立账凭证检核 ORM(Profile / 批次 / 主体 / 单文件结果 / 企微通知 / 按类型接收人)。
|
||||
依赖:models.base.Base、schedule_runs。
|
||||
逻辑:引擎写入 profiles/runs/subjects/file_results/notifications;工作台与查询服务只读这些表。
|
||||
逻辑:引擎写入 profiles/runs/subjects/file_results/notifications;通知配置表供管理员维护文件类型接收人。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -17,6 +17,7 @@ from sqlalchemy import (
|
||||
DateTime,
|
||||
ForeignKey,
|
||||
Index,
|
||||
Integer,
|
||||
JSON,
|
||||
String,
|
||||
Text,
|
||||
@@ -158,13 +159,35 @@ class VoucherCheckFileResult(Base):
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
|
||||
|
||||
class VoucherCheckNotifyConfig(Base):
|
||||
"""按业务方保存文件类型 → 接收人;换人不改 Profile 版本。"""
|
||||
|
||||
__tablename__ = "voucher_check_notify_configs"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
profile_code: Mapped[str] = mapped_column(String(32), nullable=False, unique=True)
|
||||
recipients_json: Mapped[dict] = mapped_column(JSON, nullable=False, default=dict)
|
||||
updated_by: Mapped[Optional[int]] = mapped_column(
|
||||
Integer,
|
||||
ForeignKey("users.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime,
|
||||
default=datetime.utcnow,
|
||||
onupdate=datetime.utcnow,
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
|
||||
class VoucherCheckNotification(Base):
|
||||
"""一个检核批次对应一条企微汇总通知审计。"""
|
||||
"""一个检核批次对应一条企微缺件通知审计(可含多人分信摘要)。"""
|
||||
|
||||
__tablename__ = "voucher_check_notifications"
|
||||
__table_args__ = (Index("ix_voucher_check_notifications_status", "send_status"),)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
|
||||
run_id: Mapped[int] = mapped_column(
|
||||
BigInteger,
|
||||
ForeignKey("voucher_check_runs.id", ondelete="CASCADE"),
|
||||
|
||||
Reference in new issue
Block a user