fix(client): 财务汇总下拉候选改全量往来单位并修占位叠词与表头垂直居中(验收反馈)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-07-14 13:10:11 +08:00
parent 4bd083f2eb
commit 94a5f437a5
7 changed files with 174 additions and 139 deletions
+14 -10
View File
@@ -115,7 +115,7 @@
<div class="sec-head"><h2>应收 / 应付 汇总</h2><span class="sh-sub">按往来单位 · 点击行查看流水</span></div>
<div class="table"><table>
<thead><tr>
<th><div class="th-party-wrap"><span>往来单位</span><div class="combo" id="sumPartyCombo" onclick="openSumPartyFilter(this)"><input id="sumPartyInput" readonly placeholder="搜索往来单位"><span class="caf" id="sumPartyCaf" onclick="sumPartyCafClick(event)"><svg viewBox="0 0 24 24" stroke-width="2"><use href="#i-chevron-down"/></svg></span></div></div></th>
<th><div class="th-party-wrap"><span>往来单位</span><div class="combo" id="sumPartyCombo" onclick="openSumPartyFilter(this)"><input id="sumPartyInput" readonly placeholder="往来单位"><span class="caf" id="sumPartyCaf" onclick="sumPartyCafClick(event)"><svg viewBox="0 0 24 24" stroke-width="2"><use href="#i-chevron-down"/></svg></span></div></div></th>
<th class="num">应收</th><th class="num">应付</th><th class="num">净额</th><th class="act">操作</th>
</tr></thead>
<tbody id="sumBody"></tbody>
@@ -189,23 +189,27 @@ const SUMMARY=[
];
function yuan(n){ return '¥'+n.toLocaleString(); }
// 汇总表头「往来单位」下拉筛选(对齐 ComboSearchField:单选精确匹配一行,非
// 关键字子串过滤;候选=当前汇总行往来单位,搜索口径=显示口径,不用全量往来
// 单位库,避免选到无余额单位出空表)
let sumPartyId=null; // 选中的 SUMMARY 下标;null=全部
// 关键字子串过滤;验收反馈改版:候选=全量往来单位(与收支流水 toolbar 往来
// 单位筛选同源),而非只列当前汇总行里出现的单位——选中一个汇总没有余额
// 行的单位时,走既有「没有匹配的往来单位」空态)。
// ALL_PARTNERS 模拟真实 allPartnersProvider 全量库:含 SUMMARY 全部单位 +
// 1 个汇总里没有余额行的「鼎丰超市」,用于还原空态场景。
const ALL_PARTNERS=[...SUMMARY.map(s=>s.name),'鼎丰超市'];
let sumPartyName=null; // 选中的往来单位名;null=全部
function openSumPartyFilter(t){
openSearchMenu(t, SUMMARY.map((s,i)=>({v:i,label:s.name,sel:i===sumPartyId})), v=>{
sumPartyId=Number(v); closeMenus(); buildSummary();
openSearchMenu(t, ALL_PARTNERS.map(name=>({v:name,label:name,sel:name===sumPartyName})), v=>{
sumPartyName=v; closeMenus(); buildSummary();
}, {placeholder:'搜索往来单位…'});
}
// combo 已选中值(.has)时,点击右侧图标(此时为 ×)清除,不弹出下拉
function sumPartyCafClick(e){
if(sumPartyId!=null){ e.stopPropagation(); sumPartyId=null; buildSummary(); }
if(sumPartyName!=null){ e.stopPropagation(); sumPartyName=null; buildSummary(); }
}
function buildSummary(){
const rows=sumPartyId==null?SUMMARY.map((s,i)=>({...s,i})):SUMMARY.map((s,i)=>({...s,i})).filter(s=>s.i===sumPartyId);
const has=sumPartyId!=null;
const rows=sumPartyName==null?SUMMARY.map((s,i)=>({...s,i})):SUMMARY.map((s,i)=>({...s,i})).filter(s=>s.name===sumPartyName);
const has=sumPartyName!=null;
document.getElementById('sumPartyCombo').classList.toggle('has',has);
document.getElementById('sumPartyInput').value=has?SUMMARY[sumPartyId].name:'';
document.getElementById('sumPartyInput').value=has?sumPartyName:'';
document.getElementById('sumPartyCaf').innerHTML=has
?'<svg viewBox="0 0 24 24" stroke-width="2"><use href="#i-close"/></svg>'
:'<svg viewBox="0 0 24 24" stroke-width="2"><use href="#i-chevron-down"/></svg>';