wwt-certificate-tool 1.2.75 → 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.75</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.75</span></h1>
331
+ <h1>金蝶凭证工具 <span class="ver">P1.2.77</span></h1>
332
332
  <div class="sub">纯前端离线版 · 双击即用 · 数据只存在本机,不上传任何服务器</div>
333
333
  </div>
334
334
  </div>
@@ -543,6 +543,12 @@ input[data-f="field"][list^="dlGe_"]::placeholder{color:#a8861f;font-style:itali
543
543
  <label>单据头起始号 <input type="number" id="assetBillStart" value="200000" style="width:100px"></label>
544
544
  <label>子表序号起始 <input type="number" id="assetSubStart" value="200000" style="width:100px"></label>
545
545
  </div>
546
+ <div class="genbar" style="margin-top:8px">
547
+ <label class="chk"><input type="checkbox" id="assetUseDefDept"> 使用默认费用部门(不分部门的行统一填下面这个)</label>
548
+ <label>默认部门名称 <input type="text" id="assetDefDeptName" value="公司费用" style="width:120px" placeholder="如 公司费用"></label>
549
+ <label>默认部门编码 <input type="text" id="assetDefDeptCode" value="006" style="width:90px" placeholder="如 006"></label>
550
+ <span style="font-size:12px;color:#666">(不勾选时:按费用部门→仓位→库号推断,费用部门空则随资产位置,如 福特仓→广州维修基地)</span>
551
+ </div>
546
552
  <div id="assetStat" class="stat"></div>
547
553
  <div id="assetBanner"></div>
548
554
  <div class="tablewrap" id="assetWrap"></div>
@@ -560,7 +566,8 @@ input[data-f="field"][list^="dlGe_"]::placeholder{color:#a8861f;font-style:itali
560
566
  <div class="dv-header">
561
567
  <b>📋 数据浏览/编辑</b>
562
568
  <span class="dv-hint">(在线修改行/复制行/加行/删除行,再点「保存到 xlsx」回写到本地数据。改动即生效)</span>
563
- <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>
564
571
  </div>
565
572
  <div class="dv-body">
566
573
  <div class="dv-left" id="dvLeft"></div>
@@ -2760,7 +2767,7 @@ const S = window.__STATE__ = {
2760
2767
  };
2761
2768
 
2762
2769
  /* ---------------- 版本 & 框架自动更新(只更新程序本身,本地数据/规则不动) ---------------- */
2763
- const WWT_VER=(function(){const raw='P1.2.75';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;})();
2764
2771
  const UPD_URL_KEY='wwt_fe_updurl';
2765
2772
  // 默认更新源:Gitee 上本项目的 version.json(API 接口,浏览器可直接跨域读)
2766
2773
  const DEFAULT_UPD_URL='https://gitee.com/api/v5/repos/wwtmrhu/certificate-generation/contents/dist/version.json';
@@ -4487,30 +4494,56 @@ function redrawRuleForm(){
4487
4494
  * ④ 生成凭证
4488
4495
  * ============================================================ */
4489
4496
 
4490
- // 【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
+ */
4491
4504
  const GEN_PRIORITY_SOURCES = ['入库未结算','出库未确认','调拨未确认','在修车','已完工未结算'];
4492
- 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#入库未确认),紧跟挂账组之后
4493
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
+ }
4494
4534
  function detectRulePayment(r){
4495
- const conds=r.conditions||[];
4496
- for(const c of conds){
4497
- const f=_uClean(c.field||'');
4498
- if(/付款方式|支付方式|结算方式/.test(f)){
4499
- const v=_uClean(c.value||'');
4500
- for(const p of GEN_PRIORITY_PAYMENTS) if(v.indexOf(p)>=0) return p;
4501
- }
4502
- }
4503
- const name=_uClean(r.name||'');
4504
- for(const p of GEN_PRIORITY_PAYMENTS) if(name.indexOf(p)>=0) return p;
4505
- 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;
4506
4539
  }
4507
4540
  function rulePriorityKey(r){
4541
+ const rank=detectRuleRank(r);
4542
+ if(rank!==null) return [0, rank]; // 有结算方式的:按分组排(挂账最前、对账最后)
4543
+ // 无结算方式的规则(如 119#入库未确认):rank=1,紧跟挂账组之后、结算费用之前
4508
4544
  const src=_uClean(C.normSource(r.source||''));
4509
- for(let i=0;i<GEN_PRIORITY_SOURCES.length;i++) if(src.indexOf(GEN_PRIORITY_SOURCES[i])>=0) return [0,i];
4510
- const pay=detectRulePayment(r);
4511
- const pi=GEN_PRIORITY_PAYMENTS.indexOf(pay);
4512
- if(pi>=0) return [1,pi];
4513
- 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];
4514
4547
  }
4515
4548
  function sortRulesForGen(rules){
4516
4549
  return rules.slice().sort((a,b)=>{
@@ -5918,7 +5951,7 @@ async function init(){
5918
5951
  }
5919
5952
  }
5920
5953
  }
5921
- // 【P1.2.75】资产基础表(资产位置表/资产类别表)随其它内置表在启动时一并补全,
5954
+ // 【P1.2.77】资产基础表(资产位置表/资产类别表)随其它内置表在启动时一并补全,
5922
5955
  // 仅在用户未上传(表缺失或空)时补,绝不覆盖用户已上传的数据。
5923
5956
  const AP=window.__ASSET_PRESET__||{};
5924
5957
  for(const k of Object.keys(AP)){
@@ -6235,7 +6268,7 @@ function _dvFilter(){
6235
6268
 
6236
6269
 
6237
6270
  /* ============================================================
6238
- * ⑨ 资产卡片生成引擎 (P1.2.75)
6271
+ * ⑨ 资产卡片生成引擎 (P1.2.77)
6239
6272
  * 数据源:库存.xls(厂牌含"资产工具") + 入库明细.xls(零件编码关联)
6240
6273
  * 输出:金蝶资产卡片引入文件(37列 + 可选供应商/客户/付款方式列)
6241
6274
  * ============================================================ */
@@ -6388,9 +6421,18 @@ const ASSET = (function(){
6388
6421
  const posCode=posIdx.byName[placeName]||'';
6389
6422
  if(!posCode) stats.posMiss++;
6390
6423
  const posName=posCode?(posIdx.byCode[posCode]||placeName):placeName;
6391
- // 使用部门
6392
- const deptName=clean(r['费用部门'])||clean(r['仓位']);
6393
- const deptCode=deptIdx[deptName]||'';
6424
+ // 使用部门(P1.2.77):
6425
+ // ① 若启用「默认费用部门」→ 全部卡片强制用用户填的名称+编码(不分部门的用户)
6426
+ // ② 否则按 费用部门 → 仓位 → 库号 推断,并经过 normPlace 归一化
6427
+ // (费用部门为空时随位置走,如「福特仓」→「广州维修基地」)
6428
+ let deptName, deptCode;
6429
+ if(opts.useDefDept){
6430
+ deptName=clean(opts.defDeptName)||'公司费用';
6431
+ deptCode=clean(opts.defDeptCode)||deptIdx[deptName]||'';
6432
+ }else{
6433
+ deptName=normPlace(clean(r['费用部门'])||clean(r['仓位'])||clean(r['库号']));
6434
+ deptCode=deptIdx[deptName]||'';
6435
+ }
6394
6436
  if(!deptCode) stats.deptMiss++;
6395
6437
  const cost=isLow(cg.name)?COST.low:COST.fixed;
6396
6438
  // 供应商/客户/付款方式
@@ -6429,7 +6471,7 @@ const ASSET = (function(){
6429
6471
  })();
6430
6472
 
6431
6473
 
6432
- /* ===== P1.2.75 模块9 UI 交互 ===== */
6474
+ /* ===== P1.2.77 模块9 UI 交互 ===== */
6433
6475
  const ASSET_UI=(function(){
6434
6476
  function log(msg){ const l=$('assetLog'); if(!l)return; l.classList.add('on');
6435
6477
  l.innerHTML+='<div>'+new Date().toLocaleTimeString('zh-CN')+' '+esc(msg)+'</div>'; l.scrollTop=l.scrollHeight; }
@@ -6466,6 +6508,9 @@ const ASSET_UI=(function(){
6466
6508
  acctFrom: $('acctDateFrom')?$('acctDateFrom').value:'same',
6467
6509
  billStart: $('assetBillStart')?$('assetBillStart').value:'200000',
6468
6510
  subStart: $('assetSubStart')?$('assetSubStart').value:'200000',
6511
+ useDefDept: !!$('assetUseDefDept')?.checked,
6512
+ defDeptName: $('assetDefDeptName')?$('assetDefDeptName').value:'公司费用',
6513
+ defDeptCode: $('assetDefDeptCode')?$('assetDefDeptCode').value:'006',
6469
6514
  });
6470
6515
  if(!r.ok){ $('assetBanner').innerHTML='<div class="banner err">❌ '+esc(r.msg)+'</div>'; toast(r.msg); return; }
6471
6516
  S.assetResult=r;
@@ -6530,7 +6575,7 @@ const ASSET_UI=(function(){
6530
6575
  el._assetBound=true;
6531
6576
  el.addEventListener('change',async e=>{ await onFiles(Array.from(e.target.files||[])); e.target.value=''; });
6532
6577
  }
6533
- // 【P1.2.75】拖拽上传:把 库存.xls / 入库明细.xls 拖到按钮上即可(复用上传数据页的 .dropzone 高亮样式)
6578
+ // 【P1.2.77】拖拽上传:把 库存.xls / 入库明细.xls 拖到按钮上即可(复用上传数据页的 .dropzone 高亮样式)
6534
6579
  const dz=$('assetDrop');
6535
6580
  if(dz && !dz._assetDropBound){
6536
6581
  dz._assetDropBound=true;
@@ -6831,7 +6876,7 @@ if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',
6831
6876
  else init();
6832
6877
  })();
6833
6878
 
6834
- /* ===== P1.2.75 内置:资产位置表 / 资产类别表 默认数据 ===== */
6879
+ /* ===== P1.2.77 内置:资产位置表 / 资产类别表 默认数据 ===== */
6835
6880
  window.__ASSET_PRESET__={
6836
6881
  '资产位置表':[
6837
6882
  {编码:'AOA001',地址:'广州市花都区先科一路',详细地址:'广州市花都区先科一路'},
package/dist/version.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "ver": "P1.2.75",
3
- "npm": "1.2.75",
4
- "url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.75/dist/app.html",
5
- "url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.75/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.75.html",
7
- "note": "㉘ 【P1.2.75】模块⑨资产卡片上传区支持拖拽:把 库存.xls / 入库明细.xls 直接拖到上传按钮即可导入,拖拽时有高亮提示。"
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.75",
3
+ "version": "1.2.77",
4
4
  "description": "WWT 金蝶凭证工具 · 纯前端版(离线单文件 HTML,双击即用)",
5
5
  "keywords": [
6
6
  "WWT",