Files
GX.O3.WMS/WebApi/obj/Release/Package/PackageTmp/delivery_dashboard_L21.html
T

71 lines
8.6 KiB
HTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>1号二级 - Gaussian</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:'Microsoft YaHei','PingFang SC',sans-serif;background:#f0f2f5;min-height:100vh}
.top-bar{background:linear-gradient(135deg,#1a73e8,#1557b0);color:#fff;padding:0 20px;display:flex;align-items:center;height:52px;box-shadow:0 2px 8px rgba(0,0,0,.15);position:sticky;top:0;z-index:100;gap:12px}
.top-bar .back{color:rgba(255,255,255,.85);text-decoration:none;font-size:14px;padding:4px 10px;border-radius:4px}
.top-bar .back:hover{background:rgba(255,255,255,.15)}
.top-bar .title{font-size:15px;font-weight:600;flex:1}
.user-info{margin-left:auto;font-size:12px;opacity:.85}
.main{max-width:1200px;margin:0 auto;padding:12px 16px}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
.table-wrap{overflow:auto}
table{min-width:100%;border-collapse:collapse;font-size:12px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:7px 10px;text-align:left;border:1px solid #999;border-bottom:2px solid #999;white-space:nowrap;position:sticky;top:0;z-index:2;position:relative;user-select:none}
thead th .resizer{position:absolute;right:0;top:0;bottom:0;width:5px;cursor:col-resize;z-index:3}
thead th .resizer:hover{background:#1a73e8}
tbody td{padding:6px 10px;border:1px solid #ddd;color:#333;text-align:center}
tbody tr:hover{background:#f0f6ff}
tbody tr.total-row td{background:#f0f6ff;font-weight:700;color:#1a73e8}
.count-link{color:#1a73e8;cursor:pointer;font-weight:600}
.count-link:hover{color:#1557b0;text-decoration:underline}
.pagination{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;border-top:1px solid #f0f0f0;font-size:12px;color:#999}
.pagination .btns{display:flex;gap:2px}
.pagination .btns button,.pagination .size-btn{min-width:32px;height:26px;border:1px solid #e0e0e0;border-radius:3px;background:#fff;color:#666;cursor:pointer;font-size:11px;padding:0 6px}
.pagination .btns button:hover,.pagination .size-btn:hover{border-color:#1a73e8;color:#1a73e8}
.pagination .btns button.active,.pagination .size-btn.active{background:#1a73e8;color:#fff;border-color:#1a73e8}
.pagination .size-group{display:inline-flex;gap:2px;margin-left:6px}
.empty td{text-align:center;padding:36px;color:#bbb}
.loading-overlay{display:none;position:fixed;inset:0;background:rgba(255,255,255,.7);z-index:999;justify-content:center;align-items:center}
.loading-overlay.show{display:flex}
.toast{position:fixed;top:12px;left:50%;transform:translateX(-50%);padding:10px 20px;border-radius:8px;font-size:13px;z-index:1000;box-shadow:0 4px 20px rgba(0,0,0,.15);display:none;min-width:240px;text-align:center}
.toast.error{background:#fdeaea;color:#b71c1c;display:block}
.loading-spinner{animation:spin .7s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
</style></head>
<body>
<div class="loading-overlay" id="loading"><div class="loading-spinner"></div></div><div class="toast" id="toast"></div>
<div class="top-bar"><a class="back" href="delivery_dashboard.html">← 返回</a><span class="title" id="pageTitle">1号二级</span><span class="user-info" id="userInfo"></span></div>
<div class="main"><div class="card"><div class="table-wrap"><table><thead><tr><th style="min-width:160px">研发采购负责人<span class="resizer"></span></th><th style="min-width:100px">数量<span class="resizer"></span></th></tr></thead><tbody id="dataBody"><tr class="empty"><td colspan="2">加载中...</td></tr></tbody></table></div>
<div class="pagination" id="pagination" style="display:none"><div><span>共 <em id="totalCnt">0</em> 条</span><span class="size-group" id="sizeBtns"></span></div><div class="btns" id="pageBtns"></div></div>
</div></div>
<script>
var params={};location.search.substr(1).split('&').forEach(function(s){var kv=s.split('=');if(kv[0])params[decodeURIComponent(kv[0])]=decodeURIComponent(kv[1]||'')});
var yfxm=params.yfxm||'',type=params.type||'';var typeMap={noTarget:'无交付目标',noPlan:'无交付计划'};
document.getElementById('pageTitle').textContent='1号二级 - '+yfxm+' - '+(typeMap[type]||type);
function escapeHtml(s){if(!s)return'';var d=document.createElement('div');d.appendChild(document.createTextNode(String(s)));return d.innerHTML}
function loading(b){document.getElementById('loading').classList.toggle('show',b)}
function toast(msg,tp){var el=document.getElementById('toast');el.textContent=msg;el.className='toast '+tp;clearTimeout(el._timer);el._timer=setTimeout(function(){el.className='toast'},3500)}
function logout(){sessionStorage.removeItem('gx_user');window.location.href='login.html'}
function loadData(){
loading(true);var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetDeliveryLevel21?yfxm='+encodeURIComponent(yfxm)+'&type='+type,true);
xhr.onload=function(){loading(false);try{var r=JSON.parse(xhr.responseText);if(r.success)renderTable(r.data);else toast(r.message||'查询失败','error')}catch(e){toast('数据解析异常','error')}};
xhr.onerror=function(){loading(false);toast('网络请求失败','error')};xhr.send();
}
var pageSizeOptions=[20,50,100,200],pageSize=20,currentPage=1,allData=[];
function setPageSize(size){pageSize=size;currentPage=1;renderPage()}
function renderPagination(){var total=allData.length,tp=Math.ceil(total/pageSize)||1;var pc=document.getElementById('pagination');if(total<=pageSize&&total<=20){pc.style.display='none';return}pc.style.display='flex';document.getElementById('totalCnt').textContent=total;document.getElementById('sizeBtns').innerHTML=pageSizeOptions.map(function(s){return '<button class="size-btn'+(s===pageSize?' active':'')+'" onclick="setPageSize('+s+')">'+s+'条</button>'}).join('');var pb=document.getElementById('pageBtns');if(tp<=1){pb.innerHTML='';return}var h='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage(1)">首页</button><button '+(currentPage<=1?'disabled':'')+' onclick="loadPage('+(currentPage-1)+')">‹</button>';for(var i=Math.max(1,currentPage-2);i<=Math.min(tp,currentPage+2);i++)h+='<button class="'+(i===currentPage?'active':'')+'" onclick="loadPage('+i+')">'+i+'</button>';h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+(currentPage+1)+')">›</button><button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+tp+')">末页</button>';pb.innerHTML=h}
function loadPage(page){currentPage=page;renderPage()}
function renderPage(){var tb=document.getElementById('dataBody');if(!allData.length){tb.innerHTML='<tr class="empty"><td colspan="2">暂无数据</td></tr>';renderPagination();return}var start=(currentPage-1)*pageSize,end=Math.min(start+pageSize,allData.length);var h='';for(var i=start;i<end;i++){var row=allData[i];var isTotal=(i===allData.length-1);h+='<tr'+(isTotal?' class="total-row"':'')+'><td>'+(row.yfcgfzr?escapeHtml(row.yfcgfzr):'未分配')+'</td><td>';if(!isTotal&&row.cnt>0)h+='<span class="count-link" onclick="openLevel3(\''+escapeHtml(row.yfcgfzr).replace(/\'/g,"\\'")+'\')">'+row.cnt+'</span>';else h+=row.cnt;h+='</td></tr>'}tb.innerHTML=h;renderPagination()}
function renderTable(data){allData=data||[];renderPage()}
function openLevel3(yfcgfzr){window.location.href='delivery_dashboard_L31.html?yfxm='+encodeURIComponent(yfxm)+'&type='+type+'&yfcgfzr='+encodeURIComponent(yfcgfzr)}
// 列宽拖动
(function(){var t=null,sx=0,sw=0,si=0,st=null;
document.addEventListener('mousedown',function(e){var r=e.target.closest('.resizer');if(!r)return;var th=r.parentElement;if(!th||th.tagName!='TH')return;t=th;sx=e.clientX;sw=th.offsetWidth;st=th.closest('table');si=Array.prototype.indexOf.call(th.parentNode.children,th);if(st)st._origW=st.offsetWidth;document.body.style.cursor='col-resize';e.preventDefault()});
document.addEventListener('mousemove',function(e){if(!t)return;var d=e.clientX-sx;var w=Math.max(40,sw+d);t.style.width=w+'px';t.style.minWidth=w+'px';t.style.maxWidth='none';if(st){st.style.width=(st._origW+d)+'px';st.querySelectorAll('tbody tr').forEach(function(tr){var td=tr.children[si];if(td)td.style.width=w+'px'})}});
document.addEventListener('mouseup',function(){if(t){t=null;st=null;document.body.style.cursor=''}});})();
(function(){var u=sessionStorage.getItem('gx_user');if(!u){window.location.href='login.html';return}try{document.getElementById('userInfo').innerHTML=JSON.parse(u).userName+' | <a href="javascript:void(0)" onclick="logout()" style="color:rgba(255,255,255,.75);text-decoration:none;margin-left:8px;font-size:12px;">退出</a>'}catch(e){window.location.href='login.html'}})();
loadData();
</script></body></html>