feat: add get_search_{fieldname}.dspy for codes fields with 全部 option

- get_search_providerid.dspy: organization list with 全部 as first entry
- get_search_upappid.dspy: upapp list with 全部 as first entry
- json/llm.json: update alters dataurl to use search scripts
- load_path.py: register new RBAC paths
This commit is contained in:
yumoqing 2026-06-04 17:22:50 +08:00
parent 6bfa0cb27c
commit bb4900f997
4 changed files with 36 additions and 4 deletions

View File

@ -38,12 +38,12 @@
"valueField": "id"
},
"providerid": {
"uitype": "code",
"dataurl": "{{entire_url('../api/get_organizations.dspy')}}"
"uitype": "code",
"dataurl": "{{entire_url('../api/get_search_providerid.dspy')}}"
},
"upappid": {
"uitype": "code",
"dataurl": "{{entire_url('../api/get_upapps.dspy')}}"
"uitype": "code",
"dataurl": "{{entire_url('../api/get_search_upappid.dspy')}}"
}
}
},

View File

@ -88,6 +88,8 @@ PATHS_LOGINED = [
f"/{MOD}/api/get_catelogs.dspy",
f"/{MOD}/api/get_organizations.dspy",
f"/{MOD}/api/get_ppids.dspy",
f"/{MOD}/api/get_search_providerid.dspy",
f"/{MOD}/api/get_search_upappid.dspy",
f"/{MOD}/api/get_upapps.dspy",
f"/{MOD}/api/llm_api_map_create.dspy",
f"/{MOD}/api/llm_api_map_delete.dspy",

View File

@ -0,0 +1,15 @@
result = [{'providerid': '', 'providerid_text': '全部'}]
try:
async with get_sor_context(request._run_ns, 'rbac') as sor:
orgs = await sor.sqlExe(
"select id, orgname from organization order by orgname",
{}
)
if orgs:
for r in orgs:
result.append({'providerid': str(r.id), 'providerid_text': r.orgname or ''})
except Exception as e:
debug(f'get_search_providerid error: {e}')
return json.dumps(result, ensure_ascii=False)

View File

@ -0,0 +1,15 @@
result = [{'upappid': '', 'upappid_text': '全部'}]
try:
async with get_sor_context(request._run_ns, 'uapi') as sor:
apps = await sor.sqlExe(
"select id, name from upapp order by name",
{}
)
if apps:
for r in apps:
result.append({'upappid': str(r.id), 'upappid_text': r.name or ''})
except Exception as e:
debug(f'get_search_upappid error: {e}')
return json.dumps(result, ensure_ascii=False)