新增业务打印绑定功能,整合打印模板与业务数据的映射配置,优化打印数据生成逻辑。新增免密接口,支持桌面端打印模板的查询与列表展示,提升用户体验和系统的实时数据同步能力。同时,重构相关控制器以增强系统的可维护性和扩展性。

This commit is contained in:
geht
2026-05-14 10:43:51 +08:00
parent 642cecb04d
commit 8bcc34aee0
649 changed files with 18804 additions and 70 deletions

View File

@@ -129,6 +129,7 @@
>
同名自动匹配
</a-button>
<a-button size="small" @click="addPlaceholderParamRow">添加空占位</a-button>
</a-space>
</template>
@@ -590,14 +591,35 @@
function rebuildMappingRows() {
const saved = unref(savedMappingRef);
mappingRows.value = unref(tplFields).map((t) => {
const templateField = t.bindField;
const tplList = unref(tplFields);
const tplByField = new Map(tplList.map((t) => [t.bindField, t]));
// 先按已保存 JSON 的顺序收录键(含「模板未再声明」的占位如 Parameter3 + 空 bizField避免仅依赖解析结果而丢行
const orderedKeys: string[] = [];
const seen = new Set<string>();
for (const s of saved) {
const k = (s.templateField || '').trim();
if (!k || seen.has(k)) continue;
seen.add(k);
orderedKeys.push(k);
}
for (const t of tplList) {
const k = (t.bindField || '').trim();
if (!k || seen.has(k)) continue;
seen.add(k);
orderedKeys.push(k);
}
mappingRows.value = orderedKeys.map((templateField) => {
const t = tplByField.get(templateField);
const hit = saved.find((x) => x.templateField === templateField);
return {
templateField,
bizField: hit?.bizField,
elementType: t.elementType,
titleHint: t.titleHint,
bizField: hit?.bizField ?? '',
elementType: t?.elementType || 'param',
titleHint:
t?.titleHint ||
(!t ? '已保存映射(当前模板 JSON 未声明该占位,仍可按空业务字段输出)' : ''),
};
});
}
@@ -615,10 +637,26 @@
mappingRows.value = [...unref(mappingRows)];
}
/** 手动增加仅输出空值的模板占位(写入 savedMappingRef 并重建行,避免再次「解析模板」时丢失) */
function addPlaceholderParamRow() {
const raw = window.prompt(
'请输入模板参数 bindField如 Parameter3。业务字段将固定为空字符串不参与业务 JSON 取值。',
'Parameter3',
);
const k = (raw || '').trim();
if (!k) return;
if (unref(savedMappingRef).some((x) => x.templateField === k) || unref(mappingRows).some((r) => r.templateField === k)) {
createMessage.warning('该占位已存在');
return;
}
savedMappingRef.value = [...unref(savedMappingRef), { templateField: k, bizField: '' }];
rebuildMappingRows();
}
function buildFieldMappingJson() {
const arr = unref(mappingRows)
.filter((r) => r.bizField)
.map((r) => ({ templateField: r.templateField, bizField: r.bizField }));
.filter((r) => r.templateField)
.map((r) => ({ templateField: r.templateField, bizField: r.bizField ?? '' }));
return JSON.stringify(arr);
}