audit-e2w 1.11.2 → 1.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -148
- package/dsh_plugins/audit-e2w/lib/index.js +9 -1
- package/dsh_plugins/audit-e2w/lib/skill.js +3 -2
- package/excel_word/README.md +45 -37
- package/excel_word/qoder_engine.py +10 -11
- package/excel_word/wesync/__init__.py +1 -1
- package/excel_word/wesync/ai/__init__.py +52 -0
- package/excel_word/wesync/ai/actions.py +369 -0
- package/excel_word/wesync/ai/client.py +340 -0
- package/excel_word/wesync/ai/config.py +291 -0
- package/excel_word/wesync/ai/docs.py +177 -0
- package/excel_word/wesync/ai/prompts.py +288 -0
- package/excel_word/wesync/ai/tasks/__init__.py +26 -0
- package/excel_word/wesync/ai/tasks/actions_task.py +97 -0
- package/excel_word/wesync/ai/tasks/combined.py +123 -0
- package/excel_word/wesync/ai/tasks/diff_note.py +61 -0
- package/excel_word/wesync/ai/tasks/headings.py +119 -0
- package/excel_word/wesync/ai/tasks/help_task.py +69 -0
- package/excel_word/wesync/ai/tasks/roles.py +128 -0
- package/excel_word/wesync/align.py +1 -0
- package/excel_word/wesync/api.py +544 -92
- package/excel_word/wesync/backup_history.py +44 -9
- package/excel_word/wesync/cli.py +19 -1
- package/excel_word/wesync/commands/blank_cmd.py +59 -30
- package/excel_word/wesync/commands/bookmark_cmd.py +41 -10
- package/excel_word/wesync/commands/clear_cmd.py +5 -3
- package/excel_word/wesync/commands/export_cmd.py +270 -220
- package/excel_word/wesync/commands/incremental_cmd.py +157 -0
- package/excel_word/wesync/commands/marks_cmd.py +24 -16
- package/excel_word/wesync/commands/placeholders_cmd.py +12 -7
- package/excel_word/wesync/commands/writeback_cmd.py +72 -116
- package/excel_word/wesync/config.py +3 -2
- package/excel_word/wesync/console.py +9 -2
- package/excel_word/wesync/docx_bookmarks.py +12 -5
- package/excel_word/wesync/docx_columns.py +1 -1
- package/excel_word/wesync/docx_marks.py +183 -75
- package/excel_word/wesync/docx_placeholders.py +65 -26
- package/excel_word/wesync/excel_blocks.py +144 -185
- package/excel_word/wesync/excel_export.py +15 -8
- package/excel_word/wesync/excel_marks.py +265 -193
- package/excel_word/wesync/fsops.py +11 -6
- package/excel_word/wesync/gui/__init__.py +21 -2
- package/excel_word/wesync/gui/app.py +243 -29
- package/excel_word/wesync/gui/manual.py +5 -3
- package/excel_word/wesync/gui/pages/__init__.py +53 -4
- package/excel_word/wesync/gui/pages/_page.py +129 -7
- package/excel_word/wesync/gui/pages/ai_page.py +854 -0
- package/excel_word/wesync/gui/pages/batch_page.py +64 -31
- package/excel_word/wesync/gui/pages/blank_page.py +529 -464
- package/excel_word/wesync/gui/pages/bookmark_page.py +97 -37
- package/excel_word/wesync/gui/pages/export_page.py +140 -87
- package/excel_word/wesync/gui/pages/feedback_page.py +196 -0
- package/excel_word/wesync/gui/pages/format_page.py +551 -429
- package/excel_word/wesync/gui/pages/help_page.py +73 -7
- package/excel_word/wesync/gui/pages/history_page.py +167 -144
- package/excel_word/wesync/gui/pages/marks_page.py +210 -177
- package/excel_word/wesync/gui/pages/settings_page.py +450 -0
- package/excel_word/wesync/gui/pages/writeback_page.py +167 -146
- package/excel_word/wesync/gui/runner.py +29 -13
- package/excel_word/wesync/gui/store.py +23 -7
- package/excel_word/wesync/gui/theme.py +220 -49
- package/excel_word/wesync/gui/widgets/ai_config.py +362 -0
- package/excel_word/wesync/gui/widgets/cards.py +124 -5
- package/excel_word/wesync/gui/widgets/chips.py +565 -0
- package/excel_word/wesync/gui/widgets/filebar.py +1 -1
- package/excel_word/wesync/gui/widgets/logpane.py +24 -8
- package/excel_word/wesync/gui/widgets/nav.py +267 -12
- package/excel_word/wesync/gui/widgets/theme_choice.py +93 -0
- package/excel_word/wesync/report_format.py +9 -1
- package/excel_word/wesync/settings.py +35 -0
- package/excel_word/wesync/sort_rules.py +75 -26
- package/excel_word/wesync/valuefmt.py +40 -17
- package/package.json +53 -51
- package/packaging//344/275/277/347/224/250/350/257/264/346/230/216.txt +247 -0
- package/qoder_plugins/audit-toolbox/README.md +159 -156
- package/qoder_plugins/audit-toolbox/catalog.mjs +13 -13
|
@@ -24,13 +24,13 @@ from PySide6.QtWidgets import (
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
from ... import api
|
|
27
|
-
from ..widgets.cards import make_checkbutton
|
|
27
|
+
from ..widgets.cards import make_action_bar, make_checkbutton
|
|
28
28
|
from ._page import BasePage
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class BatchPage(BasePage):
|
|
32
32
|
title = "批量同步"
|
|
33
|
-
subtitle = "
|
|
33
|
+
subtitle = "多份报告一次同步,或按模板批量生成新 Word;原件不改。"
|
|
34
34
|
|
|
35
35
|
def build(self, body: QWidget) -> None:
|
|
36
36
|
card = self.card(body)
|
|
@@ -54,15 +54,20 @@ class BatchPage(BasePage):
|
|
|
54
54
|
path = self.sync_table.item(row, 0).data(Qt.UserRole)
|
|
55
55
|
r = by_path.get(path)
|
|
56
56
|
if r:
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
item = QTableWidgetItem("✔ 成功" if r["status"] == "ok" else "✘ 已跳过")
|
|
58
|
+
if r["status"] != "ok":
|
|
59
|
+
item.setToolTip(r["reason"])
|
|
60
|
+
self.sync_table.setItem(row, 2, item)
|
|
59
61
|
else:
|
|
60
62
|
for row, r in enumerate(self._results):
|
|
61
63
|
if row >= self.tpl_table.rowCount():
|
|
62
64
|
break
|
|
63
65
|
text = "✔ 已生成" if r["status"] == "ok" and r["output"] else (
|
|
64
|
-
"✔ 预演完成" if r["status"] == "ok" else
|
|
65
|
-
|
|
66
|
+
"✔ 预演完成" if r["status"] == "ok" else "✘ 失败")
|
|
67
|
+
item = QTableWidgetItem(text)
|
|
68
|
+
if r["status"] != "ok":
|
|
69
|
+
item.setToolTip(r["reason"])
|
|
70
|
+
self.tpl_table.setItem(row, 2, item)
|
|
66
71
|
|
|
67
72
|
@staticmethod
|
|
68
73
|
def _make_table(headers: list[str]) -> QTableWidget:
|
|
@@ -82,7 +87,7 @@ class BatchPage(BasePage):
|
|
|
82
87
|
layout = QVBoxLayout(tab)
|
|
83
88
|
layout.setContentsMargins(12, 12, 12, 12)
|
|
84
89
|
layout.setSpacing(10)
|
|
85
|
-
self.tip_label(tab, "
|
|
90
|
+
self.tip_label(tab, "自动配对同名工作簿;单份失败只跳过该份。")
|
|
86
91
|
content_row = QHBoxLayout()
|
|
87
92
|
content_row.setSpacing(8)
|
|
88
93
|
content_row.addWidget(QLabel("同步内容:"))
|
|
@@ -93,7 +98,7 @@ class BatchPage(BasePage):
|
|
|
93
98
|
content_row.addWidget(box)
|
|
94
99
|
content_row.addStretch(1)
|
|
95
100
|
layout.addLayout(content_row)
|
|
96
|
-
self.batch_keep_highlight = make_checkbutton(tab, "
|
|
101
|
+
self.batch_keep_highlight = make_checkbutton(tab, "保留标注高亮", True)
|
|
97
102
|
self.batch_keep_highlight.setVisible(False)
|
|
98
103
|
self.batch_marks.toggled.connect(self.batch_keep_highlight.setVisible)
|
|
99
104
|
layout.addWidget(self.batch_keep_highlight)
|
|
@@ -108,8 +113,17 @@ class BatchPage(BasePage):
|
|
|
108
113
|
layout.addLayout(row)
|
|
109
114
|
self.sync_table = self._make_table(["报告(勾选参与)", "工作簿", "状态"])
|
|
110
115
|
layout.addWidget(self.sync_table)
|
|
111
|
-
self.sync_backup = make_checkbutton(tab, "
|
|
116
|
+
self.sync_backup = make_checkbutton(tab, "同步前备份;关闭则直接覆盖", False)
|
|
112
117
|
layout.addWidget(self.sync_backup)
|
|
118
|
+
sync_controls = {}
|
|
119
|
+
self.bind_defaults(layout, {
|
|
120
|
+
"sync_tables": self.batch_tables, "sync_marks": self.batch_marks,
|
|
121
|
+
"sync_placeholders": self.batch_placeholders,
|
|
122
|
+
"keep_highlight": self.batch_keep_highlight, "auto_backup": self.sync_backup,
|
|
123
|
+
}, [("表格", "table_zero"), ("标注", "mark_zero"), ("占位符", "placeholder_zero")], sync_controls)
|
|
124
|
+
self.table_zero = sync_controls["table_zero"]
|
|
125
|
+
self.mark_zero = sync_controls["mark_zero"]
|
|
126
|
+
self.placeholder_zero = sync_controls["placeholder_zero"]
|
|
113
127
|
self.button_row(tab, lambda: self._start_sync(True), lambda: self._start_sync(False), "全部仅预演", "开始批量同步")
|
|
114
128
|
layout.addStretch(1)
|
|
115
129
|
return tab
|
|
@@ -166,10 +180,15 @@ class BatchPage(BasePage):
|
|
|
166
180
|
return
|
|
167
181
|
backup = self.sync_backup.isChecked()
|
|
168
182
|
keep_highlight = self.batch_keep_highlight.isChecked()
|
|
183
|
+
table_zero = self.table_zero.currentData()
|
|
184
|
+
mark_zero = self.mark_zero.currentData()
|
|
185
|
+
placeholder_zero = self.placeholder_zero.currentData()
|
|
169
186
|
|
|
170
187
|
def run() -> int:
|
|
171
188
|
self._results = api.run_batch_writeback(
|
|
172
|
-
paths, dry_run=dry_run, backup=backup, contents=contents, keep_highlight=keep_highlight
|
|
189
|
+
paths, dry_run=dry_run, backup=backup, contents=contents, keep_highlight=keep_highlight,
|
|
190
|
+
table_zero=table_zero, mark_zero=mark_zero,
|
|
191
|
+
placeholder_zero=placeholder_zero,
|
|
173
192
|
)
|
|
174
193
|
return 0
|
|
175
194
|
|
|
@@ -187,10 +206,7 @@ class BatchPage(BasePage):
|
|
|
187
206
|
layout.setSpacing(10)
|
|
188
207
|
self.tip_label(
|
|
189
208
|
tab,
|
|
190
|
-
"
|
|
191
|
-
"模板原件与源 Excel 都不改动。多模板时在清单「所属模板」列给每个 Excel 指定模板编号(分组)。"
|
|
192
|
-
"工作簿必须是从对应模板导出的,否则该份跳过。"
|
|
193
|
-
"若模板正文含 {字段名} 占位符且勾选「占位符」,先点「生成正文信息填写表」,在工作簿「正文信息」表填值后再生成;未填齐的份会跳过。",
|
|
209
|
+
"按模板生成新 Word,不改原件;工作簿须与模板对应。占位符需先在「正文信息」填齐。",
|
|
194
210
|
)
|
|
195
211
|
content_row = QHBoxLayout()
|
|
196
212
|
content_row.setSpacing(8)
|
|
@@ -202,10 +218,19 @@ class BatchPage(BasePage):
|
|
|
202
218
|
content_row.addWidget(box)
|
|
203
219
|
content_row.addStretch(1)
|
|
204
220
|
layout.addLayout(content_row)
|
|
205
|
-
self.tpl_keep_highlight = make_checkbutton(tab, "
|
|
221
|
+
self.tpl_keep_highlight = make_checkbutton(tab, "保留标注高亮", True)
|
|
206
222
|
self.tpl_keep_highlight.setVisible(False)
|
|
207
223
|
self.tpl_marks.toggled.connect(self.tpl_keep_highlight.setVisible)
|
|
208
224
|
layout.addWidget(self.tpl_keep_highlight)
|
|
225
|
+
tpl_controls = {}
|
|
226
|
+
self.bind_defaults(layout, {
|
|
227
|
+
"keep_highlight": self.tpl_keep_highlight,
|
|
228
|
+
}, [
|
|
229
|
+
("表格", "table_zero"), ("标注", "mark_zero"), ("占位符", "placeholder_zero")
|
|
230
|
+
], tpl_controls)
|
|
231
|
+
self.tpl_table_zero = tpl_controls["table_zero"]
|
|
232
|
+
self.tpl_mark_zero = tpl_controls["mark_zero"]
|
|
233
|
+
self.tpl_placeholder_zero = tpl_controls["placeholder_zero"]
|
|
209
234
|
mode_row = QHBoxLayout()
|
|
210
235
|
self.mode_single = QRadioButton("单模板")
|
|
211
236
|
self.mode_single.setChecked(True)
|
|
@@ -234,19 +259,18 @@ class BatchPage(BasePage):
|
|
|
234
259
|
self.tpl_list.setMaximumHeight(90)
|
|
235
260
|
layout.addWidget(self.tpl_list)
|
|
236
261
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
layout.addLayout(xl_row)
|
|
262
|
+
actions = make_action_bar(
|
|
263
|
+
tab,
|
|
264
|
+
"生成正文信息填写表",
|
|
265
|
+
self._fill_placeholder_sheets,
|
|
266
|
+
secondary=[
|
|
267
|
+
("添加 Excel 工作簿", self._add_workbooks),
|
|
268
|
+
("移除选中行", lambda: self._remove_rows(self.tpl_table)),
|
|
269
|
+
],
|
|
270
|
+
primary_index=2,
|
|
271
|
+
)
|
|
272
|
+
actions.buttons[2].setToolTip("按模板里的 {字段名} 占位符,给各工作簿加入/补齐「正文信息」表(保留已填值),供填写正文内容。仅在实际新增字段时写盘,备份按全局设置执行。")
|
|
273
|
+
layout.addWidget(actions)
|
|
250
274
|
self.tpl_table = self._make_table(["Excel 工作簿", "所属模板", "状态"])
|
|
251
275
|
self.tpl_table.horizontalHeader().setSectionResizeMode(1, QHeaderView.ResizeToContents)
|
|
252
276
|
layout.addWidget(self.tpl_table)
|
|
@@ -361,8 +385,10 @@ class BatchPage(BasePage):
|
|
|
361
385
|
self.ctx.info("未指定模板", "请先在「所属模板」列给工作簿选择模板。")
|
|
362
386
|
return
|
|
363
387
|
total = sum(len(v) for v in groups.values())
|
|
388
|
+
backup = self.ctx.global_settings()["auto_backup"]
|
|
364
389
|
msg = (f"将按模板里的 {{字段名}} 占位符,给 {total} 个工作簿加入/补齐「正文信息」表(保留已填值)。\n\n"
|
|
365
|
-
"
|
|
390
|
+
"字段已齐全时不改文件;实际补入字段时会修改源工作簿,请先关闭这些 Excel。\n"
|
|
391
|
+
+ ("写盘前按全局设置自动备份。" if backup else "全局设置已关闭备份,本次将直接保存。"))
|
|
366
392
|
if unassigned:
|
|
367
393
|
msg += f"\n另有 {unassigned} 个未指定模板的工作簿将跳过。"
|
|
368
394
|
if not self.ctx.confirm("生成正文信息填写表", msg + "\n\n确认开始?"):
|
|
@@ -370,7 +396,9 @@ class BatchPage(BasePage):
|
|
|
370
396
|
|
|
371
397
|
def run() -> int:
|
|
372
398
|
for tpl_no, paths in groups.items():
|
|
373
|
-
api.fill_placeholder_sheets(
|
|
399
|
+
api.fill_placeholder_sheets(
|
|
400
|
+
templates[tpl_no - 1], paths, backup=backup
|
|
401
|
+
)
|
|
374
402
|
return 0
|
|
375
403
|
|
|
376
404
|
self.ctx.run_steps([("生成正文信息填写表", run)])
|
|
@@ -410,10 +438,15 @@ class BatchPage(BasePage):
|
|
|
410
438
|
):
|
|
411
439
|
return
|
|
412
440
|
keep_highlight = self.tpl_keep_highlight.isChecked()
|
|
441
|
+
table_zero = self.tpl_table_zero.currentData()
|
|
442
|
+
mark_zero = self.tpl_mark_zero.currentData()
|
|
443
|
+
placeholder_zero = self.tpl_placeholder_zero.currentData()
|
|
413
444
|
|
|
414
445
|
def run() -> int:
|
|
415
446
|
self._results = api.run_template_batch(
|
|
416
|
-
templates, items, out_dir, dry_run=dry_run, contents=contents, keep_highlight=keep_highlight
|
|
447
|
+
templates, items, out_dir, dry_run=dry_run, contents=contents, keep_highlight=keep_highlight,
|
|
448
|
+
table_zero=table_zero, mark_zero=mark_zero,
|
|
449
|
+
placeholder_zero=placeholder_zero,
|
|
417
450
|
)
|
|
418
451
|
return 0
|
|
419
452
|
|