bugfix
19
wwwroot/add_adminuser.dspy
Normal file
@ -0,0 +1,19 @@
|
||||
if params_kw.get('password') != params_kw.get('chkpassword'):
|
||||
return Error(title='add user error', message='password not match')
|
||||
|
||||
ns = params_kw.copy()
|
||||
ns['id'] = uuid()
|
||||
await rfexe('passowrd', ns)
|
||||
user_orgid = await get_user_orgid()
|
||||
ns['orgid'] = user_orgid
|
||||
dbname = rfexe('get_module_dbname','rbac')
|
||||
async db.sqlorConext(dbname) as sor:
|
||||
await sor.C('users',ns.copy())
|
||||
uid = ns['id']
|
||||
ns = {
|
||||
'id':uuid(),
|
||||
'userid':uid,
|
||||
'roleid':'admin'
|
||||
}
|
||||
await sor.C('userrole', ns.copy())
|
||||
|
46
wwwroot/add_adminuser.ui
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"widgettype":"PopupWindow",
|
||||
"options":{
|
||||
"archor":"cc",
|
||||
"cwidth":16,
|
||||
"chegith":10
|
||||
"title":"add admin user"
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"id":"adminuser",
|
||||
"widgettype":"Form",
|
||||
"options":{
|
||||
"cols":1,
|
||||
"fields":[
|
||||
{
|
||||
"name":"username",
|
||||
"label":"用户名",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"password",
|
||||
"label":"密码",
|
||||
"uitype":"password"
|
||||
},
|
||||
{
|
||||
"name":"chkpassword",
|
||||
"label":"确认密码",
|
||||
"uitype":"password"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"binds":[
|
||||
{
|
||||
"wid":"adminuser",
|
||||
"event":"submit",
|
||||
"actiontype":"urlwidget",
|
||||
"target":"self",
|
||||
"options":{
|
||||
"url":"{{entire_url('./add_adminuser.dspy')}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
ns = params_kw.copy()
|
||||
id = uuid()
|
||||
ns['id'] = id
|
||||
dbname = get_definition('codesdb')
|
||||
db = DBPools()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('appcodes', ns)
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Add Success",
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
print(f'{params_kw=}, add_kv.dspy')
|
||||
ns = params_kw.copy()
|
||||
ns['id'] = uuid()
|
||||
if ns.get('parentid') is None:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"message":"need parentid"
|
||||
}
|
||||
}
|
||||
|
||||
dbname = get_definition('codesdb')
|
||||
db = DBPools()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('appcodes_kv', ns)
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Add Success",
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
{
|
||||
"id":"kvlist",
|
||||
"widgettype":"DynamicAccordion",
|
||||
"options":{
|
||||
"data_url":"{{entire_url('get_kvs.dspy')}}",
|
||||
"data_params":{
|
||||
"hierarchy_flg":"${hierarchy_flg}",
|
||||
"pid":"${id}"
|
||||
},
|
||||
"editable":{
|
||||
"form_cheight":4,
|
||||
"new_data_url":"{{entire_url('add_kv.dspy?parentid=${id}')}}",
|
||||
"delete_data_url":"{{entire_url('delete_kv.dspy')}}",
|
||||
"update_data_url":"{{entire_url('update_kv.dspy')}}"
|
||||
},
|
||||
"fields":[
|
||||
{
|
||||
"name":"k",
|
||||
"lable":"k",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"v",
|
||||
"lable":"v",
|
||||
"uitype":"str"
|
||||
}
|
||||
],
|
||||
"content_rely_on":"hierarchy_flg",
|
||||
"content_rely_value":"1",
|
||||
"record_view":{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('codekv_record.ui')}}"
|
||||
}
|
||||
},
|
||||
"content_view":{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('codekv.ui')}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
{
|
||||
"widgettype":"HBox",
|
||||
"options":{
|
||||
"cheight":1.4
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${k}",
|
||||
"cwidth":10,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${v}",
|
||||
"cwidth":12,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
print(params_kw, 'delete_code.dspy')
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
'del_flg':'1'
|
||||
}
|
||||
dbname = get_definition('codesdb')
|
||||
db = DBPools()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.U('appcodes', ns)
|
||||
print('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
print('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
|
||||
print(params_kw, 'delete_code.dspy')
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
'del_flg':'1'
|
||||
}
|
||||
dbname = get_definition('codesdb')
|
||||
db = DBPools()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.U('appcodes_kv', ns)
|
||||
print('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
print('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
ns = params_kw.copy()
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
ns['sort'] = 'name'
|
||||
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 appcodes where del_flg='0' "
|
||||
if ns.get('name'):
|
||||
sql += ' and name like ${name}$ '
|
||||
if ns.get('hierarchy_flg'):
|
||||
sql += ' and hierarchy_flg = ${hierarchy}$ '
|
||||
r = await sor.sqlPaging(sql, ns)
|
||||
return r
|
||||
return {
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
ns = params_kw.copy()
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
ns['sort'] = 'k'
|
||||
print(f'{ns=}, get_kvs.dspy')
|
||||
|
||||
dbname = get_definition('codesdb')
|
||||
print(f'dbname=', dbname)
|
||||
db = DBPools()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
sql = "select *, $[hierarchy_flg]$ as hierarchy_flg from appcodes_kv where del_flg='0' and parentid=${pid}$"
|
||||
r = await sor.sqlPaging(sql, ns)
|
||||
return r
|
||||
return {
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"overflow":"auto"
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"Title4",
|
||||
"options":{
|
||||
"i18n":true,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left",
|
||||
"tip":"This is a test tooltip",
|
||||
"otext":"Codes maintainment"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Filler",
|
||||
"options":{},
|
||||
"subwidgets":[
|
||||
{
|
||||
"id":"codelist",
|
||||
"widgettype":"DynamicAccordion",
|
||||
"options":{
|
||||
"editable":{
|
||||
"form_cheight":4,
|
||||
"new_data_url":"{{entire_url('add_code.dspy')}}",
|
||||
"delete_data_url":"{{entire_url('delete_code.dspy')}}",
|
||||
"update_data_url":"{{entire_url('update_code.dspy')}}"
|
||||
},
|
||||
"fields":[
|
||||
{
|
||||
"name":"name",
|
||||
"lable":"CodeName",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"hierarchy_flg",
|
||||
"lable":"isHierarchy",
|
||||
"uitype":"code",
|
||||
"textField":"text",
|
||||
"valueField":"value",
|
||||
"defaultvalue":"0",
|
||||
"data":[
|
||||
{
|
||||
"value":"0",
|
||||
"text":"No"
|
||||
},
|
||||
{
|
||||
|
||||
"value":"1",
|
||||
"text":"Yes"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"data_url":"{{entire_url('get_codes.dspy')}}",
|
||||
"record_view":{
|
||||
"widgettype":"HBox",
|
||||
"options":{
|
||||
"cheight":1.4
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${name}",
|
||||
"cwidth":10,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
|
||||
"halign":"left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${hierarchy_flg}",
|
||||
"cwidth":1,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"content_view":{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('codekv.ui')}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
print(params_kw, 'update_code.dspy')
|
||||
ns = params_kw.copy()
|
||||
dbname = get_definition('codesdb')
|
||||
db = DBPools()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.U('appcodes', 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"
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 8.7 KiB |
@ -1,18 +0,0 @@
|
||||
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 {
|
||||
}
|
||||
|
@ -1,62 +0,0 @@
|
||||
{
|
||||
"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')}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"haha"
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"haha"
|
||||
}
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
{
|
||||
"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",
|
||||
"label":"用户名",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"email",
|
||||
"label":"邮箱",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"orgid",
|
||||
"label":"所属机构",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"nick_name",
|
||||
"label":"显示名称",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"address",
|
||||
"label":"地址",
|
||||
"uitype":"str"
|
||||
},
|
||||
{
|
||||
"name":"mobile",
|
||||
"label":"手机",
|
||||
"uitype":"str"
|
||||
}
|
||||
],
|
||||
"data_url":"{{entire_url('get_users.dspy')}}",
|
||||
"record_view":{
|
||||
"widgettype":"FHBox",
|
||||
"options":{
|
||||
"width":"auto",
|
||||
"cheight":1.4
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${username}",
|
||||
"cwidth":10,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${email}",
|
||||
"cwidth":15,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${orgid}",
|
||||
"cwidth":30,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${nick_name}",
|
||||
"cwidth":15,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${address}",
|
||||
"cwidth":20,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${mobile}",
|
||||
"cwidth":12,
|
||||
"dynsize":true,
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"content_view":{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('userroles.ui')}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|