This commit is contained in:
yumoqing 2025-02-17 17:19:13 +08:00
parent 1f82393f3b
commit aaeb4aef4d
6 changed files with 435 additions and 0 deletions

3
json/build.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/bash
xls2ui -m ../models -o ../wwwroot platformbiz *.json

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,148 @@
ns = params_kw.copy()
debug(f'{ns=}')
debug(f'get_organization.dspy:{ns=}')
if not ns.get('page'):
ns['page'] = 1
if not ns.get('sort'):
ns['sort'] = 'orgname'
sql = '''select a.*, b.province_id_text
from (select * from organization where 1=1 {filterstr}) a left join (select k as province_id,
v as province_id_text from appcodes_kv where parentid='chnaddr') b on a.province_id = b.province_id
'''
filterjson = params_kw.get('data_filter')
if not filterjson:
fields = [ f['name'] for f in [
{
"name": "id",
"title": "机构编码",
"type": "str",
"length": 32
},
{
"name": "orgname",
"title": "机构名称",
"type": "str",
"length": 100
},
{
"name": "alias_name",
"title": "机构别名",
"type": "str",
"length": 100
},
{
"name": "contactor",
"title": "联系人",
"type": "str",
"length": 32
},
{
"name": "contactor_phone",
"title": "联系人电话",
"type": "str",
"length": 100
},
{
"name": "province_id",
"title": "所在省id",
"type": "str",
"length": 32
},
{
"name": "city_id",
"title": "所在城市id",
"type": "str",
"length": 32
},
{
"name": "distinct_id",
"title": "所在地区id",
"type": "str",
"length": 32
},
{
"name": "emailaddress",
"title": "邮箱",
"type": "str",
"length": 256
},
{
"name": "address",
"title": "地址",
"type": "str",
"length": 400
},
{
"name": "main_business",
"title": "主营业务描述",
"type": "str",
"length": 1000
},
{
"name": "orgcode",
"title": "组织结构代码",
"type": "str",
"length": 100,
"comments": "个人客户存身份证"
},
{
"name": "license_img",
"title": "营业执照",
"type": "str",
"length": 400,
"comments": "个人客户存身份证照片"
},
{
"name": "id_img",
"title": "身份证",
"type": "str",
"length": 400,
"comments": "个人客户存身份证背面照片"
},
{
"name": "parentid",
"title": "父机构id",
"type": "str",
"length": 32
},
{
"name": "org_type",
"title": "机构类型",
"type": "str",
"length": 32,
"comments": "0:业主机构1:分销商2:公司客户3:个人客户4供应商"
},
{
"name": "accountid",
"title": "账号",
"type": "str",
"length": 32
}
] ]
filterjson = default_filterjson(fields, ns)
filterdic = ns.copy()
filterdic['filterstr'] = ''
if params_kw.orgname:
filterstr = " and orgname like ${orgname}$ "
ns['orgname'] = f'%{params_kw.orgname}%'
filterdic['filterstr'] = filterstr
sql = sql.format(**filterdic)
debug(f'{sql=}')
db = DBPools()
dbname = await rfexe('get_module_dbname', 'rbac')
async with db.sqlorContext(dbname) as sor:
r = await sor.sqlPaging(sql, ns)
return r
return {
"total":0,
"rows":[]
}

View File

@ -0,0 +1,56 @@
{
"widgettype":"VBox",
"options":{
"height":"100%",
"width":"100%"
},
"subwidgets":[
{
"widgettype":"Title4",
"options":{
"otext":"机构选择",
"i18n":true
}
},
{
"widgettype":"HBox",
"options":{
"cheight":2
},
"subwidgets":[
{
"widgettype":"Text",
"options":{
"cwidth":12,
"otext":"点击选择机构,输入名称过滤",
"i18n":true
}
},
{
"id":"orgname_input",
"widgettype":"UiStr",
"options":{
"name":"orgname",
"uitype":"str",
"css":"filler"
}
}
]
},
{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('orglist.ui')}}"
}
}
],
"binds":[
{
"wid":"orgname_input",
"event":"changed",
"actiontype":"script",
"target":"organization_tbl",
"script":"this.render(params)"
}
]
}

View File

@ -0,0 +1,228 @@
{
"id":"organization_tbl",
"widgettype":"Tabular",
"options":{
"title":"机构",
"css":"card",
"data_url":"{{entire_url('./get_organization.dspy')}}",
"data_method":"GET",
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options":{
"browserfields": {"alters": null, "cwidth": {}, "exclouded": ["id"]},
"editexclouded":[
"id"
],
"fields":[
{
"name": "id",
"title": "机构编码",
"type": "str",
"length": 32,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "机构编码"
},
{
"name": "orgname",
"title": "机构名称",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "机构名称"
},
{
"name": "alias_name",
"title": "机构别名",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "机构别名"
},
{
"name": "contactor",
"title": "联系人",
"type": "str",
"length": 32,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "联系人"
},
{
"name": "contactor_phone",
"title": "联系人电话",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "联系人电话"
},
{
"name": "province_id",
"title": "所在省id",
"type": "str",
"length": 32,
"label": "所在省id",
"uitype": "code",
"valueField": "province_id",
"textField": "province_id_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'rbac')}}",
"table": "appcode_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "province_id",
"textField": "province_id_text",
"cond": "parentid='chnaddr'"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "city_id",
"title": "所在城市id",
"type": "str",
"length": 32,
"label": "所在城市id",
"uitype": "code",
"valueField": "city_id",
"textField": "city_id_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'rbac')}}",
"table": "appcode_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "city_id",
"textField": "city_id_text",
"cond": "parentid=${province_id}$"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "distinct_id",
"title": "所在地区id",
"type": "str",
"length": 32,
"label": "所在地区id",
"uitype": "code",
"valueField": "distinct_id",
"textField": "distinct_id_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'rbac')}}",
"table": "appcode_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "distinct_id",
"textField": "distinct_id_text",
"cond": "parentid=${city_id}$"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "emailaddress",
"title": "邮箱",
"type": "str",
"length": 256,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "邮箱"
},
{
"name": "address",
"title": "地址",
"type": "str",
"length": 400,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "地址"
},
{
"name": "main_business",
"title": "主营业务描述",
"type": "str",
"length": 1000,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "主营业务描述"
},
{
"name": "orgcode",
"title": "组织结构代码",
"type": "str",
"length": 100,
"comments": "个人客户存身份证",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "组织结构代码"
},
{
"name": "license_img",
"title": "营业执照",
"type": "str",
"length": 400,
"comments": "个人客户存身份证照片",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "营业执照"
},
{
"name": "id_img",
"title": "身份证",
"type": "str",
"length": 400,
"comments": "个人客户存身份证背面照片",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "身份证"
},
{
"name": "parentid",
"title": "父机构id",
"type": "str",
"length": 32,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "父机构id"
},
{
"name": "org_type",
"title": "机构类型",
"type": "str",
"length": 32,
"comments": "0:业主机构1:分销商2:公司客户3:个人客户4供应商",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "机构类型"
},
{
"name": "accountid",
"title": "账号",
"type": "str",
"length": 32,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "账号"
}
]
},
"page_rows":160,
"cache_limit":5
}
}