feat: receive params with json
This commit is contained in:
parent
0385e63e6e
commit
6a853a9e61
@ -170,6 +170,14 @@ def FindTableIndex(table_bookmarks, location_bookmark_name):
|
|||||||
return handle_table_index
|
return handle_table_index
|
||||||
|
|
||||||
|
|
||||||
|
def InsertRowWithJSON(json_str):
|
||||||
|
"""
|
||||||
|
插入行
|
||||||
|
"""
|
||||||
|
data = json.loads(json_str)
|
||||||
|
InsertRow(data["location_bookmark_name"], data["data"], data["start_row_index"])
|
||||||
|
|
||||||
|
|
||||||
def InsertRow(location_bookmark_name, data, start_row_index=-1):
|
def InsertRow(location_bookmark_name, data, start_row_index=-1):
|
||||||
"""
|
"""
|
||||||
表格插入行
|
表格插入行
|
||||||
@ -222,7 +230,14 @@ def DebugCallInsertRow():
|
|||||||
InsertRow("h1", [["1", "2", "3"], ["4", "5", "6"]], 0)
|
InsertRow("h1", [["1", "2", "3"], ["4", "5", "6"]], 0)
|
||||||
|
|
||||||
|
|
||||||
def DeleteRow(location_bookmark_name, start_row_index, delete_row_count):
|
def DeleteRowWithJSON(json_str):
|
||||||
|
"""
|
||||||
|
删除行
|
||||||
|
"""
|
||||||
|
data = json.loads(json_str)
|
||||||
|
DeleteRow(data["location_bookmark_name"], data["start_row_index"], data["delete_row_count"])
|
||||||
|
|
||||||
|
def DeleteRow(location_bookmark_name, start_row_index, delete_row_count=-1):
|
||||||
"""
|
"""
|
||||||
删除表格行
|
删除表格行
|
||||||
|
|
||||||
@ -242,8 +257,9 @@ def DeleteRow(location_bookmark_name, start_row_index, delete_row_count):
|
|||||||
if start_row_index < 0 or start_row_index >= row_count:
|
if start_row_index < 0 or start_row_index >= row_count:
|
||||||
raise ValueError(f"起始行索引 {start_row_index} 超出范围")
|
raise ValueError(f"起始行索引 {start_row_index} 超出范围")
|
||||||
|
|
||||||
if start_row_index + delete_row_count > row_count:
|
# 如果未指定删除行数或超出范围,则删除剩余所有行
|
||||||
raise ValueError(f"删除行数量 {delete_row_count} 超出范围")
|
if start_row_index + delete_row_count > row_count or delete_row_count == -1:
|
||||||
|
delete_row_count = row_count - start_row_index
|
||||||
|
|
||||||
try:
|
try:
|
||||||
handle_table.getRows().removeByIndex(start_row_index, delete_row_count)
|
handle_table.getRows().removeByIndex(start_row_index, delete_row_count)
|
||||||
@ -419,7 +435,9 @@ g_exportedScripts = (
|
|||||||
QueryAll,
|
QueryAll,
|
||||||
QueryAllWithJSON,
|
QueryAllWithJSON,
|
||||||
InsertRow,
|
InsertRow,
|
||||||
|
InsertRowWithJSON,
|
||||||
DeleteRow,
|
DeleteRow,
|
||||||
|
DeleteRowWithJSON,
|
||||||
DebugCallReplace,
|
DebugCallReplace,
|
||||||
DebugCallReplaceList,
|
DebugCallReplaceList,
|
||||||
DebugCallInsertRow,
|
DebugCallInsertRow,
|
||||||
|
Loading…
Reference in New Issue
Block a user