fix: 功能弹窗尺寸改width/height百分比(85%/80%),cwidth/cheight字符单位太小

This commit is contained in:
yumoqing 2026-08-16 18:41:19 +08:00
parent b886bf8623
commit 085623f700
2 changed files with 8 additions and 16 deletions

View File

@ -1,13 +1,14 @@
# agent_menu_open.dspy - 通用功能弹窗:返回 PopupWindow内嵌 urlwidget 加载目标 .ui
# 供 AgentIO 上方功能菜单按钮用(按钮 actiontype=urlwidget 打开本 dspy通过参数控制弹窗大小
# 参数url(必填) title cwidth cheight
# 参数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 '功能'
cwidth = (params_kw or {}).get('cwidth', '') or '62'
cheight = (params_kw or {}).get('cheight', '') or '32'
width = (params_kw or {}).get('width', '') or '85%'
height = (params_kw or {}).get('height', '') or '80%'
if not url:
return json.dumps({
@ -15,18 +16,9 @@ if not url:
"options": {"text": "缺少 url 参数", "cfontsize": 1, "color": "#64748b", "padding": "20px"}
}, ensure_ascii=False)
try:
cw = float(cwidth)
except Exception:
cw = 62
try:
ch = float(cheight)
except Exception:
ch = 32
return json.dumps({
"widgettype": "PopupWindow",
"options": {"title": title, "cwidth": cw, "cheight": ch, "auto_open": True},
"options": {"title": title, "width": width, "height": height, "auto_open": True},
"subwidgets": [
{"widgettype": "urlwidget", "options": {"url": entire_url(url)}}
]

View File

@ -58,9 +58,9 @@ for i, m in enumerate(menus):
url = str(m.get("url", "") or "")
if not url:
continue
cwidth = str(m.get("cwidth", "62") or "62")
cheight = str(m.get("cheight", "32") or "32")
query = _urlparse.urlencode({"url": url, "title": label, "cwidth": cwidth, "cheight": cheight})
width = str(m.get("width", "85%") or "85%")
height = str(m.get("height", "80%") or "80%")
query = _urlparse.urlencode({"url": url, "title": label, "width": width, "height": height})
open_url = "/pipeline_core/api/agent_menu_open.dspy?" + query
buttons.append({
"widgettype": "Button",