diff --git a/index.html b/index.html index d7bdd8d..c4c8d1f 100644 --- a/index.html +++ b/index.html @@ -112,13 +112,7 @@ -
- - - - - -
客户分类客户base收入T-1收入DoD(与T-2差)
+
@@ -412,6 +406,15 @@ function renderCustDetail(){ } else { rows.sort(function(a,b){ return a.catb.cat?1:(b.t1-a.t1); }); } + // 动态表头:用实际日期替代 T-1 + var thead=document.querySelector('#tCustDetail thead'); + thead.innerHTML='' + +'客户分类' + +'客户' + +'base收入' + +''+(t1||'—')+'收入' + +'DoD('+(t1||'—')+'−'+(t2||'—')+')' + +''; var body=rows.map(function(r){ var dc=r.dod==null?'':(r.dod>=0?'pos':'neg'); return ''+r.cat+''+r.acc+''+n2(r.base)+'' @@ -419,6 +422,12 @@ function renderCustDetail(){ }).join(''); document.querySelector('#tCustDetail tbody').innerHTML=body; document.querySelectorAll('#tCustDetail th.de-sort').forEach(function(th){ + th.style.cursor='pointer'; + th.onclick=function(){ + var k=th.getAttribute('data-k'), ty=th.getAttribute('data-ty'); + if(DE_SORT.k===k){ DE_SORT.dir=(DE_SORT.dir==='asc'?'desc':'asc'); } else { DE_SORT.k=k; DE_SORT.ty=ty; DE_SORT.dir='desc'; } + renderCustDetail(); + }; th.classList.remove('asc','desc'); if(th.getAttribute('data-k')===DE_SORT.k) th.classList.add(DE_SORT.dir); }); @@ -426,15 +435,7 @@ function renderCustDetail(){ // 3.1/3.2 表头排序绑定 function bindCustSort(){ - // 3.1 的表头排序绑定在 renderCustDaily 内部动态处理(表头是动态生成的) - document.querySelectorAll('#tCustDetail th.de-sort').forEach(function(th){ - th.style.cursor='pointer'; - th.onclick=function(){ - var k=th.getAttribute('data-k'), ty=th.getAttribute('data-ty'); - if(DE_SORT.k===k){ DE_SORT.dir=(DE_SORT.dir==='asc'?'desc':'asc'); } else { DE_SORT.k=k; DE_SORT.ty=ty; DE_SORT.dir='desc'; } - renderCustDetail(); - }; - }); + // 3.1/3.2 表头排序绑定均在各自 render 内部动态处理(表头动态生成) // 3.2 筛选: 填充客户分类下拉 + 绑定 var sel=document.getElementById('deCat'); if(sel && D && D.cust_idsp){