wwt-certificate-tool 1.2.33 → 1.2.34
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/dist/app.html +59 -3
- package/dist/version.json +6 -6
- package/package.json +1 -1
package/dist/app.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<title>WWT 金蝶凭证工具 · 纯前端版 P1.2.
|
|
6
|
+
<title>WWT 金蝶凭证工具 · 纯前端版 P1.2.34</title>
|
|
7
7
|
<style>*{box-sizing:border-box;margin:0;padding:0}
|
|
8
8
|
body{font-family:"Microsoft YaHei","PingFang SC",-apple-system,Segoe UI,sans-serif;font-size:13px;color:#1f2328;background:#f4f6f9;line-height:1.6}
|
|
9
9
|
h1{font-size:17px;font-weight:600}
|
|
@@ -305,7 +305,7 @@ tr.bad:hover td{background:#fbe9e9}
|
|
|
305
305
|
<div class="brand">
|
|
306
306
|
<span class="logo">WWT</span>
|
|
307
307
|
<div>
|
|
308
|
-
<h1>金蝶凭证工具 <span class="ver">P1.2.
|
|
308
|
+
<h1>金蝶凭证工具 <span class="ver">P1.2.34</span></h1>
|
|
309
309
|
<div class="sub">纯前端离线版 · 双击即用 · 数据只存在本机,不上传任何服务器</div>
|
|
310
310
|
</div>
|
|
311
311
|
</div>
|
|
@@ -2643,6 +2643,16 @@ window.WWT_ENGINE = (function () {
|
|
|
2643
2643
|
}
|
|
2644
2644
|
return (rule.lines || []).slice();
|
|
2645
2645
|
}
|
|
2646
|
+
|
|
2647
|
+
// 【P1.2.34】规则级排除:当一行满足 rule.excludeWhen 全部条件时,
|
|
2648
|
+
// 本规则不处理,且不计入「被本规则排除」/「应处理子集漏命中」任何审计统计——
|
|
2649
|
+
// 业务上等同于这条行从未出现在本规则的视野里(用于「厂牌=资产工具库」这类
|
|
2650
|
+
// 由其他专门流程处理的合法跳过场景,避免覆盖率审计误报警报)。
|
|
2651
|
+
function isExcludedByRule(row, rule, curSrc, idx) {
|
|
2652
|
+
const ex = rule && rule.excludeWhen;
|
|
2653
|
+
if (!ex || !ex.length) return false;
|
|
2654
|
+
return evalConditions(row, ex, rule.excludeLogic || "AND", curSrc, idx);
|
|
2655
|
+
}
|
|
2646
2656
|
function linesKey(lines) {
|
|
2647
2657
|
return JSON.stringify(lines, (k, v) => (k === "_uid" ? undefined : v));
|
|
2648
2658
|
}
|
|
@@ -2705,6 +2715,8 @@ window.WWT_ENGINE = (function () {
|
|
|
2705
2715
|
for (let i = 0; i < rowsAll.length; i++) {
|
|
2706
2716
|
if (usedRows[curSrc].has(i)) continue;
|
|
2707
2717
|
const row = rowsAll[i];
|
|
2718
|
+
// 【P1.2.34】规则级排除:满足 excludeWhen 的行整条跳过,不进 rowsIn、不进 audit
|
|
2719
|
+
if (isExcludedByRule(row, rule, curSrc, idx)) continue;
|
|
2708
2720
|
if (evalConditions(row, rule.conditions || [], rule.logic || "AND", curSrc, idx)) {
|
|
2709
2721
|
rowsIn.push({ row: row, _i: i });
|
|
2710
2722
|
}
|
|
@@ -3015,6 +3027,8 @@ window.WWT_ENGINE = (function () {
|
|
|
3015
3027
|
for (let i = 0; i < rowsAll.length; i++) {
|
|
3016
3028
|
if (usedRows.has(i)) continue;
|
|
3017
3029
|
const row = rowsAll[i];
|
|
3030
|
+
// 【P1.2.34】规则级排除:跳过 excludeWhen 命中的行
|
|
3031
|
+
if (isExcludedByRule(row, r, curSrc, idx)) continue;
|
|
3018
3032
|
if (evalConditions(row, r.conditions || [], r.logic || "AND", curSrc, idx)) {
|
|
3019
3033
|
rowsIn.push({ row: row, _i: i });
|
|
3020
3034
|
}
|
|
@@ -3167,9 +3181,16 @@ window.WWT_ENGINE = (function () {
|
|
|
3167
3181
|
* excludedRows = 源表里不满足本规则的全部 = 条件 → 按规则就不该处理,不算遗漏
|
|
3168
3182
|
* neverMatchedRows = candidatesMissed(兼容旧字段名) */
|
|
3169
3183
|
const candidatesMissed = [], excludedRows = [];
|
|
3184
|
+
let ruleExcludedCount = 0, ruleExcludedAmount = 0;
|
|
3170
3185
|
for (let i = 0; i < rowsAll.length; i++) {
|
|
3171
3186
|
if (matchedIdxs.has(i)) continue;
|
|
3172
3187
|
const row = rowsAll[i];
|
|
3188
|
+
// 【P1.2.34】规则级排除:满足 excludeWhen 的行不进任何 audit 统计
|
|
3189
|
+
if (isExcludedByRule(row, rule, curSrc, idx)) {
|
|
3190
|
+
ruleExcludedCount++;
|
|
3191
|
+
if (amountCol) ruleExcludedAmount += num(row[amountCol]);
|
|
3192
|
+
continue;
|
|
3193
|
+
}
|
|
3173
3194
|
const rec = {
|
|
3174
3195
|
原单号: clean(row[meta.no]) || clean(row["原单号"]),
|
|
3175
3196
|
付款方式: clean(row["付款方式"]) || clean(row["支付方式"]),
|
|
@@ -3219,6 +3240,9 @@ window.WWT_ENGINE = (function () {
|
|
|
3219
3240
|
candidate_missed_clipped: candidatesMissed.length >= 200, // 是否被 200 上限截断
|
|
3220
3241
|
excluded: excludedRows.length, // 被本规则排除(不算遗漏)
|
|
3221
3242
|
excluded_clipped: excludedRows.length >= 200,
|
|
3243
|
+
// 【P1.2.34】规则级排除:满足 excludeWhen 的行彻底从 audit 视野消失(业务上合法跳过)
|
|
3244
|
+
rule_excluded: ruleExcludedCount,
|
|
3245
|
+
rule_excluded_amount: round2(ruleExcludedAmount),
|
|
3222
3246
|
// 兼容旧字段(仍叫 never_matched,但其内容仅含真正应处理子集漏命中的行)
|
|
3223
3247
|
never_matched: candidatesMissed.length,
|
|
3224
3248
|
unmatched_amount: round2(unmatchedAmt),
|
|
@@ -3394,6 +3418,7 @@ window.WWT_ENGINE = (function () {
|
|
|
3394
3418
|
buildIndex, getField, compare, evalConditions, applyTransform,
|
|
3395
3419
|
parseAmtExpr, sumAmtExpr, evalAmtExpr, isAutoDiff, splitFieldsOf,
|
|
3396
3420
|
calcDimValues, leafSubject, resolveEffectiveLines, lookupTypeDim,
|
|
3421
|
+
isExcludedByRule,
|
|
3397
3422
|
generate, balanceCheck, buildKingdee, detect, auditRule,
|
|
3398
3423
|
lookupMap, lookupTypeMap,
|
|
3399
3424
|
};
|
|
@@ -3418,7 +3443,7 @@ const S = window.__STATE__ = {
|
|
|
3418
3443
|
};
|
|
3419
3444
|
|
|
3420
3445
|
/* ---------------- 版本 & 框架自动更新(只更新程序本身,本地数据/规则不动) ---------------- */
|
|
3421
|
-
const WWT_VER=(function(){const raw='P1.2.
|
|
3446
|
+
const WWT_VER=(function(){const raw='P1.2.34';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
|
|
3422
3447
|
const UPD_URL_KEY='wwt_fe_updurl';
|
|
3423
3448
|
// 默认更新源:Gitee 上本项目的 version.json(API 接口,浏览器可直接跨域读)
|
|
3424
3449
|
const DEFAULT_UPD_URL='https://gitee.com/api/v5/repos/wwtmrhu/certificate-generation/contents/dist/version.json';
|
|
@@ -4703,6 +4728,10 @@ function renderRules(){
|
|
|
4703
4728
|
const conds=(r.conditions||[]).map(c=>'<span class="cond"><b>'+esc(c.field)+'</b> '+esc(c.op)+' '+esc(c.value)+'</span>').join('');
|
|
4704
4729
|
let body='<div class="rulebody" id="rb'+i+'">';
|
|
4705
4730
|
body+='<div style="margin:6px 0"><b>命中条件</b>('+(r.logic||'AND')+'):'+(conds||'<span style="color:#8b949e">无条件(全表命中)</span>')+'</div>';
|
|
4731
|
+
if((r.excludeWhen||[]).length){
|
|
4732
|
+
const exc=r.excludeWhen.map(c=>'<span class="cond"><b>'+esc(c.field)+'</b> '+esc(c.op)+' '+esc(c.value)+'</span>').join('');
|
|
4733
|
+
body+='<div style="background:#fff7e6;padding:6px 8px;border-radius:4px;margin:4px 0"><b style="color:#d46b08">排除条件</b>('+(r.excludeLogic||'AND')+'):'+exc+' <span style="color:#888;font-size:11px">→ 满足的行整条跳过,不进 audit</span></div>';
|
|
4734
|
+
}
|
|
4706
4735
|
if((r.branches||[]).length){
|
|
4707
4736
|
body+='<div><b>分支</b>:'+r.branches.map((b,bi)=>
|
|
4708
4737
|
'<div class="linechip"><span class="tag b">分支'+(bi+1)+' '+esc(b.name||'')+'</span>'+
|
|
@@ -4972,6 +5001,18 @@ function ruleFormHTML(){
|
|
|
4972
5001
|
(r.conditions||[]).map((c,i)=>condRowHTML(i,c)).join('')+'</div>'+
|
|
4973
5002
|
'<button class="mini" onclick="UI.addCond()">+ 加条件</button></div>';
|
|
4974
5003
|
|
|
5004
|
+
// 【P1.2.34】规则级排除:满足条件的行整条规则不处理,且不计入覆盖率审计
|
|
5005
|
+
h+='<div class="sec" style="background:#fff7e6;border-left:3px solid #fa8c16"><h4>排除条件(满足这些条件的行<b>整条不处理</b>,不计入审计·不显示在排除/漏命中里)</h4>'+
|
|
5006
|
+
'<div style="font-size:11.5px;color:#888;margin:3px 0">典型场景:「厂牌 = 资产工具库」时由其他流程直接处理,本规则不参与。留空 = 不启用排除。</div>'+
|
|
5007
|
+
'<div class="row"><span class="w60">逻辑</span>'+
|
|
5008
|
+
'<select class="w80" id="rf_exclogic">'+
|
|
5009
|
+
'<option value="AND"'+((r.excludeLogic||'AND')==='AND'?' selected':'')+'>AND(全部满足)</option>'+
|
|
5010
|
+
'<option value="OR"'+(r.excludeLogic==='OR'?' selected':'')+'>OR(任一满足)</option>'+
|
|
5011
|
+
'</select></div>'+
|
|
5012
|
+
'<div id="rf_exconds">'+
|
|
5013
|
+
(r.excludeWhen||[]).map((c,i)=>condRowHTML(i,c)).join('')+'</div>'+
|
|
5014
|
+
'<button class="mini" onclick="UI.addExcludeCond()">+ 加排除条件</button></div>';
|
|
5015
|
+
|
|
4975
5016
|
h+='<div class="sec"><h4>分支(可选:按条件走不同分录;命中第一个分支就停)</h4><div id="rf_branches">'+
|
|
4976
5017
|
(r.branches||[]).map((b,bi)=>branchHTML(bi,b)).join('')+'</div>'+
|
|
4977
5018
|
'<button class="mini" onclick="UI.addBranch()">+ 加分支</button></div>';
|
|
@@ -5039,6 +5080,14 @@ function syncFormToObj(){
|
|
|
5039
5080
|
return {field:g('field').value.trim(),op:g('op').value,value:g('value').value.trim(),
|
|
5040
5081
|
logic:g('logic').value||undefined};
|
|
5041
5082
|
});
|
|
5083
|
+
// 【P1.2.34】排除条件:满足时整条规则不处理、不进 audit
|
|
5084
|
+
r.excludeLogic=$('rf_exclogic') ? $('rf_exclogic').value : 'AND';
|
|
5085
|
+
const exConds=[...document.querySelectorAll('#rf_exconds > .condrow')].map(row=>{
|
|
5086
|
+
const g=f=>row.querySelector('[data-f="'+f+'"]');
|
|
5087
|
+
return {field:g('field').value.trim(),op:g('op').value,value:g('value').value.trim(),
|
|
5088
|
+
logic:g('logic').value||undefined};
|
|
5089
|
+
});
|
|
5090
|
+
r.excludeWhen=exConds.length ? exConds : undefined;
|
|
5042
5091
|
// 分支
|
|
5043
5092
|
const bsecs=[...document.querySelectorAll('#rf_branches > [data-bi]')];
|
|
5044
5093
|
r.branches=bsecs.map(sec=>{
|
|
@@ -6680,6 +6729,13 @@ window.UI={
|
|
|
6680
6729
|
else editing.conditions.push({field:'',op:'=',value:'',logic:''});
|
|
6681
6730
|
redrawRuleForm();
|
|
6682
6731
|
},
|
|
6732
|
+
// 【P1.2.34】加排除条件:写到 #rf_exconds
|
|
6733
|
+
addExcludeCond:()=>{
|
|
6734
|
+
syncFormToObj();
|
|
6735
|
+
if(!editing.excludeWhen) editing.excludeWhen=[];
|
|
6736
|
+
editing.excludeWhen.push({field:'',op:'=',value:'',logic:''});
|
|
6737
|
+
redrawRuleForm();
|
|
6738
|
+
},
|
|
6683
6739
|
addBranch:()=>{
|
|
6684
6740
|
syncFormToObj();
|
|
6685
6741
|
editing.branches.push({name:'分支'+((editing.branches||[]).length+1),logic:'AND',conditions:[{field:'',op:'=',value:''}],lines:[]});
|
package/dist/version.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ver": "P1.2.
|
|
3
|
-
"npm": "1.2.
|
|
4
|
-
"url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.
|
|
5
|
-
"url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.
|
|
6
|
-
"url_gh": "https://api.github.com/repos/huweipei745839/certificate-generation/contents/dist/WWT%E5%87%AD%E8%AF%81%E5%B7%A5%E5%85%B7_P1.2.
|
|
7
|
-
"note": "
|
|
2
|
+
"ver": "P1.2.34",
|
|
3
|
+
"npm": "1.2.34",
|
|
4
|
+
"url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.34/dist/app.html",
|
|
5
|
+
"url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.34/dist/app.html",
|
|
6
|
+
"url_gh": "https://api.github.com/repos/huweipei745839/certificate-generation/contents/dist/WWT%E5%87%AD%E8%AF%81%E5%B7%A5%E5%85%B7_P1.2.34.html",
|
|
7
|
+
"note": "① 新增「规则级排除」机制:规则上加 excludeWhen 字段(结构同 conditions,含 excludeLogic),满足条件的行整条规则不处理,**且不进覆盖率审计**(不进 excluded_rows、不进 candidate_missed、不进任何 audit 统计);用于「厂牌=资产工具库」等由其他流程直接处理的合法跳过场景。② UI:规则编辑面板增加「排除条件」独立配置区(橙底强调),规则列表同步显示摘要;「+ 加排除条件」按钮一键加。③ auditRule 返回值新增 rule_excluded/rule_excluded_amount 字段(供后续 UI 展示)。例:「厂牌 = 资产工具库」时整条不处理、不计入审计。"
|
|
8
8
|
}
|