feat(xq0002): 完成雇主险增减操作插件开发并补齐配套资源

- 新增XQ0002雇主险增减操作插件完整实现,包含数据层、逻辑层、UI界面
- 新增测试用的样板数据文件与插件打包脚本
- 更新文档说明插件当前状态与使用方式
- 新增收银系统登录共享模块供业务流程复用
This commit is contained in:
2026-09-22 12:41:16 +08:00
parent 6f78ed2e72
commit a1cf59f09c
39 changed files with 5938 additions and 204 deletions
@@ -0,0 +1,50 @@
// 与壳子后端交互(同源,统一账户会话 cookie 自动携带)+ WebSocket 实时流
export const PLUGIN_ID = 'xq0002'
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 (e) { /* 保留默认 */ }
throw new Error(msg)
}
return res.json()
}
export function loadConfig() {
return j(`/api/plugin-config/${PLUGIN_ID}`)
}
export function saveConfig(data) {
return j(`/api/plugin-config/${PLUGIN_ID}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
}
export function startRun(fields) {
return j('/api/runs', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ plugin_id: PLUGIN_ID, fields }),
})
}
export function getRun(runId) {
return j(`/api/runs/${runId}`)
}
export function stopRun(runId) {
return j(`/api/runs/${runId}/stop`, { method: 'POST' })
}
export 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
}