diff --git a/wwwroot/add_provider.dspy b/wwwroot/add_provider.dspy new file mode 100644 index 0000000..2b1ee08 --- /dev/null +++ b/wwwroot/add_provider.dspy @@ -0,0 +1,15 @@ +orgname = params_kw.orgname +async with get_sor_context(request._run_ns, 'platformbiz') as sor: + recs = await sor.R('organization', {'orgname': orgname}) + if not recs: + orgid = uuid() + ns = { + "id": orgid, + "orgname": orgname + } + await create_org(sor, ns, ['provider']) + await openProviderAccounts(sor, '0', orgid) + recs = ns + return UiMessage(title='添加供应商', message=f'添加成功, 新供应商id={recs.id}') +return UiError(title='添加供应商', message=f'添加失败') + diff --git a/wwwroot/add_provider.ui b/wwwroot/add_provider.ui new file mode 100644 index 0000000..653322e --- /dev/null +++ b/wwwroot/add_provider.ui @@ -0,0 +1,36 @@ +{% set roles = get_user_roles(get_user()) %} +{% if owner.operator in roles %} +{ + "widgettype": "Form", + "options": { + "description": "添加平台供应商", + "submit_url": "{{entire_url('add_provider.dspy')}}", + "fields":[ + { + "name": "orgname", + "label": "供应商名", + "uitype": "str", + "required": true + } + ] +} +{% else %} +{ + “widgettype": "PopupWindow" + "options": { + "content":{ + "widgettype": "Text", + "options": { + "otext": "你无权使用此功能", + "i18n": true + } + }, + "auto_open": true, + "auto_close": true, + "tiemout": 4, + "archor": "cc", + "cwidth": 5, + "cheight": 10 + } +} +{% endif %}