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
|
@@ -1,178 +1,211 @@
|
|
|
1
|
-
"""标注与占位页:链接标注(高亮标记)与正文 {字段名} 占位符的导出/同步。"""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from PySide6.QtWidgets import
|
|
6
|
-
|
|
7
|
-
from ... import api
|
|
8
|
-
from ..widgets.cards import make_checkbutton
|
|
9
|
-
from .
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
tabs.addTab(self.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
layout
|
|
29
|
-
layout.
|
|
30
|
-
|
|
31
|
-
self.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
layout
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
layout.addWidget(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
self.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
1
|
+
"""标注与占位页:链接标注(高亮标记)与正文 {字段名} 占位符的导出/同步。"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from PySide6.QtWidgets import QTabWidget, QVBoxLayout, QWidget
|
|
6
|
+
|
|
7
|
+
from ... import api
|
|
8
|
+
from ..widgets.cards import make_action_bar, make_checkbutton
|
|
9
|
+
from ..widgets.chips import ChipRow
|
|
10
|
+
from ._page import BasePage
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class MarksPage(BasePage):
|
|
14
|
+
title = "标注与占位"
|
|
15
|
+
subtitle = "高亮标注与正文 {字段名} 占位符:导出到 Excel,填好后一键写回。"
|
|
16
|
+
|
|
17
|
+
def build(self, body: QWidget) -> None:
|
|
18
|
+
card = self.card(body)
|
|
19
|
+
tabs = QTabWidget()
|
|
20
|
+
card.layout().addWidget(tabs)
|
|
21
|
+
tabs.addTab(self._build_marks_tab(), "链接标注")
|
|
22
|
+
tabs.addTab(self._build_placeholder_tab(), "正文占位符")
|
|
23
|
+
|
|
24
|
+
# ---------- 链接标注 tab ----------
|
|
25
|
+
|
|
26
|
+
def _build_marks_tab(self) -> QWidget:
|
|
27
|
+
tab = QWidget()
|
|
28
|
+
layout = QVBoxLayout(tab)
|
|
29
|
+
layout.setContentsMargins(12, 12, 12, 12)
|
|
30
|
+
layout.setSpacing(10)
|
|
31
|
+
self.options = ChipRow([
|
|
32
|
+
("keep_highlight", "保留标注高亮", True, "便于人工复核"),
|
|
33
|
+
("backup", "同步前备份", True, "关闭则直接覆盖", True),
|
|
34
|
+
])
|
|
35
|
+
tab.layout().addWidget(self.options)
|
|
36
|
+
self.keep_highlight = self.options["keep_highlight"]
|
|
37
|
+
self.marks_backup = self.options["backup"]
|
|
38
|
+
mark_controls = {}
|
|
39
|
+
self.bind_defaults(layout, {
|
|
40
|
+
"keep_highlight": self.keep_highlight,
|
|
41
|
+
"auto_backup": self.marks_backup,
|
|
42
|
+
}, [("标注", "mark_zero")], mark_controls)
|
|
43
|
+
self.mark_zero = mark_controls["mark_zero"]
|
|
44
|
+
layout.addWidget(self._marks_buttons())
|
|
45
|
+
layout.addStretch(1)
|
|
46
|
+
return tab
|
|
47
|
+
|
|
48
|
+
def _marks_buttons(self) -> QWidget:
|
|
49
|
+
return make_action_bar(
|
|
50
|
+
self,
|
|
51
|
+
"开始同步",
|
|
52
|
+
lambda: self._sync_marks(False),
|
|
53
|
+
secondary=[
|
|
54
|
+
("导出/刷新标注", self._export_marks),
|
|
55
|
+
("仅预演同步", lambda: self._sync_marks(True)),
|
|
56
|
+
],
|
|
57
|
+
primary_index=2,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
def _export_marks(self) -> None:
|
|
61
|
+
if not self.ctx.require_docx():
|
|
62
|
+
return
|
|
63
|
+
docx, custom_excel = self.ctx.docx, self.ctx.excel
|
|
64
|
+
backup = self.marks_backup.isChecked()
|
|
65
|
+
links = self.ctx.global_settings()["excel_links"]
|
|
66
|
+
totals = self.ctx.global_settings()["totals_formula"]
|
|
67
|
+
xlsx = api.workbook_path(docx, custom_excel)
|
|
68
|
+
if xlsx.exists():
|
|
69
|
+
steps = [("导出/刷新标注", lambda: api.run_marks(docx, custom_excel, backup=backup))]
|
|
70
|
+
else:
|
|
71
|
+
if not self.ctx.confirm(
|
|
72
|
+
"尚未生成工作簿",
|
|
73
|
+
f"未找到工作簿:\n{xlsx}\n\n是否现在先执行一次完整导出(表格 + 链接标注)?",
|
|
74
|
+
):
|
|
75
|
+
self.ctx.log("已取消导出。", "muted")
|
|
76
|
+
return
|
|
77
|
+
steps = [("导出表格到 Excel(含链接标注)", lambda: api.run_export(
|
|
78
|
+
docx, custom_excel, backup=backup,
|
|
79
|
+
with_excel_links=links, totals_formula=totals,
|
|
80
|
+
))]
|
|
81
|
+
self.ctx.run_steps(steps)
|
|
82
|
+
|
|
83
|
+
def _sync_marks(self, dry_run: bool) -> None:
|
|
84
|
+
if not self.ctx.require_docx():
|
|
85
|
+
return
|
|
86
|
+
docx, custom_excel = self.ctx.docx, self.ctx.excel
|
|
87
|
+
xlsx = api.workbook_path(docx, custom_excel)
|
|
88
|
+
keep_highlight = self.keep_highlight.isChecked()
|
|
89
|
+
backup = self.marks_backup.isChecked()
|
|
90
|
+
mark_zero = self.mark_zero.currentData()
|
|
91
|
+
if not xlsx.exists():
|
|
92
|
+
self.ctx.log(f"未找到工作簿:{xlsx}\n请先执行“导出/刷新标注”。", "error")
|
|
93
|
+
return
|
|
94
|
+
if not dry_run:
|
|
95
|
+
message = (
|
|
96
|
+
f"将把「链接标注」工作表里填写的内容写回 Word:\n\nWord:{docx}\nExcel:{xlsx}\n\n"
|
|
97
|
+
+ ("同步后保留高亮。\n" if keep_highlight else "同步后自动去掉该处高亮。\n")
|
|
98
|
+
+ "\n"
|
|
99
|
+
+ ("写盘前会自动备份,确认开始同步?" if backup else "本次已取消备份,确认开始同步?")
|
|
100
|
+
)
|
|
101
|
+
if not self.ctx.confirm("确认同步标注", message):
|
|
102
|
+
self.ctx.log("已取消标注同步。", "muted")
|
|
103
|
+
return
|
|
104
|
+
self.ctx.run_steps(
|
|
105
|
+
[
|
|
106
|
+
(
|
|
107
|
+
("同步标注(预演)" if dry_run else "同步标注") + ("·保留高亮" if keep_highlight else ""),
|
|
108
|
+
lambda: api.run_marks_sync(
|
|
109
|
+
docx, custom_excel,
|
|
110
|
+
dry_run=dry_run,
|
|
111
|
+
keep_highlight=keep_highlight,
|
|
112
|
+
backup=backup, mark_zero=mark_zero,
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
]
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# ---------- 正文占位符 tab ----------
|
|
119
|
+
|
|
120
|
+
def _build_placeholder_tab(self) -> QWidget:
|
|
121
|
+
tab = QWidget()
|
|
122
|
+
layout = QVBoxLayout(tab)
|
|
123
|
+
layout.setContentsMargins(12, 12, 12, 12)
|
|
124
|
+
layout.setSpacing(10)
|
|
125
|
+
self.placeholder_backup = make_checkbutton(tab, "同步前备份;关闭则直接覆盖", True)
|
|
126
|
+
layout.addWidget(self.placeholder_backup)
|
|
127
|
+
placeholder_controls = {}
|
|
128
|
+
self.bind_defaults(
|
|
129
|
+
layout,
|
|
130
|
+
{"auto_backup": self.placeholder_backup},
|
|
131
|
+
[("占位符", "placeholder_zero")],
|
|
132
|
+
placeholder_controls,
|
|
133
|
+
)
|
|
134
|
+
self.placeholder_zero = placeholder_controls["placeholder_zero"]
|
|
135
|
+
self.tip_label(
|
|
136
|
+
tab,
|
|
137
|
+
"导出 {字段名} 到「正文信息」,填写后同步;未填保留并警告。该表与模板生成共用。",
|
|
138
|
+
)
|
|
139
|
+
actions = make_action_bar(
|
|
140
|
+
tab,
|
|
141
|
+
"开始同步",
|
|
142
|
+
lambda: self._sync_placeholders(False),
|
|
143
|
+
secondary=[
|
|
144
|
+
("导出/刷新占位符", self._export_placeholders),
|
|
145
|
+
("仅预演同步", lambda: self._sync_placeholders(True)),
|
|
146
|
+
],
|
|
147
|
+
primary_index=2,
|
|
148
|
+
)
|
|
149
|
+
layout.addWidget(actions)
|
|
150
|
+
layout.addStretch(1)
|
|
151
|
+
return tab
|
|
152
|
+
|
|
153
|
+
def _export_placeholders(self) -> None:
|
|
154
|
+
if not self.ctx.require_docx():
|
|
155
|
+
return
|
|
156
|
+
docx, custom_excel = self.ctx.docx, self.ctx.excel
|
|
157
|
+
backup = self.placeholder_backup.isChecked()
|
|
158
|
+
links = self.ctx.global_settings()["excel_links"]
|
|
159
|
+
totals = self.ctx.global_settings()["totals_formula"]
|
|
160
|
+
xlsx = api.workbook_path(docx, custom_excel)
|
|
161
|
+
if xlsx.exists():
|
|
162
|
+
steps = [("导出/刷新占位符", lambda: api.run_placeholder_export(docx, custom_excel, backup=backup))]
|
|
163
|
+
else:
|
|
164
|
+
if not self.ctx.confirm(
|
|
165
|
+
"尚未生成工作簿",
|
|
166
|
+
f"未找到工作簿:\n{xlsx}\n\n是否现在先执行一次完整导出(表格 + 链接标注),再补齐占位符骨架?",
|
|
167
|
+
):
|
|
168
|
+
self.ctx.log("已取消导出。", "muted")
|
|
169
|
+
return
|
|
170
|
+
steps = [
|
|
171
|
+
("导出表格到 Excel(含链接标注)", lambda: api.run_export(
|
|
172
|
+
docx, custom_excel, backup=backup,
|
|
173
|
+
with_excel_links=links, totals_formula=totals,
|
|
174
|
+
)),
|
|
175
|
+
("导出/刷新占位符", lambda: api.run_placeholder_export(
|
|
176
|
+
docx, custom_excel, backup=backup,
|
|
177
|
+
)),
|
|
178
|
+
]
|
|
179
|
+
self.ctx.run_steps(steps)
|
|
180
|
+
|
|
181
|
+
def _sync_placeholders(self, dry_run: bool) -> None:
|
|
182
|
+
if not self.ctx.require_docx():
|
|
183
|
+
return
|
|
184
|
+
docx, custom_excel = self.ctx.docx, self.ctx.excel
|
|
185
|
+
xlsx = api.workbook_path(docx, custom_excel)
|
|
186
|
+
backup = self.placeholder_backup.isChecked()
|
|
187
|
+
placeholder_zero = self.placeholder_zero.currentData()
|
|
188
|
+
if not xlsx.exists():
|
|
189
|
+
self.ctx.log(f"未找到工作簿:{xlsx}\n请先执行“导出/刷新占位符”。", "error")
|
|
190
|
+
return
|
|
191
|
+
if not dry_run:
|
|
192
|
+
message = (
|
|
193
|
+
f"将按「正文信息」表填写的值替换 Word 里的 {{字段名}} 占位符:\n\n"
|
|
194
|
+
f"Word:{docx}\nExcel:{xlsx}\n\n"
|
|
195
|
+
"未填值的占位符保留原样并逐条警告。\n"
|
|
196
|
+
+ ("写盘前会自动备份,确认开始同步?" if backup else "本次已取消备份,确认开始同步?")
|
|
197
|
+
)
|
|
198
|
+
if not self.ctx.confirm("确认同步占位符", message):
|
|
199
|
+
self.ctx.log("已取消占位符同步。", "muted")
|
|
200
|
+
return
|
|
201
|
+
self.ctx.run_steps(
|
|
202
|
+
[
|
|
203
|
+
(
|
|
204
|
+
"同步占位符(预演)" if dry_run else "同步占位符",
|
|
205
|
+
lambda: api.run_placeholder_sync(
|
|
206
|
+
docx, custom_excel, dry_run=dry_run,
|
|
207
|
+
backup=backup, placeholder_zero=placeholder_zero,
|
|
208
|
+
),
|
|
209
|
+
)
|
|
210
|
+
]
|
|
178
211
|
)
|