pipeline_core/wwwroot/api/agent_menu_open.dspy

26 lines
1.1 KiB
Plaintext
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.

# agent_menu_open.dspy - 通用功能弹窗:返回 PopupWindow内嵌 urlwidget 加载目标 .ui
# 供 AgentIO 上方功能菜单按钮用(按钮 actiontype=urlwidget 打开本 dspy通过参数控制弹窗大小
# 参数url(必填) title width height百分比字符串默认 85%/80%
# 注意PopupWindow 用 width/height 百分比cwidth/cheight 是字符单位,对列表页太小)
import json
url = (params_kw or {}).get('url', '') or ''
title = (params_kw or {}).get('title', '') or '功能'
width = (params_kw or {}).get('width', '') or '85%'
height = (params_kw or {}).get('height', '') or '80%'
if not url:
return json.dumps({
"widgettype": "Text",
"options": {"text": "缺少 url 参数", "cfontsize": 1, "color": "#64748b", "padding": "20px"}
}, ensure_ascii=False)
return json.dumps({
"widgettype": "PopupWindow",
"options": {"title": title, "width": width, "height": height, "auto_open": True},
"subwidgets": [
{"widgettype": "urlwidget", "options": {"url": entire_url(url)}}
]
}, ensure_ascii=False)