feat(plugin): 新增 XQ0006 周考勤异常处理、XQ0083 调动流程生效确认;其余插件累积改动

XQ0001 排班异常识别 / XQ0002 雇主险增减操作 / XQ0012 ERP 付款申请 / XQ0013 社保费用申报 / XQ0042 抖音平台核对 / XQ0084 银行卡更新:逻辑与界面 bundle 更新(含各自版本号变更)
This commit is contained in:
2026-11-18 18:55:59 +08:00
parent b40c558893
commit 50fb138e1b
113 changed files with 13544 additions and 606 deletions
@@ -10,13 +10,14 @@
| 项 | 规则 |
|---|---|
| 核查窗口 | 近 `days` 天(默认 9,含当天) |
| 核查窗口 | 近 `days` 天(默认 9,含当天)再排除最近 2 天(当天/昨天),实际核查 7 天 |
| 调动台账 | 按「调动时间」落在窗口内;`现职位序列` 含「职能」→ 比「现单位」,否则比「现四级部门」;当日排班属于该部门即正常 |
| 排班归属 | 先按 `rf_s_kq_work_date_query` 查该部门全部排班名做成员判断;接口查不到集合时兜底「完整排班名包含部门名」 |
| 预入职台账 | 按「操作时间」落在窗口内;「预入职日期」当天有排班即正常 |
| 剔除不推送 | `现职位序列` 命中 经营系管理序列 / 职能系专业序列 / 门店技师序列 |
| 单位未变 | 职能类序列且「原单位」=「现单位」→ 不纳入 |
| 离职过滤 | 花名册查不到工号 → 按离职剔除(调动/入职都生效) |
| 后勤剔除 | 花名册「一级部门」含「后勤」(如后勤(C))→ 不纳入异常、不推送 |
| 店长解析 | 固定路由优先(`秒创传媒职能序列` → 刘凤琳 37010004);否则按工号取部门链(四级→三级→所属→二级)逐级找同名门店下岗位含「店长」的人;仍解析不到 → 默认处理人(多个轮流分配),无默认处理人则只留档不推送 |
| 生物识别 | 考勤平台 BioData `q=工号` 记录为 0 → 标「未登记」,在店长消息尾部单独成段;平台异常时降级跳过 |
@@ -27,9 +28,8 @@
| 字段 | 默认 | 说明 |
|---|---|---|
| `save_dir` | `D:\资料\人资\排班异常识别` | 名单、台账(`台账/`)、推送记录(`推送记录/`) |
| `days` | 9 | 核查窗口天数 |
| `refresh` | true | 关闭则复用已有台账/花名册 |
| `roster_path` / `transfer_ledger` / `preentry_ledger` | 空 | 留空自动用 SDK 导出到 `save_dir/台账/` |
| `days` | 9 | 核查窗口天数(再排除最近 2 天,实际核查 N-2 天) |
| `roster_cache` | true | 花名册 30 分钟内复用;关闭则每次重新导出(台账每次都重新导) |
| `push` | true | 关闭只出名单 |
| `push_group` | 数字人沟通群 | 汇总群全称 |
| `push_at_all` | false | 汇总群 @所有人 |
@@ -37,6 +37,7 @@
| `check_biometrics` | true | 生物识别核查开关 |
| `bio_username` / `bio_password` | 空 | 考勤平台账号(留空用内置/环境变量) |
| `dws_path` | 空 | 留空自动检测(`DINGTALK_DWS_BIN` → 用户目录 → PATH) |
| `probe_dws` | false | 仅检测 dws(插件 UI「检测」按钮用):立即返回 `dws_available`/`dws_path`,不取数、不推送 |
## dws 检测
@@ -53,7 +53,7 @@ class ShiftAbnormalPlugin(ScenePlugin):
id = "xq0001"
name = "排班异常识别"
version = "1.0.1"
version = "1.0.3"
description = ("核查近 N 天新入职/调入人员的当日排班是否属于应有门店,输出异常名单并按店长"
"单聊 + 汇总群推送(依赖 hr_sdk / dingtalk_sdk;未装 dws 时只出名单不推送)。")
platform = "hr"
@@ -70,21 +70,9 @@ class ShiftAbnormalPlugin(ScenePlugin):
"type": "int", "title": "核查窗口(天)", "default": config.DAYS_DEFAULT,
"description": "近 N 天(含当天)内新入职/调动的人员",
},
"refresh": {
"type": "boolean", "title": "重新导出台账与花名册", "default": True,
"description": "关闭则复用输出目录下已有文件(调试用,避免每次重复导出)",
},
"roster_path": {
"type": "string", "title": "花名册路径", "default": "",
"description": "留空 = 自动导出到「输出目录/台账/员工花名册.xlsx」",
},
"transfer_ledger": {
"type": "string", "title": "调动台账路径", "default": "",
"description": "留空 = 自动导出到「输出目录/台账/调动台账.xlsx」",
},
"preentry_ledger": {
"type": "string", "title": "预入职台账路径", "default": "",
"description": "留空 = 自动导出到「输出目录/台账/预入职台账.xlsx」",
"roster_cache": {
"type": "boolean", "title": "花名册 30 分钟内复用", "default": True,
"description": "开启后同一份在职花名册 30 分钟内直接复用;关闭则每次重新导出",
},
"push": {
"type": "boolean", "title": "推送钉钉", "default": True,
@@ -128,6 +116,20 @@ class ShiftAbnormalPlugin(ScenePlugin):
def log(msg: str, level: str = "INFO") -> None:
ctx.log(msg, level)
# ---- 0. 仅检测 dws(UI「检测」按钮:probe_dws=true,不取数、不推送) ----
if bool(fields.get("probe_dws", False)):
path = detect_dws(str(fields.get("dws_path") or ""))
if path:
log(f"[INFO] dws 检测通过:{path}")
else:
log("[WARN] 未检测到 dws:执行时将只出名单、不推送", "WARNING")
return {
"ok": True, "probe": True,
"dws_available": bool(path), "dws_path": path,
"summary": (f"dws 可用:{path}" if path
else "未检测到 dws(执行时只出名单、不推送)"),
}
save_dir = config.save_dir(fields)
os.makedirs(save_dir, exist_ok=True)
@@ -162,30 +164,24 @@ class ShiftAbnormalPlugin(ScenePlugin):
def _run(self, client, fields: dict, save_dir: str, dws_path: str,
log, ctx) -> dict:
days = config.days(fields)
refresh = bool(fields.get("refresh", True))
ledger_dir = os.path.join(save_dir, config.LEDGER_SUBDIR)
os.makedirs(ledger_dir, exist_ok=True)
# ---- 3. 取数(按需现导) ----
roster_path = self._pick(fields.get("roster_path"),
os.path.join(ledger_dir, config.ROSTER_FILENAME))
if refresh or not os.path.exists(roster_path):
log("[INFO] 导出员工花名册(在职)…")
roster_path = hr_roster.export(
client, statuses=["在职"], output=roster_path, ttl=0)
# ---- 3. 取数:台账与花名册一律现导到「输出目录/台账/」 ----
roster_path = os.path.join(ledger_dir, config.ROSTER_FILENAME)
roster_ttl = config.ROSTER_TTL_CACHE if bool(fields.get("roster_cache", True)) else 0
log("[INFO] 导出员工花名册(在职)…")
roster_path = hr_roster.export(
client, statuses=["在职"], output=roster_path, ttl=roster_ttl)
ctx.progress(30)
transfer_path = self._pick(fields.get("transfer_ledger"),
os.path.join(ledger_dir, config.TRANSFER_FILENAME))
if refresh or not os.path.exists(transfer_path):
log("[INFO] 导出调动台账…")
transfer_path = hr_ledger.export_transfer(client, output=transfer_path)
transfer_path = os.path.join(ledger_dir, config.TRANSFER_FILENAME)
log("[INFO] 导出调动台账…")
transfer_path = hr_ledger.export_transfer(client, output=transfer_path)
preentry_path = self._pick(fields.get("preentry_ledger"),
os.path.join(ledger_dir, config.PREENTRY_FILENAME))
if refresh or not os.path.exists(preentry_path):
log("[INFO] 导出预入职台账…")
preentry_path = hr_ledger.export_pre_entry(client, output=preentry_path)
preentry_path = os.path.join(ledger_dir, config.PREENTRY_FILENAME)
log("[INFO] 导出预入职台账…")
preentry_path = hr_ledger.export_pre_entry(client, output=preentry_path)
ctx.progress(45)
# ---- 4. 判定 ----
@@ -215,6 +211,22 @@ class ShiftAbnormalPlugin(ScenePlugin):
"WARNING")
rows = [r for r in rows if rules.to_text(r.get("工号")) in roster_codes]
# 后勤组织过滤:花名册「一级部门」含「后勤」的(如后勤(C))不纳入异常
if rows:
dept1_by_code = manager_mod.dept1_map(roster_df)
if not dept1_by_code:
log(f"[WARN] 花名册缺少「{config.COL_DEPT1}」列,后勤组织剔除未生效",
"WARNING")
else:
excluded = [r for r in rows
if manager_mod.dept1_excluded(
dept1_by_code.get(rules.to_text(r.get("工号")), ""))]
if excluded:
names = [f"{r.get('姓名')}/{r.get('工号')}" for r in excluded]
log(f"[WARN] 一级部门含后勤,剔除 {len(excluded)} 人:{names}",
"WARNING")
rows = [r for r in rows if r not in excluded]
# 预入职台账无四级部门列 → 按工号回填
for row in rows:
if row.get("类别") == "入职" and not rules.clean(row.get("现四级部门")):
@@ -275,11 +287,6 @@ class ShiftAbnormalPlugin(ScenePlugin):
return summary
# ---------------- 工具 ----------------
@staticmethod
def _pick(explicit, fallback: str) -> str:
value = str(explicit or "").strip()
return os.path.abspath(value) if value else os.path.abspath(fallback)
@staticmethod
def _push(payload, dws_path: str, save_dir: str, log) -> dict:
"""执行推送(单聊 + 汇总群),返回摘要字段。"""
@@ -0,0 +1,38 @@
# -*- 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()
@@ -74,8 +74,10 @@ def test_rules() -> None:
_eq(rules.clean("37000001.0"), "37000001", "去掉浮点尾缀")
_eq(rules.clean(" nan "), "", "空占位清洗")
_eq(rules.shift_name("2026-11-09_印象-门店-服务岗"), "印象-门店-服务岗", "排班名去日期前缀")
_eq(rules.recent_window(date(2026, 11, 9), 9), (date(2026, 11, 1), date(2026, 11, 9)),
"近 9 天窗口")
_eq(rules.recent_window(date(2026, 11, 9), 9), (date(2026, 11, 1), date(2026, 11, 7)),
"近 9 天窗口排除最近 2 天 → 实际 7 天")
_eq(rules.recent_window(date(2026, 11, 9), 2), (date(2026, 11, 8), date(2026, 11, 8)),
"窗口天数不大于排除天数时至少保留 1 天")
_ok(rules.seq_excluded("经营系管理序列"), "剔除序列命中")
_ok(not rules.seq_excluded("门店服务序列"), "非剔除序列不命中")
@@ -127,16 +129,16 @@ def test_rules() -> None:
def _roster() -> pd.DataFrame:
return pd.DataFrame([
{"工号": "E1", "姓名": "张三", "四级部门": "门店A", "三级部门": "", "所属部门": "",
"二级部门": "", "岗位": "服务员"},
{"工号": "M1", "姓名": "王店长", "四级部门": "门店A", "三级部门": "", "所属部门": "",
"二级部门": "", "岗位": "店长"},
{"工号": "E3", "姓名": "赵六", "四级部门": "", "三级部门": "门店C", "所属部门": "",
"二级部门": "", "岗位": "技师"},
{"工号": "M3", "姓名": "陈店长", "四级部门": "", "三级部门": "门店C", "所属部门": "",
"二级部门": "", "岗位": "店长"},
{"工号": "E4", "姓名": "孙七", "四级部门": "门店D", "三级部门": "", "所属部门": "",
"二级部门": "", "岗位": "服务员"},
{"工号": "E1", "姓名": "张三", "一级部门": "集团门店一部", "四级部门": "门店A",
"三级部门": "", "所属部门": "", "二级部门": "", "岗位": "服务员"},
{"工号": "M1", "姓名": "王店长", "一级部门": "集团门店一部", "四级部门": "门店A",
"三级部门": "", "所属部门": "", "二级部门": "", "岗位": "店长"},
{"工号": "E3", "姓名": "赵六", "一级部门": "集团门店一部", "四级部门": "",
"三级部门": "门店C", "所属部门": "", "二级部门": "", "岗位": "技师"},
{"工号": "M3", "姓名": "陈店长", "一级部门": "集团门店一部", "四级部门": "",
"三级部门": "门店C", "所属部门": "", "二级部门": "", "岗位": "店长"},
{"工号": "E4", "姓名": "孙七", "一级部门": "后勤(C)", "四级部门": "门店D",
"三级部门": "", "所属部门": "", "二级部门": "", "岗位": "服务员"},
])
@@ -151,6 +153,12 @@ def test_manager() -> None:
_eq(manager_mod.find_store_by_manager(frame, "M1", "王店长"), "门店A", "店长所属门店")
_eq(manager_mod.lookup_dept4_by_code(frame, "E1"), "门店A", "按工号回填四级部门")
dept1_by_code = manager_mod.dept1_map(frame)
_eq(dept1_by_code.get("E4"), "后勤(C)", "工号→一级部门映射")
_ok(manager_mod.dept1_excluded(dept1_by_code.get("E4", "")), "一级部门含后勤命中剔除")
_ok(not manager_mod.dept1_excluded(dept1_by_code.get("E1", "")), "非后勤一级部门不剔除")
_eq(manager_mod.dept1_map(pd.DataFrame([{"工号": "E1"}])), {}, "无一级部门列返回空映射")
fixed = manager_mod.match_fixed_route({"现职位序列": "秒创传媒职能序列"})
_eq(fixed, (("37010004", "刘凤琳"), "秒创传媒职能序列"), "固定路由命中")
_eq(manager_mod.match_fixed_route({"现职位序列": "门店服务序列"}), None, "固定路由未命中")
@@ -17,10 +17,14 @@ ROSTER_FILENAME = "员工花名册.xlsx"
TRANSFER_FILENAME = "调动台账.xlsx"
PREENTRY_FILENAME = "预入职台账.xlsx"
RECORD_SUBDIR = "推送记录"
#: 花名册缓存有效期(秒):开启「30 分钟内复用」时同路径文件直接复用
ROSTER_TTL_CACHE = 1800
# ==================== 核查窗口 ====================
#: 近 N 天(含当天)
DAYS_DEFAULT = 9
#: 「近 N 天」中再排除最近 M 天(当天/昨天数据未稳定):9 天口径实际核查 7 天
WINDOW_EXCLUDE_RECENT_DAYS = 2
#: 每 N 次查询校验一次登录态(避免会话过期后逐人触发重登)
SESSION_REVALIDATE_EVERY = 30
@@ -30,6 +34,7 @@ COL_CODE = "工号"
COL_DEPT4 = "四级部门"
COL_DEPT3 = "三级部门"
COL_DEPT2 = "二级部门"
COL_DEPT1 = "一级部门"
COL_DEPT_SELF = "所属部门"
COL_POSITION = "岗位"
MANAGER_KEYWORD = "店长"
@@ -40,6 +45,8 @@ ROSTER_REQUIRED = (COL_CODE, COL_NAME, COL_DEPT4, COL_POSITION)
# ==================== 判定口径 ====================
#: 现职位序列命中以下序列的异常不纳入、不推送
EXCLUDE_SEQ_KEYWORDS = ("经营系管理序列", "职能系专业序列", "门店技师序列")
#: 花名册「一级部门」含以下关键字的异常不纳入、不推送(集团下的后勤组织,如后勤(C))
EXCLUDE_DEPT1_KEYWORDS = ("后勤",)
#: 调动名单:命中以下职能序列且「原单位」=「现单位」的,不纳入异常
FUNC_SEQ_UNIT_UNCHANGED_KEYWORDS = (
"职能管理序列", "职能系管理序列", "职能专业序列", "职能系专业序列",
@@ -11,7 +11,7 @@
from __future__ import annotations
import os
from typing import List, Optional, Tuple
from typing import Dict, List, Optional, Tuple
import pandas as pd
@@ -118,6 +118,20 @@ def lookup_dept4_by_code(frame: pd.DataFrame, code: str) -> str:
return to_text(hit.iloc[0][config.COL_DEPT4])
def dept1_map(frame: pd.DataFrame) -> Dict[str, str]:
"""工号 → 一级部门(花名册无「一级部门」列时返回空 dict)。"""
if config.COL_DEPT1 not in frame.columns:
return {}
return {to_text(code): to_text(dept1) for code, dept1
in zip(frame[config.COL_CODE], frame[config.COL_DEPT1])}
def dept1_excluded(dept1: str) -> bool:
"""一级部门命中剔除关键字(如「后勤」)→ True。"""
text = clean(dept1)
return any(keyword in text for keyword in config.EXCLUDE_DEPT1_KEYWORDS)
def match_fixed_route(row: dict):
"""命中固定路由返回 ``((工号, 姓名), 范围描述)``,未命中返回 ``None``。"""
seq = to_text(row.get("现职位序列"))
@@ -69,9 +69,11 @@ def parse_date(value) -> Optional[date]:
def recent_window(end: Optional[date] = None, days: int = config.DAYS_DEFAULT
) -> Tuple[date, date]:
"""近 N 天闭区间(含当天)。"""
"""核查窗口:近 N 天(含当天),再排除最近 M 天(当天/昨天),实际 N-M 天。"""
end = end or date.today()
return end - timedelta(days=max(1, days) - 1), end
days = max(1, days)
skip = min(config.WINDOW_EXCLUDE_RECENT_DAYS, days - 1)
return end - timedelta(days=days - 1), end - timedelta(days=skip)
# ==================== 台账 ====================
@@ -251,7 +253,9 @@ def collect_rows(ledger_path: str, check_row, fetcher: ShiftFetcher,
"""读台账 → 逐行判定 → 异常行列表。"""
frame = load_ledger(ledger_path, log)
begin, end_date = recent_window(end, days)
log(f"[INFO] 筛选范围:{begin} ~ {end_date}(近 {days} 天)")
log(f"[INFO] 筛选范围:{begin} ~ {end_date}(近 {days} 天,排除最近 "
f"{config.WINDOW_EXCLUDE_RECENT_DAYS} 天,实际核查 "
f"{(end_date - begin).days + 1} 天)")
rows = []
for _, raw in frame.iterrows():
row = check_row(fetcher, dept_fetcher, raw, begin, end_date)
@@ -2,7 +2,7 @@
"schema_version": 1,
"id": "xq0001",
"name": "排班异常识别",
"version": "1.0.1",
"version": "1.0.3",
"description": "核查近 N 天新入职/调入人员的当日排班是否属于应有门店;输出异常名单(含店长/处理人、推送状态、生物识别),按店长单聊 + 汇总群推送。依赖 hr_sdk(取数与台账导出)与 dingtalk_sdk(单聊/群聊推送);本机未安装 dws 时只出名单不推送。",
"category": "人资",
"icon": "",
@@ -40,31 +40,13 @@
"type": "integer",
"title": "核查窗口(天)",
"default": 9,
"description": "近 N 天(含当天)内新入职/调动的人员"
"description": "近 N 天(含当天)内新入职/调动的人员,再排除最近 2 天(当天/昨天),实际核查 N-2 天"
},
"refresh": {
"roster_cache": {
"type": "boolean",
"title": "重新导出台账与花名册",
"title": "花名册 30 分钟内复用",
"default": true,
"description": "关闭则复用输出目录下已有文件(调试用,避免每次重复导出)"
},
"roster_path": {
"type": "string",
"title": "花名册路径",
"default": "",
"description": "留空 = 自动导出到「输出目录/台账/员工花名册.xlsx」"
},
"transfer_ledger": {
"type": "string",
"title": "调动台账路径",
"default": "",
"description": "留空 = 自动导出到「输出目录/台账/调动台账.xlsx」"
},
"preentry_ledger": {
"type": "string",
"title": "预入职台账路径",
"default": "",
"description": "留空 = 自动导出到「输出目录/台账/预入职台账.xlsx」"
"description": "开启后同一份在职花名册 30 分钟内直接复用;关闭则每次重新导出(台账每次都重新导)"
},
"push": {
"type": "boolean",
@@ -114,6 +96,12 @@
"title": "dws 路径",
"default": "",
"description": "留空自动检测(DINGTALK_DWS_BIN / 用户目录 / PATH);检测不到会跳过推送"
},
"probe_dws": {
"type": "boolean",
"title": "仅检测 dws",
"default": false,
"description": "插件 UI「检测」按钮使用:只检测 dws 是否可用并立即返回,不取数、不推送"
}
},
"required": []
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,6 @@
<template>
<div class="page">
<!-- ① 工具条:整组靠右(已保存 → 方案下拉 → 存为方案 → 删除) -->
<!-- 方案工具条:本机配置自动保存;方案供壳子「定时任务」按 config_id 引用 -->
<div class="toolbar">
<span class="spacer" />
<span class="saved" :class="{ 'is-idle': !lastSavedAt }">
@@ -15,12 +15,12 @@
@click="removeScheme">删除</el-button>
</div>
<!-- ② 内联提示(结果横幅由壳子展示,这里只放本插件短提示) -->
<div v-if="needLogin" class="notice is-warn">
<span class="n-ico">!</span><span>未登录:请先在壳子登录统一账户</span>
</div>
<div v-else-if="notice" class="notice" :class="'is-' + notice.type">
<span class="n-ico">·</span><span>{{ notice.text }}</span>
<span class="n-ico">{{ notice.type === 'ok' ? '✓' : (notice.type === 'error' ? '✕' : '!') }}</span>
<span>{{ notice.text }}</span>
</div>
<!-- 01 执行设置 -->
@@ -31,19 +31,16 @@
<span class="sec-line" />
</div>
<div class="sec-body">
<el-form label-position="top" @submit.prevent>
<div class="grid">
<el-form-item class="span-all" label="输出目录">
<el-form label-position="top">
<div class="grid-2">
<el-form-item label="输出目录">
<div class="dir-ctrl">
<el-input v-model="form.save_dir" class="dir-input" :disabled="running" clearable
placeholder="留空 = D:\资料\人资\排班异常识别" />
<el-button class="dir-btn" :disabled="running || picking === 'save_dir'"
:loading="picking === 'save_dir'" @click="pickDir('save_dir', '选择输出目录')">
选择
</el-button>
<el-button class="dir-btn" :disabled="running || picking" :loading="picking"
@click="pickDir">选择</el-button>
</div>
</el-form-item>
<el-form-item label="核查窗口(天)">
<el-input-number v-model="form.days" :min="1" :max="60" :step="1"
:disabled="running" controls-position="right" />
@@ -53,104 +50,52 @@
<div class="rows">
<div class="row">
<div class="r-main">
<div class="r-title">重新导出台账与花名册</div>
<div class="r-desc">关闭则复用「输出目录/台账/」下已有文件(调试用,避免每次重复导出)</div>
<div class="r-title">花名册 30 分钟内复用</div>
<div class="r-desc">开启后同一份在职花名册 30 分钟内直接复用;关闭则每次重新导出</div>
</div>
<div class="r-ctrl">
<el-switch v-model="form.roster_cache" :disabled="running" />
</div>
<div class="r-ctrl"><el-switch v-model="form.refresh" :disabled="running" /></div>
</div>
</div>
<div class="tip">
核查口径:<b>近 N 天(含当天)</b>新入职/调入人员,
调动按「调动时间」、入职按「预入职日期」查当日排班是否属于应有门店。
台账与花名册自动导出到 <b>输出目录/台账/</b>;核查近 N 天(含当天)内新入职/调入人员,
调动按「调动时间」、入职按「预入职日期」核对当日排班,再排除当天/昨天(默认 9 天实际核查 7 天)。
</div>
</el-form>
</div>
</section>
<!-- 02 台账来源 -->
<!-- 02 钉钉推送 -->
<section class="sec">
<div class="sec-head">
<span class="sec-badge">02</span>
<span class="sec-name">台账来源</span>
<span class="sec-line" />
</div>
<div class="sec-body">
<el-form label-position="top" @submit.prevent>
<div class="grid">
<el-form-item class="span-all" label="花名册路径">
<div class="dir-ctrl">
<el-input v-model="form.roster_path" class="dir-input" :disabled="running" clearable
placeholder="留空自动导出:台账/员工花名册.xlsx" />
<el-button class="dir-btn" :disabled="running || picking === 'roster_path'"
:loading="picking === 'roster_path'"
@click="pickFile('roster_path', '选择花名册文件', ['xlsx', 'xlsm'])">
选择
</el-button>
</div>
</el-form-item>
<el-form-item label="调动台账路径">
<div class="dir-ctrl">
<el-input v-model="form.transfer_ledger" class="dir-input" :disabled="running" clearable
placeholder="留空自动导出:台账/调动台账.xlsx" />
<el-button class="dir-btn" :disabled="running || picking === 'transfer_ledger'"
:loading="picking === 'transfer_ledger'"
@click="pickFile('transfer_ledger', '选择调动台账', ['xlsx', 'xlsm'])">
选择
</el-button>
</div>
</el-form-item>
<el-form-item label="预入职台账路径">
<div class="dir-ctrl">
<el-input v-model="form.preentry_ledger" class="dir-input" :disabled="running" clearable
placeholder="留空自动导出:台账/预入职台账.xlsx" />
<el-button class="dir-btn" :disabled="running || picking === 'preentry_ledger'"
:loading="picking === 'preentry_ledger'"
@click="pickFile('preentry_ledger', '选择预入职台账', ['xlsx', 'xlsm'])">
选择
</el-button>
</div>
</el-form-item>
</div>
<div class="tip">
三项都留空时,插件会用 <b>hr_sdk</b> 现导花名册(在职)与两本台账到
「输出目录/台账/」。表头均按第 2 行读取。
</div>
</el-form>
</div>
</section>
<!-- 03 推送 -->
<section class="sec">
<div class="sec-head">
<span class="sec-badge">03</span>
<span class="sec-name">钉钉推送</span>
<span class="sec-line" />
</div>
<div class="sec-body">
<el-form label-position="top" @submit.prevent>
<div class="rows">
<div class="row">
<div class="r-main">
<div class="r-title">推送钉钉</div>
<div class="r-desc">按店长单聊 + 汇总群;关闭则只出名单</div>
</div>
<div class="r-ctrl"><el-switch v-model="form.push" :disabled="running" /></div>
<div class="rows">
<div class="row">
<div class="r-main">
<div class="r-title">推送钉钉</div>
<div class="r-desc">按店长单聊 + 汇总群;关闭则只出名单</div>
</div>
<div class="row" :class="{ 'is-hidden': !form.push }">
<div class="r-main">
<div class="r-title">汇总群 @所有人</div>
<div class="r-desc">需群里有 @所有人 权限</div>
</div>
<div class="r-ctrl">
<el-switch v-model="form.push_at_all" :disabled="running || !form.push" />
</div>
<div class="r-ctrl"><el-switch v-model="form.push" :disabled="running" /></div>
</div>
<div class="row" :class="{ 'is-hidden': !form.push }">
<div class="r-main">
<div class="r-title">汇总群 @所有人</div>
<div class="r-desc">需群里有 @所有人 权限</div>
</div>
<div class="r-ctrl">
<el-switch v-model="form.push_at_all" :disabled="running || !form.push" />
</div>
</div>
</div>
<div class="grid grid-date">
<el-form label-position="top" class="mt-3">
<div class="grid">
<el-form-item label="汇总群名">
<el-input v-model="form.push_group" :disabled="running || !form.push" clearable
placeholder="数字人沟通群" />
@@ -159,48 +104,49 @@
<el-input v-model="form.default_manager" :disabled="running" clearable
placeholder="工号或姓名,多个用英文逗号分隔" />
</el-form-item>
<el-form-item class="span-all" label="dws 路径">
<div class="dir-ctrl">
<el-input v-model="form.dws_path" class="dir-input" :disabled="running" clearable
placeholder="留空自动检测(DINGTALK_DWS_BIN / 用户目录 / PATH)" />
<el-button class="dir-btn" :disabled="running || picking === 'dws_path'"
:loading="picking === 'dws_path'"
@click="pickFile('dws_path', '选择 dws.exe', ['exe'])">
选择
</el-button>
</div>
</el-form-item>
</div>
<el-form-item label="dws 路径">
<div class="dir-ctrl">
<el-input v-model="form.dws_path" class="dir-input" :disabled="running" clearable
placeholder="留空自动检测(DINGTALK_DWS_BIN / 用户目录 / PATH)" />
<el-button class="dir-btn" :disabled="running || picking" :loading="picking"
@click="pickDwsFile">选择</el-button>
<el-button class="dir-btn" :disabled="running || probing" :loading="probing"
@click="probeDws">检测</el-button>
</div>
</el-form-item>
<div class="tip">
本机未安装 dws 时会<b>自动跳过推送</b>(名单照常留档),并在日志提示;
本机未安装 dws 时会<b>自动跳过推送</b>(名单照常留档);「检测」会把找到的路径回填到输入框。
解析不到店长的异常归入「默认处理人」(多个轮流分配),留空则只留档不推送。
</div>
</el-form>
</div>
</section>
<!-- 04 生物识别 -->
<!-- 03 生物识别核查 -->
<section class="sec">
<div class="sec-head">
<span class="sec-badge">04</span>
<span class="sec-badge">03</span>
<span class="sec-name">生物识别核查</span>
<span class="sec-line" />
</div>
<div class="sec-body">
<el-form label-position="top" @submit.prevent>
<div class="rows">
<div class="row">
<div class="r-main">
<div class="r-title">核查是否已录指纹 / 人脸</div>
<div class="r-desc">调考勤平台 BioData(与 HR 不同系统);存在账号互踢,可能顶掉当前考勤会话</div>
</div>
<div class="r-ctrl">
<el-switch v-model="form.check_biometrics" :disabled="running" />
</div>
<div class="rows">
<div class="row">
<div class="r-main">
<div class="r-title">核查是否已录指纹 / 人脸</div>
<div class="r-desc">调考勤平台 BioData(与 HR 不同系统);存在账号互踢,可能顶掉当前考勤会话</div>
</div>
<div class="r-ctrl">
<el-switch v-model="form.check_biometrics" :disabled="running" />
</div>
</div>
</div>
<div class="grid grid-date" :class="{ 'is-dim': !form.check_biometrics }">
<el-form label-position="top" class="mt-3" :class="{ 'is-dim': !form.check_biometrics }">
<div class="grid">
<el-form-item label="考勤平台账号">
<el-input v-model="form.bio_username" :disabled="running || !form.check_biometrics"
clearable placeholder="留空用内置 / attendance_login_username" />
@@ -219,7 +165,7 @@
</div>
</section>
<!-- ④ 折叠说明 -->
<!-- 判定口径与输出 -->
<details class="help">
<summary><span>判定口径与输出</span><span class="h-arrow">▾</span></summary>
<div class="help-body">
@@ -227,7 +173,8 @@
当日排班属于该部门即正常(按部门查全部排班名做成员判断,查不到集合时兜底「排班名包含部门名」)。</div>
<div class="hb-line"><b>入职</b>:预入职日期当天有排班即正常;台账无四级部门列时按工号回查花名册补齐。</div>
<div class="hb-line"><b>不纳入</b>:现职位序列命中 经营系管理序列 / 职能系专业序列 / 门店技师序列;
职能类序列且「原单位」=「现单位」;花名册查不到工号(按离职处理)。</div>
职能类序列且「原单位」=「现单位」;花名册查不到工号(按离职处理);
花名册「一级部门」含「后勤」(如后勤(C))。</div>
<div class="hb-line"><b>店长解析</b>:固定路由优先(秒创传媒职能序列 → 刘凤琳 37010004),否则按部门链
四级→三级→所属→二级逐级找同名门店下岗位含「店长」的人。</div>
<div class="hb-line"><b>输出</b>:名单 <code>排班异常名单_YYYYMMDD_HHMMSS.xlsx</code>(17 列,含店长/处理人、
@@ -235,7 +182,6 @@
</div>
</details>
<!-- ⑤ 操作区 -->
<div class="actions">
<el-button type="primary" class="btn-run" :loading="running" @click="run()">
{{ running ? '执行中 ' + progress + '%' : '一键执行' }}
@@ -248,6 +194,12 @@
<el-button :disabled="running" @click="saveNow(true)">保存配置</el-button>
<el-button text :disabled="running" @click="resetDefaults">恢复默认</el-button>
</div>
<div v-if="running" class="runline">
<span class="pulse" />
<span>正在执行,日志与进度实时显示在工作台下方「运行日志」区</span>
<span class="pct">{{ progress }}%</span>
</div>
</div>
</template>
@@ -255,15 +207,13 @@
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { usePluginUI } from './usePluginUI'
import { PLUGIN_ID } from './api'
// 字段名必须与 plugin.json.fields.properties 完全一致
const DEFAULTS = () => ({
save_dir: 'D:\\资料\\人资\\排班异常识别',
days: 9,
refresh: true,
roster_path: '',
transfer_ledger: '',
preentry_ledger: '',
roster_cache: true,
push: true,
push_group: '数字人沟通群',
push_at_all: false,
@@ -293,8 +243,14 @@ function validate() {
function buildPayload(f) {
return {
...f,
save_dir: String(f.save_dir || '').trim(),
days: Number(f.days) || 9,
roster_cache: !!f.roster_cache,
push: !!f.push,
push_group: String(f.push_group || '').trim(),
push_at_all: !!f.push_at_all,
default_manager: String(f.default_manager || '').trim(),
check_biometrics: !!f.check_biometrics,
bio_username: String(f.bio_username || '').trim(),
bio_password: String(f.bio_password || '').trim(),
dws_path: String(f.dws_path || '').trim(),
@@ -308,59 +264,120 @@ const {
run, forceStop,
} = usePluginUI({ defaults: DEFAULTS, validate, buildPayload })
// ---------- 路径选择:调壳子原生对话框(只回路径、不写盘) ----------
const picking = ref('')
// ---------- 壳子原生对话框(只回路径、不写盘) ----------
const picking = ref(false)
async function pickDirectory(field, title) {
const r = await fetch('/api/dialog/directory', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title, current: form[field] || '' }),
})
const d = await r.json().catch(() => ({}))
if (!r.ok) throw new Error(d.detail || d.error || ('HTTP ' + r.status))
if (d.path) form[field] = d.path
}
async function pickDir(field, title) {
picking.value = field
async function pickDir() {
picking.value = true
try {
await pickDirectory(field, title)
const r = await fetch('/api/dialog/directory', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: '选择输出目录', current: form.save_dir || '' }),
})
const d = await r.json().catch(() => ({}))
if (!r.ok) throw new Error(d.detail || d.error || ('HTTP ' + r.status))
if (d.path) form.save_dir = d.path
} catch (e) {
ElMessage.warning('打开文件夹选择失败:' + e.message)
} finally {
picking.value = ''
picking.value = false
}
}
async function pickFile(field, title, filters) {
picking.value = field
async function pickDwsFile() {
picking.value = true
try {
const r = await fetch('/api/dialog/file', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title, current: form[field] || '', filters }),
body: JSON.stringify({ title: '选择 dws.exe', current: form.dws_path || '', filters: ['exe'] }),
})
// 老壳子(1.10.x)没有该接口:退化到选文件夹
// 老壳子没有该接口:退化到选文件夹
if (r.status === 404) {
await pickDirectory(field, title)
const d = await fetch('/api/dialog/directory', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: '选择 dws.exe 所在目录', current: form.dws_path || '' }),
}).then((x) => x.json().catch(() => ({}))).catch(() => ({}))
if (d.path) form.dws_path = d.path
return
}
const d = await r.json().catch(() => ({}))
if (!r.ok) throw new Error(d.detail || ('HTTP ' + r.status))
if (d.path) form[field] = d.path
if (!r.ok) throw new Error(d.detail || d.error || ('HTTP ' + r.status))
if (d.path) form.dws_path = d.path
} catch (e) {
ElMessage.warning('选择文件失败:' + e.message)
} finally {
picking.value = ''
picking.value = false
}
}
// ---------- dws 检测:跑一次只检测的插件运行(probe_dws),命中路径回填输入框 ----------
const probing = ref(false)
async function waitRunDone(runId) {
for (let i = 0; i < 40; i += 1) {
await new Promise((resolve) => setTimeout(resolve, 500))
const r = await fetch('/api/runs/' + encodeURIComponent(runId))
if (!r.ok) continue
const d = await r.json().catch(() => ({}))
if (['done', 'error', 'cancelled'].includes(d.status)) return d
}
throw new Error('检测超时(运行未结束)')
}
async function probeDws() {
probing.value = true
try {
const r = await fetch('/api/runs', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
plugin_id: PLUGIN_ID,
fields: { ...buildPayload(form), probe_dws: true },
}),
})
const d = await r.json().catch(() => ({}))
if (!r.ok) throw new Error(d.detail || d.error || ('HTTP ' + r.status))
if (!d.run_id) throw new Error('未返回 run_id')
const run = await waitRunDone(d.run_id)
const path = String((run.result || {}).dws_path || '')
if (path) {
form.dws_path = path
ElMessage.success('dws 可用,已回填路径')
} else if (run.status === 'error') {
throw new Error(run.error || '检测失败')
} else {
ElMessage.warning('未检测到 dws:执行时将只出名单、不推送')
}
} catch (e) {
ElMessage.warning('检测失败:' + (e.message || e))
} finally {
probing.value = false
}
}
</script>
<style scoped>
/* 插件差异样式:只使用壳子 token,不写字面色值;左右内边距由壳子提供 */
.dir-ctrl { display: flex; align-items: center; gap: var(--space-2); width: 100%; }
.dir-ctrl .dir-input { flex: 1 1 auto; min-width: 0; }
.dir-ctrl .dir-btn { flex: 0 0 auto; }
.span-all { grid-column: 1 / -1; }
/* 输出目录 + 核查窗口同一行:路径自适应,天数固定窄列 */
.grid-2 {
display: grid;
grid-template-columns: minmax(0, 1fr) 150px;
gap: 0 var(--space-4);
}
.grid-2 .el-form-item { margin-bottom: 12px; }
.grid-2 .el-input-number { width: 100%; }
.mt-3 { margin-top: var(--space-3); }
.is-dim { opacity: .72; }
@media (max-width: 560px) {
.grid-2 { grid-template-columns: minmax(0, 1fr); }
}
</style>
@@ -0,0 +1,431 @@
/* ============================================================
插件 UI 基础样式(规范 v3 · 对齐壳子「白底面板 + 描边卡」)
- token 与壳子 frontend/src/style.css 同源(权威源 design-app/styles.css)
- Element Plus 变量映射到壳子 token
- 版式类:page / toolbar / notice / sec / grid / tip / actions / badge / table
规则:插件内只用 var(--xxx),不写字面色值;左右内边距由壳子提供,不要重复加
============================================================ */
:root {
/* 底色与卡面 */
--canvas: #F2F4F8;
--surface: #FFFFFF;
--field: #F5F6FA;
--subtle: #F7F8FC;
/* 描边 */
--line: #E8EAF1;
--line-soft: #F0F2F7;
--line-btn: #E3E6EF;
/* 文字五阶 */
--t1: #12141B;
--t2: #3C4250;
--t3: #6E7686;
--t4: #A3AAB8;
--t5: #C6CBD6;
/* 主色(靛蓝) */
--brand: #4F5AE8;
--brand-ink: #3D47D4;
--brand-soft: #EEF0FE;
--brand-track: #DDE1F8;
--brand-hover: #4550E0;
/* 语义色 */
--good: #0E9F76; --good-ink: #0B8A66; --good-soft: #EBF7F2; --good-line: #D3EDE3;
--warn: #D98218; --warn-ink: #B4700F; --warn-soft: #FDF3E4; --warn-line: rgba(217, 130, 24, .28);
--danger: #E5484D; --danger-ink: #CC3B40; --danger-soft: #FDEDED; --danger-line: #F6D7D8;
/* 圆角 */
--r-row: 8px;
--r-field: 9px;
--r-btn: 10px;
--r-sub: 12px;
--r-card: 14px;
--r-pill: 999px;
/* 阴影(插件内基本不用,保持与壳子同值) */
--sh-card: 0 2px 8px rgba(18, 20, 31, .05);
--sh-float: 0 8px 24px rgba(18, 20, 31, .10);
--sh-brand: 0 4px 12px rgba(79, 89, 232, .28);
--sh-brand-sm: 0 2px 8px rgba(79, 89, 232, .24);
/* 字体 */
--f-cn: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
--f-num: "Inter", "SF Pro Display", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
--f-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
/* 间距 */
--space-1: 4px;
--space-1-5: 6px;
--space-2: 8px;
--space-2-5: 10px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 28px;
--dur: .15s;
--ease: cubic-bezier(.22, 1, .36, 1);
}
/* ---------- Element Plus → 壳子 token ---------- */
:root {
--el-color-primary: var(--brand);
--el-color-primary-light-3: #7A83EE;
--el-color-primary-light-5: #A6ACF4;
--el-color-primary-light-7: #C9CDF9;
--el-color-primary-light-8: #DDE0FB;
--el-color-primary-light-9: var(--brand-soft);
--el-color-primary-dark-2: var(--brand-ink);
--el-color-success: var(--good);
--el-color-success-light-9: var(--good-soft);
--el-color-warning: var(--warn);
--el-color-warning-light-9: var(--warn-soft);
--el-color-danger: var(--danger);
--el-color-danger-light-9: var(--danger-soft);
--el-color-error: var(--danger);
--el-text-color-primary: var(--t1);
--el-text-color-regular: var(--t2);
--el-text-color-secondary: var(--t3);
--el-text-color-placeholder: var(--t4);
--el-border-color: var(--line);
--el-border-color-light: var(--line);
--el-border-color-lighter: var(--line-soft);
--el-border-color-extra-light: var(--line-soft);
--el-fill-color-blank: var(--surface);
--el-fill-color-light: var(--field);
--el-bg-color: var(--surface);
--el-border-radius-base: var(--r-field);
--el-border-radius-small: var(--r-field);
--el-font-family: var(--f-cn);
--el-font-size-base: 12.5px;
--el-box-shadow-light: var(--sh-card);
}
/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
background: var(--surface);
color: var(--t1);
font-family: var(--f-cn);
font-size: 12.5px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
#app { padding: 0; }
/* ---------- 页面:只排垂直节奏(左右 24px 由壳子给) ---------- */
.page {
width: 100%;
display: flex;
flex-direction: column;
gap: var(--space-4);
padding: 2px 0 20px;
}
/* ---------- 工具条:方案下拉 + 存为方案 + 删除 + 已保存胶囊 ---------- */
.toolbar {
display: flex;
align-items: center;
gap: var(--space-2);
flex-wrap: wrap;
min-height: 32px;
}
.toolbar .spacer { flex: 1; }
.scheme-sel { width: 200px; }
.saved {
display: inline-flex;
align-items: center;
gap: 6px;
height: 22px;
padding: 0 9px;
border-radius: var(--r-pill);
background: var(--good-soft);
border: 1px solid var(--good-line);
color: var(--good-ink);
font: 500 11px/1 var(--f-cn);
white-space: nowrap;
}
.saved i { width: 5px; height: 5px; border-radius: 50%; background: var(--good); }
.saved.is-idle { background: var(--field); border-color: var(--line); color: var(--t4); }
.saved.is-idle i { background: var(--t5); }
/* ---------- 提示条(替代顶部大横幅) ---------- */
.notice {
display: flex;
align-items: flex-start;
gap: var(--space-2);
padding: 9px 12px;
border-radius: var(--r-sub);
border: 1px solid var(--line);
background: var(--subtle);
font: 400 12px/18px var(--f-cn);
color: var(--t2);
}
.notice .n-ico { flex: 0 0 auto; font-weight: 700; }
.notice.is-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.notice.is-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.notice.is-ok { background: var(--good-soft); border-color: var(--good-line); color: var(--good-ink); }
/* ---------- 分区卡:与壳子列表卡/表格卡同一套 ---------- */
.sec {
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--r-sub);
overflow: hidden;
}
.sec-head {
display: flex;
align-items: center;
gap: var(--space-2);
padding: 10px 14px;
background: var(--subtle);
border-bottom: 1px solid var(--line);
}
.sec-badge {
width: 20px;
height: 20px;
border-radius: 6px;
display: inline-grid;
place-items: center;
font: 600 10.5px/1 var(--f-num);
color: var(--brand-ink);
background: var(--brand-soft);
flex-shrink: 0;
}
.sec-name { font: 600 13px/18px var(--f-cn); color: var(--t1); white-space: nowrap; }
.sec-line { flex: 1; height: 1px; background: var(--line-soft); }
.sec-body { padding: 14px 14px 6px; }
/* ---------- 栅格与表单 ---------- */
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 0 16px;
}
.grid-switch { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
/* 日期行紧跟在开关行后,补一点呼吸 */
.grid-date { margin-top: 4px; }
.grid .el-form-item { margin-bottom: 12px; }
.grid .el-form-item__label {
padding-bottom: 6px !important;
font-weight: 500;
color: var(--t2);
}
.grid .el-input,
.grid .el-select,
.grid .el-date-editor,
.grid .el-input-number { width: 100% !important; }
/* ---------- 说明文字 ---------- */
.tip {
margin-top: var(--space-2);
font: 400 11.5px/1.65 var(--f-cn);
color: var(--t3);
}
.tip b { color: var(--t2); font-weight: 600; }
/* ---------- 执行摘要(操作区上方一行低调说明) ---------- */
.plan { display: flex; align-items: baseline; gap: var(--space-2); font-size: 11.5px; line-height: 1.6; color: var(--t3); }
.plan .p-tag { flex: 0 0 auto; font-weight: 600; color: var(--brand-ink); }
.plan .p-text { min-width: 0; }
.plan.is-empty .p-text { color: var(--warn); }
/* ---------- 操作区 ---------- */
.actions {
display: flex;
align-items: center;
gap: var(--space-2);
flex-wrap: wrap;
padding-top: 14px;
border-top: 1px solid var(--line-soft);
}
.actions .spacer { flex: 1; }
.btn-run {
min-width: 150px;
height: 34px;
border: none;
border-radius: var(--r-btn);
background: var(--brand);
color: #fff;
font: 600 12.5px/18px var(--f-cn);
letter-spacing: 1px;
box-shadow: var(--sh-brand);
transition: background var(--dur), box-shadow var(--dur), transform .06s;
}
.btn-run:hover { background: var(--brand-hover); }
.btn-run:active { transform: translateY(1px); box-shadow: var(--sh-brand-sm); }
.btn-run.is-loading { pointer-events: none; }
/* ---------- 状态胶囊(与壳子表格状态列同款) ---------- */
.badge {
display: inline-flex;
align-items: center;
gap: 5px;
height: 22px;
padding: 0 9px;
border: 1px solid transparent;
border-radius: 6px;
font: 500 11px/1 var(--f-cn);
white-space: nowrap;
}
.badge i { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge.ok { color: var(--good-ink); background: var(--good-soft); border-color: var(--good-line); }
.badge.ok i { background: var(--good); }
.badge.warn { color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }
.badge.warn i { background: var(--warn); }
.badge.bad { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
.badge.bad i { background: var(--danger); }
.badge.idle { color: var(--t3); background: var(--field); border-color: var(--line); }
.badge.idle i { background: var(--t5); }
/* ---------- 表格(插件内需要列表时用;与壳子表格同口径) ---------- */
.table-card {
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--r-sub);
overflow: hidden;
}
.table-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-3);
padding: 12px 16px;
background: var(--subtle);
border-bottom: 1px solid var(--line);
font: 600 13.5px/20px var(--f-cn);
color: var(--t1);
}
.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table th {
padding: 10px 16px;
text-align: center;
font: 500 11px/16px var(--f-cn);
color: var(--t3);
background: var(--surface);
border-bottom: 1px solid var(--line);
}
.table td {
padding: 10px 16px;
text-align: center;
border-bottom: 1px solid var(--line-soft);
font: 400 12px/18px var(--f-cn);
color: var(--t2);
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur); }
.table tbody tr:hover { background: var(--field); }
.table td.is-name { text-align: left; font-weight: 600; color: var(--t1); }
.table th.is-name { text-align: left; }
/* ---------- 运行态一行文字(进度由壳子 RunIndicator 展示) ---------- */
.runline { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; color: var(--t3); }
.runline .pct { font: 600 12px/1 var(--f-num); color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse {
0% { box-shadow: 0 0 0 0 var(--brand-soft); }
70% { box-shadow: 0 0 0 7px transparent; }
100% { box-shadow: 0 0 0 0 transparent; }
}
/* ============================================================
v3.1 扩展:步骤卡 / 行式设置项 / 折叠说明
- 适用于「互斥步骤」「开关+联动下拉」「大段流程说明」
- 仍然只用 token,不写字面色值
============================================================ */
/* ---------- 步骤卡(互斥单选,≤4 项) ---------- */
.step-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--space-2-5);
}
.step-card {
position: relative;
display: flex;
flex-direction: column;
gap: 3px;
padding: 11px 32px 11px 13px;
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--r-sub);
cursor: pointer;
transition: border-color var(--dur), background var(--dur), box-shadow var(--dur);
}
.step-card:hover { border-color: var(--brand-track); background: var(--subtle); }
.step-card.on {
border-color: var(--brand);
background: var(--brand-soft);
box-shadow: inset 0 0 0 1px var(--brand-soft);
}
.step-card .sc-title { font: 600 13px/18px var(--f-cn); color: var(--t1); }
.step-card.on .sc-title { color: var(--brand-ink); }
.step-card .sc-desc { font: 400 11.5px/1.6 var(--f-cn); color: var(--t3); }
.step-card .sc-check {
position: absolute; top: 10px; right: 10px;
width: 16px; height: 16px; color: var(--brand);
}
.step-cards.is-disabled .step-card { opacity: .55; pointer-events: none; }
.sr-only {
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* ---------- 行式设置项(标题+说明在左,控件在右) ---------- */
.rows {
display: flex; flex-direction: column; gap: var(--space-2);
padding: var(--space-2);
background: var(--subtle);
border: 1px solid var(--line);
border-radius: var(--r-sub);
}
.row {
display: flex; align-items: center; justify-content: space-between;
gap: var(--space-4);
padding: 9px 12px;
background: var(--surface);
border: 1px solid var(--line-soft);
border-radius: var(--r-field);
}
.row .r-main { min-width: 0; }
.row .r-title { font: 500 12.5px/18px var(--f-cn); color: var(--t1); }
.row .r-desc { margin-top: 1px; font: 400 11.5px/1.6 var(--f-cn); color: var(--t3); }
.row .r-ctrl { flex: 0 0 auto; }
.row.is-hidden { display: none; }
/* ---------- 折叠说明(流程说明气泡卡片) ---------- */
.help {
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--r-sub);
overflow: hidden;
}
.help > summary {
display: flex; align-items: center; justify-content: space-between;
gap: var(--space-2); padding: 10px 14px;
background: var(--subtle);
font: 600 12.5px/18px var(--f-cn); color: var(--t2);
cursor: pointer; list-style: none;
}
.help > summary::-webkit-details-marker { display: none; }
.help[open] > summary { border-bottom: 1px solid var(--line); }
.help .h-arrow { color: var(--t4); transition: transform var(--dur); font-size: 11px; }
.help[open] .h-arrow { transform: rotate(180deg); }
.help-body {
padding: 12px 14px;
font: 400 12px/1.8 var(--f-cn); color: var(--t3);
}
.help-body b { color: var(--t2); font-weight: 600; }
.help-body .hb-line + .hb-line { margin-top: 6px; }
@@ -0,0 +1,356 @@
// 插件 UI 公共 kit v2(vendored 进各插件 ui-src,构建期内联,运行零外部依赖)。
//
// 与 v1 的差异(适配当前壳子):
// 1. 新增 restoreLastFields():调 /api/plugins/<id>/last-fields 恢复上次执行参数(password 不落盘);
// 2. 顶部大横幅 → 内联 notice:执行结果横幅、插件名/版本、运行 Indicator 已由壳子
// (PageHead + 结果横幅 + RunIndicator)统一渲染,插件内不再重复;
// 3. startRun 的 409 单独识别:壳子在 iframe fetch 上包了「入队确认」,用户取消会返回 409,
// 不能再当成普通失败提示。
//
// 保留能力:本机当前配置(加载/防抖自动保存/恢复默认)、多配置方案(供定时任务按 config_id 引用)、
// 执行状态机(执行/强停/WS 进度 + 轮询兜底/未登录重试)。
import { computed, onMounted, reactive, ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { PLUGIN_ID } from './api'
async function j(url, opts) {
const res = await fetch(url, opts)
if (res.status === 401) {
throw Object.assign(new Error('未登录:请先在壳子登录统一账户再打开本界面'), { code: 401 })
}
if (!res.ok) {
let msg = `HTTP ${res.status}`
try {
msg = (await res.json()).detail || msg
} catch (_) { /* 保留默认 */ }
throw Object.assign(new Error(msg), { code: res.status, status: res.status })
}
return res.json()
}
// ---- 后端 API(同源,统一账户会话 cookie 自动携带)----
const loadConfig = () => j(`/api/plugin-config/${PLUGIN_ID}`)
const saveConfig = (data) => j(`/api/plugin-config/${PLUGIN_ID}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const loadLastFields = () => j(`/api/plugins/${PLUGIN_ID}/last-fields`)
const listSchemes = () => j(`/api/plugin-configs?plugin_id=${encodeURIComponent(PLUGIN_ID)}`)
const saveScheme = (name, fields) => j('/api/plugin-configs', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ plugin_id: PLUGIN_ID, name, fields }),
})
const deleteScheme = (cfgId) =>
j(`/api/plugin-configs/${encodeURIComponent(PLUGIN_ID)}/${encodeURIComponent(cfgId)}`, { method: 'DELETE' })
const startRun = (fields) => j('/api/runs', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ plugin_id: PLUGIN_ID, fields }),
})
const getRun = (runId) => j(`/api/runs/${runId}`)
const stopRun = (runId) => j(`/api/runs/${runId}/stop`, { method: 'POST' })
function connectWS(onEvent) {
const ws = new WebSocket((location.protocol === 'https:' ? 'wss://' : 'ws://')
+ location.host + '/ws')
ws.onmessage = (e) => { try { onEvent(JSON.parse(e.data)) } catch (_) { /* 忽略脏帧 */ } }
return ws
}
// ---- 工具 ----
const clone = (o) => JSON.parse(JSON.stringify(o))
// 本机配置的「上次保存时间」:后端只存字段、不返回时间戳,
// 这里用 localStorage 记住,刷新后仍能显示(取不到时静默)。
const SAVED_AT_KEY = `plugin:${PLUGIN_ID}:lastSavedAt`
function readSavedAt() {
try { return localStorage.getItem(SAVED_AT_KEY) || '' } catch (_) { return '' }
}
function writeSavedAt(v) {
try { localStorage.setItem(SAVED_AT_KEY, v) } catch (_) { /* 存储不可用时只保留内存态 */ }
}
// 保存字段合并规则:标量空值(''/null/undefined)不覆盖;数组照原样应用
// (空数组可能是有意配置,如「留空=不筛选」)
function mergeSaved(form, saved) {
Object.keys(form).forEach((k) => {
const v = saved ? saved[k] : undefined
if (v === undefined || v === null || v === '') return
form[k] = Array.isArray(v) ? [...v] : v
})
}
export function usePluginUI(opts = {}) {
const { defaults, validate, buildPayload } = opts
const form = reactive(defaults ? defaults() : {})
const loaded = ref(false)
const needLogin = ref(false)
const notice = ref(null) // { type: 'warn'|'error'|'ok', text }
const lastSavedAt = ref(readSavedAt())
const running = ref(false)
const progress = ref(0)
const stopping = ref(false)
let ws = null
let runId = ''
let pollTimer = null
let saveTimer = null
// 传空 type 视为清除横幅(不能留 {type:null},否则会渲染成只有"!"的空横幅)
const notify = (type, text) => { notice.value = type ? { type, text } : null }
// ---------- 当前配置:加载 / 防抖自动保存 ----------
// 登录由壳子统一处理(打开界面时会话必然就绪),这里读取失败一律静默回退默认值,
// 不弹任何提示;真到执行时才发现会话问题,再明确告知。
onMounted(async () => {
try {
const saved = await loadConfig()
mergeSaved(form, saved)
} catch (e) {
if (e.code === 401) needLogin.value = true
}
loaded.value = true
refreshSchemes()
})
watch(form, () => {
if (!loaded.value || running.value) return
clearTimeout(saveTimer)
saveTimer = setTimeout(() => saveNow(false), 800)
}, { deep: true })
async function saveNow(explicit) {
try {
await saveConfig(clone(form))
lastSavedAt.value = new Date().toLocaleTimeString('zh-CN', { hour12: false })
writeSavedAt(lastSavedAt.value)
if (explicit) ElMessage.success('配置已保存到本机')
} catch (e) {
if (e.code === 401) needLogin.value = true
else ElMessage.error('配置保存失败:' + e.message)
}
}
function resetDefaults() {
Object.assign(form, defaults ? defaults(form) : {})
notify(null)
ElMessage.info('已恢复默认配置')
}
// 恢复上次执行参数(壳子记录,password 类字段不落盘)
async function restoreLastFields() {
try {
const r = await loadLastFields()
const fields = r.fields || {}
if (!Object.keys(fields).length) {
ElMessage.info('暂无上次执行参数')
return
}
mergeSaved(form, fields)
ElMessage.success('已恢复上次执行参数' + (r.at ? `(${r.at})` : ''))
} catch (e) {
if (e.code === 401) needLogin.value = true
else ElMessage.error('恢复上次参数失败:' + e.message)
}
}
// ---------- 多配置方案 ----------
const schemes = ref([])
const schemeSel = ref('')
const schemeOptions = computed(() => [
{ value: '', label: '当前配置(自动保存)' },
...schemes.value.map((s) => ({ value: s.id, label: s.name })),
])
async function refreshSchemes() {
try {
const r = await listSchemes()
schemes.value = r.configs || []
} catch (_) { /* 方案是辅助能力,失败静默 */ }
}
function onSchemeChange(id) {
if (!id) return
const s = schemes.value.find((x) => x.id === id)
if (!s) return
mergeSaved(form, s.fields)
ElMessage.success(`已应用方案「${s.name}」`)
}
async function saveSchemeAs() {
const cur = schemes.value.find((x) => x.id === schemeSel.value)
let name = ''
try {
({ value: name } = await ElMessageBox.prompt(
'方案保存到本机(同名覆盖,密码明文保存,每套方案可绑定不同账号),供「定时任务」引用:到点自动取该方案的最新参数执行。',
'存为配置方案',
{
inputValue: cur ? cur.name : '',
confirmButtonText: '保存方案',
cancelButtonText: '取消',
inputPattern: /\S/,
inputErrorMessage: '请输入方案名称',
},
))
} catch (_) {
return
}
name = String(name).trim()
if (!name) return
const dup = schemes.value.find((x) => x.name === name)
if (dup) {
try {
await ElMessageBox.confirm(
`已存在同名方案「${dup.name}」,保存将覆盖它的参数(多套不同配置请用不同名称)。`,
'覆盖已有方案',
{ type: 'warning', confirmButtonText: '覆盖保存', cancelButtonText: '取消' },
)
} catch (_) {
return
}
}
try {
const r = await saveScheme(name, clone(form))
await refreshSchemes()
schemeSel.value = r.config ? r.config.id : ''
ElMessage.success(`方案「${name}」已保存`)
} catch (e) {
if (e.code === 401) needLogin.value = true
else ElMessage.error('方案保存失败:' + e.message)
}
}
async function removeScheme() {
const s = schemes.value.find((x) => x.id === schemeSel.value)
if (!s) return
try {
await ElMessageBox.confirm(
`删除配置方案「${s.name}」?引用它的定时任务到点会跳过触发并提示重选。`,
'删除方案',
{ type: 'warning', confirmButtonText: '删除', cancelButtonText: '取消' },
)
} catch (_) {
return
}
try {
await deleteScheme(s.id)
schemeSel.value = ''
await refreshSchemes()
ElMessage.success('方案已删除')
} catch (e) {
ElMessage.error('方案删除失败:' + e.message)
}
}
// ---------- 执行 ----------
// action: download(只下载)/ reconcile(只核对);不传则用 payload 里的 action
async function run(action) {
if (running.value) return
if (needLogin.value) {
try {
await loadConfig()
needLogin.value = false
} catch (_) {
notify('error', '登录态未就绪,请稍后重试')
return
}
}
if (validate && !validate(action)) return
await saveNow(false)
notify(null)
running.value = true
progress.value = 0
try {
const payload = buildPayload ? buildPayload(form) : clone(form)
if (action) payload.action = action
const r = await startRun(payload)
runId = r.run_id
connect()
startPolling()
} catch (e) {
running.value = false
stopPolling()
if (e.code === 401) {
needLogin.value = true
notify('error', '登录态未就绪,本次没有启动,请稍后重试')
} else if (e.code === 409) {
// 壳子「入队确认」里用户点了取消
notify('warn', '已取消加入执行队列,本次没有启动')
} else {
notify('error', '启动执行失败:' + e.message)
}
}
}
async function forceStop() {
if (!runId || stopping.value) return
stopping.value = true
try {
await stopRun(runId)
ElMessage.warning('已发出强制停止指令,正在终止执行进程…')
} catch (e) {
ElMessage.error('停止失败:' + e.message)
} finally {
stopping.value = false
}
}
function connect() {
if (ws && ws.readyState <= 1) return
ws = connectWS((ev) => {
if (ev.run_id && ev.run_id !== runId) return
if (ev.t === 'progress') progress.value = Math.max(progress.value, ev.pct || 0)
// 用户强制停止 / 排队取消 / 排队超时 → 「已取消」,不显示成「执行失败」
else if (ev.t === 'run_done') ev.ok ? finished() : (ev.status === 'cancelled' ? cancelled(ev.error) : failed(ev.error || '执行失败'))
})
ws.onclose = () => { ws = null }
}
function startPolling() {
stopPolling()
pollTimer = setInterval(async () => {
if (!runId) return
try {
const r = await getRun(runId)
if (r.status === 'done') finished(r.result?.summary)
else if (r.status === 'cancelled') cancelled(r.error)
else if (r.status === 'error') failed(r.error || '执行失败')
} catch (_) { /* 下轮再试 */ }
}, 5000)
}
function stopPolling() {
if (pollTimer) { clearInterval(pollTimer); pollTimer = null }
}
function finished(summary) {
stopPolling()
running.value = false
progress.value = 100
// 结果横幅由壳子统一展示,插件内仅在需要时给一句简短结论
if (summary) notify('ok', summary)
}
// 用户主动停止 / 排队取消 / 排队超时:不算失败,给中性的「已取消」提示
function cancelled(err) {
stopPolling()
running.value = false
notify('warn', '任务已取消:' + (err || '用户已停止'))
}
function failed(err) {
stopPolling()
running.value = false
notify('error', '执行失败:' + err)
}
return {
form, loaded, needLogin, notice, lastSavedAt, running, progress, stopping,
saveNow, resetDefaults, restoreLastFields,
schemes, schemeSel, schemeOptions, onSchemeChange, saveSchemeAs, removeScheme,
run, forceStop,
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>排班异常识别</title>
<script type="module" crossorigin src="/pui/xq0001/assets/index-BDGRb4em.js"></script>
<link rel="stylesheet" crossorigin href="/pui/xq0001/assets/index-ClszVJW9.css">
<script type="module" crossorigin src="/pui/xq0001/assets/index-B_NxccWb.js"></script>
<link rel="stylesheet" crossorigin href="/pui/xq0001/assets/index-AdMpb9bA.css">
</head>
<body>
<div id="app"></div>
@@ -1,121 +0,0 @@
:root {
--bg: #f5f7fa;
--card: #ffffff;
--line: #e5e8ef;
--text: #1f2430;
--muted: #7a8296;
--primary: #2f6fed;
--primary-hover: #255fd6;
--ok: #15a05a;
--warn: #b7791f;
--err: #d64545;
--radius: 10px;
}
* { box-sizing: border-box; }
body {
margin: 0;
padding: 16px;
background: var(--bg);
color: var(--text);
font: 13px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}
.wrap { display: flex; flex-direction: column; gap: 12px; max-width: 1020px; margin: 0 auto; }
.card {
background: var(--card);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 14px 16px;
}
.card-head {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 8px;
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.saved { color: var(--muted); font-size: 12px; }
.group { padding: 10px 0; border-top: 1px dashed var(--line); }
.group:first-of-type { border-top: 0; padding-top: 0; }
.group-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.span2 { grid-column: span 2; }
.label { font-size: 12px; color: #3c4557; }
.help { font-size: 11px; color: var(--muted); line-height: 1.5; }
input[type="text"], input[type="number"], input[type="password"] {
width: 100%; height: 32px; padding: 0 10px;
border: 1px solid var(--line); border-radius: 6px;
background: #fff; color: var(--text); font-size: 13px; outline: none;
transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47,111,237,.12); }
.switches { display: flex; flex-wrap: wrap; gap: 6px 18px; min-height: 32px; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.switch input { width: 14px; height: 14px; accent-color: var(--primary); }
.actions { display: flex; flex-direction: column; gap: 10px; }
.run-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn {
height: 32px; padding: 0 14px; border-radius: 6px; font-size: 13px;
border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer;
transition: all .15s;
}
.btn:hover { border-color: #cfd6e4; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { color: var(--err); border-color: #f3c9c9; }
.btn.ghost:hover { background: #fff5f5; }
.btn.link { border: 0; background: none; color: var(--primary); padding: 0 6px; height: 28px; }
.btn.link:hover { text-decoration: underline; }
.btn.small { font-size: 12px; }
.status { margin-left: auto; font-size: 12px; color: var(--muted); }
.status.running { color: var(--primary); }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.progress { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 6px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4f8bff, #2f6fed); transition: width .3s; }
.pct { width: 42px; text-align: right; color: var(--muted); font-size: 12px; }
.notice { padding: 8px 12px; border-radius: 6px; font-size: 12.5px; }
.notice.warn { background: #fff8e6; color: var(--warn); border: 1px solid #f4e2b8; }
.notice.error { background: #fff2f2; color: var(--err); border: 1px solid #f6cfcf; }
.notice.ok { background: #f0fbf4; color: var(--ok); border: 1px solid #c3ecd6; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
display: inline-flex; flex-direction: column; gap: 2px;
padding: 6px 10px; border-radius: 8px; background: #f6f8fc; border: 1px solid var(--line);
min-width: 88px;
}
.chip b { font-size: 14px; font-weight: 600; }
.chip span { font-size: 11px; color: var(--muted); }
.chip.path { flex: 1; min-width: 240px; }
.chip.path b { font-size: 12px; font-weight: 500; word-break: break-all; }
.log {
margin: 0; padding: 10px 12px; height: 260px; overflow: auto;
background: #0f172a; color: #d6e2f5; border-radius: 8px;
font: 12px/1.6 "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
white-space: pre-wrap; word-break: break-all;
}
.log .warn { color: #ffd58a; }
.log .err { color: #ff9b9b; }
.log .ts { color: #6b7c99; }
@media (max-width: 760px) {
.grid { grid-template-columns: 1fr; }
.field.span2 { grid-column: span 1; }
}