修复前端无法加载getRecordWithOnload返回值的问题

This commit is contained in:
jingrow 2026-03-11 18:09:47 +08:00
parent 48a825e3f3
commit 1e13b10c49
2 changed files with 9 additions and 4 deletions

View File

@ -105,8 +105,11 @@ export const getRecordWithOnload = async (pagetype: string, name: string): Promi
// 使用getdoc RPC方法它会调用onload方法并返回__onload数据
const result = await api.call('jingrow.desk.form.load.getdoc', { pagetype, name })
// getdoc返回的是{ docs: [pg], docinfo: {...} }
const pg = result.docs?.[0]
// 兼容两种响应格式:
// SaaS 直接返回 { docs: [pg], docinfo: {...} }
// jlocal 返回 { message: { docs: [pg], docinfo: {...} } }
const docData = result.docs ? result : (result.message || {})
const pg = docData.docs?.[0]
if (pg) {
return { success: true, data: pg }
} else {

View File

@ -26,6 +26,8 @@ def getdoc(**kwargs):
resp = requests.post(url, headers=headers, json=kwargs, timeout=30)
if resp.status_code == 200:
return resp.json().get("message", {})
logger.error(f"[form.load.getdoc] SaaS error: {resp.status_code}")
# SaaS getdoc 直接返回 {docs: [...], docinfo: {...}} 格式
# 不包装在 message 里
return resp.json()
logger.error(f"[getdoc] SaaS error: {resp.status_code} - {resp.text[:200]}")
return {}