feat: code-type fields use fieldname/fieldname_text format
- get_search_providerid.dspy: return {providerid, providerid_text}
- get_search_upappid.dspy: return {upappid, upappid_text}
- get_search_apiname.dspy: return {apiname, apiname_text}
- json/llm.json: add valueField/textField for providerid, upappid
- json/llm_api_map.json: add valueField/textField for apiname, query_apiname
This ensures filter form and add/edit form use the same data format.
This commit is contained in:
parent
8ee2eccc55
commit
34627054b1
@ -38,11 +38,15 @@
|
|||||||
},
|
},
|
||||||
"providerid": {
|
"providerid": {
|
||||||
"uitype": "code",
|
"uitype": "code",
|
||||||
"dataurl": "{{entire_url('../api/get_search_providerid.dspy')}}"
|
"dataurl": "{{entire_url('../api/get_search_providerid.dspy')}}",
|
||||||
|
"valueField": "providerid",
|
||||||
|
"textField": "providerid_text"
|
||||||
},
|
},
|
||||||
"upappid": {
|
"upappid": {
|
||||||
"uitype": "code",
|
"uitype": "code",
|
||||||
"dataurl": "{{entire_url('../api/get_search_upappid.dspy')}}"
|
"dataurl": "{{entire_url('../api/get_search_upappid.dspy')}}",
|
||||||
|
"valueField": "upappid",
|
||||||
|
"textField": "upappid_text"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -7,11 +7,15 @@
|
|||||||
"alters": {
|
"alters": {
|
||||||
"apiname": {
|
"apiname": {
|
||||||
"uitype": "code",
|
"uitype": "code",
|
||||||
"dataurl": "{{entire_url('../api/get_search_apiname.dspy')}}?llmid={{params_kw.llmid}}"
|
"dataurl": "{{entire_url('../api/get_search_apiname.dspy')}}?llmid={{params_kw.llmid}}",
|
||||||
|
"valueField": "apiname",
|
||||||
|
"textField": "apiname_text"
|
||||||
},
|
},
|
||||||
"query_apiname": {
|
"query_apiname": {
|
||||||
"uitype": "code",
|
"uitype": "code",
|
||||||
"dataurl": "{{entire_url('../api/get_search_apiname.dspy?allow_empty=1')}}?llmid={{params_kw.llmid}}"
|
"dataurl": "{{entire_url('../api/get_search_apiname.dspy?allow_empty=1')}}?llmid={{params_kw.llmid}}",
|
||||||
|
"valueField": "apiname",
|
||||||
|
"textField": "apiname_text"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,7 +3,7 @@ allow_empty = params_kw.get('allow_empty', '')
|
|||||||
|
|
||||||
result = []
|
result = []
|
||||||
if allow_empty:
|
if allow_empty:
|
||||||
result = [{'value': '', 'text': '不指定'}]
|
result = [{'apiname': '', 'apiname_text': '不指定'}]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not llmid:
|
if not llmid:
|
||||||
@ -23,7 +23,7 @@ try:
|
|||||||
# Query uapi table from uapi module's db
|
# Query uapi table from uapi module's db
|
||||||
async with get_sor_context(request._run_ns, 'uapi') as sor:
|
async with get_sor_context(request._run_ns, 'uapi') as sor:
|
||||||
apis = await sor.sqlExe(
|
apis = await sor.sqlExe(
|
||||||
"select name as value, name as text from uapi where upappid = ${upappid}$ order by name",
|
"select name as apiname, name as apiname_text from uapi where upappid = ${upappid}$ order by name",
|
||||||
{'upappid': upappid}
|
{'upappid': upappid}
|
||||||
)
|
)
|
||||||
return json.dumps(result + list(apis), ensure_ascii=False)
|
return json.dumps(result + list(apis), ensure_ascii=False)
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
result = [{'value': '', 'text': '全部'}]
|
result = [{'providerid': '', 'providerid_text': '全部'}]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with get_sor_context(request._run_ns, 'rbac') as sor:
|
async with get_sor_context(request._run_ns, 'rbac') as sor:
|
||||||
orgs = await sor.sqlExe(
|
orgs = await sor.sqlExe(
|
||||||
"select id as value, orgname as text from organization order by orgname",
|
"select id as providerid, orgname as providerid_text from organization order by orgname",
|
||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
return json.dumps([{'value': '', 'text': '全部'}] + list(orgs), ensure_ascii=False)
|
return json.dumps([{'providerid': '', 'providerid_text': '全部'}] + list(orgs), ensure_ascii=False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
debug(f'get_search_providerid error: {e}')
|
debug(f'get_search_providerid error: {e}')
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
result = [{'value': '', 'text': '全部'}]
|
result = [{'upappid': '', 'upappid_text': '全部'}]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with get_sor_context(request._run_ns, 'uapi') as sor:
|
async with get_sor_context(request._run_ns, 'uapi') as sor:
|
||||||
apps = await sor.sqlExe(
|
apps = await sor.sqlExe(
|
||||||
"select id as value, name as text from upapp order by name",
|
"select id as upappid, name as upappid_text from upapp order by name",
|
||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
return json.dumps([{'value': '', 'text': '全部'}] + list(apps), ensure_ascii=False)
|
return json.dumps([{'upappid': '', 'upappid_text': '全部'}] + list(apps), ensure_ascii=False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
debug(f'get_search_upappid error: {e}')
|
debug(f'get_search_upappid error: {e}')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user