- 新增 fill_consumable_doc,根据 CSV 填写 Word 出库单(宋体五号) - Web 处理完成后自动生成出库单并提供下载 - 前端拆分为 static 资源,支持在线编辑 CSV 与分步提交财务系统 - 补充 API.md、README(含 Mermaid 数据流)及 config.example.json Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
"""
|
|
配置加载
|
|
|
|
从项目根目录的 config.json 读取配置,返回结构化的配置字典。
|
|
"""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
_CONFIG_PATH = Path(__file__).parent.parent / "config.json"
|
|
|
|
|
|
def load_config() -> dict:
|
|
"""加载并合并配置,缺失字段使用默认值"""
|
|
raw = {}
|
|
if _CONFIG_PATH.exists():
|
|
with open(_CONFIG_PATH, encoding="utf-8") as f:
|
|
raw = json.load(f)
|
|
|
|
project_root = _CONFIG_PATH.parent
|
|
|
|
return {
|
|
"sso_login_url": raw.get("sso_login_url", "https://tyrz.fynu.edu.cn/sso/login"),
|
|
"portal_url": raw.get("portal_url", "https://tyrz.fynu.edu.cn/oshall"),
|
|
"reimburse_url": raw.get("reimburse_url", "http://210.45.32.214:8081"),
|
|
"reimburse_page": raw.get("reimburse_page", "/expen/common/common?v=4.0"),
|
|
"username": raw.get("username", ""),
|
|
"password": raw.get("password", ""),
|
|
"default_name": raw.get("default_name", ""),
|
|
"default_card_no": raw.get("default_card_no", ""),
|
|
"default_person_id": raw.get("default_person_id", ""),
|
|
"consumable_storage": raw.get("consumable_storage", "躬行楼 C205"),
|
|
"attachment_dir": project_root / "attachments",
|
|
} |