feat(xq0011): 支持检查项选择并增加岗位等核心字段到异常名单

This commit is contained in:
2026-09-29 08:47:27 +08:00
parent 87f995ca47
commit f8f108af5d
100 changed files with 11920 additions and 1121 deletions
@@ -1,50 +1,2 @@
// 与壳子后端交互(同源,统一账户会话 cookie 自动携带)+ WebSocket 实时流
// 插件身份声明(API 实现收敛在 usePluginUI.js 公共 kit,各插件 ui-src 只需声明自己的 id)
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
}