Files
37duAutomation/plugins/XQ0001-0100/XQ0084 银行卡更新EHR系统/_pack.py
T
puddy de7eeee08f feat(plugin): XQ0084 0.1.1 插件界面 + 核对通过自动导入 HR 工资卡并回写台账
- 新增 ui-src(Vue3+Element Plus,v3 规范)与构建产物 ui/,plugin.json 开启 ui
- 接入 hr_sdk.wage_import:核对通过记录按身份证匹配导入工资卡,成功后回写「是否更新HR系统=是」
- 委托发放/缺开户银行记录跳过并注明原因,现金发放仍不导入;导入失败不中断出表与推送
- 工作簿新增 HR导入/说明列,推送正文补充导入统计;_pack 排除 ui-src 并校验 ui/index.html
2026-11-18 11:02:25 +08:00

39 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""发布打包辅助(`_` 前缀,运行时不会被插件扫描加载)。
把插件压成 dist-plugin/xq0084_v<版本>.zip(zip 根含 plugin.json)。
排除:ui-src、__pycache__、_selftest*、本脚本、*.pyc。
"""
import json
import zipfile
from pathlib import Path
_HERE = Path(__file__).resolve().parent
_OUT_DIR = _HERE.parents[2] / "dist-plugin"
_EXCLUDE_DIRS = {"ui-src", "__pycache__", "debug", ".sessions", "out", "images"}
_EXCLUDE_FILES = {"_pack.py"}
_EXCLUDE_PREFIXES = ("_selftest",)
def main():
manifest = json.loads((_HERE / "plugin.json").read_text(encoding="utf-8"))
pid, ver = manifest["id"], manifest["version"]
if manifest.get("ui") and not (_HERE / "ui" / "index.html").is_file():
raise SystemExit("ui=true 但缺少 ui/index.html:请先在 ui-src 下执行 npm run build")
_OUT_DIR.mkdir(exist_ok=True)
out = _OUT_DIR / f"{pid}_v{ver}.zip"
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as zf:
for p in sorted(_HERE.rglob("*")):
rel = p.relative_to(_HERE)
if set(rel.parts) & _EXCLUDE_DIRS or p.name in _EXCLUDE_FILES:
continue
if p.name.startswith(_EXCLUDE_PREFIXES) or p.suffix == ".pyc":
continue
if p.is_file():
zf.write(p, str(rel))
print(f"已打包: {out}({out.stat().st_size / 1024:.0f} KB)")
if __name__ == "__main__":
main()