wwt-certificate-tool 1.2.76 → 1.2.77

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 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.76</title>
6
+ <title>WWT 金蝶凭证工具 · 纯前端版 P1.2.77</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}
@@ -328,7 +328,7 @@ input[data-f="field"][list^="dlGe_"]::placeholder{color:#a8861f;font-style:itali
328
328
  <div class="brand">
329
329
  <span class="logo">WWT</span>
330
330
  <div>
331
- <h1>金蝶凭证工具 <span class="ver">P1.2.76</span></h1>
331
+ <h1>金蝶凭证工具 <span class="ver">P1.2.77</span></h1>
332
332
  <div class="sub">纯前端离线版 · 双击即用 · 数据只存在本机,不上传任何服务器</div>
333
333
  </div>
334
334
  </div>
@@ -566,7 +566,8 @@ input[data-f="field"][list^="dlGe_"]::placeholder{color:#a8861f;font-style:itali
566
566
  <div class="dv-header">
567
567
  <b>📋 数据浏览/编辑</b>
568
568
  <span class="dv-hint">(在线修改行/复制行/加行/删除行,再点「保存到 xlsx」回写到本地数据。改动即生效)</span>
569
- <button class="btn ghost" style="margin-left:auto" onclick="UI.closeDataViewer()">✕ 关闭</button>
569
+ <button class="btn" style="margin-left:auto" onclick="UI.closeDataViewer()">← 返回</button>
570
+ <button class="btn ghost" onclick="UI.closeDataViewer()">✕ 关闭</button>
570
571
  </div>
571
572
  <div class="dv-body">
572
573
  <div class="dv-left" id="dvLeft"></div>
@@ -2766,7 +2767,7 @@ const S = window.__STATE__ = {
2766
2767
  };
2767
2768
 
2768
2769
  /* ---------------- 版本 & 框架自动更新(只更新程序本身,本地数据/规则不动) ---------------- */
2769
- const WWT_VER=(function(){const raw='P1.2.76';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
2770
+ const WWT_VER=(function(){const raw='P1.2.77';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
2770
2771
  const UPD_URL_KEY='wwt_fe_updurl';
2771
2772
  // 默认更新源:Gitee 上本项目的 version.json(API 接口,浏览器可直接跨域读)
2772
2773
  const DEFAULT_UPD_URL='https://gitee.com/api/v5/repos/wwtmrhu/certificate-generation/contents/dist/version.json';
@@ -4493,30 +4494,56 @@ function redrawRuleForm(){
4493
4494
  * ④ 生成凭证
4494
4495
  * ============================================================ */
4495
4496
 
4496
- // 【P1.2.60】多规则全选生成时,按以下优先级排序,让同类/同付款方式规则的凭证号相邻
4497
+ /* 【P1.2.77】多规则全选生成时的默认排序(按用户 2026-11-25 截图要求重排)
4498
+ * 结算方式分组顺序:挂账(最前) → 结算费用 → 转未结算 → 银行F/现金流 → 入库F
4499
+ * → 冲F/S → 应付出 → 对账S/对账F(最后)
4500
+ * 这样:①挂账排 119# 入库未确认之前;②127-131/132/156#(应付出) 与 149#/150#(对账S) 相邻;
4501
+ * ③对账类凭证排最后;④现金流银行F 145-148# 排在「转未结算」之后;⑤入库F → 冲F/S → S组和F对账。
4502
+ * 用「组号」而非凭证号判断——凭证号每次生成会变,规则名/结算方式才是稳定的识别依据。
4503
+ */
4497
4504
  const GEN_PRIORITY_SOURCES = ['入库未结算','出库未确认','调拨未确认','在修车','已完工未结算'];
4498
- const GEN_PRIORITY_PAYMENTS = ['对冲F','对账S','对账F','还件F','入库F','冲转S','冲转F','挂账','冲预收','冲预付','现金S','银行S','现金F','银行F'];
4505
+ // 按顺序匹配:rank 越小越先生成;同一 rank 内保持规则原顺序(稳定排序)
4506
+ const GEN_PAY_GROUPS = [
4507
+ {rank:0, keys:['挂账']},
4508
+ {rank:2, keys:['结算费用']},
4509
+ {rank:3, keys:['转未结算','未结算']},
4510
+ {rank:4, keys:['现金银行','银行F','现金F','银行S','现金S']}, // 现金流 145-148#,排在转未结算之后
4511
+ {rank:5, keys:['入库F']},
4512
+ {rank:6, keys:['冲转S','冲转F','对冲F']},
4513
+ {rank:7, keys:['应付出']},
4514
+ {rank:8, keys:['对冲S','对账S','对账F','对账']}, // 对账/对冲S 类排最后
4515
+ {rank:9, keys:['冲预收','冲预付','还件F']},
4516
+ ];
4517
+ // rank=1 留给「无结算方式」的规则(如 119#入库未确认),紧跟挂账组之后
4499
4518
  function _uClean(s){ return String(s==null?'':s).trim(); }
4519
+ // 结算方式文本(只取条件里的「结算方式/付款方式/支付方式」字段值)——绝对优先于规则名
4520
+ function _payTexts(r){
4521
+ const out=[];
4522
+ (r.conditions||[]).forEach(c=>{
4523
+ if(/付款方式|支付方式|结算方式/.test(_uClean(c.field||''))) out.push(_uClean(c.value||''));
4524
+ });
4525
+ return out;
4526
+ }
4527
+ // 两轮匹配:第①轮只用结算方式条件值,第②轮才用规则名兜底(避免规则名里的「对冲F」盖过条件里的「应付出」)
4528
+ function _matchPayGroup(r){
4529
+ const pays=_payTexts(r), name=_uClean(r.name||'');
4530
+ for(const t of pays){ for(const g of GEN_PAY_GROUPS){ for(const k of g.keys) if(t.indexOf(k)>=0) return {key:k,rank:g.rank}; } }
4531
+ for(const g of GEN_PAY_GROUPS){ for(const k of g.keys) if(name.indexOf(k)>=0) return {key:k,rank:g.rank}; }
4532
+ return null;
4533
+ }
4500
4534
  function detectRulePayment(r){
4501
- const conds=r.conditions||[];
4502
- for(const c of conds){
4503
- const f=_uClean(c.field||'');
4504
- if(/付款方式|支付方式|结算方式/.test(f)){
4505
- const v=_uClean(c.value||'');
4506
- for(const p of GEN_PRIORITY_PAYMENTS) if(v.indexOf(p)>=0) return p;
4507
- }
4508
- }
4509
- const name=_uClean(r.name||'');
4510
- for(const p of GEN_PRIORITY_PAYMENTS) if(name.indexOf(p)>=0) return p;
4511
- return '';
4535
+ const m=_matchPayGroup(r); return m?m.key:'';
4536
+ }
4537
+ function detectRuleRank(r){
4538
+ const m=_matchPayGroup(r); return m?m.rank:null;
4512
4539
  }
4513
4540
  function rulePriorityKey(r){
4541
+ const rank=detectRuleRank(r);
4542
+ if(rank!==null) return [0, rank]; // 有结算方式的:按分组排(挂账最前、对账最后)
4543
+ // 无结算方式的规则(如 119#入库未确认):rank=1,紧跟挂账组之后、结算费用之前
4514
4544
  const src=_uClean(C.normSource(r.source||''));
4515
- for(let i=0;i<GEN_PRIORITY_SOURCES.length;i++) if(src.indexOf(GEN_PRIORITY_SOURCES[i])>=0) return [0,i];
4516
- const pay=detectRulePayment(r);
4517
- const pi=GEN_PRIORITY_PAYMENTS.indexOf(pay);
4518
- if(pi>=0) return [1,pi];
4519
- return [2,0];
4545
+ for(let i=0;i<GEN_PRIORITY_SOURCES.length;i++) if(src.indexOf(GEN_PRIORITY_SOURCES[i])>=0) return [0,1,i];
4546
+ return [0,1,99];
4520
4547
  }
4521
4548
  function sortRulesForGen(rules){
4522
4549
  return rules.slice().sort((a,b)=>{
@@ -5924,7 +5951,7 @@ async function init(){
5924
5951
  }
5925
5952
  }
5926
5953
  }
5927
- // 【P1.2.76】资产基础表(资产位置表/资产类别表)随其它内置表在启动时一并补全,
5954
+ // 【P1.2.77】资产基础表(资产位置表/资产类别表)随其它内置表在启动时一并补全,
5928
5955
  // 仅在用户未上传(表缺失或空)时补,绝不覆盖用户已上传的数据。
5929
5956
  const AP=window.__ASSET_PRESET__||{};
5930
5957
  for(const k of Object.keys(AP)){
@@ -6241,7 +6268,7 @@ function _dvFilter(){
6241
6268
 
6242
6269
 
6243
6270
  /* ============================================================
6244
- * ⑨ 资产卡片生成引擎 (P1.2.76)
6271
+ * ⑨ 资产卡片生成引擎 (P1.2.77)
6245
6272
  * 数据源:库存.xls(厂牌含"资产工具") + 入库明细.xls(零件编码关联)
6246
6273
  * 输出:金蝶资产卡片引入文件(37列 + 可选供应商/客户/付款方式列)
6247
6274
  * ============================================================ */
@@ -6394,7 +6421,7 @@ const ASSET = (function(){
6394
6421
  const posCode=posIdx.byName[placeName]||'';
6395
6422
  if(!posCode) stats.posMiss++;
6396
6423
  const posName=posCode?(posIdx.byCode[posCode]||placeName):placeName;
6397
- // 使用部门(P1.2.76):
6424
+ // 使用部门(P1.2.77):
6398
6425
  // ① 若启用「默认费用部门」→ 全部卡片强制用用户填的名称+编码(不分部门的用户)
6399
6426
  // ② 否则按 费用部门 → 仓位 → 库号 推断,并经过 normPlace 归一化
6400
6427
  // (费用部门为空时随位置走,如「福特仓」→「广州维修基地」)
@@ -6444,7 +6471,7 @@ const ASSET = (function(){
6444
6471
  })();
6445
6472
 
6446
6473
 
6447
- /* ===== P1.2.76 模块9 UI 交互 ===== */
6474
+ /* ===== P1.2.77 模块9 UI 交互 ===== */
6448
6475
  const ASSET_UI=(function(){
6449
6476
  function log(msg){ const l=$('assetLog'); if(!l)return; l.classList.add('on');
6450
6477
  l.innerHTML+='<div>'+new Date().toLocaleTimeString('zh-CN')+' '+esc(msg)+'</div>'; l.scrollTop=l.scrollHeight; }
@@ -6548,7 +6575,7 @@ const ASSET_UI=(function(){
6548
6575
  el._assetBound=true;
6549
6576
  el.addEventListener('change',async e=>{ await onFiles(Array.from(e.target.files||[])); e.target.value=''; });
6550
6577
  }
6551
- // 【P1.2.76】拖拽上传:把 库存.xls / 入库明细.xls 拖到按钮上即可(复用上传数据页的 .dropzone 高亮样式)
6578
+ // 【P1.2.77】拖拽上传:把 库存.xls / 入库明细.xls 拖到按钮上即可(复用上传数据页的 .dropzone 高亮样式)
6552
6579
  const dz=$('assetDrop');
6553
6580
  if(dz && !dz._assetDropBound){
6554
6581
  dz._assetDropBound=true;
@@ -6849,7 +6876,7 @@ if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',
6849
6876
  else init();
6850
6877
  })();
6851
6878
 
6852
- /* ===== P1.2.76 内置:资产位置表 / 资产类别表 默认数据 ===== */
6879
+ /* ===== P1.2.77 内置:资产位置表 / 资产类别表 默认数据 ===== */
6853
6880
  window.__ASSET_PRESET__={
6854
6881
  '资产位置表':[
6855
6882
  {编码:'AOA001',地址:'广州市花都区先科一路',详细地址:'广州市花都区先科一路'},
package/dist/version.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "ver": "P1.2.76",
3
- "npm": "1.2.76",
4
- "url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.76/dist/app.html",
5
- "url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.76/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.76.html",
7
- "note": "㉙ 【P1.2.76】修复使用部门:费用部门为空时随资产位置推断(福特仓→广州维修基地/编码003.003);新增「默认费用部门」勾选框,可自填名称+编码(如 006 公司费用)统一填入。"
2
+ "ver": "P1.2.77",
3
+ "npm": "1.2.77",
4
+ "url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.77/dist/app.html",
5
+ "url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.77/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.77.html",
7
+ "note": "㉚ 【P1.2.77】多规则生成默认排序重排:挂账最前→(无结算方式如119#)→结算费用→转未结算→现金流银行F→入库F→冲F/S→应付出→对账S/F最后(按结算方式判定,非凭证号);数据浏览/编辑抽屉增加「←返回」按钮。"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wwt-certificate-tool",
3
- "version": "1.2.76",
3
+ "version": "1.2.77",
4
4
  "description": "WWT 金蝶凭证工具 · 纯前端版(离线单文件 HTML,双击即用)",
5
5
  "keywords": [
6
6
  "WWT",