fix: 树控件创建节点后返回user_data,修复新增子项不显示
This commit is contained in:
parent
1438de9d58
commit
47f7e8e5c1
@ -34,8 +34,10 @@ try:
|
|||||||
|
|
||||||
async with DBPools().sqlorContext(dbname) as sor:
|
async with DBPools().sqlorContext(dbname) as sor:
|
||||||
await sor.C('product_category', data)
|
await sor.C('product_category', data)
|
||||||
|
_new_rows = await sor.sqlExe("SELECT * FROM product_category WHERE id = ${id}$", {'id': data['id']})
|
||||||
|
_user_data = _new_rows[0] if _new_rows else data
|
||||||
|
|
||||||
result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '类别创建成功', 'type': 'success'}}
|
result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '类别创建成功', 'type': 'success', 'user_data': _user_data}}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'}
|
result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'}
|
||||||
|
|||||||
@ -34,6 +34,8 @@ db = DBPools()
|
|||||||
dbname = get_module_dbname('product_management')
|
dbname = get_module_dbname('product_management')
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
r = await sor.C('product_category', ns.copy())
|
r = await sor.C('product_category', ns.copy())
|
||||||
|
_new_rows = await sor.sqlExe("SELECT * FROM product_category WHERE id = ${id}$", {'id': id})
|
||||||
|
_user_data = _new_rows[0] if _new_rows else ns
|
||||||
return {
|
return {
|
||||||
"widgettype":"Message",
|
"widgettype":"Message",
|
||||||
"options":{
|
"options":{
|
||||||
@ -41,7 +43,8 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
"cheight":9,
|
"cheight":9,
|
||||||
"title":"Add Success",
|
"title":"Add Success",
|
||||||
"timeout":3,
|
"timeout":3,
|
||||||
"message":"ok"
|
"message":"ok",
|
||||||
|
"user_data": _user_data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user