bugfix
This commit is contained in:
parent
d01bbbf86c
commit
20bb7638d1
@ -7,7 +7,7 @@ from xlsxData import xlsxFactory
|
|||||||
from appPublic.folderUtils import listFile, _mkdir
|
from appPublic.folderUtils import listFile, _mkdir
|
||||||
from appPublic.myTE import MyTemplateEngine
|
from appPublic.myTE import MyTemplateEngine
|
||||||
from tmpls import data_browser_tmpl, get_data_tmpl, data_new_tmpl, data_update_tmpl, data_delete_tmpl
|
from tmpls import data_browser_tmpl, get_data_tmpl, data_new_tmpl, data_update_tmpl, data_delete_tmpl
|
||||||
from xls2crud import build_dbdesc, field_list
|
from xls2crud import build_dbdesc, field_list, subtable2toolbar
|
||||||
from tmpls import data_new_tmpl, data_update_tmpl, data_delete_tmpl
|
from tmpls import data_new_tmpl, data_update_tmpl, data_delete_tmpl
|
||||||
|
|
||||||
ui_tmpl = """
|
ui_tmpl = """
|
||||||
@ -121,6 +121,7 @@ def build_tree_ui(tree_data, dbdesc):
|
|||||||
tbldesc = DictObject(**tbldesc)
|
tbldesc = DictObject(**tbldesc)
|
||||||
tbldesc.tblname = tree_data.tblname
|
tbldesc.tblname = tree_data.tblname
|
||||||
tbldesc.update(tree_data.params)
|
tbldesc.update(tree_data.params)
|
||||||
|
subtable2toolbar(tbldesc)
|
||||||
exclouds = tbldesc.edit_exclouded_fields or []
|
exclouds = tbldesc.edit_exclouded_fields or []
|
||||||
if tbldesc.idField not in exclouds:
|
if tbldesc.idField not in exclouds:
|
||||||
exclouds.append(tbldesc.idField)
|
exclouds.append(tbldesc.idField)
|
||||||
|
|||||||
43
xls2crud.py
43
xls2crud.py
@ -26,21 +26,6 @@ def build_dbdesc(models_dir: str) -> dict:
|
|||||||
db_desc.update({tbname:d})
|
db_desc.update({tbname:d})
|
||||||
return db_desc
|
return db_desc
|
||||||
|
|
||||||
def build_subtable(subtable):
|
|
||||||
t = subtable
|
|
||||||
url = f"../{t.subtable}"
|
|
||||||
if t.url:
|
|
||||||
url = t.url
|
|
||||||
params = t.params or {}
|
|
||||||
params[t.field] = "${id}"
|
|
||||||
return {
|
|
||||||
"widgettype":"urlwidget",
|
|
||||||
"options":{
|
|
||||||
"params":params,
|
|
||||||
"url":"{{entire_url('" + url + "')}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def subtable2toolbar(desc):
|
def subtable2toolbar(desc):
|
||||||
if desc.subtables is None:
|
if desc.subtables is None:
|
||||||
return
|
return
|
||||||
@ -103,34 +88,6 @@ def build_crud_ui(crud_data: dict, dbdesc: dict):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
desc.bindsstr = json.dumps(binds, indent=4, ensure_ascii=False)
|
desc.bindsstr = json.dumps(binds, indent=4, ensure_ascii=False)
|
||||||
"""
|
|
||||||
if desc.subtables:
|
|
||||||
if len(desc.subtables) == 1:
|
|
||||||
t = desc.subtables[0]
|
|
||||||
d = build_subtable(t)
|
|
||||||
content_view = DictObject(**d)
|
|
||||||
else:
|
|
||||||
items = []
|
|
||||||
for t in desc.subtables:
|
|
||||||
d = build_subtable(t)
|
|
||||||
item = {
|
|
||||||
"name":t.subtable,
|
|
||||||
"label":t.title or t.subtable,
|
|
||||||
"content":d
|
|
||||||
}
|
|
||||||
items.append(item)
|
|
||||||
content_view = DictObject(**{
|
|
||||||
"widgettype":"TabPanel",
|
|
||||||
"options":{
|
|
||||||
"tab_wide":"auto",
|
|
||||||
"height":"100%",
|
|
||||||
"width":"100%",
|
|
||||||
"tab_pos":"top",
|
|
||||||
"items":items
|
|
||||||
}
|
|
||||||
})
|
|
||||||
desc.content_view = content_view
|
|
||||||
"""
|
|
||||||
desc.update({
|
desc.update({
|
||||||
"tblname":crud_data.tblname,
|
"tblname":crud_data.tblname,
|
||||||
"dbname":crud_data.dbname
|
"dbname":crud_data.dbname
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user