This commit is contained in:
yumoqing 2024-03-19 18:17:38 +08:00
parent b91704a695
commit e078be970f
8 changed files with 250 additions and 2 deletions

Binary file not shown.

View File

@ -1,9 +1,9 @@
print(params_kw, 'update_kv.dspy') print(params_kw, 'update_code.dspy')
ns = params_kw.copy() ns = params_kw.copy()
dbname = get_definition('codesdb') dbname = get_definition('codesdb')
db = DBPools() db = DBPools()
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.U('appcodes_kv', ns) r = await sor.U('appcodes', ns)
print('update success'); print('update success');
return { return {
"widgettype":"Message", "widgettype":"Message",

View File

@ -0,0 +1,24 @@
print(params_kw, 'update_kv.dspy')
ns = params_kw.copy()
dbname = get_definition('codesdb')
db = DBPools()
async with db.sqlorContext(dbname) as sor:
r = await sor.U('appcodes_kv', ns)
print('update success');
return {
"widgettype":"Message",
"options":{
"title":"Update Success",
"message":"ok"
}
}
print('update failed');
return {
"widgettype":"Error",
"options":{
"title":"Update Error",
"message":"failed"
}
}

View File

@ -0,0 +1,18 @@
ns = params_kw.copy()
if not ns.get('page'):
ns['page'] = 1
if not ns.get('sort'):
ns['sort'] = ['orgid', 'username']
if ns.get('name'):
ns['name'] = '%' + params_kw['name'] + '%'
dbname = get_definition('codesdb')
print(f'dbname=', dbname)
db = DBPools()
async with db.sqlorContext(dbname) as sor:
sql = "select * from users where del_flg='0' "
r = await sor.sqlPaging(sql, ns)
return r
return {
}

62
wwwroot/rbac/index.ui Normal file
View File

@ -0,0 +1,62 @@
{
"widgettype":"TabPanel",
"options":{
"tab_wide":"auto",
"height":"100%",
"width":"100%",
"tab_long":"70%",
"tab_pos":"top",
"items":[
{
"name":"org",
"label":"Organization",
"content":{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('organizations.ui')}}"
}
}
},
{
"name":"org_type",
"label":"Org. Type",
"content":{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('orgtypes.ui')}}"
}
}
},
{
"name":"user",
"label":"User",
"content":{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('users.ui')}}"
}
}
},
{
"name":"role",
"label":"Role",
"content":{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('roles.ui')}}"
}
}
},
{
"name":"perm",
"label":"Permission",
"content":{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('permissions.ui')}}"
}
}
}
]
}
}

View File

@ -0,0 +1,6 @@
{
"widgettype":"Text",
"options":{
"text":"haha"
}
}

6
wwwroot/rbac/roles.ui Normal file
View File

@ -0,0 +1,6 @@
{
"widgettype":"Text",
"options":{
"text":"haha"
}
}

132
wwwroot/rbac/users.ui Normal file
View File

@ -0,0 +1,132 @@
{
"id":"codelist",
"widgettype":"DynamicAccordion",
"options":{
"editable":{
"form_cheight":4,
"new_data_url":"{{entire_url('add_user.dspy')}}",
"delete_data_url":"{{entire_url('delete_user.dspy')}}",
"update_data_url":"{{entire_url('update_user.dspy')}}"
},
"fields":[
{
"name":"username",
"cwidth":10,
"label":"UserName",
"uitype":"str"
},
{
"name":"email",
"cwidth":10,
"label":"邮箱",
"uitype":"password"
},
{
"name":"orgid",
"cwidth":10,
"label":"所属机构",
"uitype":"str"
},
{
"name":"nick_name",
"cwidth":10,
"label":"显示名称",
"uitype":"str"
},
{
"name":"password",
"cwidth":10,
"label":"用户名",
"uitype":"password"
},
{
"name":"address",
"cwidth":10,
"label":"地址",
"uitype":"password"
},
{
"name":"mobile",
"cwidth":10,
"label":"手机",
"uitype":"password"
}
],
"data_url":"{{entire_url('get_users.dspy')}}",
"record_view":{
"widgettype":"HBox",
"options":{
"cheight":1.4
},
"subwidgets":[
{
"widgettype":"Text",
"options":{
"text":"${username}",
"cwidth":10,
"dynsize":true,
"wrap":true,
"halign":"left"
}
},
{
"widgettype":"Text",
"options":{
"text":"${email}",
"cwidth":10,
"dynsize":true,
"wrap":true,
"halign":"left"
}
},
{
"widgettype":"Text",
"options":{
"text":"${orgid}",
"cwidth":10,
"dynsize":true,
"wrap":true,
"halign":"left"
}
},
{
"widgettype":"Text",
"options":{
"text":"${nick_name}",
"cwidth":10,
"dynsize":true,
"wrap":true,
"halign":"left"
}
},
{
"widgettype":"Text",
"options":{
"text":"${address}",
"cwidth":10,
"dynsize":true,
"wrap":true,
"halign":"left"
}
},
{
"widgettype":"Text",
"options":{
"text":"${mobile}",
"cwidth":10,
"dynsize":true,
"wrap":true,
"halign":"left"
}
}
]
},
"content_view":{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('userroles.ui')}}"
}
}
}
}