diff --git a/wwwroot/tenant_brand.ui b/wwwroot/tenant_brand.ui new file mode 100644 index 00000000..0dfe323b --- /dev/null +++ b/wwwroot/tenant_brand.ui @@ -0,0 +1,26 @@ +# 租户品牌设置 - 设置左上角图标和系统名称 +userorgid = await get_userorgid() +env = request._run_ns +async with get_sor_context(env, 'sage') as sor: + org = (await sor.sqlExe('SELECT orgname, iconid FROM organization WHERE id = ${orgid}$', {'orgid': userorgid}))[0] + +result = { + "widgettype": "VBox", + "options": {"width": "100%", "padding": "20px", "spacing": 16}, + "subwidgets": [ + {"widgettype": "Title3", "options": {"text": "租户品牌设置"}}, + {"widgettype": "Text", "options": {"text": "设置左上角显示的图标和系统名称"}}, + { + "widgettype": "Form", + "options": { + "url": entire_url('./tenant_brand_save.dspy'), + "cols": 1, + "submit_label": "保存", + "fields": [ + {"name": "orgname", "type": "text", "label": "系统名称", "default": org.orgname or ''}, + {"name": "iconid", "type": "file", "label": "图标(SVG/PNG)", "uitype": "file", "accept": ".svg,.png,.jpg"} + ] + } + } + ] +} diff --git a/wwwroot/tenant_brand_save.dspy b/wwwroot/tenant_brand_save.dspy new file mode 100644 index 00000000..833a37da --- /dev/null +++ b/wwwroot/tenant_brand_save.dspy @@ -0,0 +1,13 @@ +# 保存租户品牌设置 +userorgid = await get_userorgid() +orgname = params_kw.get('orgname', '') +iconid = params_kw.get('iconid', '') + +env = request._run_ns +async with get_sor_context(env, 'sage') as sor: + await sor.U('organization', {'id': userorgid, 'orgname': orgname, 'iconid': iconid}) + +result = { + "widgettype": "Message", + "options": {"title": "成功", "message": "品牌设置已保存,刷新页面生效", "type": "success"} +}