baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)

This commit is contained in:
Gaussian committed 2026-11-06 18:38:38 +08:00
commit c2b0e7be0d
6522 files changed
+3530643

No files matched your search

@@ -0,0 +1,211 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购看板明细 - 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:1500px;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;max-height:calc(100vh-190px)}
.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;transition:all.15s;padding:0 6px}
.pagination .btns button:hover,.pagination .size-btn:hover{border-color:#1a73e8;color:#1a73e8}
.pagination .btns button.active{background:#1a73e8;color:#fff;border-color:#1a73e8}
.pagination .size-btn.active{background:#1a73e8;color:#fff;border-color:#1a73e8}
.pagination .size-group{display:inline-flex;gap:2px;margin-left:6px}
table{min-width:100%;border-collapse:collapse;font-size:12px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:6px 8px;text-align:left;border:1px solid #999;white-space:nowrap;position:sticky;top:0;z-index:3;position:relative;user-select:none}
thead th .resizer{position:absolute;right:0;top:0;bottom:0;width:5px;cursor:col-resize;z-index:4}
thead th .resizer:hover{background:#1a73e8}
thead th.sub-header{background:#eef2f7;border-top:0;font-weight:400;color:#666}
tbody td{padding:5px 8px;border:1px solid #ddd;color:#333;text-align:center}
tbody td.left{text-align:left}
tbody tr:hover{background:#f0f6ff}
tbody tr.total-row td{background:#f0f6ff;font-weight:700;color:#1a73e8}
.yfxm-link{color:#1a73e8;cursor:pointer;font-weight:600}
.yfxm-link:hover{color:#1557b0;text-decoration:underline}
.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}
.loading-spinner{width:34px;height:34px;border:3px solid #e0e0e0;border-top-color:#1a73e8;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
</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="procurement_dashboard.html">← 返回看板</a>
<span class="title" id="pageTitle">采购看板明细</span>
<span class="user-info" id="userInfo"></span>
</div>
<div class="main">
<div class="card">
<div class="table-wrap">
<table>
<thead id="headerArea"></thead>
<tbody id="dataBody"><tr class="empty"><td colspan="3">加载中...</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 month=params.month||'',ywzt=params.ywzt||'';
var ywztMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
var pageSizeOptions=[20,50,100,200],pageSize=20,currentPage=1,allData=[];
document.getElementById('pageTitle').textContent='采购看板明细 - '+month+' '+(ywztMap[ywzt]||'');
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/GetProcurementDashboardDetail?month='+encodeURIComponent(month)+'&ywzt='+encodeURIComponent(ywzt),true);
xhr.onload=function(){
loading(false);
try{
var r=JSON.parse(xhr.responseText);
if(r.success)renderTable(r.data,r.cncgfzrList);
else toast(r.message||'查询失败','error')
}catch(e){toast('数据解析异常','error')}
};
xhr.onerror=function(){loading(false);toast('网络请求失败','error')};
xhr.send();
}
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;
// 每页条数
var sb=document.getElementById('sizeBtns');
sb.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 renderTable(data,cncgfzrList){
var ha=document.getElementById('headerArea');
var tb=document.getElementById('dataBody');
allData=data||[];
if(!allData.length){ha.innerHTML='';tb.innerHTML='<tr class="empty"><td colspan="3">暂无数据</td></tr>';return}
// 第一行表头:基础列,cncgfzr列留空
var h1='<tr>';
h1+='<th style="min-width:160px">研发项目<span class="resizer"></span></th>';
h1+='<th style="min-width:100px">采购申请条数<span class="resizer"></span></th>';
h1+='<th style="min-width:100px">(第二轮)已有价格<span class="resizer"></span></th>';
h1+='<th style="min-width:120px">(第二轮)无价格<span class="resizer"></span></th>';
cncgfzrList.forEach(function(){h1+='<th style="min-width:90px"><span class="resizer"></span></th>'});
h1+='</tr>';
// 第二行表头:未分配采购策略 + 各策略采购负责人
var h2='<tr>';
h2+='<th class="sub-header"></th>';
h2+='<th class="sub-header"></th>';
h2+='<th class="sub-header"></th>';
h2+='<th class="sub-header">未分配采购策略</th>';
cncgfzrList.forEach(function(cg){h2+='<th class="sub-header">'+escapeHtml(cg)+'</th>'});
h2+='</tr>';
ha.innerHTML=h1+h2;
renderPage(cncgfzrList);
}
function renderPage(cncgfzrList){
var tb=document.getElementById('dataBody');
if(!cncgfzrList)cncgfzrList=[]; // keep from initial render
var cols=3+cncgfzrList.length;
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);
var trCls=isTotal?' class="total-row"' : '';
h+='<tr'+trCls+'>';
h+='<td class="left">';
if(!isTotal) h+='<span class="yfxm-link" onclick="openThird(\''+escapeHtml(row.yfxmmc).replace(/\'/g,"\\'")+'\')">'+escapeHtml(row.yfxmmc)+'</span>';
else h+=escapeHtml(row.yfxmmc);
h+='</td>';
h+='<td>'+(row.total||0)+'</td>';
h+='<td>'+(row.hasPrice||0)+'</td>';
h+='<td>'+(row.noPrice||0)+'</td>';
cncgfzrList.forEach(function(cg){
h+='<td>'+(row['_cg_'+cg]||0)+'</td>';
});
h+='</tr>';
}
tb.innerHTML=h;
renderPagination();
}
function openThird(yfxmmc){
window.location.href='procurement_dashboard_detail_items.html?month='+encodeURIComponent(month)+'&ywzt='+encodeURIComponent(ywzt)+'&yfxm='+encodeURIComponent(yfxmmc);
}
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData||!month){window.location.href='login.html';return}
try{
var u=JSON.parse(userData);
document.getElementById('userInfo').innerHTML=(u.userName||u.userId)+' | <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'}
})();
// 列宽拖动
(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=''}});
})();
loadData();
</script>
</body>
</html>
@@ -0,0 +1,138 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>研发订单到料考核 - 三级明细</title>
<link rel="stylesheet" href="View/common/nav.css" />
<style>
* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", Arial, sans-serif; background: #f4f6fb; color: #1f2937; }
.main-content { padding: 18px 24px; }
.header { background: linear-gradient(90deg, #2f6df6 0%, #4f8bff 100%); color: #fff; padding: 18px 24px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.header h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.header .meta { font-size: 13px; opacity: .9; }
.table-wrap { background: #fff; border-radius: 12px; margin-top: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.toolbar { padding: 14px 18px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 10px; }
.toolbar .title { font-size: 14px; font-weight: 600; color: #374151; }
.toolbar .back { background: #fff; border: 1px solid #d1d5db; color: #374151; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.toolbar .back:hover { background: #f3f4f6; }
.gx-grid { max-height: calc(100vh - 280px); min-height: 600px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 8px 10px; border: 1px solid #e5e7eb; text-align: left; white-space: nowrap; }
table th { background: #f3f4f6; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.empty { color: #9ca3af; }
.page-bar { padding: 12px 18px; border-top: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: flex-end; gap: 10px; font-size: 12px; color: #6b7280; }
.page-bar button { background: #fff; border: 1px solid #d1d5db; color: #374151; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.page-bar button:hover { background: #f3f4f6; }
.page-bar button:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.tag-cg { background: #fee2e2; color: #b91c1c; }
.tag-gao { background: #ffedd5; color: #c2410c; }
.tag-zhong { background: #fef9c3; color: #a16207; }
.tag-di { background: #dcfce7; color: #15803d; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="header">
<h1>研发订单到料考核 · 三级明细</h1>
<div class="meta" id="meta"></div>
</div>
<div class="table-wrap">
<div class="toolbar">
<button class="back" onclick="window.close()">返回</button>
<div class="title" id="title"></div>
</div>
<div class="gx-grid" id="grid"></div>
<div class="page-bar" id="pageBar"></div>
</div>
</div>
<script>
var params = new URLSearchParams(window.location.search);
var checkType = params.get('checkType') || 'project';
var yfxmId = params.get('yfxmId') || '';
var yfxmName = params.get('yfxmName') || '未指定';
var buyer = params.get('buyer') || '';
var yt = params.get('yt') || '';
var riskLevel = params.get('riskLevel') || '';
var page = 1, pageSize = 50;
var catNames = { project: '项目需求达成风险', promise: '采购承诺达成风险', std: '标准采购周期达成风险' };
// 各考核分类对应的基准交付日期列名
var baseFieldNames = { project: '要求交付日期', promise: '计划交付(研发)', std: '标准交付日期' };
function ytName(y) { return { '0': '生产', '1': '研发', '2': '售后' }[y] || '全部'; }
function riskTag(r) {
var cls = r === '超高' ? 'tag-cg' : r === '高' ? 'tag-gao' : r === '中' ? 'tag-zhong' : 'tag-di';
return '<span class="tag ' + cls + '">' + r + '</span>';
}
document.getElementById('title').innerHTML = (catNames[checkType] || checkType) + ' / ' + yfxmName + ' / ' + (buyer || '全部') + ' / ' + ytName(yt) + ' / ' + (riskLevel || '全部');
document.getElementById('meta').innerHTML = '考核分类:<strong>' + (catNames[checkType] || checkType) + '</strong> &nbsp;|&nbsp; 用途:<strong>' + ytName(yt) + '</strong> &nbsp;|&nbsp; 风险等级:<strong>' + (riskLevel || '全部') + '</strong> &nbsp;|&nbsp; 研发项目:<strong>' + yfxmName + '</strong> &nbsp;|&nbsp; 负责人:<strong>' + (buyer || '全部') + '</strong>';
function load() {
var grid = document.getElementById('grid');
grid.innerHTML = '<div style="color:#9ca3af;padding:20px 0;">加载中...</div>';
var url = 'api/Procurement/GetAuditReceiveLevel3?page=' + page + '&pageSize=' + pageSize +
'&checkType=' + encodeURIComponent(checkType) +
'&yfxmId=' + encodeURIComponent(yfxmId) +
'&riskLevel=' + encodeURIComponent(riskLevel) +
'&yt=' + encodeURIComponent(yt) +
'&buyer=' + encodeURIComponent(buyer);
fetch(url).then(function (r) { return r.json(); }).then(function (res) {
if (!res.success) { grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">加载失败: ' + res.message + '</div>'; return; }
render(res);
}).catch(function (e) {
grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">请求异常: ' + e + '</div>';
});
}
function render(res) {
if (!res.items || res.items.length === 0) {
document.getElementById('grid').innerHTML = '<div style="color:#9ca3af;padding:20px 0;">暂无数据</div>';
document.getElementById('pageBar').innerHTML = '共 0 条';
return;
}
var items = res.items;
var html = '<table><thead><tr><th>序号</th><th>流程编号</th><th>单据编号</th><th>物料</th><th>用途</th><th>策略采购员</th><th>研发项目</th><th>' + (baseFieldNames[checkType] || '交付日期') + '</th><th>最早收料日期</th><th>时效(天)</th><th>风险等级</th></tr></thead><tbody>';
items.forEach(function (it, idx) {
var daysTxt = it.days === null || it.days === undefined || it.days === '' ? '<span class="empty">未收料</span>' : it.days;
html += '<tr>';
html += '<td>' + ((page - 1) * pageSize + idx + 1) + '</td>';
html += '<td>' + it.lcbh + '</td>';
html += '<td>' + (it.djbh || '<span class="empty">-</span>') + '</td>';
html += '<td>' + (it.wlmc || '<span class="empty">-</span>') + (it.wlgg ? ' / ' + it.wlgg : '') + '</td>';
html += '<td>' + ytName(it.ytUse) + '</td>';
html += '<td>' + (it.yfcgfzr || '<span class="empty">-</span>') + '</td>';
html += '<td>' + (it.yfxmName || '<span class="empty">-</span>') + '</td>';
html += '<td>' + (it.baseDate || '<span class="empty">-</span>') + '</td>';
html += '<td>' + (it.firstReceiveDate || '<span class="empty">未收料</span>') + '</td>';
html += '<td>' + daysTxt + '</td>';
html += '<td>' + riskTag(it.riskLevel) + '</td>';
html += '</tr>';
});
html += '</tbody></table>';
document.getElementById('grid').innerHTML = html;
// 分页
var total = res.total;
var totalPage = Math.ceil(total / pageSize);
var bar = '<span>共 ' + total + ' 条 / 第 ' + page + ' 页 / 共 ' + totalPage + ' 页</span>';
bar += '<button onclick="prevPage()" ' + (page <= 1 ? 'disabled' : '') + '>上一页</button>';
bar += '<button onclick="nextPage()" ' + (page >= totalPage ? 'disabled' : '') + '>下一页</button>';
document.getElementById('pageBar').innerHTML = bar;
}
function prevPage() { if (page > 1) { page--; load(); } }
function nextPage() { page++; load(); }
load();
</script>
<script src="View/common/nav.js"></script>
</body>
</html>
@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\1</_PublishTargetUrl>
<History>True|2026-09-08T01:31:18.0062650Z||;True|2026-09-07T10:26:31.5838394+08:00||;True|2026-09-07T10:20:49.1129599+08:00||;True|2026-09-07T09:37:30.1979509+08:00||;True|2026-09-04T16:31:49.4596927+08:00||;True|2026-09-04T16:06:31.3259073+08:00||;True|2026-08-18T09:51:59.3666691+08:00||;True|2026-08-17T17:06:43.4568135+08:00||;True|2026-08-17T09:42:27.8156190+08:00||;True|2026-08-14T16:52:13.7440900+08:00||;True|2026-08-14T16:42:38.4548286+08:00||;True|2026-08-14T14:52:14.8351128+08:00||;True|2026-08-13T15:15:49.8409025+08:00||;True|2026-08-13T14:07:36.8370386+08:00||;True|2026-08-06T10:36:00.8099402+08:00||;True|2026-08-05T14:43:23.1856296+08:00||;True|2026-08-04T09:34:44.8282856+08:00||;True|2026-07-31T14:15:17.8924066+08:00||;True|2026-07-29T17:42:14.7465984+08:00||;True|2026-07-28T14:34:03.8612324+08:00||;True|2026-07-28T14:29:24.5766446+08:00||;True|2026-07-28T14:11:27.5824603+08:00||;True|2026-07-28T09:28:49.8005658+08:00||;True|2026-07-28T09:28:39.3771641+08:00||;True|2026-07-28T09:28:26.9653303+08:00||;True|2026-07-27T14:33:17.8556875+08:00||;True|2026-07-27T14:28:25.8121460+08:00||;True|2026-07-24T16:51:55.7769810+08:00||;True|2026-07-24T15:25:29.8947525+08:00||;True|2026-07-24T10:49:03.6003286+08:00||;True|2026-07-22T16:23:35.6347492+08:00||;True|2026-07-22T16:17:35.8799930+08:00||;True|2026-07-22T15:49:28.6121559+08:00||;True|2026-07-22T14:55:18.2703822+08:00||;True|2026-07-22T14:51:59.4718336+08:00||;True|2026-07-01T10:02:04.5477902+08:00||;True|2026-06-17T17:46:44.1504757+08:00||;True|2026-06-17T17:38:09.4990885+08:00||;True|2026-06-17T17:37:55.6743611+08:00||;False|2026-06-17T17:37:51.8483598+08:00||;True|2026-06-17T17:33:33.5540476+08:00||;False|2026-06-17T17:33:29.8580593+08:00||;True|2026-06-17T17:29:10.0025733+08:00||;False|2026-06-17T17:28:56.0140964+08:00||;True|2026-06-17T17:23:13.5724326+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
<File Include="bin/GXWebApi.dll">
<publishTime>09/08/2026 09:31:17</publishTime>
</File>
<File Include="bin/GXWebApi.pdb">
<publishTime>09/08/2026 09:31:17</publishTime>
</File>
<File Include="bin/Kingdee.BOS.WebApi.Client.dll">
<publishTime>11/24/2023 11:11:32</publishTime>
</File>
<File Include="bin/log4net.dll">
<publishTime>08/11/2022 14:57:47</publishTime>
</File>
<File Include="bin/Microsoft.mshtml.dll">
<publishTime>02/09/2023 19:58:24</publishTime>
</File>
<File Include="bin/Microsoft.Web.Infrastructure.dll">
<publishTime>08/11/2022 14:57:46</publishTime>
</File>
<File Include="bin/MySql.Data.dll">
<publishTime>11/28/2023 13:03:41</publishTime>
</File>
<File Include="bin/Newtonsoft.Json.dll">
<publishTime>03/18/2021 04:03:36</publishTime>
</File>
<File Include="bin/Spire.License.dll">
<publishTime>02/09/2023 19:58:30</publishTime>
</File>
<File Include="bin/Spire.Pdf.Wpf.dll">
<publishTime>02/09/2023 19:58:30</publishTime>
</File>
<File Include="bin/Spire.XLS.Wpf.dll">
<publishTime>02/09/2023 19:58:30</publishTime>
</File>
<File Include="bin/System.Net.Http.Formatting.dll">
<publishTime>11/28/2018 21:00:36</publishTime>
</File>
<File Include="bin/System.Web.Cors.dll">
<publishTime>11/28/2018 20:58:44</publishTime>
</File>
<File Include="bin/System.Web.Http.Cors.dll">
<publishTime>11/28/2018 21:01:26</publishTime>
</File>
<File Include="bin/System.Web.Http.dll">
<publishTime>11/28/2018 21:01:00</publishTime>
</File>
<File Include="bin/System.Web.Http.WebHost.dll">
<publishTime>11/28/2018 21:02:56</publishTime>
</File>
<File Include="crm_sale_order_sync.html">
<publishTime>09/08/2026 09:29:29</publishTime>
</File>
<File Include="dashboard.html">
<publishTime>08/18/2026 16:36:19</publishTime>
</File>
<File Include="dashboard_detail.html">
<publishTime>08/04/2026 09:33:06</publishTime>
</File>
<File Include="delivery_dashboard.html">
<publishTime>08/18/2026 16:35:29</publishTime>
</File>
<File Include="delivery_dashboard_L21.html">
<publishTime>07/30/2026 14:17:33</publishTime>
</File>
<File Include="delivery_dashboard_L22.html">
<publishTime>07/30/2026 14:18:43</publishTime>
</File>
<File Include="delivery_dashboard_L31.html">
<publishTime>07/30/2026 14:18:11</publishTime>
</File>
<File Include="delivery_dashboard_L32.html">
<publishTime>07/30/2026 11:11:36</publishTime>
</File>
<File Include="delivery_dashboard_noorder2.html">
<publishTime>08/03/2026 15:11:22</publishTime>
</File>
<File Include="delivery_dashboard_noorder3.html">
<publishTime>08/03/2026 15:11:42</publishTime>
</File>
<File Include="delivery_dashboard_noorder4.html">
<publishTime>08/03/2026 15:18:49</publishTime>
</File>
<File Include="Global.asax">
<publishTime>06/17/2026 17:02:54</publishTime>
</File>
<File Include="home.html">
<publishTime>09/07/2026 09:50:07</publishTime>
</File>
<File Include="Images/idc_Eng.jpg">
<publishTime>08/18/2026 17:32:08</publishTime>
</File>
<File Include="index.html">
<publishTime>08/18/2026 16:38:18</publishTime>
</File>
<File Include="log4net.config">
<publishTime>06/17/2026 17:03:07</publishTime>
</File>
<File Include="login.html">
<publishTime>09/02/2026 09:02:55</publishTime>
</File>
<File Include="multi_detail.html">
<publishTime>07/29/2026 17:07:56</publishTime>
</File>
<File Include="procurement.html">
<publishTime>09/07/2026 10:24:57</publishTime>
</File>
<File Include="procurement_audit_leadtime.html">
<publishTime>09/04/2026 15:23:18</publishTime>
</File>
<File Include="procurement_audit_leadtime_l2.html">
<publishTime>09/04/2026 11:13:28</publishTime>
</File>
<File Include="procurement_audit_leadtime_l3.html">
<publishTime>09/04/2026 11:18:55</publishTime>
</File>
<File Include="procurement_audit_receive_l2.html">
<publishTime>09/04/2026 14:06:59</publishTime>
</File>
<File Include="procurement_audit_receive_l3.html">
<publishTime>09/04/2026 15:23:23</publishTime>
</File>
<File Include="procurement_board_list.html">
<publishTime>09/04/2026 16:29:44</publishTime>
</File>
<File Include="procurement_dashboard.html">
<publishTime>08/18/2026 16:35:01</publishTime>
</File>
<File Include="procurement_dashboard_detail.html">
<publishTime>07/29/2026 10:12:54</publishTime>
</File>
<File Include="procurement_dashboard_detail_items.html">
<publishTime>07/29/2026 10:12:57</publishTime>
</File>
<File Include="procurement_dashboard_level4.html">
<publishTime>07/29/2026 10:12:59</publishTime>
</File>
<File Include="procurement_detail.html">
<publishTime>08/13/2026 15:12:38</publishTime>
</File>
<File Include="View/common/grid.css">
<publishTime>09/02/2026 14:54:52</publishTime>
</File>
<File Include="View/common/grid.js">
<publishTime>09/02/2026 14:54:55</publishTime>
</File>
<File Include="View/common/nav.css">
<publishTime>08/18/2026 16:46:33</publishTime>
</File>
<File Include="View/common/nav.js">
<publishTime>09/08/2026 09:29:30</publishTime>
</File>
<File Include="View/Delivery/bom_master.html">
<publishTime>09/04/2026 16:29:40</publishTime>
</File>
<File Include="View/Delivery/delivery_board.html">
<publishTime>09/04/2026 16:29:43</publishTime>
</File>
<File Include="View/Delivery/delivery_dashboard.html">
<publishTime>09/04/2026 16:29:43</publishTime>
</File>
<File Include="View/Delivery/delivery_dashboard_risk.html">
<publishTime>09/04/2026 16:29:44</publishTime>
</File>
<File Include="View/Delivery/material_delivery.html">
<publishTime>09/04/2026 16:29:42</publishTime>
</File>
<File Include="View/Delivery/production_delivery.html">
<publishTime>09/04/2026 16:29:41</publishTime>
</File>
<File Include="View/Delivery/schedule.html">
<publishTime>09/04/2026 16:29:41</publishTime>
</File>
<File Include="View/MES/mes_dashboard.html">
<publishTime>08/18/2026 16:43:31</publishTime>
</File>
<File Include="Web.config">
<publishTime>09/04/2026 14:05:45</publishTime>
</File>
</ItemGroup>
</Project>
@@ -0,0 +1,148 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购看板 - Gaussian</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="View/common/nav.css">
<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}
.top-bar .logo{font-size:17px;font-weight:600;margin-right:24px}
.top-links a{color:rgba(255,255,255,.75);text-decoration:none;padding:0 16px;height:100%;display:flex;align-items:center;font-size:13px;border-radius:4px 4px 0 0;transition:.2s}
.top-links a:hover,.top-links a.active{color:#fff;background:rgba(255,255,255,.1)}
.user-info{margin-left:auto;font-size:12px;opacity:.85}
.main{max-width:1500px;margin:0 auto;padding:12px 16px}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;align-items:center}
.card-header h3{font-size:14px;color:#333;font-weight:600}
.table-wrap{overflow:auto;max-height:calc(100vh-180px)}
table{min-width:100%;border-collapse:collapse;font-size:12px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:8px 8px;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:7px 8px;border:1px solid #ddd;color:#333;text-align:center}
tbody tr:hover{background:#f0f6ff}
tbody td.month-cell{text-align:left;font-weight:600;color:#1a73e8}
tbody tr.total-row td{background:#f0f6ff;font-weight:700;color:#1a73e8}
.count-link{color:#1a73e8;cursor:pointer;text-decoration:underline;font-weight:600}
.count-link:hover{color:#1557b0}
.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}
.loading-spinner{width:34px;height:34px;border:3px solid #e0e0e0;border-top-color:#1a73e8;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
</style>
</head>
<body>
<div class="loading-overlay" id="loading"><div class="loading-spinner"></div></div>
<div class="toast" id="toast"></div>
<div id="sidebar"></div>
<div class="main-content">
<div class="main">
<div class="card">
<div class="card-header"><h3>采购看板 - 按月业务状态汇总</h3></div>
<div class="table-wrap">
<table>
<thead><tr id="headerRow"></tr></thead>
<tbody id="dataBody"><tr class="empty"><td colspan="2">加载中...</td></tr></tbody>
</table>
</div>
</div>
</div>
<script>
var ywztMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
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 loadData(){
loading(true);
var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetProcurementDashboard',true);
xhr.onload=function(){
loading(false);
try{
var r=JSON.parse(xhr.responseText);
if(r.success)renderTable(r.data,r.ywzts,r.ywztMap);
else toast(r.message||'查询失败','error')
}catch(e){toast('数据异常','error')}
};
xhr.onerror=function(){loading(false);toast('网络请求失败','error')};
xhr.send();
}
function renderTable(data,ywzts,_ywztMap){
var header=document.getElementById('headerRow');
var tbody=document.getElementById('dataBody');
if(!data||!data.length){header.innerHTML='<th>月份</th>';tbody.innerHTML='<tr class="empty"><td colspan="2">暂无数据</td></tr>';return}
// 表头
var hh='<th style="min-width:100px">月份<span class="resizer"></span></th>';
ywzts.forEach(function(y){hh+='<th style="min-width:110px">'+(ywztMap[y]||y)+'<span class="resizer"></span></th>'});
hh+='<th style="min-width:80px">合计<span class="resizer"></span></th>';
header.innerHTML=hh;
// 数据行
var h='';
data.forEach(function(row,idx){
var isTotal=(idx===data.length-1);
var trCls=isTotal?' class="total-row"':'';
h+='<tr'+trCls+'>';
h+='<td class="month-cell">'+escapeHtml(row.month)+'</td>';
var rowTotal=0;
ywzts.forEach(function(y){
var cnt=parseInt(row[y])||0;
rowTotal+=cnt;
if(cnt>0&&!isTotal)
h+='<td><span class="count-link" onclick="openDetail(\''+escapeHtml(row.month)+'\',\''+y+'\')">'+cnt+'</span></td>';
else
h+='<td>'+(cnt||'')+'</td>';
});
h+='<td>'+(isTotal?rowTotal:'')+'</td>';
h+='</tr>';
});
tbody.innerHTML=h;
}
function openDetail(month,ywzt){
// 暂时跳转到看板详情(后续开发二级列表)
window.location.href='procurement_dashboard_detail.html?month='+encodeURIComponent(month)+'&ywzt='+encodeURIComponent(ywzt);
}
// ===== 登录校验和导航栏由公共组件提供 =====
// 列宽拖动
(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=''}});
})();
loadData();
</script>
</div><!-- /main-content -->
<!-- 公共侧边栏组件(菜单维护点:View/common/nav.js) -->
<script src="View/common/nav.js"></script>
</body>
</html>
@@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>研发订单到料考核 - 二级看板</title>
<link rel="stylesheet" href="View/common/nav.css" />
<style>
* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", Arial, sans-serif; background: #f4f6fb; color: #1f2937; }
.main-content { padding: 18px 24px; }
.header { background: linear-gradient(90deg, #2f6df6 0%, #4f8bff 100%); color: #fff; padding: 18px 24px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.header h1 { font-size: 20px; margin: 0; font-weight: 600; }
.header .meta { font-size: 13px; opacity: .9; }
.table-wrap { background: #fff; border-radius: 12px; margin-top: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.table-wrap .toolbar { padding: 14px 18px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 10px; }
.table-wrap .toolbar .title { font-size: 14px; font-weight: 600; color: #374151; }
.table-wrap .toolbar .back { background: #fff; border: 1px solid #d1d5db; color: #374151; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.table-wrap .toolbar .back:hover { background: #f3f4f6; }
.gx-grid { max-height: calc(100vh - 240px); min-height: 600px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 8px 10px; border: 1px solid #e5e7eb; text-align: left; white-space: nowrap; }
table th { background: #f3f4f6; font-weight: 600; position: sticky; top: 0; z-index: 1; }
table td.clickable { color: #2563eb; cursor: pointer; }
table td.clickable:hover { text-decoration: underline; }
.empty { color: #9ca3af; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="header">
<div>
<h1>研发订单到料考核 · 二级看板</h1>
<div class="meta" id="meta"></div>
</div>
</div>
<div class="table-wrap">
<div class="toolbar">
<button class="back" onclick="window.close()">返回</button>
<div class="title">研发项目 × 策略采购负责人</div>
</div>
<div class="gx-grid" id="grid"></div>
</div>
</div>
<script>
// 从 URL 读参数
var params = new URLSearchParams(window.location.search);
var checkType = params.get('checkType') || 'project';
var yt = params.get('yt') || ''; // '' = 全部用途
var riskLevel = params.get('riskLevel') || '';
var catNames = { project: '项目需求达成风险', promise: '采购承诺达成风险', std: '标准采购周期达成风险' };
function ytName(y) { return { '0': '生产', '1': '研发', '2': '售后' }[y] || '全部'; }
function riskCls(r) { return r === '超高' ? '#b91c1c' : r === '高' ? '#c2410c' : r === '中' ? '#a16207' : '#15803d'; }
document.getElementById('meta').innerHTML = '考核分类:<strong>' + (catNames[checkType] || checkType) + '</strong> &nbsp;|&nbsp; 用途:<strong>' + ytName(yt) + '</strong> &nbsp;|&nbsp; 风险等级:<strong style="color:' + riskCls(riskLevel) + '">' + (riskLevel || '全部') + '</strong>';
function load() {
var grid = document.getElementById('grid');
grid.innerHTML = '<div style="color:#9ca3af;padding:20px 0;">加载中...</div>';
fetch('api/Procurement/GetAuditReceiveLevel2?checkType=' + encodeURIComponent(checkType) + '&yt=' + encodeURIComponent(yt) + '&riskLevel=' + encodeURIComponent(riskLevel)).then(function (r) { return r.json(); }).then(function (res) {
if (!res.success) { grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">加载失败: ' + res.message + '</div>'; return; }
render(res);
}).catch(function (e) {
grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">请求异常: ' + e + '</div>';
});
}
function render(d) {
var buyers = d.buyers || [];
if (!d.rows || d.rows.length === 0) {
document.getElementById('grid').innerHTML = '<div style="color:#9ca3af;padding:20px 0;">暂无数据</div>';
return;
}
var html = '<table><thead><tr><th>研发项目</th>';
buyers.forEach(function (b) { html += '<th>' + b + '</th>'; });
html += '<th>合计</th></tr></thead><tbody>';
d.rows.forEach(function (r) {
html += '<tr><td>' + (r.yfxmName || '未指定') + '</td>';
buyers.forEach(function (b) {
var v = r[b] || 0;
if (v > 0) {
// 点单元格跳三级(新窗口)
var url = 'procurement_audit_receive_l3.html?checkType=' + encodeURIComponent(checkType) +
'&yfxmId=' + encodeURIComponent(r.yfxmId) +
'&yfxmName=' + encodeURIComponent(r.yfxmName || '未指定') +
'&buyer=' + encodeURIComponent(b) +
'&yt=' + encodeURIComponent(yt) +
'&riskLevel=' + encodeURIComponent(riskLevel);
html += '<td class="clickable" onclick="window.open(\'' + url + '\', \'_blank\')">' + v + '</td>';
} else {
html += '<td><span class="empty">-</span></td>';
}
});
html += '<td><strong>' + r.total + '</strong></td></tr>';
});
// 合计行
html += '<tr style="background:#f3f4f6;font-weight:600;"><td>合计</td>';
var grandTotal = 0;
buyers.forEach(function (b) {
var colSum = 0;
d.rows.forEach(function (r) { colSum += (r[b] || 0); });
grandTotal += colSum;
html += '<td>' + colSum + '</td>';
});
html += '<td><strong>' + grandTotal + '</strong></td></tr>';
html += '</tbody></table>';
document.getElementById('grid').innerHTML = html;
}
load();
</script>
<script src="View/common/nav.js"></script>
</body>
</html>
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="GXWebApi.WebApiApplication" Language="C#" %>
@@ -0,0 +1,122 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\Code\\WMS\\WebApi\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\controllers\\procurementcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:controllers\\procurementcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|d:\\code\\wms\\webapi\\multi_detail.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:multi_detail.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\procurement.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:procurement.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\procurement_dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:procurement_dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\login.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:login.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 6,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "multi_detail.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\multi_detail.html",
"RelativeDocumentMoniker": "multi_detail.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\multi_detail.html",
"RelativeToolTip": "multi_detail.html",
"ViewState": "AgIAALUAAAAAAAAAAAAcwNcAAAAzAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-29T09:07:47.812Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "procurement_dashboard.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\procurement_dashboard.html",
"RelativeDocumentMoniker": "procurement_dashboard.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\procurement_dashboard.html",
"RelativeToolTip": "procurement_dashboard.html",
"ViewState": "AgIAAFIAAAAAAAAAAAAuwF0AAAAsAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-28T09:09:18.881Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "procurement.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\procurement.html",
"RelativeDocumentMoniker": "procurement.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\procurement.html",
"RelativeToolTip": "procurement.html",
"ViewState": "AgIAAPIAAAAAAAAAAADwvxEBAAAPAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-28T07:53:40.173Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "dashboard.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\dashboard.html",
"RelativeDocumentMoniker": "dashboard.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\dashboard.html",
"RelativeToolTip": "dashboard.html",
"ViewState": "AgIAAB4CAAAAAAAAAADwvykCAABRAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-23T06:13:39.023Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "login.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\login.html",
"RelativeDocumentMoniker": "login.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\login.html",
"RelativeToolTip": "login.html",
"ViewState": "AgIAACYAAAAAAAAAAAAIwD0AAAAdAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-22T07:29:25.523Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "ProcurementController.cs",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\Controllers\\ProcurementController.cs",
"RelativeDocumentMoniker": "Controllers\\ProcurementController.cs",
"ToolTip": "D:\\Code\\WMS\\WebApi\\Controllers\\ProcurementController.cs",
"RelativeToolTip": "Controllers\\ProcurementController.cs",
"ViewState": "AgIAALACAAAAAAAAAAAnwCMDAABCAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-07-23T08:21:22.519Z",
"EditorCaption": ""
}
]
}
]
}
]
}
@@ -0,0 +1,174 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
namespace GXWebApi.Common
{
public class MySqlUtils : IDisposable
{
#region 构造函数
public MySqlUtils()
{
}
#endregion
#region 连接字符串
private string _connectionString;
public string ConnectionString
{
get { return _connectionString; }
set { _connectionString = value; }
}
#endregion
#region 数据库连接
/// <summary>
/// 数据库连接
/// </summary>
public MySqlConnection Connection
{
get;
set;
}
#endregion
#region 获取连接
/// <summary>
///
/// </summary>
/// <returns></returns>
public MySqlConnection GetConnection()
{
try
{
if (Connection == null)
{
Connection = new MySqlConnection();
Connection.ConnectionString = _connectionString;
}
if (Connection.State == ConnectionState.Broken)
{
Connection.Close();
}
if (Connection.State == ConnectionState.Closed)
{
Connection.ConnectionString = _connectionString;
Connection.Open();
}
return Connection;
}
catch (Exception ex)
{
throw new Exception("获取连接失败.\r\n" + ex.Message);
}
}
#endregion
#region 销毁对象
/// <summary>
///
/// </summary>
public void Dispose()
{
if (Connection != null)
{
if (Connection.State != ConnectionState.Closed)
{
Connection.Close();
}
Connection.Dispose();
Connection = null;
}
}
#endregion
#region 执行查询
/// <summary>
///
/// </summary>
/// <param name="strSQL"></param>
/// <returns></returns>
public DataTable ExecQuery(string strSQL)
{
DataSet dsTemp = new DataSet();
try
{
using (MySqlDataAdapter daExcute = new MySqlDataAdapter(strSQL, GetConnection()))
{
daExcute.Fill(dsTemp);
if (DBNull.Value.Equals(dsTemp) || dsTemp.Tables.Count < 1 || DBNull.Value.Equals(dsTemp.Tables[0]))
{
throw new Exception("查询结果为空.");
}
else
{
return dsTemp.Tables[0];
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
#endregion
#region 执行增删改(不带参数)
/// <summary>
/// 执行增删改操作
/// </summary>
/// <param name="strSQL">SQL语句</param>
/// <returns>受影响的行数</returns>
public int ExecNonQuery(string strSQL)
{
try
{
using (MySqlCommand cmd = new MySqlCommand(strSQL, GetConnection()))
{
return cmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
throw new Exception("执行SQL失败: " + strSQL + "\r\n" + ex.Message, ex);
}
}
#endregion
#region 执行增删改(带参数)
/// <summary>
/// 执行带参数的增删改操作
/// </summary>
/// <param name="strSQL">SQL语句</param>
/// <param name="parameters">参数数组</param>
/// <returns>受影响的行数</returns>
public int ExecNonQuery(string strSQL, params MySqlParameter[] parameters)
{
try
{
using (MySqlCommand cmd = new MySqlCommand(strSQL, GetConnection()))
{
if (parameters != null && parameters.Length > 0)
{
cmd.Parameters.AddRange(parameters);
}
return cmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
throw new Exception("执行SQL失败: " + strSQL + "\r\n" + ex.Message, ex);
}
}
#endregion
}
}
@@ -0,0 +1,163 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>物料明细 - 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:1500px;margin:0 auto;padding:12px 16px}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;align-items:center}
.card-header h3{font-size:14px;color:#333;font-weight:600}
.table-wrap{overflow:auto;max-height:calc(100vh-160px)}
table{min-width:100%;border-collapse:collapse;font-size:12px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:6px 8px;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:5px 8px;border:1px solid #ddd;color:#333}
tbody tr:hover{background:#f0f6ff}
.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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
.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}
</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="javascript:history.back()">← 返回</a>
<span class="title" id="pageTitle">物料明细</span>
<span class="user-info" id="userInfo"></span>
</div>
<div class="main">
<div class="card">
<div class="card-header"><h3 id="subTitle">物料明细列表</h3></div>
<div class="table-wrap">
<table>
<thead><tr>
<th>流程编号<span class="resizer"></span></th><th>单据编号<span class="resizer"></span></th><th>行号<span class="resizer"></span></th><th>物料编码<span class="resizer"></span></th><th>物料名称<span class="resizer"></span></th><th>数量<span class="resizer"></span></th>
<th>第一轮报价<span class="resizer"></span></th><th>第二轮报价<span class="resizer"></span></th><th>供应商<span class="resizer"></span></th>
<th>策略采购负责人<span class="resizer"></span></th><th>研发采购负责人<span class="resizer"></span></th><th>要求交付日期<span class="resizer"></span></th><th>审批日期<span class="resizer"></span></th><th>天数<span class="resizer"></span></th>
</tr></thead>
<tbody id="dataBody"><tr class="empty"><td colspan="14">加载中...</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 month=params.month||'',ywzt=params.ywzt||'',yfxm=params.yfxm||'',rangeType=params.rangeType||'';
var ywztMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
var pageSizeOptions=[20,50,100,200],pageSize=20,currentPage=1,allData=[];
document.getElementById('subTitle').textContent='研发项目:'+yfxm+' | '+(ywztMap[ywzt]||'')+' | '+rangeType;
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/GetProcurementDashboardLevel4?month='+encodeURIComponent(month)+'&yfxm='+encodeURIComponent(yfxm)+'&ywzt='+ywzt+'&rangeType='+encodeURIComponent(rangeType),true);
xhr.onload=function(){
loading(false);
try{
var r=JSON.parse(xhr.responseText);
if(r.success)renderList(r.data);
else toast(r.message||'查询失败','error')
}catch(e){toast('数据解析异常','error')}
};
xhr.onerror=function(){loading(false);toast('网络请求失败','error')};
xhr.send();
}
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;
var sb=document.getElementById('sizeBtns');
sb.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="14">暂无数据</td></tr>';return}
var start=(currentPage-1)*pageSize,end=Math.min(start+pageSize,allData.length);
var h='';
for(var i=start;i<end;i++){
var item=allData[i];
h+='<tr><td>'+escapeHtml(item.lcbh)+'</td><td>'+escapeHtml(item.djbh)+'</td><td>'+escapeHtml(item.xh)+'</td><td>'+escapeHtml(item.wlbmCode)+'</td><td>'+escapeHtml(item.wlmc)+'</td><td>'+escapeHtml(item.sqsl)+'</td><td>'+escapeHtml(item.onebj)+'</td><td>'+escapeHtml(item.twobj)+'</td><td>'+escapeHtml(item.gys)+'</td><td>'+escapeHtml(item.cncgfzr)+'</td><td>'+escapeHtml(item.yfcgfzr)+'</td><td>'+escapeHtml(item.dhrq)+'</td><td>'+escapeHtml(item.pmDate)+'</td><td>'+escapeHtml(item.dayDiff)+'</td></tr>';
}
tb.innerHTML=h;
renderPagination();
}
function renderList(data){
allData=data||[];
renderPage();
}
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var u=JSON.parse(userData);
document.getElementById('userInfo').innerHTML=(u.userName||u.userId)+' | <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'}
})();
// 列宽拖动
(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=''}});
})();
loadData();
</script>
</body>
</html>
@@ -0,0 +1,169 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gaussian 首页</title>
<link rel="stylesheet" href="View/common/nav.css">
<style>
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{
font-family:'Microsoft YaHei','PingFang SC','Segoe UI',sans-serif;
/* 干净的浅灰蓝渐变背景,替代原 IDC 机房图 */
background:linear-gradient(135deg,#eef3fb 0%,#e4eaf4 45%,#dbe4f0 100%);
color:#2c3e50;
min-height:100vh;
}
/* 顶部欢迎横幅 */
.main-content{min-height:100vh;padding:26px 30px 40px}
.hero{
max-width:1280px;margin:0 auto 26px;
background:linear-gradient(135deg,#1a56db 0%,#2563eb 55%,#3b82f6 100%);
color:#fff;border-radius:18px;padding:30px 34px;
box-shadow:0 14px 40px rgba(37,99,235,.30);
display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:18px;
}
.hero .greeting h1{font-size:28px;font-weight:700;letter-spacing:.5px;margin-bottom:6px}
.hero .greeting .sub{font-size:14px;opacity:.88}
.hero .greeting .user-line{font-size:13px;opacity:.92;margin-top:10px}
.hero .date-badge{
background:rgba(255,255,255,.16);backdrop-filter:blur(6px);
border:1px solid rgba(255,255,255,.28);border-radius:14px;
padding:18px 24px;text-align:center;min-width:150px;
}
.hero .date-badge .day{font-size:30px;font-weight:700;line-height:1.1}
.hero .date-badge .wd{font-size:13px;opacity:.9;margin-top:2px}
.hero .date-badge .yr{font-size:12px;opacity:.75}
/* 分组标题条 */
.home-group-title{
max-width:1280px;margin:0 auto 14px;
background:#fff;border-radius:12px;padding:13px 20px;
font-size:15px;font-weight:700;color:#1a3a6b;
box-shadow:0 2px 10px rgba(0,0,0,.05);
display:flex;align-items:center;gap:10px;
border-left:4px solid #2563eb;
}
.home-group-title .gicon{font-size:18px}
/* 卡片网格 */
.home-grid{
max-width:1280px;margin:0 auto 26px;
display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:16px;
}
.home-card{
background:#fff;border-radius:14px;padding:22px 20px;
text-decoration:none;color:#2c3e50;
display:flex;flex-direction:column;gap:10px;
transition:transform .18s,box-shadow .18s,border-color .18s;
border:1px solid #e8eef7;
box-shadow:0 2px 10px rgba(0,0,0,.04);
position:relative;overflow:hidden;
}
.home-card::before{
content:'';position:absolute;top:0;left:0;bottom:0;width:4px;
background:linear-gradient(180deg,#2563eb,#3b82f6);
transform:scaleY(0);transform-origin:top;transition:transform .2s;
}
.home-card:hover{transform:translateY(-4px);box-shadow:0 12px 30px rgba(37,99,235,.20);border-color:#c7dcff}
.home-card:hover::before{transform:scaleY(1)}
.home-card .icon{
width:46px;height:46px;border-radius:12px;
background:linear-gradient(135deg,#eef3ff,#e8f0fe);
display:flex;align-items:center;justify-content:center;
font-size:24px;
}
.home-card .title{font-size:15px;font-weight:700;color:#1a3a6b}
.home-card .desc{font-size:12px;color:#8a93a6;line-height:1.5}
.home-card .arrow{font-size:12px;color:#2563eb;margin-top:auto;opacity:0;transition:opacity .2s,transform .2s}
.home-card:hover .arrow{opacity:1;transform:translateX(3px)}
/* 空状态 */
.home-empty{
max-width:1280px;margin:30px auto 0;
background:#fff;border-radius:12px;padding:40px;text-align:center;color:#999;
box-shadow:0 2px 10px rgba(0,0,0,.04);
}
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="hero">
<div class="greeting">
<h1>欢迎回来</h1>
<div class="sub">Gaussian IT 管理系统 · 工作台</div>
<div class="user-line" id="userLine"></div>
</div>
<div class="date-badge">
<div class="day" id="heroDay">--</div>
<div class="wd" id="heroWd">--</div>
<div class="yr" id="heroYr">--</div>
</div>
</div>
<div id="homeGroups"></div>
</div>
<script src="View/common/nav.js"></script>
<script>
// 读取当前登录用户,未登录跳回登录页
var user = getLoginUser();
if (!user) { window.location.href = 'login.html'; }
(function () {
var line = document.getElementById('userLine');
if (line && user) {
var name = user.userName || user.userId || user.name || '未知';
line.textContent = '当前用户:' + name + ' 登录时间:' + new Date().toLocaleString();
}
// 右上日期徽章
var d = new Date();
var dayMap = ['日','一','二','三','四','五','六'];
var dd = document.getElementById('heroDay');
var dw = document.getElementById('heroWd');
var dy = document.getElementById('heroYr');
if (dd) dd.textContent = d.getDate();
if (dw) dw.textContent = '周' + dayMap[d.getDay()];
if (dy) dy.textContent = d.getFullYear() + '年' + (d.getMonth()+1) + '月';
})();
// 依据 MENU_GROUPS 渲染功能入口卡片(按角色权限过滤)
function renderHome() {
var wrap = document.getElementById('homeGroups');
if (!wrap) return;
var html = '';
var shown = 0;
for (var i = 0; i < MENU_GROUPS.length; i++) {
var g = MENU_GROUPS[i];
// 首页入口在首页本身不展示
if (g.hideOnHome) continue;
var items = [];
if (g.children && g.children.length) {
for (var k = 0; k < g.children.length; k++) {
var c = g.children[k];
if (hasRole(c.role)) items.push(c);
}
} else {
if (hasRole(g.role)) items.push({ title: g.title, href: g.href, icon: g.icon });
}
if (items.length === 0) continue;
shown += items.length;
html += '<div class="home-group-title"><span class="gicon">' + (g.icon || '📁') + '</span>' + g.title + '</div>';
html += '<div class="home-grid">';
for (var j = 0; j < items.length; j++) {
html += '<a class="home-card" href="' + APP_BASE + items[j].href + '">'
+ '<div class="icon">' + (items[j].icon || '📄') + '</div>'
+ '<div class="title">' + items[j].title + '</div>'
+ '<div class="desc">点击进入</div>'
+ '<div class="arrow">→</div>'
+ '</a>';
}
html += '</div>';
}
if (shown === 0) html = '<div class="home-empty">当前账号暂无可用的功能入口</div>';
wrap.innerHTML = html;
}
renderHome();
</script>
</body>
</html>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,489 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OA研发物料采购申请管理</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 24px;
display: flex;
align-items: center;
height: 56px;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
position: sticky;
top: 0;
z-index: 100;
}
.top-bar .logo { font-size: 18px; font-weight: 600; letter-spacing: 1px; margin-right: 32px; }
.top-bar .nav-tabs { display: flex; gap: 4px; height: 100%; }
.top-bar .nav-tabs a {
color: rgba(255,255,255,0.75);
text-decoration: none;
padding: 0 20px;
display: flex;
align-items: center;
font-size: 14px;
border-radius: 4px 4px 0 0;
transition: all 0.2s;
}
.top-bar .nav-tabs a:hover { color: #fff; background: rgba(255,255,255,0.1); }
.top-bar .nav-tabs a.active { color: #fff; background: rgba(255,255,255,0.2); }
.top-bar .user-info { margin-left: auto; font-size: 13px; opacity: 0.85; }
/* ===== 主容器 ===== */
.main-container { max-width: 1500px; margin: 0 auto; padding: 16px 20px; }
/* ===== 查询栏 ===== */
.search-bar {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
padding: 12px 16px; margin-bottom: 12px;
display: grid; grid-template-columns: repeat(4,1fr); gap: 8px 14px; align-items:center;
}
.search-bar label { font-size: 12px; color: #555; font-weight: 600; white-space: nowrap; }
.search-bar .field{display:inline-flex;align-items:center;gap:4px}
.search-bar input,.search-bar select {
height: 32px; padding: 0 10px; border: 2px solid #e0e0e0; border-radius: 5px;
font-size: 13px; outline: none; transition: border-color 0.2s; box-sizing:border-box;
}
.search-bar .field input{flex:1;min-width:0}
.search-bar input:focus,.search-bar select:focus{border-color:#1a73e8}
.search-bar .btn {
height: 32px; padding: 0 16px; border: none; border-radius: 5px;
font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.search-bar .btn-primary { background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff; }
.search-bar .btn-primary:hover { opacity: 0.92; }
.search-bar .btn-outline { background: #fff; color: #666; border: 2px solid #e0e0e0; }
.search-bar .btn-outline:hover { border-color: #1a73e8; color: #1a73e8; }
/* ===== 内容区(列表+详情) ===== */
.content-area { display: flex; gap: 14px; min-height: 600px; }
/* ===== 列表卡片 ===== */
.list-card {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.list-card .card-header {
padding: 12px 20px; border-bottom: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center;
}
.list-card .card-header h3 { font-size: 15px; color: #333; font-weight: 600; }
.list-card .card-header .count { font-size: 13px; color: #999; }
.list-card .card-header .count em { font-style: normal; color: #1a73e8; font-weight: 700; }
.table-wrap { overflow-x: auto; flex: 1; }
table { min-width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
background: #f8f9fa; color: #555; font-weight: 600;
padding: 9px 12px; text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 9px 12px; border: 1px solid #ddd; color: #333; }
tbody tr { transition: background 0.15s; cursor: pointer; }
tbody tr:hover { background: #f0f6ff; }
tbody tr.active { background: #e8f0fe; }
.empty-row td { text-align: center; padding: 36px; color: #bbb; font-size: 14px; }
.table-wrap { overflow-y: auto; max-height: calc(100vh - 280px); }
.row-chk { width: 18px; height: 18px; cursor: pointer; vertical-align: middle; }
td:first-child { text-align: center; }
/* ===== 分页 ===== */
.pagination {
padding: 10px 20px; border-top: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #666;
}
.pagination .page-btns { display: flex; gap: 4px; }
.pagination .page-btns button {
min-width: 30px; height: 30px; border: 1px solid #e0e0e0; border-radius: 4px;
background: #fff; color: #333; cursor: pointer; font-size: 12px; transition: all 0.15s;
}
.pagination .page-btns button:hover { border-color: #1a73e8; color: #1a73e8; }
.pagination .page-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.pagination .page-btns button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .size-btns button {
min-width: 40px; height: 24px; border: 1px solid #e0e0e0; border-radius: 3px;
background: #fff; color: #666; cursor: pointer; font-size: 11px; transition: all 0.15s; margin: 0 1px;
}
.pagination .size-btns button:hover { border-color: #1a73e8; color: #1a73e8; }
.pagination .size-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
/* ===== 详情侧栏 ===== */
.detail-panel {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
width: 0; overflow: hidden; transition: width 0.3s ease;
display: flex; flex-direction: column;
}
.detail-panel.open { width: 620px; min-width: 620px; }
.detail-panel .panel-header {
padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center;
}
.detail-panel .panel-header h3 { font-size: 14px; color: #333; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-panel .panel-header .close-btn {
width: 26px; height: 26px; border: none; background: #f5f5f5; border-radius: 4px;
cursor: pointer; font-size: 15px; color: #999;
display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0;
}
.detail-panel .panel-header .close-btn:hover { background: #fee; color: #e74c3c; }
.detail-panel .panel-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
/* ===== 主信息区 ===== */
.master-info {
display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px;
padding: 10px 14px; background: #fafbfc; border-radius: 6px; margin-bottom: 12px;
}
.master-info .info-row { display: flex; font-size: 12px; }
.master-info .info-row .lbl { color: #999; width: 80px; flex-shrink: 0; }
.master-info .info-row .val { color: #333; font-weight: 500; }
/* ===== Tabs ===== */
.detail-tabs {
display: flex; border-bottom: 2px solid #f0f0f0; margin-bottom: 10px;
}
.detail-tabs .tab {
padding: 7px 14px; font-size: 13px; color: #999; cursor: pointer;
border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.detail-tabs .tab:hover { color: #1a73e8; }
.detail-tabs .tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }
.detail-tab-content { display: none; }
.detail-tab-content.active { display: block; }
/* ===== 子表格 ===== */
.sub-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sub-table thead th {
background: #f8f9fa; color: #555; font-weight: 600;
padding: 6px 8px; text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap;
}
.sub-table tbody td { padding: 5px 8px; border: 1px solid #ddd; color: #333; }
.sub-table tbody tr:hover { background: #f8f9fa; }
.sub-table .status-badge {
display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.status-badge.completed { background: #e6f9ed; color: #1a7a3a; }
.status-badge.partial { background: #fff8e1; color: #e67e22; }
.status-badge.pending { background: #f0f0f0; color: #999; }
.sub-table .link-btn { color: #1a73e8; cursor: pointer; text-decoration: underline; font-size: 12px; }
.sub-table .link-btn:hover { color: #1557b0; }
/* ===== 维护字段输入 ===== */
.maintain-grid {
display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 12px;
padding: 8px 10px; background: #fafbfc; border-radius: 6px; margin: 6px 0;
}
.maintain-field { display: flex; flex-direction: column; gap: 2px; }
.maintain-field .mf-label { font-size: 11px; color: #999; }
.maintain-field input, .maintain-field select {
height: 28px; padding: 0 8px; border: 1px solid #ddd; border-radius: 4px;
font-size: 12px; outline: none; transition: border-color 0.15s;
}
.maintain-field input:focus, .maintain-field select:focus { border-color: #1a73e8; }
.maintain-field input[type="number"] { text-align: right; }
.detail-header-bar {
display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.detail-header-bar .row-label { font-size: 13px; font-weight: 600; color: #333; }
.save-btn {
height: 28px; padding: 0 16px; border: none; border-radius: 4px;
background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff;
font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.save-btn:hover { opacity: 0.9; }
.save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* ===== 加载/通知 ===== */
.loading-overlay {
display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.7); z-index: 999;
justify-content: center; align-items: center;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
width: 36px; height: 36px; border: 3px solid #e0e0e0; border-top-color: #1a73e8;
border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
padding: 10px 22px; border-radius: 8px; font-size: 13px; z-index: 1000;
box-shadow: 0 4px 20px rgba(0,0,0,0.15); display: none; min-width: 260px; text-align: center;
}
.toast.error { background: #fdeaea; color: #b71c1c; display: block; }
.toast.success { background: #e6f9ed; color: #1a7a3a; display: block; }
.toast.info { background: #e3f2fd; color: #1565c0; display: block; }
@media (max-width: 1100px) {
.content-area { flex-direction: column; }
.detail-panel.open { width: 100%; min-width: 0; }
.maintain-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
.maintain-grid { grid-template-columns: 1fr; }
.master-info { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="loading-overlay" id="loadingOverlay"><div class="loading-spinner"></div></div>
<div class="toast" id="toast"></div>
<div class="top-bar">
<div class="logo" style="font-size:17px;font-weight:600;letter-spacing:1px;margin-right:24px;">Gaussian</div>
<div class="nav-tabs" id="navTabs"></div>
<div class="user-info" id="userInfo"></div>
</div>
<div class="main-container">
<div class="search-bar">
<span class="field"><label>流程编号:</label><input type="text" id="txtLcbh" placeholder="流程编号" autocomplete="off" /></span>
<span class="field"><label>申请日期:</label><input type="date" id="txtSqrq" /></span>
<span class="field"><label>研发项目:</label><input type="text" id="txtYfxm" placeholder="研发项目" autocomplete="off" /></span>
<span class="field"><label>专项名称:</label><input type="text" id="txtReqName" placeholder="专项名称" autocomplete="off" /></span>
<span class="field"><label>申请人:</label><input type="text" id="txtSqrxm" placeholder="申请人" autocomplete="off" /></span>
<span class="field"><label>物料编码:</label><input type="text" id="txtWlbmCode" placeholder="物料编码" autocomplete="off" /></span>
<span class="field"><label>策略采购负责人:</label><input type="text" id="txtCncgfzr" placeholder="策略采购负责人 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>研发采购负责人:</label><input type="text" id="txtYfcgfzr" placeholder="研发采购负责人 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>供应商:</label><input type="text" id="txtGys" placeholder="供应商 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>业务状态:</label>
<select id="txtDjzk"><option value="">全部</option><option value="0">--</option><option value="1">采购订单-转单追踪</option><option value="2">供应链-待供应商报价</option><option value="3">供应链-待ED审批</option><option value="4">供应链-ED驳回,重新议价</option><option value="5">供应链-ED已审批</option><option value="6">研发-采购申请驳回</option><option value="7">研发-采购申请撤回</option><option value="8">研发-采购申请取消</option><option value="9">研发-量产复用件</option></select>
</span>
<span style="grid-column:3/-1;text-align:right;display:flex;gap:12px;justify-content:flex-end;align-items:center">
<span style="font-size:12px;color:#999">共 <em id="totalCount" style="font-style:normal;color:#1a73e8;font-weight:700">0</em> 条</span>
<button class="btn btn-primary" onclick="loadList()">查询</button>
<button class="btn btn-outline" onclick="resetSearch()">重置</button>
</span>
</div>
<div class="content-area">
<!-- 列表 -->
<div class="list-card">
<div class="card-header">
<h3>研发物料采购申请单</h3>
<span class="count">
当前页 <em id="pageCount">0</em>
&nbsp; <button class="btn-batch" id="btnBatch" onclick="openBatch()" disabled style="height:28px;padding:0 12px;border:0;border-radius:4px;background:#1a73e8;color:#fff;font-size:12px;cursor:pointer;vertical-align:middle;opacity:.5">批量汇总</button>
&nbsp; <button onclick="exportXlsx()" style="height:28px;padding:0 12px;border:1px solid #1a73e8;border-radius:4px;background:#fff;color:#1a73e8;font-size:12px;cursor:pointer;vertical-align:middle">导出Excel</button>
&nbsp; <button onclick="document.getElementById('fileInput').click()" style="height:28px;padding:0 12px;border:1px solid #1a73e8;border-radius:4px;background:#fff;color:#1a73e8;font-size:12px;cursor:pointer;vertical-align:middle">导入Excel</button>
<input type="file" id="fileInput" accept=".xls,.xlsx" style="display:none" onchange="importXlsx(this)" />
</span>
</div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th style="width:32px;text-align:center"><input type="checkbox" id="chkAll" onclick="toggleAll(this)" /></th>
<th style="width:28px;">#</th>
<th>流程编号</th>
<th>申请日期</th>
<th>研发项目</th>
<th>专项名称</th>
<th>申请人</th>
<th>单据状态</th>
<th>项目经理审批时间</th>
</tr>
</thead>
<tbody id="listBody">
<tr class="empty-row"><td colspan="9">暂无数据,请点击查询按钮加载</td></tr>
</tbody>
</table>
</div>
<div class="pagination" id="pagination">
<div>
<span>共 <em id="totalPages">0</em> 页,</span>
<span>每页显示
<span class="size-btns" id="sizeBtns"></span>
</span>
</div>
<div class="page-btns" id="pageBtns"></div>
</div>
</div>
</div>
<script>
var currentPage=1,pageSize=50,currentData=[],selectedIds={};
var pageSizeOptions=[50,100,200,1000,2000];
var djzkMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
function escapeHtml(s){if(!s)return '';var d=document.createElement('div');d.appendChild(document.createTextNode(String(s)));return d.innerHTML}
function showLoading(){document.getElementById('loadingOverlay').classList.add('show')}
function hideLoading(){document.getElementById('loadingOverlay').classList.remove('show')}
function showToast(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 getVal(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value.trim()):''}
function getSel(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value):''}
function loadList(){
saveFilters();showLoading();currentPage=1;
var p='lcbh='+getVal('txtLcbh')+'&sqrq='+getVal('txtSqrq')+'&yfxm='+getVal('txtYfxm')+'&reqName='+getVal('txtReqName')+'&sqrxm='+getVal('txtSqrxm')+'&djzk='+getSel('txtDjzk')+'&wlbmCode='+getVal('txtWlbmCode')+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&gys='+getVal('txtGys')+'&page=1&pageSize='+pageSize;
var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetRequestList?'+p,true);
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success){try{currentData=r.data||[];renderList(currentData);renderPagination(r.total||0);document.getElementById('totalCount').textContent=r.total||0}catch(er){showToast('渲染异常:'+er.message,'error')}}
else showToast(r.message||'查询失败','error')
}catch(e){showToast('数据解析异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send();
}
function loadPage(page){
saveFilters();showLoading();currentPage=page;
var p='lcbh='+getVal('txtLcbh')+'&sqrq='+getVal('txtSqrq')+'&yfxm='+getVal('txtYfxm')+'&reqName='+getVal('txtReqName')+'&sqrxm='+getVal('txtSqrxm')+'&djzk='+getSel('txtDjzk')+'&wlbmCode='+getVal('txtWlbmCode')+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&gys='+getVal('txtGys')+'&page='+page+'&pageSize='+pageSize;
var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetRequestList?'+p,true);
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success){currentData=r.data||[];renderList(currentData);renderPagination(r.total||0);document.getElementById('totalCount').textContent=r.total||0}
else showToast(r.message||'查询失败','error')
}catch(e){showToast('数据解析异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send();
}
var filterIds=['txtLcbh','txtSqrq','txtYfxm','txtReqName','txtSqrxm','txtDjzk','txtWlbmCode','txtCncgfzr','txtYfcgfzr','txtGys'];
function saveFilters(){
filterIds.forEach(function(id){if(document.getElementById(id))sessionStorage.setItem('pro_'+id,document.getElementById(id).value)});
}
function restoreFilters(){
filterIds.forEach(function(id){var v=sessionStorage.getItem('pro_'+id);if(v!==null){var el=document.getElementById(id);if(el)el.value=v}});
var ps=sessionStorage.getItem('pro_pageSize');
if(ps!==null&&pageSizeOptions.indexOf(parseInt(ps))>=0)pageSize=parseInt(ps);
}
function resetSearch(){
filterIds.forEach(function(id){sessionStorage.removeItem('pro_'+id);var el=document.getElementById(id);if(el)el.value=''});
selectedIds={};loadList();
}
function renderList(data){
var tbody=document.getElementById('listBody');
if(!data||!data.length){tbody.innerHTML='<tr class="empty-row"><td colspan="9">暂无匹配数据</td></tr>';document.getElementById('pageCount').textContent='0';return}
var h='';
data.forEach(function(item,idx){
var checked=selectedIds[item.id]?'checked':'';
h+='<tr class="list-row" data-id="'+escapeHtml(item.id)+'" data-lcbh="'+escapeHtml(item.lcbh)+'" data-djbh="'+escapeHtml(item.djbh)+'" data-requestid="'+escapeHtml(item.requestId)+'" onclick="selectRow(this)">';
h+='<td style="text-align:center"><input type="checkbox" class="row-chk" data-id="'+escapeHtml(item.id)+'" '+checked+' onclick="event.stopPropagation();toggleRow(this)"/></td>';
h+='<td>'+((currentPage-1)*pageSize+idx+1)+'</td>';
h+='<td><strong>'+escapeHtml(item.lcbh)+'</strong></td>';
h+='<td>'+escapeHtml(item.sqrq)+'</td>';
h+='<td>'+escapeHtml(item.yfxmmc)+'</td>';
h+='<td style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="'+escapeHtml(item.REQUESTNAME)+'">'+escapeHtml(item.REQUESTNAME)+'</td>';
h+='<td>'+escapeHtml(item.sqrxm)+'</td>';
h+='<td>'+(djzkMap[item.djzk]||'')+'</td>';
h+='<td>'+escapeHtml(item.pmAuditTime)+'</td>';
h+='</tr>';
});
tbody.innerHTML=h;document.getElementById('pageCount').textContent=data.length;updateBatchBtn();
}
function selectRow(el){
var lcbh=el.getAttribute('data-lcbh'),djbh=el.getAttribute('data-djbh'),requestId=el.getAttribute('data-requestid');
var row=currentData.find(function(d){return d.lcbh===lcbh});
var sqrq=row?row.sqrq:'',sqrxm=row?row.sqrxm:'',yfxmmc=row?row.yfxmmc:'',reqName=row?encodeURIComponent(row.REQUESTNAME||''):'',pmTime=row?encodeURIComponent(row.pmAuditTime||''):'';
window.location.href='procurement_detail.html?lcbh='+encodeURIComponent(lcbh)+'&djbh='+encodeURIComponent(djbh)+'&requestId='+encodeURIComponent(requestId)+'&sqrq='+encodeURIComponent(sqrq)+'&sqrxm='+encodeURIComponent(sqrxm)+'&yfxmmc='+encodeURIComponent(yfxmmc)+'&reqName='+reqName+'&pmTime='+pmTime;
}
function toggleRow(cb){var id=cb.getAttribute('data-id');if(cb.checked)selectedIds[id]=true;else delete selectedIds[id];updateBatchBtn()}
function toggleAll(cb){document.querySelectorAll('.row-chk').forEach(function(c){c.checked=cb.checked;var id=c.getAttribute('data-id');if(cb.checked)selectedIds[id]=true;else delete selectedIds[id]});updateBatchBtn()}
function setPageSize(size){
pageSize=size;
sessionStorage.setItem('pro_pageSize',size);
loadList();
}
function renderPagination(total){
var tp=Math.ceil(total/pageSize)||1;document.getElementById('totalPages').textContent=tp;
// 每页条数按钮
var sb=document.getElementById('sizeBtns');
var sh='';pageSizeOptions.forEach(function(s){sh+='<button class="'+(s===pageSize?'active':'')+'" onclick="setPageSize('+s+')">'+s+'条</button>'});
sb.innerHTML=sh;
// 页码按钮
var c=document.getElementById('pageBtns');if(tp<=1){c.innerHTML='';return}
var h='';h+='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage(1)">首页</button>';h+='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage('+(currentPage-1)+')">‹</button>';var start=Math.max(1,currentPage-2),end=Math.min(tp,currentPage+2);
for(var i=start;i<=end;i++)h+='<button class="'+(i===currentPage?'active':'')+'" onclick="loadPage('+i+')">'+i+'</button>';h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+(currentPage+1)+')">›</button>';h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+tp+')">末页</button>';c.innerHTML=h;
}
function updateBatchBtn(){var btn=document.getElementById('btnBatch');if(!btn)return;var cnt=Object.keys(selectedIds).length;btn.disabled=cnt===0;btn.style.opacity=cnt===0?'.5':'1';btn.textContent='批量汇总 ('+cnt+')'}
function openBatch(){var ids=Object.keys(selectedIds);if(!ids.length){showToast('请先选择申请单','error');return}window.location.href='multi_detail.html?ids='+ids.join(',')}
function exportXlsx(){
var ids=Object.keys(selectedIds);
if(!ids.length){showToast('请先勾选要导出的申请单','error');return}
showLoading();
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/ExportXlsx',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success&&r.data){
var blob=new Blob(['\uFEFF'+r.data],{type:'text/plain;charset=utf-8'});
var a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='采购申请维护数据_'+new Date().toISOString().slice(0,10)+'.xls';a.click();
showToast('导出成功,共 '+r.total+' 条','success');
}else showToast(r.message||'导出失败','error')
}catch(e){showToast('导出异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send(JSON.stringify({ids:ids}));
}
function importXlsx(input){
var file=input.files[0];if(!file)return;
var reader=new FileReader();
reader.onload=function(){
showLoading();
var bytes=new Uint8Array(reader.result);
var binary='';
for(var i=0;i<bytes.length;i++)binary+=String.fromCharCode(bytes[i]);
var base64=btoa(binary);
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/ImportXlsx',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();input.value='';
try{var r=JSON.parse(xhr.responseText);showToast(r.message||(r.success?'导入成功':'导入失败'),r.success?'success':'error')}catch(e){showToast('导入响应异常','error')}
};
xhr.onerror=function(){hideLoading();input.value='';showToast('网络请求失败','error')};
xhr.send(JSON.stringify({file:base64}));
};
reader.readAsArrayBuffer(file);
}
function logout(){sessionStorage.removeItem('gx_user');window.location.href='login.html'}
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var user=JSON.parse(userData);var roles=user.roleNumbers||[];
if(roles.indexOf('Purchase01')<0){alert('当前用户无权限');sessionStorage.removeItem('gx_user');window.location.href='login.html';return}
var nav='';if(roles.indexOf('CRM01')>=0)nav+='<a href="index.html">CRM同步</a>';if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement.html" class="active">采购申请管理</a>';if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement_dashboard.html">采购看板</a>';if(roles.indexOf('Purchase01')>=0)nav+='<a href="delivery_dashboard.html">采购物料交付状态看板</a>';if(roles.indexOf('YF01')>=0)nav+='<a href="dashboard.html">研发采购看板</a>';
document.getElementById('navTabs').innerHTML=nav;document.getElementById('userInfo').innerHTML=(user.userName||user.userId)+' | <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){alert('当前用户无权限');window.location.href='login.html'}
})();
restoreFilters();
loadList();
</script>
</body>
</html>
@@ -0,0 +1,480 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OA研发物料采购申请管理</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="View/common/nav.css">
<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 24px;
display: flex;
align-items: center;
height: 56px;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
position: sticky;
top: 0;
z-index: 100;
}
.top-bar .logo { font-size: 18px; font-weight: 600; letter-spacing: 1px; margin-right: 32px; }
.top-bar .nav-tabs { display: flex; gap: 4px; height: 100%; }
.top-bar .nav-tabs a {
color: rgba(255,255,255,0.75);
text-decoration: none;
padding: 0 20px;
display: flex;
align-items: center;
font-size: 14px;
border-radius: 4px 4px 0 0;
transition: all 0.2s;
}
.top-bar .nav-tabs a:hover { color: #fff; background: rgba(255,255,255,0.1); }
.top-bar .nav-tabs a.active { color: #fff; background: rgba(255,255,255,0.2); }
.top-bar .user-info { margin-left: auto; font-size: 13px; opacity: 0.85; }
/* ===== 主容器 ===== */
.main-container { max-width: 1500px; margin: 0 auto; padding: 16px 20px; }
/* ===== 查询栏 ===== */
.search-bar {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
padding: 12px 16px; margin-bottom: 12px;
display: grid; grid-template-columns: repeat(4,1fr); gap: 8px 14px; align-items:center;
}
.search-bar label { font-size: 12px; color: #555; font-weight: 600; white-space: nowrap; }
.search-bar .field{display:inline-flex;align-items:center;gap:4px}
.search-bar input,.search-bar select {
height: 32px; padding: 0 10px; border: 2px solid #e0e0e0; border-radius: 5px;
font-size: 13px; outline: none; transition: border-color 0.2s; box-sizing:border-box;
}
.search-bar .field input{flex:1;min-width:0}
.search-bar input:focus,.search-bar select:focus{border-color:#1a73e8}
.search-bar .btn {
height: 32px; padding: 0 16px; border: none; border-radius: 5px;
font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.search-bar .btn-primary { background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff; }
.search-bar .btn-primary:hover { opacity: 0.92; }
.search-bar .btn-outline { background: #fff; color: #666; border: 2px solid #e0e0e0; }
.search-bar .btn-outline:hover { border-color: #1a73e8; color: #1a73e8; }
/* ===== 内容区(列表+详情) ===== */
.content-area { display: flex; gap: 14px; min-height: 600px; }
/* ===== 列表卡片 ===== */
.list-card {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.list-card .card-header {
padding: 12px 20px; border-bottom: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center;
}
.list-card .card-header h3 { font-size: 15px; color: #333; font-weight: 600; }
.list-card .card-header .count { font-size: 13px; color: #999; }
.list-card .card-header .count em { font-style: normal; color: #1a73e8; font-weight: 700; }
.table-wrap { overflow-x: auto; flex: 1; }
table { min-width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
background: #f8f9fa; color: #555; font-weight: 600;
padding: 9px 12px; text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 9px 12px; border: 1px solid #ddd; color: #333; }
tbody tr { transition: background 0.15s; cursor: pointer; }
tbody tr:hover { background: #f0f6ff; }
tbody tr.active { background: #e8f0fe; }
.empty-row td { text-align: center; padding: 36px; color: #bbb; font-size: 14px; }
.table-wrap { overflow-y: auto; max-height: calc(100vh - 280px); }
.row-chk { width: 18px; height: 18px; cursor: pointer; vertical-align: middle; }
td:first-child { text-align: center; }
/* ===== 分页 ===== */
.pagination {
padding: 10px 20px; border-top: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #666;
}
.pagination .page-btns { display: flex; gap: 4px; }
.pagination .page-btns button {
min-width: 30px; height: 30px; border: 1px solid #e0e0e0; border-radius: 4px;
background: #fff; color: #333; cursor: pointer; font-size: 12px; transition: all 0.15s;
}
.pagination .page-btns button:hover { border-color: #1a73e8; color: #1a73e8; }
.pagination .page-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.pagination .page-btns button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .size-btns button {
min-width: 40px; height: 24px; border: 1px solid #e0e0e0; border-radius: 3px;
background: #fff; color: #666; cursor: pointer; font-size: 11px; transition: all 0.15s; margin: 0 1px;
}
.pagination .size-btns button:hover { border-color: #1a73e8; color: #1a73e8; }
.pagination .size-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
/* ===== 详情侧栏 ===== */
.detail-panel {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
width: 0; overflow: hidden; transition: width 0.3s ease;
display: flex; flex-direction: column;
}
.detail-panel.open { width: 620px; min-width: 620px; }
.detail-panel .panel-header {
padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center;
}
.detail-panel .panel-header h3 { font-size: 14px; color: #333; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-panel .panel-header .close-btn {
width: 26px; height: 26px; border: none; background: #f5f5f5; border-radius: 4px;
cursor: pointer; font-size: 15px; color: #999;
display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0;
}
.detail-panel .panel-header .close-btn:hover { background: #fee; color: #e74c3c; }
.detail-panel .panel-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
/* ===== 主信息区 ===== */
.master-info {
display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px;
padding: 10px 14px; background: #fafbfc; border-radius: 6px; margin-bottom: 12px;
}
.master-info .info-row { display: flex; font-size: 12px; }
.master-info .info-row .lbl { color: #999; width: 80px; flex-shrink: 0; }
.master-info .info-row .val { color: #333; font-weight: 500; }
/* ===== Tabs ===== */
.detail-tabs {
display: flex; border-bottom: 2px solid #f0f0f0; margin-bottom: 10px;
}
.detail-tabs .tab {
padding: 7px 14px; font-size: 13px; color: #999; cursor: pointer;
border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.detail-tabs .tab:hover { color: #1a73e8; }
.detail-tabs .tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }
.detail-tab-content { display: none; }
.detail-tab-content.active { display: block; }
/* ===== 子表格 ===== */
.sub-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sub-table thead th {
background: #f8f9fa; color: #555; font-weight: 600;
padding: 6px 8px; text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap;
}
.sub-table tbody td { padding: 5px 8px; border: 1px solid #ddd; color: #333; }
.sub-table tbody tr:hover { background: #f8f9fa; }
.sub-table .status-badge {
display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.status-badge.completed { background: #e6f9ed; color: #1a7a3a; }
.status-badge.partial { background: #fff8e1; color: #e67e22; }
.status-badge.pending { background: #f0f0f0; color: #999; }
.sub-table .link-btn { color: #1a73e8; cursor: pointer; text-decoration: underline; font-size: 12px; }
.sub-table .link-btn:hover { color: #1557b0; }
/* ===== 维护字段输入 ===== */
.maintain-grid {
display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 12px;
padding: 8px 10px; background: #fafbfc; border-radius: 6px; margin: 6px 0;
}
.maintain-field { display: flex; flex-direction: column; gap: 2px; }
.maintain-field .mf-label { font-size: 11px; color: #999; }
.maintain-field input, .maintain-field select {
height: 28px; padding: 0 8px; border: 1px solid #ddd; border-radius: 4px;
font-size: 12px; outline: none; transition: border-color 0.15s;
}
.maintain-field input:focus, .maintain-field select:focus { border-color: #1a73e8; }
.maintain-field input[type="number"] { text-align: right; }
.detail-header-bar {
display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.detail-header-bar .row-label { font-size: 13px; font-weight: 600; color: #333; }
.save-btn {
height: 28px; padding: 0 16px; border: none; border-radius: 4px;
background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff;
font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.save-btn:hover { opacity: 0.9; }
.save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* ===== 加载/通知 ===== */
.loading-overlay {
display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.7); z-index: 999;
justify-content: center; align-items: center;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
width: 36px; height: 36px; border: 3px solid #e0e0e0; border-top-color: #1a73e8;
border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
padding: 10px 22px; border-radius: 8px; font-size: 13px; z-index: 1000;
box-shadow: 0 4px 20px rgba(0,0,0,0.15); display: none; min-width: 260px; text-align: center;
}
.toast.error { background: #fdeaea; color: #b71c1c; display: block; }
.toast.success { background: #e6f9ed; color: #1a7a3a; display: block; }
.toast.info { background: #e3f2fd; color: #1565c0; display: block; }
@media (max-width: 1100px) {
.content-area { flex-direction: column; }
.detail-panel.open { width: 100%; min-width: 0; }
.maintain-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
.maintain-grid { grid-template-columns: 1fr; }
.master-info { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="loading-overlay" id="loadingOverlay"><div class="loading-spinner"></div></div>
<div class="toast" id="toast"></div>
<div id="sidebar"></div>
<div class="main-content">
<div class="search-bar">
<span class="field"><label>流程编号:</label><input type="text" id="txtLcbh" placeholder="流程编号" autocomplete="off" /></span>
<span class="field"><label>单据编号:</label><input type="text" id="txtDjbh" placeholder="单据编号" autocomplete="off" /></span>
<span class="field"><label>申请日期:</label><input type="date" id="txtSqrq" /></span>
<span class="field"><label>研发项目:</label><input type="text" id="txtYfxm" placeholder="研发项目" autocomplete="off" /></span>
<span class="field"><label>专项名称:</label><input type="text" id="txtReqName" placeholder="专项名称" autocomplete="off" /></span>
<span class="field"><label>申请人:</label><input type="text" id="txtSqrxm" placeholder="申请人" autocomplete="off" /></span>
<span class="field"><label>物料编码:</label><input type="text" id="txtWlbmCode" placeholder="物料编码" autocomplete="off" /></span>
<span class="field"><label>策略采购负责人:</label><input type="text" id="txtCncgfzr" placeholder="策略采购负责人 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>研发采购负责人:</label><input type="text" id="txtYfcgfzr" placeholder="研发采购负责人 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>供应商:</label><input type="text" id="txtGys" placeholder="供应商 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>业务状态:</label>
<select id="txtDjzk"><option value="">全部</option><option value="0">--</option><option value="1">采购订单-转单追踪</option><option value="2">供应链-待供应商报价</option><option value="3">供应链-待ED审批</option><option value="4">供应链-ED驳回,重新议价</option><option value="5">供应链-ED已审批</option><option value="6">研发-采购申请驳回</option><option value="7">研发-采购申请撤回</option><option value="8">研发-采购申请取消</option><option value="9">研发-量产复用件</option></select>
</span>
<span style="grid-column:3/-1;text-align:right;display:flex;gap:12px;justify-content:flex-end;align-items:center">
<span style="font-size:12px;color:#999">共 <em id="totalCount" style="font-style:normal;color:#1a73e8;font-weight:700">0</em> 条</span>
<button class="btn btn-primary" onclick="loadList()">查询</button>
<button class="btn btn-outline" onclick="resetSearch()">重置</button>
</span>
</div>
<div class="content-area">
<!-- 列表 -->
<div class="list-card">
<div class="card-header">
<h3>研发物料采购申请单</h3>
<span class="count">
当前页 <em id="pageCount">0</em>
&nbsp; <button class="btn-batch" id="btnBatch" onclick="openBatch()" disabled style="height:28px;padding:0 12px;border:0;border-radius:4px;background:#1a73e8;color:#fff;font-size:12px;cursor:pointer;vertical-align:middle;opacity:.5">批量汇总</button>
&nbsp; <button onclick="exportXlsx()" style="height:28px;padding:0 12px;border:1px solid #1a73e8;border-radius:4px;background:#fff;color:#1a73e8;font-size:12px;cursor:pointer;vertical-align:middle">导出Excel</button>
&nbsp; <button onclick="document.getElementById('fileInput').click()" style="height:28px;padding:0 12px;border:1px solid #1a73e8;border-radius:4px;background:#fff;color:#1a73e8;font-size:12px;cursor:pointer;vertical-align:middle">导入Excel</button>
<input type="file" id="fileInput" accept=".xls,.xlsx" style="display:none" onchange="importXlsx(this)" />
</span>
</div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th style="width:32px;text-align:center"><input type="checkbox" id="chkAll" onclick="toggleAll(this)" /></th>
<th style="width:28px;">#</th>
<th>流程编号</th>
<th>单据编号</th>
<th>申请日期</th>
<th>研发项目</th>
<th>专项名称</th>
<th>申请人</th>
<th>单据状态</th>
<th>项目经理审批时间</th>
</tr>
</thead>
<tbody id="listBody">
<tr class="empty-row"><td colspan="10">暂无数据,请点击查询按钮加载</td></tr>
</tbody>
</table>
</div>
<div class="pagination" id="pagination">
<div>
<span>共 <em id="totalPages">0</em> 页,</span>
<span>每页显示
<span class="size-btns" id="sizeBtns"></span>
</span>
</div>
<div class="page-btns" id="pageBtns"></div>
</div>
</div>
</div>
<script>
var currentPage=1,pageSize=50,currentData=[],selectedIds={};
var pageSizeOptions=[50,100,200,1000,2000];
var djzkMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
function escapeHtml(s){if(!s)return '';var d=document.createElement('div');d.appendChild(document.createTextNode(String(s)));return d.innerHTML}
function showLoading(){document.getElementById('loadingOverlay').classList.add('show')}
function hideLoading(){document.getElementById('loadingOverlay').classList.remove('show')}
function showToast(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 getVal(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value.trim()):''}
function getSel(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value):''}
function loadList(){
saveFilters();showLoading();currentPage=1;
var p='lcbh='+getVal('txtLcbh')+'&djbh='+getVal('txtDjbh')+'&sqrq='+getVal('txtSqrq')+'&yfxm='+getVal('txtYfxm')+'&reqName='+getVal('txtReqName')+'&sqrxm='+getVal('txtSqrxm')+'&djzk='+getSel('txtDjzk')+'&wlbmCode='+getVal('txtWlbmCode')+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&gys='+getVal('txtGys')+'&page=1&pageSize='+pageSize;
var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetRequestList?'+p,true);
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success){try{currentData=r.data||[];renderList(currentData);renderPagination(r.total||0);document.getElementById('totalCount').textContent=r.total||0}catch(er){showToast('渲染异常:'+er.message,'error')}}
else showToast(r.message||'查询失败','error')
}catch(e){showToast('数据解析异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send();
}
function loadPage(page){
saveFilters();showLoading();currentPage=page;
var p='lcbh='+getVal('txtLcbh')+'&djbh='+getVal('txtDjbh')+'&sqrq='+getVal('txtSqrq')+'&yfxm='+getVal('txtYfxm')+'&reqName='+getVal('txtReqName')+'&sqrxm='+getVal('txtSqrxm')+'&djzk='+getSel('txtDjzk')+'&wlbmCode='+getVal('txtWlbmCode')+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&gys='+getVal('txtGys')+'&page='+page+'&pageSize='+pageSize;
var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetRequestList?'+p,true);
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success){currentData=r.data||[];renderList(currentData);renderPagination(r.total||0);document.getElementById('totalCount').textContent=r.total||0}
else showToast(r.message||'查询失败','error')
}catch(e){showToast('数据解析异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send();
}
var filterIds=['txtLcbh','txtDjbh','txtSqrq','txtYfxm','txtReqName','txtSqrxm','txtDjzk','txtWlbmCode','txtCncgfzr','txtYfcgfzr','txtGys'];
function saveFilters(){
filterIds.forEach(function(id){if(document.getElementById(id))sessionStorage.setItem('pro_'+id,document.getElementById(id).value)});
}
function restoreFilters(){
filterIds.forEach(function(id){var v=sessionStorage.getItem('pro_'+id);if(v!==null){var el=document.getElementById(id);if(el)el.value=v}});
var ps=sessionStorage.getItem('pro_pageSize');
if(ps!==null&&pageSizeOptions.indexOf(parseInt(ps))>=0)pageSize=parseInt(ps);
}
function resetSearch(){
filterIds.forEach(function(id){sessionStorage.removeItem('pro_'+id);var el=document.getElementById(id);if(el)el.value=''});
selectedIds={};loadList();
}
function renderList(data){
var tbody=document.getElementById('listBody');
if(!data||!data.length){tbody.innerHTML='<tr class="empty-row"><td colspan="10">暂无匹配数据</td></tr>';document.getElementById('pageCount').textContent='0';return}
var h='';
data.forEach(function(item,idx){
var checked=selectedIds[item.id]?'checked':'';
h+='<tr class="list-row" data-id="'+escapeHtml(item.id)+'" data-lcbh="'+escapeHtml(item.lcbh)+'" data-djbh="'+escapeHtml(item.djbh)+'" data-requestid="'+escapeHtml(item.requestId)+'" onclick="selectRow(this)">';
h+='<td style="text-align:center"><input type="checkbox" class="row-chk" data-id="'+escapeHtml(item.id)+'" '+checked+' onclick="event.stopPropagation();toggleRow(this)"/></td>';
h+='<td>'+((currentPage-1)*pageSize+idx+1)+'</td>';
h+='<td><strong>'+escapeHtml(item.lcbh)+'</strong></td>';
h+='<td>'+escapeHtml(item.djbh)+'</td>';
h+='<td>'+escapeHtml(item.sqrq)+'</td>';
h+='<td>'+escapeHtml(item.yfxmmc)+'</td>';
h+='<td style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="'+escapeHtml(item.REQUESTNAME)+'">'+escapeHtml(item.REQUESTNAME)+'</td>';
h+='<td>'+escapeHtml(item.sqrxm)+'</td>';
h+='<td>'+(djzkMap[item.djzk]||'')+'</td>';
h+='<td>'+escapeHtml(item.pmAuditTime)+'</td>';
h+='</tr>';
});
tbody.innerHTML=h;document.getElementById('pageCount').textContent=data.length;updateBatchBtn();
}
function selectRow(el){
var lcbh=el.getAttribute('data-lcbh'),djbh=el.getAttribute('data-djbh'),requestId=el.getAttribute('data-requestid');
var row=currentData.find(function(d){return d.lcbh===lcbh});
var sqrq=row?row.sqrq:'',sqrxm=row?row.sqrxm:'',yfxmmc=row?row.yfxmmc:'',reqName=row?encodeURIComponent(row.REQUESTNAME||''):'',pmTime=row?encodeURIComponent(row.pmAuditTime||''):'';
window.location.href='procurement_detail.html?lcbh='+encodeURIComponent(lcbh)+'&djbh='+encodeURIComponent(djbh)+'&requestId='+encodeURIComponent(requestId)+'&sqrq='+encodeURIComponent(sqrq)+'&sqrxm='+encodeURIComponent(sqrxm)+'&yfxmmc='+encodeURIComponent(yfxmmc)+'&reqName='+reqName+'&pmTime='+pmTime;
}
function toggleRow(cb){var id=cb.getAttribute('data-id');if(cb.checked)selectedIds[id]=true;else delete selectedIds[id];updateBatchBtn()}
function toggleAll(cb){document.querySelectorAll('.row-chk').forEach(function(c){c.checked=cb.checked;var id=c.getAttribute('data-id');if(cb.checked)selectedIds[id]=true;else delete selectedIds[id]});updateBatchBtn()}
function setPageSize(size){
pageSize=size;
sessionStorage.setItem('pro_pageSize',size);
loadList();
}
function renderPagination(total){
var tp=Math.ceil(total/pageSize)||1;document.getElementById('totalPages').textContent=tp;
// 每页条数按钮
var sb=document.getElementById('sizeBtns');
var sh='';pageSizeOptions.forEach(function(s){sh+='<button class="'+(s===pageSize?'active':'')+'" onclick="setPageSize('+s+')">'+s+'条</button>'});
sb.innerHTML=sh;
// 页码按钮
var c=document.getElementById('pageBtns');if(tp<=1){c.innerHTML='';return}
var h='';h+='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage(1)">首页</button>';h+='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage('+(currentPage-1)+')">‹</button>';var start=Math.max(1,currentPage-2),end=Math.min(tp,currentPage+2);
for(var i=start;i<=end;i++)h+='<button class="'+(i===currentPage?'active':'')+'" onclick="loadPage('+i+')">'+i+'</button>';h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+(currentPage+1)+')">›</button>';h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+tp+')">末页</button>';c.innerHTML=h;
}
function updateBatchBtn(){var btn=document.getElementById('btnBatch');if(!btn)return;var cnt=Object.keys(selectedIds).length;btn.disabled=cnt===0;btn.style.opacity=cnt===0?'.5':'1';btn.textContent='批量汇总 ('+cnt+')'}
function openBatch(){var ids=Object.keys(selectedIds);if(!ids.length){showToast('请先选择申请单','error');return}window.location.href='multi_detail.html?ids='+ids.join(',')}
function exportXlsx(){
var ids=Object.keys(selectedIds);
if(!ids.length){showToast('请先勾选要导出的申请单','error');return}
showLoading();
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/ExportXlsx',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success&&r.data){
var blob=new Blob(['\uFEFF'+r.data],{type:'text/plain;charset=utf-8'});
var a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='采购申请维护数据_'+new Date().toISOString().slice(0,10)+'.xls';a.click();
showToast('导出成功,共 '+r.total+' 条','success');
}else showToast(r.message||'导出失败','error')
}catch(e){showToast('导出异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send(JSON.stringify({ids:ids}));
}
function importXlsx(input){
var file=input.files[0];if(!file)return;
var reader=new FileReader();
reader.onload=function(){
showLoading();
var bytes=new Uint8Array(reader.result);
var binary='';
for(var i=0;i<bytes.length;i++)binary+=String.fromCharCode(bytes[i]);
var base64=btoa(binary);
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/ImportXlsx',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();input.value='';
try{var r=JSON.parse(xhr.responseText);showToast(r.message||(r.success?'导入成功':'导入失败'),r.success?'success':'error')}catch(e){showToast('导入响应异常','error')}
};
xhr.onerror=function(){hideLoading();input.value='';showToast('网络请求失败','error')};
xhr.send(JSON.stringify({file:base64}));
};
reader.readAsArrayBuffer(file);
}
restoreFilters();
loadList();
</script>
<!-- 公共导航栏组件(菜单维护点:View/common/nav.js) -->
<script src="View/common/nav.js"></script>
</body>
</html>
@@ -0,0 +1,193 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购物料交付状态看板 - 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}
.top-bar .logo{font-size:17px;font-weight:600;margin-right:24px}
.top-links a{color:rgba(255,255,255,.75);text-decoration:none;padding:0 16px;display:flex;align-items:center;font-size:13px;border-radius:4px 4px 0 0;transition:.2s}
.top-links a:hover,.top-links a.active{color:#fff;background:rgba(255,255,255,.1)}
.user-info{margin-left:auto;font-size:12px;opacity:.85}
.main{max-width:1500px;margin:0 auto;padding:12px 16px}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;align-items:center}
.card-header h3{font-size:14px;color:#333;font-weight:600}
.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 8px;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 8px;border:1px solid #ddd;color:#333;text-align:center}
tbody td.left{text-align:left}
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}
.loading-spinner{width:34px;height:34px;border:3px solid #e0e0e0;border-top-color:#1a73e8;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
</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">
<span class="logo">Gaussian</span>
<div class="top-links" id="navTabs" style="display:flex;gap:4px;height:100%;"></div>
<span class="user-info" id="userInfo"></span>
</div>
<div class="main">
<div class="card">
<div class="card-header"><h3>采购物料交付状态看板(按研发项目汇总)</h3></div>
<div class="table-wrap">
<table>
<thead><tr id="headerRow"></tr></thead>
<tbody id="dataBody"><tr class="empty"><td colspan="8">加载中...</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>
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/GetDeliveryDashboard',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=[];
var colDefs=[
{key:'yfxmmc',label:'研发项目',minW:160,cls:'left'},
{key:'noOrder',label:'未转单',minW:100,linkGroup:'n'},
{key:'noTarget',label:'无交付目标',minW:105,linkGroup:'a'},
{key:'noPlan',label:'无交付计划',minW:105,linkGroup:'a'},
{key:'inProgress',label:'进行中',minW:90,linkGroup:'b'},
{key:'overdue',label:'延期中',minW:90,linkGroup:'b'},
{key:'cancelled',label:'需求取消',minW:100}
];
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 tbody=document.getElementById('dataBody');
if(!allData.length){tbody.innerHTML='<tr class="empty"><td colspan="8">暂无数据</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);var trCls=isTotal?' class="total-row"':'';
h+='<tr'+trCls+'>';
colDefs.forEach(function(c){
var val=row[c.key]||0;
if(c.cls)h+='<td class="'+c.cls+'">';else h+='<td>';
if(isTotal||!c.linkGroup)h+=escapeHtml(''+val);
else if(c.key==='noOrder'){
if(val>0)h+='<span class="count-link" onclick="openNoOrder(\''+escapeHtml(row.yfxmmc).replace(/\'/g,"\\'")+'\')">'+val+'</span>';else h+=val;
}else if(c.key==='noTarget'||c.key==='noPlan'){
if(val>0)h+='<span class="count-link" onclick="openLevel21(\''+escapeHtml(row.yfxmmc).replace(/\'/g,"\\'")+'\',\''+c.key+'\')">'+val+'</span>';else h+=val;
}else if(c.key==='inProgress'||c.key==='overdue'){
if(val>0)h+='<span class="count-link" onclick="openLevel22(\''+escapeHtml(row.yfxmmc).replace(/\'/g,"\\'")+'\',\''+c.key+'\')">'+val+'</span>';else h+=val;
}else h+=escapeHtml(''+val);
h+='</td>';
});
h+='</tr>';
}
tbody.innerHTML=h;renderPagination();
}
function renderTable(data){
var header=document.getElementById('headerRow');
var hh='';colDefs.forEach(function(c){hh+='<th style="min-width:'+c.minW+'px">'+c.label+'<span class="resizer"></span></th>'});
header.innerHTML=hh;
allData=data||[];renderPage();
}
function openLevel21(yfxm,type){window.location.href='delivery_dashboard_L21.html?yfxm='+encodeURIComponent(yfxm)+'&type='+type}
function openLevel22(yfxm,type){window.location.href='delivery_dashboard_L22.html?yfxm='+encodeURIComponent(yfxm)+'&type='+type}
function openNoOrder(yfxm){window.location.href='delivery_dashboard_noorder2.html?yfxm='+encodeURIComponent(yfxm)}
// 列宽拖动
(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 userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var user=JSON.parse(userData);
var roles=user.roleNumbers||[];
var nav='';
if(roles.indexOf('CRM01')>=0)nav+='<a href="index.html">CRM同步</a>';
if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement.html">采购申请管理</a>';
if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement_dashboard.html">采购看板</a>';
if(roles.indexOf('Purchase01')>=0)nav+='<a href="delivery_dashboard.html" class="active">采购物料交付状态看板</a>';
if(roles.indexOf('YF01')>=0)nav+='<a href="dashboard.html">研发采购看板</a>';
if(roles.indexOf('Produce02')>=0)nav+='<a href="View/MES/mes_dashboard.html">MES追溯看板</a>';
document.getElementById('navTabs').innerHTML=nav;
document.getElementById('userInfo').innerHTML=(user.userName||user.userId)+' | <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){alert('当前用户无权限');window.location.href='login.html'}
})();
loadData();
</script>
</body>
</html>
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NameOfLastUsedPublishProfile>D:\Code\WMS\WebApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>
</StartPageUrl>
<StartAction>CurrentPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>True</EnableENC>
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace GXWebApi.Common
{
/// <summary>
/// 扩展方法类
/// </summary>
public static class Extensions
{
/// <summary>
/// 安全转换为字符串(处理null和DBNull)
/// </summary>
public static string ToStringEx(this object obj)
{
if (obj == null || obj == DBNull.Value)
return string.Empty;
return obj.ToString();
}
/// <summary>
/// 安全转换为整数(处理null和DBNull)
/// </summary>
public static int ToInt(this object obj)
{
if (obj == null || obj == DBNull.Value)
return 0;
int result;
if (int.TryParse(obj.ToString(), out result))
return result;
return 0;
}
public static int ToInt32(this object pf)
{
if (Convert.IsDBNull(pf) || pf == null)
{
return 0;
}
if (pf.ToString() == "")
{
return 0;
}
try
{
if (pf is bool)
{
if ((bool)pf)
{
return 1;
}
return 0;
}
return (int)Convert.ToDecimal(pf);
}
catch
{
return 0;
}
}
/// <summary>
/// 安全转换为可为空的DateTime(处理null和DBNull)
/// </summary>
public static DateTime? ToDateTimeNullable(this object obj)
{
if (obj == null || obj == DBNull.Value)
return null;
DateTime result;
if (DateTime.TryParse(obj.ToString(), out result))
return result;
return null;
}
/// <summary>
/// 判断字符串是否为空或空白
/// </summary>
public static bool IsNullOrEmpty(this object pf)
{
if (Convert.IsDBNull(pf) || pf == null)
{
return true;
}
Type type = pf.GetType();
if (type == typeof(string))
{
return pf.ToStringEx().Trim() == "";
}
if (type == typeof(int) || type == typeof(short) || type == typeof(int) || type == typeof(long))
{
return pf.ToInt() == 0;
}
if (type == typeof(decimal) || type == typeof(double) || type == typeof(float))
{
return pf.ToDecimal() == 0m;
}
return false;
}
public static decimal ToDecimal(this object pf)
{
if (Convert.IsDBNull(pf) || pf == null)
{
return 0m;
}
if (pf.ToString() == "")
{
return 0m;
}
try
{
return Convert.ToDecimal(pf);
}
catch
{
return 0m;
}
}
/// <summary>
/// 判断字符串是否为空、空白或仅包含空格
/// </summary>
public static bool IsNullOrWhiteSpace(this string str)
{
return string.IsNullOrWhiteSpace(str);
}
}
}
@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>研发订单考核时效 - 二级看板</title>
<link rel="stylesheet" href="View/common/nav.css" />
<style>
* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", Arial, sans-serif; background: #f4f6fb; color: #1f2937; }
.main-content { padding: 18px 24px; }
.header { background: linear-gradient(90deg, #2f6df6 0%, #4f8bff 100%); color: #fff; padding: 18px 24px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.header h1 { font-size: 20px; margin: 0; font-weight: 600; }
.header .meta { font-size: 13px; opacity: .9; }
.table-wrap { background: #fff; border-radius: 12px; margin-top: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.table-wrap .toolbar { padding: 14px 18px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 10px; }
.table-wrap .toolbar .title { font-size: 14px; font-weight: 600; color: #374151; }
.table-wrap .toolbar .back { background: #fff; border: 1px solid #d1d5db; color: #374151; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.table-wrap .toolbar .back:hover { background: #f3f4f6; }
.gx-grid { max-height: calc(100vh - 240px); min-height: 600px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 8px 10px; border: 1px solid #e5e7eb; text-align: left; white-space: nowrap; }
table th { background: #f3f4f6; font-weight: 600; position: sticky; top: 0; z-index: 1; }
table td.clickable { color: #2563eb; cursor: pointer; }
table td.clickable:hover { text-decoration: underline; }
.empty { color: #9ca3af; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="header">
<div>
<h1>研发订单考核时效 · 二级看板</h1>
<div class="meta" id="meta"></div>
</div>
</div>
<div class="table-wrap">
<div class="toolbar">
<button class="back" onclick="window.close()">返回</button>
<div class="title">研发项目 × 策略采购负责人</div>
</div>
<div class="gx-grid" id="grid"></div>
</div>
</div>
<script>
// 从 URL 读参数
var params = new URLSearchParams(window.location.search);
var yt = params.get('yt') || ''; // '' = 全部用途
var riskLevel = params.get('riskLevel') || '';
function ytName(y) { return { '0': '生产', '1': '研发', '2': '售后' }[y] || '全部'; }
function riskCls(r) { return r === '超高' ? '#b91c1c' : r === '高' ? '#c2410c' : r === '中' ? '#a16207' : '#15803d'; }
document.getElementById('meta').innerHTML = '用途:<strong>' + ytName(yt) + '</strong> &nbsp;|&nbsp; 风险等级:<strong style="color:' + riskCls(riskLevel) + '">' + (riskLevel || '全部') + '</strong>';
function load() {
var grid = document.getElementById('grid');
grid.innerHTML = '<div style="color:#9ca3af;padding:20px 0;">加载中...</div>';
fetch('api/Procurement/GetAuditLeadtimeLevel2?yt=' + encodeURIComponent(yt) + '&riskLevel=' + encodeURIComponent(riskLevel)).then(function (r) { return r.json(); }).then(function (res) {
if (!res.success) { grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">加载失败: ' + res.message + '</div>'; return; }
render(res);
}).catch(function (e) {
grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">请求异常: ' + e + '</div>';
});
}
function render(d) {
var buyers = d.buyers || [];
if (!d.rows || d.rows.length === 0) {
document.getElementById('grid').innerHTML = '<div style="color:#9ca3af;padding:20px 0;">暂无数据</div>';
return;
}
var html = '<table><thead><tr><th>研发项目</th>';
buyers.forEach(function (b) { html += '<th>' + b + '</th>'; });
html += '<th>合计</th></tr></thead><tbody>';
d.rows.forEach(function (r) {
html += '<tr><td>' + (r.yfxmName || '未指定') + '</td>';
buyers.forEach(function (b) {
var v = r[b] || 0;
if (v > 0) {
// 点单元格跳三级(新窗口)
var url = 'procurement_audit_leadtime_l3.html?yfxmId=' + encodeURIComponent(r.yfxmId) +
'&yfxmName=' + encodeURIComponent(r.yfxmName || '未指定') +
'&buyer=' + encodeURIComponent(b) +
'&yt=' + encodeURIComponent(yt) +
'&riskLevel=' + encodeURIComponent(riskLevel);
html += '<td class="clickable" onclick="window.open(\'' + url + '\', \'_blank\')">' + v + '</td>';
} else {
html += '<td><span class="empty">-</span></td>';
}
});
html += '<td><strong>' + r.total + '</strong></td></tr>';
});
// 合计行
html += '<tr style="background:#f3f4f6;font-weight:600;"><td>合计</td>';
var grandTotal = 0;
buyers.forEach(function (b) {
var colSum = 0;
d.rows.forEach(function (r) { colSum += (r[b] || 0); });
grandTotal += colSum;
html += '<td>' + colSum + '</td>';
});
html += '<td><strong>' + grandTotal + '</strong></td></tr>';
html += '</tbody></table>';
document.getElementById('grid').innerHTML = html;
}
load();
</script>
<script src="View/common/nav.js"></script>
</body>
</html>
@@ -0,0 +1,122 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\Code\\WMS\\WebApi\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\controllers\\procurementcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:controllers\\procurementcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|d:\\code\\wms\\webapi\\multi_detail.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:multi_detail.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\procurement.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:procurement.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\procurement_dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:procurement_dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\login.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:login.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 6,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "multi_detail.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\multi_detail.html",
"RelativeDocumentMoniker": "multi_detail.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\multi_detail.html",
"RelativeToolTip": "multi_detail.html",
"ViewState": "AgIAALUAAAAAAAAAAAAcwNcAAAAzAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-29T09:07:47.812Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "procurement_dashboard.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\procurement_dashboard.html",
"RelativeDocumentMoniker": "procurement_dashboard.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\procurement_dashboard.html",
"RelativeToolTip": "procurement_dashboard.html",
"ViewState": "AgIAAFIAAAAAAAAAAAAuwF0AAAAsAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-28T09:09:18.881Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "procurement.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\procurement.html",
"RelativeDocumentMoniker": "procurement.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\procurement.html",
"RelativeToolTip": "procurement.html",
"ViewState": "AgIAAPIAAAAAAAAAAADwvxEBAAAPAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-28T07:53:40.173Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "dashboard.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\dashboard.html",
"RelativeDocumentMoniker": "dashboard.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\dashboard.html",
"RelativeToolTip": "dashboard.html",
"ViewState": "AgIAAB4CAAAAAAAAAADwvykCAABRAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-23T06:13:39.023Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "login.html",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\login.html",
"RelativeDocumentMoniker": "login.html",
"ToolTip": "D:\\Code\\WMS\\WebApi\\login.html",
"RelativeToolTip": "login.html",
"ViewState": "AgIAACYAAAAAAAAAAAAIwD0AAAAdAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
"WhenOpened": "2026-07-22T07:29:25.523Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "ProcurementController.cs",
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\Controllers\\ProcurementController.cs",
"RelativeDocumentMoniker": "Controllers\\ProcurementController.cs",
"ToolTip": "D:\\Code\\WMS\\WebApi\\Controllers\\ProcurementController.cs",
"RelativeToolTip": "Controllers\\ProcurementController.cs",
"ViewState": "AgIAALACAAAAAAAAAAAnwCQDAAAJAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-07-23T08:21:22.519Z",
"EditorCaption": ""
}
]
}
]
}
]
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="utf-8"?>
<doc>
<assembly>
<name>System.Web.Http.Cors</name>
</assembly>
<members>
<member name="T:System.Web.Http.CorsHttpConfigurationExtensions">
<summary>CORS-related extension methods for <see cref="T:System.Web.Http.HttpConfiguration" />.</summary>
</member>
<member name="M:System.Web.Http.CorsHttpConfigurationExtensions.EnableCors(System.Web.Http.HttpConfiguration)">
<summary>Enables the support for CORS.</summary>
<param name="httpConfiguration">The <see cref="T:System.Web.Http.HttpConfiguration" />.</param>
</member>
<member name="M:System.Web.Http.CorsHttpConfigurationExtensions.EnableCors(System.Web.Http.HttpConfiguration,System.Web.Http.Cors.ICorsPolicyProvider)">
<summary>Enables the support for CORS.</summary>
<param name="httpConfiguration">The <see cref="T:System.Web.Http.HttpConfiguration" />.</param>
<param name="defaultPolicyProvider">The default <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" />.</param>
<exception cref="T:System.ArgumentNullException">httpConfiguration</exception>
</member>
<member name="M:System.Web.Http.CorsHttpConfigurationExtensions.GetCorsEngine(System.Web.Http.HttpConfiguration)">
<summary>Gets the <see cref="T:System.Web.Cors.ICorsEngine" /> from the <see cref="T:System.Web.Http.HttpConfiguration" />.</summary>
<returns>The <see cref="T:System.Web.Cors.ICorsEngine" />.</returns>
<param name="httpConfiguration">The <see cref="T:System.Web.Http.HttpConfiguration" />.</param>
<exception cref="T:System.ArgumentNullException">httpConfiguration</exception>
</member>
<member name="M:System.Web.Http.CorsHttpConfigurationExtensions.GetCorsPolicyProviderFactory(System.Web.Http.HttpConfiguration)">
<summary>Gets the <see cref="T:System.Web.Http.Cors.ICorsPolicyProviderFactory" /> from the <see cref="T:System.Web.Http.HttpConfiguration" />.</summary>
<returns>The <see cref="T:System.Web.Http.Cors.ICorsPolicyProviderFactory" />.</returns>
<param name="httpConfiguration">The <see cref="T:System.Web.Http.HttpConfiguration" />.</param>
<exception cref="T:System.ArgumentNullException">httpConfiguration</exception>
</member>
<member name="M:System.Web.Http.CorsHttpConfigurationExtensions.SetCorsEngine(System.Web.Http.HttpConfiguration,System.Web.Cors.ICorsEngine)">
<summary>Sets the <see cref="T:System.Web.Cors.ICorsEngine" /> on the <see cref="T:System.Web.Http.HttpConfiguration" />.</summary>
<param name="httpConfiguration">The <see cref="T:System.Web.Http.HttpConfiguration" />.</param>
<param name="corsEngine">The <see cref="T:System.Web.Cors.ICorsEngine" />.</param>
<exception cref="T:System.ArgumentNullException">httpConfiguration or corsEngine</exception>
</member>
<member name="M:System.Web.Http.CorsHttpConfigurationExtensions.SetCorsPolicyProviderFactory(System.Web.Http.HttpConfiguration,System.Web.Http.Cors.ICorsPolicyProviderFactory)">
<summary>Sets the <see cref="T:System.Web.Http.Cors.ICorsPolicyProviderFactory" /> on the <see cref="T:System.Web.Http.HttpConfiguration" />.</summary>
<param name="httpConfiguration">The <see cref="T:System.Web.Http.HttpConfiguration" />.</param>
<param name="corsPolicyProviderFactory">The <see cref="T:System.Web.Http.Cors.ICorsPolicyProviderFactory" />.</param>
<exception cref="T:System.ArgumentNullException">httpConfiguration or corsPolicyProviderFactory</exception>
</member>
<member name="T:System.Web.Http.Cors.AttributeBasedPolicyProviderFactory">
<summary>An implementation of <see cref="T:System.Web.Http.Cors.ICorsPolicyProviderFactory" /> that returns the <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" /> from the controller or action attribute.</summary>
</member>
<member name="M:System.Web.Http.Cors.AttributeBasedPolicyProviderFactory.#ctor">
<summary>Initializes a new instance of the <see cref="T:System.Web.Http.Cors.AttributeBasedPolicyProviderFactory" /> class.</summary>
</member>
<member name="P:System.Web.Http.Cors.AttributeBasedPolicyProviderFactory.DefaultPolicyProvider">
<summary>Gets or sets the default <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" />.</summary>
<returns>The default <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" />.</returns>
</member>
<member name="M:System.Web.Http.Cors.AttributeBasedPolicyProviderFactory.GetCorsPolicyProvider(System.Net.Http.HttpRequestMessage)">
<summary>Gets the <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" /> for the request.</summary>
<returns>The <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" />.</returns>
<param name="request">The request.</param>
<exception cref="T:System.ArgumentNullException">request</exception>
</member>
<member name="T:System.Web.Http.Cors.CorsHttpRequestMessageExtensions">
<summary>CORS-related extension methods for <see cref="T:System.Net.Http.HttpRequestMessage" />.</summary>
</member>
<member name="M:System.Web.Http.Cors.CorsHttpRequestMessageExtensions.GetCorsRequestContext(System.Net.Http.HttpRequestMessage)">
<summary>Gets the <see cref="T:System.Web.Cors.CorsRequestContext" /> for a given request.</summary>
<returns>The <see cref="T:System.Web.Cors.CorsRequestContext" />.</returns>
<param name="request">The <see cref="T:System.Net.Http.HttpRequestMessage" />.</param>
<exception cref="T:System.ArgumentNullException">request</exception>
</member>
<member name="T:System.Web.Http.Cors.CorsHttpResponseMessageExtensions">
<summary>CORS-related extension methods for <see cref="T:System.Net.Http.HttpResponseMessage" />.</summary>
</member>
<member name="M:System.Web.Http.Cors.CorsHttpResponseMessageExtensions.WriteCorsHeaders(System.Net.Http.HttpResponseMessage,System.Web.Cors.CorsResult)">
<summary>Writes the CORS headers on the response.</summary>
<param name="response">The <see cref="T:System.Net.Http.HttpResponseMessage" />.</param>
<param name="corsResult">The <see cref="T:System.Web.Cors.CorsResult" />.</param>
<exception cref="T:System.ArgumentNullException">response or corsResult</exception>
</member>
<member name="T:System.Web.Http.Cors.CorsMessageHandler">
<summary>Custom <see cref="T:System.Net.Http.DelegatingHandler" /> for handling CORS requests.</summary>
</member>
<member name="M:System.Web.Http.Cors.CorsMessageHandler.#ctor(System.Web.Http.HttpConfiguration)">
<summary>Initializes a new instance of the <see cref="T:System.Web.Http.Cors.CorsMessageHandler" /> class.</summary>
<param name="httpConfiguration">The <see cref="T:System.Web.Http.HttpConfiguration" />.</param>
<exception cref="T:System.ArgumentNullException">httpConfiguration</exception>
</member>
<member name="M:System.Web.Http.Cors.CorsMessageHandler.HandleCorsPreflightRequestAsync(System.Net.Http.HttpRequestMessage,System.Web.Cors.CorsRequestContext,System.Threading.CancellationToken)">
<summary>Handles the preflight request specified by CORS.</summary>
<returns>The <see cref="T:System.Threading.Tasks.Task`1" /></returns>
<param name="request">The request.</param>
<param name="corsRequestContext">The cors request context.</param>
<param name="cancellationToken">The cancellation token.</param>
<exception cref="T:System.ArgumentNullException">request or corsRequestContext</exception>
</member>
<member name="M:System.Web.Http.Cors.CorsMessageHandler.HandleCorsRequestAsync(System.Net.Http.HttpRequestMessage,System.Web.Cors.CorsRequestContext,System.Threading.CancellationToken)">
<summary>Handles the actual CORS request.</summary>
<returns>The <see cref="T:System.Threading.Tasks.Task`1" />.</returns>
<param name="request">The <see cref="T:System.Net.Http.HttpRequestMessage" />.</param>
<param name="corsRequestContext">The <see cref="T:System.Web.Cors.CorsRequestContext" />.</param>
<param name="cancellationToken">The <see cref="T:System.Threading.CancellationToken" />.</param>
<exception cref="T:System.ArgumentNullException">request or corsRequestContext</exception>
</member>
<member name="M:System.Web.Http.Cors.CorsMessageHandler.SendAsync(System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken)">
<summary>Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.</summary>
<returns>Returns <see cref="T:System.Threading.Tasks.Task`1" />. The task object representing the asynchronous operation.</returns>
<param name="request">The HTTP request message to send to the server.</param>
<param name="cancellationToken">A cancellation token to cancel operation.</param>
</member>
<member name="T:System.Web.Http.Cors.DisableCorsAttribute">
<summary>This class defines an attribute that can be applied to an action or a controller to disable CORS.</summary>
</member>
<member name="M:System.Web.Http.Cors.DisableCorsAttribute.#ctor">
<summary>Initializes a new instance of the <see cref="T:System.Web.Http.Cors.DisableCorsAttribute" /> class.</summary>
</member>
<member name="M:System.Web.Http.Cors.DisableCorsAttribute.GetCorsPolicyAsync(System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken)">
<summary>Gets the CORS policy asynchronously.</summary>
<returns>The newly created task for this operation.</returns>
<param name="request">The request.</param>
<param name="cancellationToken">The cancellation token assigned for this task.</param>
</member>
<member name="T:System.Web.Http.Cors.EnableCorsAttribute">
<summary>This class defines an attribute that can be applied to an action or a controller to enable CORS. By default, it allows all origins, methods and headers.</summary>
</member>
<member name="M:System.Web.Http.Cors.EnableCorsAttribute.#ctor(System.String,System.String,System.String)">
<summary>Initializes a new instance of the <see cref="T:System.Web.Http.Cors.EnableCorsAttribute" /> class.</summary>
<param name="origins">Comma-separated list of origins that are allowed to access the resource. Use "*" to allow all.</param>
<param name="headers">Comma-separated list of headers that are supported by the resource. Use "*" to allow all. Use null or empty string to allow none.</param>
<param name="methods">Comma-separated list of methods that are supported by the resource. Use "*" to allow all. Use null or empty string to allow none.</param>
</member>
<member name="M:System.Web.Http.Cors.EnableCorsAttribute.#ctor(System.String,System.String,System.String,System.String)">
<summary>Initializes a new instance of the <see cref="T:System.Web.Http.Cors.EnableCorsAttribute" /> class.</summary>
<param name="origins">Comma-separated list of origins that are allowed to access the resource. Use "*" to allow all.</param>
<param name="headers">Comma-separated list of headers that are supported by the resource. Use "*" to allow all. Use null or empty string to allow none.</param>
<param name="methods">Comma-separated list of methods that are supported by the resource. Use "*" to allow all. Use null or empty string to allow none.</param>
<param name="exposedHeaders">Comma-separated list of headers that the resource might use and can be exposed. Use null or empty string to expose none.</param>
</member>
<member name="P:System.Web.Http.Cors.EnableCorsAttribute.ExposedHeaders">
<summary>Gets the headers that the resource might use and can be exposed.</summary>
</member>
<member name="M:System.Web.Http.Cors.EnableCorsAttribute.GetCorsPolicyAsync(System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken)"></member>
<member name="P:System.Web.Http.Cors.EnableCorsAttribute.Headers">
<summary>Gets the headers that are supported by the resource.</summary>
</member>
<member name="P:System.Web.Http.Cors.EnableCorsAttribute.Methods">
<summary>Gets the methods that are supported by the resource.</summary>
</member>
<member name="P:System.Web.Http.Cors.EnableCorsAttribute.Origins">
<summary>Gets the origins that are allowed to access the resource.</summary>
</member>
<member name="P:System.Web.Http.Cors.EnableCorsAttribute.PreflightMaxAge">
<summary>Gets or sets the number of seconds the results of a preflight request can be cached.</summary>
</member>
<member name="P:System.Web.Http.Cors.EnableCorsAttribute.SupportsCredentials">
<summary>Gets or sets a value indicating whether the resource supports user credentials in the request.</summary>
</member>
<member name="T:System.Web.Http.Cors.ICorsPolicyProvider">
<summary>Provides an abstraction for getting the <see cref="T:System.Web.Cors.CorsPolicy" />.</summary>
</member>
<member name="M:System.Web.Http.Cors.ICorsPolicyProvider.GetCorsPolicyAsync(System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken)">
<summary>Gets the <see cref="T:System.Web.Cors.CorsPolicy" />.</summary>
<returns>The <see cref="T:System.Web.Cors.CorsPolicy" />.</returns>
<param name="request">The request.</param>
<param name="cancellationToken">The cancellation token.</param>
</member>
<member name="T:System.Web.Http.Cors.ICorsPolicyProviderFactory">
<summary>Provides an abstraction for getting the <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" />.</summary>
</member>
<member name="M:System.Web.Http.Cors.ICorsPolicyProviderFactory.GetCorsPolicyProvider(System.Net.Http.HttpRequestMessage)">
<summary>Gets the <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" /> for the request.</summary>
<returns>The <see cref="T:System.Web.Http.Cors.ICorsPolicyProvider" />.</returns>
<param name="request">The request.</param>
</member>
<member name="T:System.Web.Http.Cors.Tracing.TraceCategories">
<summary>Category names traced by the default CORS tracing implementation.</summary>
</member>
<member name="F:System.Web.Http.Cors.Tracing.TraceCategories.CorsCategory">
<summary>The trace category for CORS-related events.</summary>
</member>
</members>
</doc>
@@ -0,0 +1,101 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WebLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/LogInfo/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
<connectionStrings>
<add name="GXWMS" connectionString="server=10.10.10.101;database=GXWMS;uid=sa;pwd=Gx@20240111;Pooling=true;" providerName="System.Data.SqlClient" />
<add name="RndSuiteDev" connectionString="server=10.1.102.3;database=RndSuiteDev;uid=summer_chu;pwd=P@ssw0rd;Pooling=true;" providerName="System.Data.SqlClient" />
<add name="MESConnection" connectionString="server=10.10.10.107;database=cloudpivot;user=root;password=GSpa11word" providerName="System.Data.SqlClient" />
<add name="OAConnection" connectionString="server=39.100.72.102;database=ecology;user=ecology;password=Z!BYT+jSDDyYHMdX+qFSLzJCYXW" providerName="System.Data.SqlClient" />
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-BulletinBoard-20190513083738;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-BulletinBoard-20190513083738.mdf" />
</connectionStrings>
<appSettings>
<!-- 金蝶云星空 WebApi 服务地址 -->
<add key="KingdeeApiUrl" value="http://localhost/k3cloud/"/>
<!-- MES 看板自动刷新间隔(秒),默认 600 秒 = 10 分钟;设为 0 关闭自动刷新 -->
<add key="MesAutoRefreshSeconds" value="600"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.7.2"/>
<httpRuntime targetFramework="4.7.2"/>
<customErrors mode="Off"/>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule"/>
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<remove name="WebDAV"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
<security>
<requestFiltering>
<verbs>
<add verb="GET" allowed="true"/>
<add verb="POST" allowed="true"/>
<add verb="PUT" allowed="true"/>
<add verb="DELETE" allowed="true"/>
<add verb="OPTIONS" allowed="true"/>
</verbs>
</requestFiltering>
</security>
<directoryBrowse enabled="false"/>
<defaultDocument>
<files>
<clear />
<add value="login.html" />
</files>
</defaultDocument>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,737 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>研发物料采购看板 - Gaussian</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="View/common/nav.css">
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
<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: 4px
}
.top-bar .logo {
font-size: 17px;
font-weight: 600;
margin-right: 24px
}
.top-links a {
color: rgba(255,255,255,.75);
text-decoration: none;
padding: 0 16px;
height: 100%;
display: flex;
align-items: center;
font-size: 13px;
border-radius: 4px 4px 0 0;
transition: .2s
}
.top-links a:hover {
color: #fff;
background: rgba(255,255,255,.1)
}
.top-links a.active {
color: #fff;
background: rgba(255,255,255,.2)
}
.user-info {
margin-left: auto;
font-size: 12px;
opacity: .85
}
.main {
max-width: 1500px;
margin: 0 auto;
padding: 12px 16px
}
/* ===== 搜索栏 ===== */
.search-bar {
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 4px rgba(0,0,0,.08);
padding: 12px 16px;
margin-bottom: 10px;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px 14px;
align-items: center
}
.search-bar label {
font-size: 12px;
color: #555;
font-weight: 600;
white-space: nowrap
}
.search-bar .field {
display: inline-flex;
align-items: center;
gap: 4px
}
.search-bar input,.search-bar select {
height: 32px;
padding: 0 10px;
border: 2px solid #e0e0e0;
border-radius: 5px;
font-size: 13px;
outline: 0;
transition: border-color .2s;box-sizing:border-box
}
.search-bar .field input{flex:1;min-width:0}
.multi-select{position:relative;flex:1;min-width:0}
.multi-select .ms-box{height:32px;padding:0 10px;border:1px solid #d5d9e0;border-radius:5px;font-size:13px;background:#fff;display:flex;align-items:center;justify-content:space-between;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;color:#333}
.multi-select .ms-box:hover{border-color:#1a73e8}
.multi-select .ms-arrow{font-size:10px;color:#888;margin-left:6px;flex-shrink:0}
.multi-select .ms-drop{display:none;position:absolute;top:calc(100% + 2px);left:0;min-width:200px;z-index:50;background:#fff;border:1px solid #d5d9e0;border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,.12);max-height:280px;overflow:auto;padding:2px 0}
.multi-select.open .ms-drop{display:block}
.multi-select .ms-drop label{display:flex;align-items:center;gap:6px;padding:0 10px;height:26px;font-size:12px;color:#333;cursor:pointer;white-space:nowrap;transition:background .15s;line-height:1}
.multi-select .ms-drop label:hover{background:#f0f6ff}
.multi-select .ms-drop label input{margin:0;width:14px;height:14px;min-width:14px;min-height:14px;flex-shrink:0;flex:0 0 14px;vertical-align:middle;accent-color:#1a73e8;outline:none;cursor:pointer}
.multi-select .ms-drop .ms-divider{height:1px;background:#eee;margin:2px 0}
.search-bar input:focus {
border-color: #1a73e8;
box-shadow: 0 0 0 3px rgba(26,115,232,.12)
}
.search-bar .btn {
height: 32px;
padding: 0 16px;
border: 0;
border-radius: 5px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: .2s
}
.search-bar .btn-primary {
background: linear-gradient(135deg,#1a73e8,#1557b0);
color: #fff
}
.search-bar .btn-primary:hover {
opacity: .92
}
.search-bar .btn-outline {
background: #fff;
color: #666;
border: 2px solid #e0e0e0
}
.search-bar .btn-outline:hover {
border-color: #1a73e8;
color: #1a73e8
}
.search-bar .total em {
font-style: normal;
color: #1a73e8;
font-weight: 700
}
/* ===== 表格 ===== */
.list-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 4px rgba(0,0,0,.08);
overflow: visible
}
.list-card .card-header {
padding: 10px 16px;
border-bottom: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center
}
.list-card .card-header h3 {
font-size: 14px;
color: #333;
font-weight: 600
}
.list-card .card-header .count {
font-size: 12px;
color: #999;
margin-left: auto;
margin-right: 12px
}
.list-card .btn-export {
height: 28px; padding: 0 16px; border: 0; border-radius: 4px;
background: linear-gradient(135deg,#34a853,#1e8e3e); color: #fff;
font-size: 12px; font-weight: 600; cursor: pointer; transition: .2s
}
.list-card .btn-export:hover { opacity: .9 }
.list-card .btn-export:disabled { opacity: .4; cursor: not-allowed }
table th input[type=checkbox], table td input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: #1a73e8; vertical-align: middle }
.table-wrap {
overflow: auto;
max-height: calc(100vh - 220px)
}
table {
min-width: 100%;
border-collapse: collapse;
font-size: 12px
}
thead th {
background: #f8f9fa;
color: #555;
font-weight: 600;
padding: 8px 8px;
text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap;
position: sticky;
top: 0;
z-index: 1;
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: 7px 8px;
border: 1px solid #ddd;
color: #333
}
tbody tr {
transition: background .15s;
cursor: pointer
}
tbody tr:hover {
background: #f0f6ff
}
.empty td {
text-align: center;
padding: 36px;
color: #bbb
}
.pagination {
padding: 10px 16px;
border-top: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
color: #666
}
.pagination .btns {
display: flex;
gap: 3px
}
.pagination .btns button {
min-width: 28px;
height: 28px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background: #fff;
color: #333;
cursor: pointer;
font-size: 12px;
transition: .15s
}
.pagination .btns button:hover {
border-color: #1a73e8;
color: #1a73e8
}
.pagination .btns button.active {
background: #1a73e8;
color: #fff;
border-color: #1a73e8
}
.pagination .btns button:disabled {
opacity: .4;
cursor: default
}
.pagination .size-btns button {
min-width: 40px; height: 24px; border: 1px solid #e0e0e0; border-radius: 3px;
background: #fff; color: #666; cursor: pointer; font-size: 11px; margin: 0 1px; transition: .15s
}
.pagination .size-btns button:hover { border-color: #1a73e8; color: #1a73e8 }
.pagination .size-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8 }
.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
}
.loading-spinner {
width: 34px;
height: 34px;
border: 3px solid #e0e0e0;
border-top-color: #1a73e8;
border-radius: 50%;
animation: spin .7s linear infinite
}
@keyframes spin {
to {
transform: rotate(360deg)
}
}
.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
}
.toast.success {
background: #e6f9ed;
color: #1a7a3a;
display: block
}
</style>
</head>
<body>
<div class="loading-overlay" id="loading"><div class="loading-spinner"></div></div>
<div class="toast" id="toast"></div>
<div id="sidebar"></div>
<div class="main-content">
<div class="main">
<div class="search-bar">
<span class="field"><label>流程编号:</label><input type="text" id="txtLcbh" placeholder="流程编号" autocomplete="off" /></span>
<span class="field"><label>申请人:</label><input type="text" id="txtSqrxm" placeholder="申请人" autocomplete="off" /></span>
<span class="field"><label>专项名称:</label><input type="text" id="txtReqName" placeholder="专项名称" autocomplete="off" /></span>
<span class="field"><label>研发项目:</label><input type="text" id="txtYfxmmc" placeholder="研发项目" autocomplete="off" /></span>
<span class="field"><label>物料编码:</label><input type="text" id="txtMatCode" placeholder="物料编码" autocomplete="off" /></span>
<span class="field"><label>物料名称:</label><input type="text" id="txtMatName" placeholder="物料名称" autocomplete="off" /></span>
<span class="field"><label>策略采购负责人:</label><input type="text" id="txtCncgfzr" placeholder="策略采购负责人" autocomplete="off" /></span>
<span class="field"><label>研发采购负责人:</label><input type="text" id="txtYfcgfzr" placeholder="研发采购负责人" autocomplete="off" /></span>
<span class="field" style="grid-column:1"><label>业务状态:</label>
<div class="multi-select" id="ywztMulti">
<div class="ms-box" onclick="toggleYwzt()"><span class="ms-text">全部</span><span class="ms-arrow">▾</span></div>
<div class="ms-drop" id="ywztDrop">
<label><input type="checkbox" value="" checked onclick="onAllCheck(this)">全部</label>
<div class="ms-divider"></div>
<label><input type="checkbox" value="1" onclick="onItemCheck(this)">采购订单-转单追踪</label>
<label><input type="checkbox" value="2" onclick="onItemCheck(this)">供应链-待供应商报价</label>
<label><input type="checkbox" value="3" onclick="onItemCheck(this)">供应链-待ED审批</label>
<label><input type="checkbox" value="4" onclick="onItemCheck(this)">供应链-ED驳回,重新议价</label>
<label><input type="checkbox" value="5" onclick="onItemCheck(this)">供应链-ED已审批</label>
<label><input type="checkbox" value="6" onclick="onItemCheck(this)">研发-采购申请驳回</label>
<label><input type="checkbox" value="7" onclick="onItemCheck(this)">研发-采购申请撤回</label>
<label><input type="checkbox" value="8" onclick="onItemCheck(this)">研发-采购申请取消</label>
<label><input type="checkbox" value="9" onclick="onItemCheck(this)">研发-量产复用件</label>
</div>
</div>
</span>
<span style="grid-column:2/-1;text-align:right;display:flex;gap:12px;justify-content:flex-end;align-items:center">
<span style="font-size:12px;color:#999">共 <em id="totalCount" style="font-style:normal;color:#1a73e8;font-weight:700">0</em> 条</span>
<button class="btn btn-primary" onclick="loadList()">查询</button>
<button class="btn btn-outline" onclick="resetSearch()">重置</button>
</span>
</div>
<div class="list-card">
<div class="card-header"><h3>研发物料采购明细</h3><span class="count">当前页 <em id="pageCount">0</em></span><button class="btn btn-export" onclick="exportSelected()" id="exportBtn" disabled>导出Excel</button></div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th style="width:30px"><input type="checkbox" id="checkAll" onclick="onCheckAll(this)" title="全选" /></th>
<th>#<span class="resizer"></span></th>
<th>流程编号<span class="resizer"></span></th>
<th>申请日期<span class="resizer"></span></th>
<th>物料编码<span class="resizer"></span></th>
<th>物料名称<span class="resizer"></span></th>
<th>申请数量<span class="resizer"></span></th>
<th>研发项目<span class="resizer"></span></th>
<th>申请人<span class="resizer"></span></th>
<th>专项名称<span class="resizer"></span></th>
<th>业务状态<span class="resizer"></span></th>
<th>策略采购负责人<span class="resizer"></span></th>
<th>研发采购负责人<span class="resizer"></span></th>
<th>计划交付日期(策略采购)<span class="resizer"></span></th>
<th>计划交付日期(研发采购)<span class="resizer"></span></th>
</tr>
</thead>
<tbody id="listBody"><tr class="empty"><td colspan="15">加载中...</td></tr></tbody>
</table>
</div>
<div class="pagination">
<div><span>共 <em id="totalPages">0</em> 页,</span><span>每页显示 <span class="size-btns" id="sizeBtns"></span></span></div>
<div class="btns" id="pageBtns"></div>
</div>
</div>
</div>
<script>
var currentPage = 1, pageSize = 20, currentData = [];
var pageSizeOptions=[20,50,100,200];
var selectedMap = {}; // 勾选的行(key=requestId+lcbh)
var ywztMap={'1':'转单追踪','2':'待报价','3':'待ED审批','4':'ED驳回','5':'ED已审批','6':'驳回','7':'撤回','8':'取消','9':'量产复用'};
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);
}
// ===== 业务状态多选 =====
var ywztMap2={'1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
function toggleYwzt(){var el=document.getElementById('ywztMulti');if(el)el.classList.toggle('open')}
document.addEventListener('click',function(e){
var ms=document.getElementById('ywztMulti');
if(ms&&!ms.contains(e.target))ms.classList.remove('open');
});
function getSelectedYwzt(){
var boxes=document.querySelectorAll('#ywztDrop input[type=checkbox]');
var selected=[];
boxes.forEach(function(b){if(b.checked&&b.value!=='')selected.push(b.value)});
return selected;
}
function updateYwztBoxText(){
var textEl=document.querySelector('#ywztMulti .ms-text');
if(!textEl)return;
var selected=getSelectedYwzt();
if(!selected.length){textEl.textContent='全部';return}
var names=selected.map(function(v){return ywztMap2[v]||v});
textEl.textContent=(names.length>2?names.slice(0,2).join('、')+' 等':names.join('、'));
}
function onAllCheck(allChk){
// 点击"全部":清空所有其他选项
if(allChk.checked){
document.querySelectorAll('#ywztDrop input[type=checkbox]').forEach(function(b){if(b!==allChk)b.checked=false});
}
updateYwztBoxText();
}
function onItemCheck(checkbox){
// 点击具体状态:取消"全部"勾选
if(checkbox.checked){
var allChk=document.querySelector('#ywztDrop input[value=""]');
if(allChk)allChk.checked=false;
}else{
// 如果所有具体状态都未选,自动勾回"全部"
var boxes=document.querySelectorAll('#ywztDrop input[type=checkbox]');
var anySel=Array.prototype.some.call(boxes,function(b){return b.value!==''&&b.checked});
if(!anySel){
var allChk=document.querySelector('#ywztDrop input[value=""]');
if(allChk)allChk.checked=true;
}
}
updateYwztBoxText();
}
function restoreYwzt(sel){
var allChk=document.querySelector('#ywztDrop input[value=""]');
document.querySelectorAll('#ywztDrop input[type=checkbox]').forEach(function(b){b.checked=false});
if(!sel||!sel.length){if(allChk)allChk.checked=true}
else{sel.forEach(function(v){var b=document.querySelector('#ywztDrop input[value="'+v+'"]');if(b)b.checked=true})}
updateYwztBoxText();
}
// 持久化搜索条件
function saveFilters() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var el=document.getElementById(id);if(el)sessionStorage.setItem('dash_'+id,el.value)
});
sessionStorage.setItem('dash_ywztMulti',getSelectedYwzt().join(','));
}
function restoreFilters() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var v=sessionStorage.getItem('dash_'+id);if(v!==null){var el=document.getElementById(id);if(el)el.value=v}
});
var yw=sessionStorage.getItem('dash_ywztMulti');
if(yw!==null)restoreYwzt(yw?yw.split(','):[]);
var ps=sessionStorage.getItem('dash_pageSize');
if(ps!==null&&pageSizeOptions.indexOf(parseInt(ps))>=0)pageSize=parseInt(ps);
}
function getVal(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value.trim()):''}
function loadList() {
loading(true);
saveFilters();
currentPage = 1;
var yw=document.getElementById('txtYwzt')?document.getElementById('txtYwzt').value:getSelectedYwzt().join(',');
var url = 'api/Procurement/GetDashboardList?lcbhNo='+getVal('txtLcbh')+'&sqrxm='+getVal('txtSqrxm')+'&reqName='+getVal('txtReqName')+'&yfxmmc='+getVal('txtYfxmmc')+'&matCode='+getVal('txtMatCode')+'&matName='+getVal('txtMatName')+'&ywzt='+encodeURIComponent(yw)+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&page=1&pageSize='+pageSize;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function () {
loading(false);
try { var r = JSON.parse(xhr.responseText); if (r.success) { currentData = r.data || []; renderList(currentData); renderPagination(r.total || 0); document.getElementById('totalCount').textContent = r.total || 0; } else { toast(r.message || '查询失败', 'error') } }
catch (e) { toast('数据解析异常', 'error') }
};
xhr.onerror = function () { loading(false); toast('网络请求失败', 'error') };
xhr.send();
}
function loadPage(page) {
loading(true);
currentPage = page;
var yw=document.getElementById('txtYwzt')?document.getElementById('txtYwzt').value:getSelectedYwzt().join(',');
var url = 'api/Procurement/GetDashboardList?lcbhNo='+getVal('txtLcbh')+'&sqrxm='+getVal('txtSqrxm')+'&reqName='+getVal('txtReqName')+'&yfxmmc='+getVal('txtYfxmmc')+'&matCode='+getVal('txtMatCode')+'&matName='+getVal('txtMatName')+'&ywzt='+encodeURIComponent(yw)+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&page='+page+'&pageSize='+pageSize;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function () {
loading(false);
try { var r = JSON.parse(xhr.responseText); if (r.success) { currentData = r.data || []; renderList(currentData); renderPagination(r.total || 0); document.getElementById('totalCount').textContent = r.total || 0; } else { toast(r.message || '查询失败', 'error') } }
catch (e) { toast('数据解析异常', 'error') }
};
xhr.onerror = function () { loading(false); toast('网络请求失败', 'error') };
xhr.send();
}
function resetSearch() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var el=document.getElementById(id);if(el)el.value='';sessionStorage.removeItem('dash_'+id)
});
sessionStorage.removeItem('dash_ywztMulti');
restoreYwzt([]);
loadList();
}
function renderList(data) {
var tbody = document.getElementById('listBody');
if (!data || !data.length) {
tbody.innerHTML = '<tr class="empty"><td colspan="15">暂无数据</td></tr>';
document.getElementById('pageCount').textContent = '0';
return;
}
var h = '';
data.forEach(function (item, idx) {
var key = item.requestId + '_' + item.lcbh;
h += '<tr onclick="selectRow(this)" data-key="' + escapeHtml(key) + '" data-lcbh="' + escapeHtml(item.lcbh) + '" data-djbh="' + escapeHtml(item.djbh) + '" data-requestid="' + escapeHtml(item.requestId) + '" data-reqname="' + escapeHtml(item.reqName || '') + '" data-yfxmmc="' + escapeHtml(item.yfxmmc || '') + '" data-sqrxm="' + escapeHtml(item.sqrxm || '') + '" data-sqrq="' + escapeHtml(item.sqrq || '') + '" data-cncgfzr="' + escapeHtml(item.cncgfzr || '') + '" data-yfcgfzr="' + escapeHtml(item.yfcgfzr || '') + '">';
h += '<td><input type="checkbox" onclick="event.stopPropagation();onRowCheck(this)" ' + (selectedMap[key] ? 'checked' : '') + ' /></td>';
h += '<td>' + ((currentPage - 1) * pageSize + idx + 1) + '</td>';
h += '<td><strong>' + escapeHtml(item.lcbh) + '</strong></td>';
h += '<td>' + escapeHtml(item.sqrq) + '</td>';
h += '<td>' + escapeHtml(item.wlbmCode) + '</td>';
h += '<td>' + escapeHtml(item.wlmc) + '</td>';
h += '<td>' + escapeHtml(item.sqsl) + '</td>';
h += '<td>' + escapeHtml(item.yfxmmc) + '</td>';
h += '<td>' + escapeHtml(item.sqrxm) + '</td>';
h += '<td style="max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="' + escapeHtml(item.reqName || '') + '">' + escapeHtml(item.reqName || '') + '</td>';
h += '<td>' + (ywztMap[item.ywzt]||item.ywzt||'') + '</td>';
h += '<td>' + escapeHtml(item.cncgfzr || '') + '</td>';
h += '<td>' + escapeHtml(item.yfcgfzr || '') + '</td>';
h += '<td>' + escapeHtml(item.cnjhjfrq || '') + '</td>';
h += '<td>' + escapeHtml(item.yfjhjfrq || '') + '</td>';
h += '</tr>';
});
tbody.innerHTML = h;
document.getElementById('pageCount').textContent = data.length;
}
function setPageSize(size){pageSize=size;currentPage=1;sessionStorage.setItem('dash_pageSize',size);loadList()}
function renderPagination(total) {
var tp = Math.ceil(total / pageSize) || 1;
document.getElementById('totalPages').textContent = tp;
// 每页条数按钮
var sb = document.getElementById('sizeBtns');
sb.innerHTML = pageSizeOptions.map(function(s){return '<button class="'+(s===pageSize?'active':'')+'" onclick="setPageSize('+s+')">'+s+'条</button>'}).join('');
var c = document.getElementById('pageBtns');
if (tp <= 1) { c.innerHTML = ''; return }
var h = '';
h += '<button ' + (currentPage <= 1 ? 'disabled' : '') + ' onclick="loadPage(1)">首页</button>';
h += '<button ' + (currentPage <= 1 ? 'disabled' : '') + ' onclick="loadPage(' + (currentPage - 1) + ')">‹</button>';
var start = Math.max(1, currentPage - 2), end = Math.min(tp, currentPage + 2);
for (var i = start; i <= end; i++)h += '<button class="' + (i === currentPage ? 'active' : '') + '" onclick="loadPage(' + i + ')">' + i + '</button>';
h += '<button ' + (currentPage >= tp ? 'disabled' : '') + ' onclick="loadPage(' + (currentPage + 1) + ')">›</button>';
h += '<button ' + (currentPage >= tp ? 'disabled' : '') + ' onclick="loadPage(' + tp + ')">末页</button>';
c.innerHTML = h;
}
// ===== 多选 =====
function onRowCheck(cb) {
var tr = cb.closest('tr');
var key = tr.getAttribute('data-key');
if (cb.checked) selectedMap[key] = true; else delete selectedMap[key];
updateCheckAll();
}
function onCheckAll(cb) {
document.querySelectorAll('#listBody input[type=checkbox]').forEach(function (b) {
if (b === cb) return;
b.checked = cb.checked;
var tr = b.closest('tr');
var key = tr ? tr.getAttribute('data-key') : '';
if (cb.checked) { if (key) selectedMap[key] = true } else { if (key) delete selectedMap[key] }
});
updateExportBtn();
}
function updateCheckAll() {
var all = document.querySelectorAll('#listBody input[type=checkbox]');
var allChk = document.getElementById('checkAll');
var anyUnchecked = Array.prototype.some.call(all, function (b) { return !b.checked });
if (allChk) allChk.checked = all.length > 0 && !anyUnchecked;
updateExportBtn();
}
function updateExportBtn() {
var cnt = Object.keys(selectedMap).length;
document.getElementById('exportBtn').disabled = cnt === 0;
}
function exportSelected() {
// 从 currentData 中提取勾选的行(跨分页通过 selectedMap 的 key 匹配)
var rows = currentData.filter(function (item) {
return selectedMap[item.requestId + '_' + item.lcbh];
});
if (!rows.length) { toast('请先勾选要导出的数据', 'error'); return }
exportRowsToExcel(rows);
}
function exportRowsToExcel(rows) {
var headers = ['流程编号','申请日期','研发项目','申请人','专项名称','物料编码','物料名称','申请数量','业务状态','策略采购负责人','研发采购负责人','计划交付日期(策略采购)','计划交付日期(研发采购)'];
var data = [headers];
rows.forEach(function (r) {
data.push([r.lcbh||'', r.sqrq||'', r.yfxmmc||'', r.sqrxm||'', r.reqName||'', r.wlbmCode||'', r.wlmc||'', r.sqsl||'', ywztMap[r.ywzt]||r.ywzt||'', r.cncgfzr||'', r.yfcgfzr||'', r.cnjhjfrq||'', r.yfjhjfrq||'']);
});
// 列宽自适应
var wscols = headers.map(function (h, i) {
var max = h.length;
rows.forEach(function (r) {
var v = String((r[['lcbh','sqrq','yfxmmc','sqrxm','reqName','wlbmCode','wlmc','sqsl','ywzt','cncgfzr','yfcgfzr','cnjhjfrq','yfjhjfrq'][i]]||''));
if (v.length > max) max = v.length;
});
return { wch: Math.min(max + 2, 40) };
});
var ws = XLSX.utils.aoa_to_sheet(data);
ws['!cols'] = wscols;
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, '研发采购看板');
XLSX.writeFile(wb, '研发采购看板_' + new Date().toISOString().slice(0,10) + '.xlsx');
toast('已导出 ' + rows.length + ' 条数据', 'success');
}
function selectRow(el) {
var lcbh = el.getAttribute('data-lcbh');
var djbh = el.getAttribute('data-djbh');
var requestId = el.getAttribute('data-requestid');
var reqName = el.getAttribute('data-reqname') || '';
var yfxmmc = el.getAttribute('data-yfxmmc') || '';
var sqrxm = el.getAttribute('data-sqrxm') || '';
var sqrq = el.getAttribute('data-sqrq') || '';
window.location.href = 'dashboard_detail.html?lcbh=' + encodeURIComponent(lcbh)
+ '&djbh=' + encodeURIComponent(djbh)
+ '&requestId=' + encodeURIComponent(requestId)
+ '&sqrq=' + encodeURIComponent(sqrq)
+ '&sqrxm=' + encodeURIComponent(sqrxm)
+ '&yfxmmc=' + encodeURIComponent(yfxmmc)
+ '&reqName=' + encodeURIComponent(reqName);
}
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName'].forEach(function(id){
var el=document.getElementById(id);if(el)el.addEventListener('keydown',function(e){if(e.key==='Enter')loadList()})
});
// 登录校验和导航栏由公共组件提供;YF01 页面访问控制保留
(function(){
try{
var u=JSON.parse(sessionStorage.getItem('gx_user')||'null');
var rn=(u&&u.roleNumbers)||[];
if(rn.indexOf('YF01')<0){alert('当前用户无权限');sessionStorage.removeItem('gx_user');window.location.href='login.html'}
}catch(e){window.location.href='login.html'}
})();
restoreFilters();
loadList();
// 列宽拖动
(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=''}});
})();
</script>
</div><!-- /main-content -->
<!-- 公共侧边栏组件(菜单维护点:View/common/nav.js) -->
<script src="View/common/nav.js"></script>
</body>
</html>
@@ -0,0 +1,31 @@
/* ============================================
* GX-WMS 通用列表(Grid)组件样式
* 与 grid.js 配套使用
* ============================================ */
.gx-grid { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow-x: auto; max-height: calc(100vh - 220px); overflow-y: auto; }
.gx-grid table { width: 100%; border-collapse: collapse; min-width: 2400px; table-layout: fixed; }
.gx-grid thead { background: #f7f9fc; }
.gx-grid thead th { position: sticky; top: 0; background: #f7f9fc; z-index: 5; text-align: left; padding: 9px 8px; font-size: 12px; color: #606266; font-weight: 600; border-bottom: 2px solid #ebeef5; white-space: nowrap; border-right: 1px solid #ebeef5; position: relative; user-select: none; }
.gx-grid thead th .gx-resizer { position: absolute; right: 0; top: 0; height: 100%; width: 6px; cursor: col-resize; user-select: none; }
.gx-grid thead th .gx-resizer:hover { background: #409eff; }
.gx-grid thead th .gx-resizer.active { background: #409eff; }
.gx-grid tbody td { padding: 8px; font-size: 12px; color: #303133; border-bottom: 1px solid #f0f2f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid #f5f7fa; }
.gx-grid tbody tr:hover { background: #f5f7fa; }
.gx-grid tbody tr:nth-child(even) { background: #fafbfc; }
.gx-grid tbody tr:nth-child(even):hover { background: #f5f7fa; }
/* 风险标签 */
.gx-grid .tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.gx-grid .tag.broken { background: #fef0f0; color: #f56c6c; }
.gx-grid .tag.warn { background: #fdf6ec; color: #e6a23c; }
.gx-grid .tag.safe { background: #f0f9eb; color: #67c23a; }
.gx-grid .tag.empty { background: #f4f4f5; color: #909399; }
/* 数字 */
.gx-grid .num { font-family: 'Consolas','Monaco',monospace; }
.gx-grid .num.zero { color: #c0c4cc; }
.gx-grid .num.neg { color: #f56c6c; font-weight: 600; }
/* 占位符 */
.gx-grid .muted { color: #909399; }
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,246 @@
/* GX-WMS 左侧侧边栏导航样式 */
:root { --sidebar-width: 240px; --sidebar-collapsed: 60px; }
body.with-sidebar { padding-left: var(--sidebar-width); transition: padding-left .25s ease; }
body.sidebar-collapsed.with-sidebar { padding-left: var(--sidebar-collapsed); }
#sidebar {
position: fixed;
top: 0; left: 0; bottom: 0;
width: var(--sidebar-width);
background: #1e293b;
color: #cbd5e1;
overflow-y: auto;
box-shadow: 2px 0 8px rgba(0,0,0,.08);
z-index: 1000;
font-family: 'Microsoft YaHei','PingFang SC',sans-serif;
transition: width .25s ease;
}
body.sidebar-collapsed #sidebar { width: var(--sidebar-collapsed); }
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
/* 收缩按钮 */
.sidebar-toggle {
position: absolute;
top: 16px; right: 10px;
width: 26px; height: 26px;
border: none; border-radius: 4px;
background: transparent;
color: #94a3b8;
font-size: 15px;
cursor: pointer;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
transition: all .15s;
}
.sidebar-toggle:hover { background: #334155; color: #fff; }
body.sidebar-collapsed .sidebar-toggle { right: 17px; }
/* 用户信息区 */
.sidebar-user {
display: flex;
align-items: center;
gap: 10px;
padding: 16px 14px;
border-bottom: 1px solid #334155;
background: #0f172a;
}
.sidebar-user .avatar {
width: 38px; height: 38px;
border-radius: 50%;
background: linear-gradient(135deg,#3b82f6,#1d4ed8);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
font-weight: 600;
flex-shrink: 0;
}
.sidebar-user .user-text { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 14px; color: #e2e8f0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .user-action { font-size: 12px; margin-top: 2px; }
.sidebar-user .user-action a { color: #94a3b8; text-decoration: none; }
.sidebar-user .user-action a:hover { color: #60a5fa; }
/* 菜单容器 */
.sidebar-menu { padding: 8px 0; }
/* 分组标题(可折叠) */
.menu-group-title {
display: flex;
align-items: center;
padding: 11px 16px;
cursor: pointer;
font-size: 14px;
color: #cbd5e1;
user-select: none;
transition: background .15s;
}
.menu-group-title:hover { background: #334155; color: #fff; }
.menu-group-title .menu-icon {
width: 22px;
font-size: 16px;
flex-shrink: 0;
text-align: center;
}
.menu-group-title .menu-label { flex: 1; margin-left: 10px; }
.menu-group-title .menu-arrow {
font-size: 11px;
color: #64748b;
transition: transform .2s;
}
.menu-arrow.rotate { transform: rotate(-180deg); color: #94a3b8; }
.menu-group.expanded > .menu-group-title {
background: #334155;
color: #fff;
}
/* 子菜单容器 */
.menu-children {
max-height: 0;
overflow: hidden;
transition: max-height .25s ease;
background: #0f172a;
}
.menu-group.expanded > .menu-children {
max-height: 1200px;
}
/* 子菜单项 */
.menu-child {
display: flex;
align-items: center;
padding: 9px 16px 9px 44px;
color: #94a3b8;
text-decoration: none;
font-size: 13px;
transition: all .15s;
border-left: 3px solid transparent;
}
.menu-child:hover { background: #1e293b; color: #e2e8f0; }
.menu-child.active {
background: #1e3a8a;
color: #fff;
border-left-color: #3b82f6;
font-weight: 500;
}
.menu-child-dot {
width: 14px;
color: #475569;
font-size: 16px;
flex-shrink: 0;
}
.menu-child.active .menu-child-dot { color: #60a5fa; }
/* ===== 子分组(多级菜单,支持任意层级) ===== */
.menu-subgroup-title {
display: flex;
align-items: center;
padding: 10px 16px 10px 22px;
color: #94a3b8;
cursor: pointer;
font-size: 13px;
transition: all .15s;
}
.menu-subgroup-title:hover { background: #334155; color: #fff; }
.menu-subgroup-title .menu-icon { width: 20px; font-size: 14px; text-align: center; }
.menu-subgroup-title .menu-label { flex: 1; margin-left: 8px; }
.menu-subgroup-title .menu-arrow { font-size: 10px; color: #64748b; margin-right: 10px; transition: transform .2s; }
.menu-subgroup-children {
max-height: 0;
overflow: hidden;
transition: max-height .25s ease;
}
.menu-subgroup.expanded > .menu-subgroup-children { max-height: 1000px; }
/* 多级缩进:按层级加深 */
.menu-child[data-depth="2"] { padding-left: 58px; }
.menu-child[data-depth="3"] { padding-left: 72px; }
.menu-child[data-depth="4"] { padding-left: 86px; }
.menu-subgroup-title[data-depth="2"] { padding-left: 34px; }
.menu-subgroup-title[data-depth="3"] { padding-left: 48px; }
.menu-subgroup-title[data-depth="4"] { padding-left: 62px; }
/* 单项菜单(无子项) */
.menu-single {
display: flex;
align-items: center;
padding: 11px 16px;
color: #cbd5e1;
text-decoration: none;
font-size: 14px;
transition: background .15s;
border-left: 3px solid transparent;
}
.menu-single:hover { background: #334155; color: #fff; }
.menu-single.active {
background: #1e3a8a;
color: #fff;
border-left-color: #3b82f6;
font-weight: 500;
}
.menu-single .menu-icon {
width: 22px;
font-size: 16px;
flex-shrink: 0;
text-align: center;
}
.menu-single .menu-label { margin-left: 10px; }
/* ===== 折叠状态(只显示图标) ===== */
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 16px 0; }
body.sidebar-collapsed .sidebar-user .avatar { width: 34px; height: 34px; font-size: 14px; }
body.sidebar-collapsed .sidebar-user .user-text { display: none; }
body.sidebar-collapsed .menu-group-title { justify-content: center; padding: 13px 0; }
body.sidebar-collapsed .menu-group-title .menu-label { display: none; }
body.sidebar-collapsed .menu-group-title .menu-arrow { display: none; }
body.sidebar-collapsed .menu-group-title .menu-icon { width: auto; }
body.sidebar-collapsed .menu-children { display: none; }
body.sidebar-collapsed .menu-single { justify-content: center; padding: 13px 0; }
body.sidebar-collapsed .menu-single .menu-label { display: none; }
body.sidebar-collapsed .menu-single .menu-icon { width: auto; }
/* 折叠时菜单项 hover 提示 */
body.sidebar-collapsed .menu-group-title { position: relative; }
body.sidebar-collapsed .menu-group-title:hover::after {
content: attr(data-title);
position: absolute;
left: calc(var(--sidebar-collapsed) + 8px);
top: 50%;
transform: translateY(-50%);
background: #0f172a;
color: #e2e8f0;
padding: 6px 12px;
border-radius: 6px;
font-size: 13px;
white-space: nowrap;
z-index: 1001;
box-shadow: 0 4px 12px rgba(0,0,0,.3);
pointer-events: none;
}
body.sidebar-collapsed .menu-single { position: relative; }
body.sidebar-collapsed .menu-single:hover::after {
content: attr(data-title);
position: absolute;
left: calc(var(--sidebar-collapsed) + 8px);
top: 50%;
transform: translateY(-50%);
background: #0f172a;
color: #e2e8f0;
padding: 6px 12px;
border-radius: 6px;
font-size: 13px;
white-space: nowrap;
z-index: 1001;
box-shadow: 0 4px 12px rgba(0,0,0,.3);
pointer-events: none;
}
@@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>金蝶CRM产品同步 - Gaussian</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; }
.container { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); width: 100%; max-width: 520px; overflow: hidden; }
.header { background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff; padding: 28px 32px; text-align: center; }
.header h1 { font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.header p { font-size: 13px; opacity: 0.85; margin-top: 6px; }
.body { padding: 32px; }
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.form-group label .required { color: #e74c3c; margin-left: 2px; }
.form-group input { width: 100%; height: 48px; padding: 0 16px; font-size: 15px; border: 2px solid #e0e0e0; border-radius: 8px; outline: none; transition: border-color 0.25s, box-shadow 0.25s; }
.form-group input:focus { border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12); }
.form-group input::placeholder { color: #bbb; }
.api-hint { font-size: 12px; color: #999; margin-top: 4px; }
.btn { width: 100%; height: 50px; font-size: 16px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #1a73e8, #1557b0); border: none; border-radius: 8px; cursor: pointer; letter-spacing: 1px; transition: opacity 0.2s, transform 0.1s; }
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.result { margin-top: 24px; padding: 16px; border-radius: 8px; font-size: 14px; line-height: 1.7; display: none; word-break: break-all; white-space: pre-wrap; max-height: 400px; overflow-y: auto; }
.result.success { display: block; background: #e6f9ed; border: 1px solid #a3e4bc; color: #1a7a3a; }
.result.error { display: block; background: #fdeaea; border: 1px solid #f5b7b7; color: #b71c1c; }
.result .icon { font-size: 18px; margin-right: 6px; }
.history { margin-top: 28px; border-top: 1px solid #eee; padding-top: 20px; }
.history h3 { font-size: 15px; color: #555; margin-bottom: 12px; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8f9fa; border-radius: 6px; margin-bottom: 8px; font-size: 13px; cursor: pointer; transition: background 0.2s; }
.history-item:hover { background: #e8f0fe; }
.history-item .number { font-weight: 600; color: #1a73e8; }
.history-item .status { padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.history-item .status.ok { background: #e6f9ed; color: #1a7a3a; }
.history-item .status.fail { background: #fdeaea; color: #b71c1c; }
.loading-spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { text-align: center; padding: 0 32px 28px; font-size: 12px; color: #aaa; }
</style>
</head>
<body>
<div style="position:fixed;top:0;left:0;right:0;background:linear-gradient(135deg, #1a73e8, #1557b0);color:#fff;padding:0 24px;display:flex;align-items:center;height:56px;box-shadow:0 2px 8px rgba(0,0,0,0.15);z-index:100;">
<span style="font-size:18px;font-weight:600;margin-right:32px;">Gaussian</span>
<div style="display:flex;gap:4px;height:100%;" id="navTabs"></div>
<span style="margin-left:auto;font-size:13px;opacity:0.85;" id="userInfo"></span>
</div>
<div style="padding-top:56px;">
<div class="container">
<div class="header">
<h1>金蝶CRM产品同步</h1>
<p>调用 CrUpCrmProduct 接口同步物料数据</p>
</div>
<div class="body">
<div class="form-group">
<label>物料编码<span class="required">*</span></label>
<input type="text" id="txtFMaNumber" placeholder="请输入物料编码,如:900000344" autocomplete="off" />
<div class="api-hint">接口:POST /api/Differential/CrUpCrmProduct</div>
</div>
<button class="btn" id="btnSubmit" onclick="doSync()">开始同步</button>
<div class="result" id="result"></div>
<div class="history" id="history" style="display:none;">
<h3>操作记录</h3>
<div id="historyList"></div>
</div>
</div>
<div class="footer">GXWebApi &copy; 2026</div>
</div>
</div>
<script>
var HISTORY_KEY = 'gx_sync_history';
function getHistory() { try { return JSON.parse(localStorage.getItem(HISTORY_KEY) || '[]'); } catch (e) { return []; } }
function saveHistory(item) { var list = getHistory(); list.unshift(item); if (list.length > 10) list = list.slice(0, 10); localStorage.setItem(HISTORY_KEY, JSON.stringify(list)); renderHistory(); }
function escapeHtml(str) { var div = document.createElement('div'); div.appendChild(document.createTextNode(str)); return div.innerHTML; }
function renderHistory() {
var list = getHistory(); var container = document.getElementById('historyList'); var wrap = document.getElementById('history');
if (list.length === 0) { wrap.style.display = 'none'; return; }
wrap.style.display = 'block'; var html = '';
list.forEach(function (item) {
var cls = item.success ? 'ok' : 'fail'; var txt = item.success ? '成功' : '失败';
var msgHtml = item.message ? '<div style="font-size:11px;color:#999;margin-top:3px;">' + escapeHtml(item.message) + '</div>' : '';
html += '<div class="history-item" onclick="fillNumber(\'' + item.number + '\')" style="display:block;cursor:pointer;">'
+ '<div style="display:flex;justify-content:space-between;align-items:center;">'
+ '<span class="number">' + item.number + '</span>'
+ '<span style="color:#999;font-size:12px;">' + item.time + '</span>'
+ '<span class="status ' + cls + '">' + txt + '</span></div>' + msgHtml + '</div>';
});
container.innerHTML = html;
}
function fillNumber(num) { document.getElementById('txtFMaNumber').value = num; }
function showResult(success, message) { var el = document.getElementById('result'); el.className = 'result ' + (success ? 'success' : 'error'); el.innerHTML = '<span class="icon">' + (success ? '&#10003;' : '&#10007;') + '</span>' + message; }
function hideResult() { var el = document.getElementById('result'); el.className = 'result'; el.style.display = 'none'; }
function doSync() {
var input = document.getElementById('txtFMaNumber'); var btn = document.getElementById('btnSubmit'); var FMaNumber = input.value.trim();
if (!FMaNumber) { showResult(false, '请输入物料编码'); input.focus(); return; }
hideResult(); btn.disabled = true; btn.innerHTML = '<span class="loading-spinner"></span>同步中...';
var xhr = new XMLHttpRequest();
xhr.open('POST', 'api/Differential/CrUpCrmProduct', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.timeout = 120000;
xhr.onload = function () {
btn.disabled = false; btn.innerHTML = '开始同步';
try { var resp = JSON.parse(xhr.responseText); var success = resp.success === 'true' || resp.success === true; var msg = resp.message || (success ? '同步成功' : '同步失败'); showResult(success, msg); saveHistory({ number: FMaNumber, success: success, message: msg, time: new Date().toLocaleString('zh-CN', { hour12: false }) }); }
catch (e) { var errMsg = '服务器返回异常:' + xhr.responseText.substring(0, 500); showResult(false, errMsg); saveHistory({ number: FMaNumber, success: false, message: errMsg, time: new Date().toLocaleString('zh-CN', { hour12: false }) }); }
};
xhr.onerror = function () { btn.disabled = false; btn.innerHTML = '开始同步'; showResult(false, '网络连接失败'); };
xhr.ontimeout = function () { btn.disabled = false; btn.innerHTML = '开始同步'; showResult(false, '请求超时(2分钟)'); };
xhr.send(JSON.stringify({ FMaNumber: FMaNumber }));
}
document.getElementById('txtFMaNumber').addEventListener('keydown', function (e) { if (e.key === 'Enter') { doSync(); } });
function logout(){sessionStorage.removeItem('gx_user');window.location.href='login.html'}
renderHistory();
// ===== 登录校验 =====
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var user=JSON.parse(userData);
var roles=user.roleNumbers||[];
if(roles.indexOf('CRM01')<0){alert('当前用户无权限');sessionStorage.removeItem('gx_user');window.location.href='login.html';return}
var nav='<a href="index.html" style="color:#fff;text-decoration:none;padding:0 20px;display:flex;align-items:center;background:rgba(255,255,255,0.2);border-radius:4px 4px 0 0;font-size:14px;">CRM产品同步</a>';
if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement.html" style="color:rgba(255,255,255,0.75);text-decoration:none;padding:0 20px;display:flex;align-items:center;font-size:14px;">采购申请管理</a>';
if(roles.indexOf('YF01')>=0)nav+='<a href="dashboard.html" style="color:rgba(255,255,255,0.75);text-decoration:none;padding:0 20px;display:flex;align-items:center;font-size:14px;">研发采购看板</a>';
if(roles.indexOf('Produce02')>=0)nav+='<a href="View/MES/mes_dashboard.html" style="color:rgba(255,255,255,0.75);text-decoration:none;padding:0 20px;display:flex;align-items:center;font-size:14px;">MES追溯看板</a>';
document.getElementById('navTabs').innerHTML=nav;
document.getElementById('userInfo').innerHTML=(user.userName||user.userId)+' | <a href="javascript:void(0)" onclick="logout()" style="color:#fff;text-decoration:none;margin-left:8px;font-size:12px;">退出</a>';
}catch(e){alert('当前用户无权限');window.location.href='login.html'}
})();
</script>
</body>
</html>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>
@@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>金蝶-CRM销售订单新变更单同步 - Gaussian</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="View/common/nav.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; }
.container { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); width: 100%; max-width: 520px; overflow: hidden; }
.header { background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff; padding: 28px 32px; text-align: center; }
.header h1 { font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.header p { font-size: 13px; opacity: 0.85; margin-top: 6px; }
.body { padding: 32px; }
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.form-group label .required { color: #e74c3c; margin-left: 2px; }
.form-group input { width: 100%; height: 48px; padding: 0 16px; font-size: 15px; border: 2px solid #e0e0e0; border-radius: 8px; outline: none; transition: border-color 0.25s, box-shadow 0.25s; }
.form-group input:focus { border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12); }
.form-group input::placeholder { color: #bbb; }
.api-hint { font-size: 12px; color: #999; margin-top: 4px; }
.btn { width: 100%; height: 50px; font-size: 16px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #1a73e8, #1557b0); border: none; border-radius: 8px; cursor: pointer; letter-spacing: 1px; transition: opacity 0.2s, transform 0.1s; }
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.result { margin-top: 24px; padding: 16px; border-radius: 8px; font-size: 14px; line-height: 1.7; display: none; word-break: break-all; white-space: pre-wrap; max-height: 400px; overflow-y: auto; }
.result.success { display: block; background: #e6f9ed; border: 1px solid #a3e4bc; color: #1a7a3a; }
.result.error { display: block; background: #fdeaea; border: 1px solid #f5b7b7; color: #b71c1c; }
.result .icon { font-size: 18px; margin-right: 6px; }
.history { margin-top: 28px; border-top: 1px solid #eee; padding-top: 20px; }
.history h3 { font-size: 15px; color: #555; margin-bottom: 12px; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8f9fa; border-radius: 6px; margin-bottom: 8px; font-size: 13px; cursor: pointer; transition: background 0.2s; }
.history-item:hover { background: #e8f0fe; }
.history-item .number { font-weight: 600; color: #1a73e8; }
.history-item .status { padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.history-item .status.ok { background: #e6f9ed; color: #1a7a3a; }
.history-item .status.fail { background: #fdeaea; color: #b71c1c; }
.loading-spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { text-align: center; padding: 0 32px 28px; font-size: 12px; color: #aaa; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content" style="padding-top:0;">
<div class="container">
<div class="header">
<h1>金蝶-CRM销售订单新变更单同步</h1>
<p>调用 KingdeeSynCRMXSDDXBGD 接口同步销售订单新变更单</p>
</div>
<div class="body">
<div class="form-group">
<label>单据编号<span class="required">*</span></label>
<input type="text" id="txtFBillNO" placeholder="请输入单据编号,如:PO2026070006_V001" autocomplete="off" />
<div class="api-hint">接口:POST /api/Differential/KingdeeSynCRMXSDDXBGD</div>
</div>
<button class="btn" id="btnSubmit" onclick="doSync()">开始同步</button>
<div class="result" id="result"></div>
<div class="history" id="history" style="display:none;">
<h3>操作记录</h3>
<div id="historyList"></div>
</div>
</div>
<div class="footer">GXWebApi &copy; 2026</div>
</div>
</div>
</div><!-- /main-content -->
<script>
var HISTORY_KEY = 'gx_crm_sale_order_sync_history';
function getHistory() { try { return JSON.parse(localStorage.getItem(HISTORY_KEY) || '[]'); } catch (e) { return []; } }
function saveHistory(item) { var list = getHistory(); list.unshift(item); if (list.length > 10) list = list.slice(0, 10); localStorage.setItem(HISTORY_KEY, JSON.stringify(list)); renderHistory(); }
function escapeHtml(str) { var div = document.createElement('div'); div.appendChild(document.createTextNode(str)); return div.innerHTML; }
function renderHistory() {
var list = getHistory(); var container = document.getElementById('historyList'); var wrap = document.getElementById('history');
if (list.length === 0) { wrap.style.display = 'none'; return; }
wrap.style.display = 'block'; var html = '';
list.forEach(function (item) {
var cls = item.success ? 'ok' : 'fail'; var txt = item.success ? '成功' : '失败';
var msgHtml = item.message ? '<div style="font-size:11px;color:#999;margin-top:3px;">' + escapeHtml(item.message) + '</div>' : '';
html += '<div class="history-item" onclick="fillNumber(\'' + item.number + '\')" style="display:block;cursor:pointer;">'
+ '<div style="display:flex;justify-content:space-between;align-items:center;">'
+ '<span class="number">' + item.number + '</span>'
+ '<span style="color:#999;font-size:12px;">' + item.time + '</span>'
+ '<span class="status ' + cls + '">' + txt + '</span></div>' + msgHtml + '</div>';
});
container.innerHTML = html;
}
function fillNumber(num) { document.getElementById('txtFBillNO').value = num; }
function showResult(success, message) { var el = document.getElementById('result'); el.className = 'result ' + (success ? 'success' : 'error'); el.innerHTML = '<span class="icon">' + (success ? '&#10003;' : '&#10007;') + '</span>' + message; }
function hideResult() { var el = document.getElementById('result'); el.className = 'result'; el.style.display = 'none'; }
function doSync() {
var input = document.getElementById('txtFBillNO'); var btn = document.getElementById('btnSubmit'); var FBillNO = input.value.trim();
if (!FBillNO) { showResult(false, '请输入单据编号'); input.focus(); return; }
hideResult(); btn.disabled = true; btn.innerHTML = '<span class="loading-spinner"></span>同步中...';
var xhr = new XMLHttpRequest();
xhr.open('POST', 'api/Differential/KingdeeSynCRMXSDDXBGD', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.timeout = 180000;
xhr.onload = function () {
btn.disabled = false; btn.innerHTML = '开始同步';
try { var resp = JSON.parse(xhr.responseText); var success = resp.success === 'true' || resp.success === true; var msg = resp.message || (success ? '同步成功' : '同步失败'); showResult(success, msg); saveHistory({ number: FBillNO, success: success, message: msg, time: new Date().toLocaleString('zh-CN', { hour12: false }) }); }
catch (e) { var errMsg = '服务器返回异常:' + xhr.responseText.substring(0, 500); showResult(false, errMsg); saveHistory({ number: FBillNO, success: false, message: errMsg, time: new Date().toLocaleString('zh-CN', { hour12: false }) }); }
};
xhr.onerror = function () { btn.disabled = false; btn.innerHTML = '开始同步'; showResult(false, '网络连接失败'); };
xhr.ontimeout = function () { btn.disabled = false; btn.innerHTML = '开始同步'; showResult(false, '请求超时(3分钟)'); };
xhr.send(JSON.stringify({ FBillNO: FBillNO }));
}
document.getElementById('txtFBillNO').addEventListener('keydown', function (e) { if (e.key === 'Enter') { doSync(); } });
renderHistory();
// ===== 页面访问控制:CRM01;导航栏由公共组件提供 =====
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var user=JSON.parse(userData);
var roles=user.roleNumbers||[];
if(roles.indexOf('CRM01')<0){alert('当前用户无权限');sessionStorage.removeItem('gx_user');window.location.href='login.html';return}
}catch(e){alert('当前用户无权限');window.location.href='login.html'}
})();
</script>
<!-- 公共侧边栏组件(菜单维护点:View/common/nav.js) -->
<script src="View/common/nav.js"></script>
</body>
</html>
@@ -0,0 +1 @@
{"RootPath":"D:\\Code\\WMS\\WebApi","ProjectFileName":"GXWebApi.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"App_Start\\WebApiConfig.cs"},{"SourceFile":"Common\\CrmApi.cs"},{"SourceFile":"Common\\DBHelpe.cs"},{"SourceFile":"Common\\Extensions.cs"},{"SourceFile":"Common\\LogHelper.cs"},{"SourceFile":"Common\\MySqlUtils.cs"},{"SourceFile":"Common\\ResponseStatus.cs"},{"SourceFile":"Common\\WmsCommonFunction.cs"},{"SourceFile":"Controllers\\DifferentialController.cs"},{"SourceFile":"Controllers\\ProcurementController.cs"},{"SourceFile":"Global.asax.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.6.AssemblyAttributes.cs"}],"References":[{"Reference":"D:\\Code\\WMS\\WebApi\\Kingdee.BOS.WebApi.Client.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\Code\\WMS\\GuangFu.StringTracing\\packages\\log4net.2.0.12\\lib\\net45\\log4net.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\Code\\WMS\\GuangFu.StringTracing\\packages\\Microsoft.Web.Infrastructure.1.0.0.0\\lib\\net40\\Microsoft.Web.Infrastructure.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\OPSOFT\\OPSOFTV60\\AP\\BIN\\MySql.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\Code\\WMS\\WebApi\\Newtonsoft.Json.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.Configuration.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\Code\\WMS\\WebApi\\packages\\Microsoft.AspNet.WebApi.Client.5.2.7\\lib\\net45\\System.Net.Http.Formatting.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.Web.ApplicationServices.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\Code\\WMS\\WebApi\\packages\\Microsoft.AspNet.Cors.5.2.7\\lib\\net45\\System.Web.Cors.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6\\System.Web.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":fLine truncated
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NameOfLastUsedPublishProfile>D:\Code\WMS\WebApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>
</StartPageUrl>
<StartAction>CurrentPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>True</EnableENC>
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,99 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WebLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/LogInfo/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
<connectionStrings>
<add name="GXWMS" connectionString="server=10.10.10.101;database=GXWMS;uid=sa;pwd=Gx@20240111;Pooling=true;" providerName="System.Data.SqlClient" />
<add name="RndSuiteDev" connectionString="server=10.1.102.3;database=RndSuiteDev;uid=summer_chu;pwd=P@ssw0rd;Pooling=true;" providerName="System.Data.SqlClient" />
<add name="MESConnection" connectionString="server=10.10.10.107;database=cloudpivot;user=root;password=GSpa11word" providerName="System.Data.SqlClient" />
<add name="OAConnection" connectionString="server=39.100.72.102;database=ecology;user=ecology;password=Z!BYT+jSDDyYHMdX+qFSLzJCYXW" providerName="System.Data.SqlClient" />
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-BulletinBoard-20190513083738;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-BulletinBoard-20190513083738.mdf" />
</connectionStrings>
<appSettings>
<!-- 金蝶云星空 WebApi 服务地址 -->
<add key="KingdeeApiUrl" value="http://localhost/k3cloud/"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.7.2"/>
<httpRuntime targetFramework="4.7.2"/>
<customErrors mode="Off"/>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule"/>
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<remove name="WebDAV"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
<security>
<requestFiltering>
<verbs>
<add verb="GET" allowed="true"/>
<add verb="POST" allowed="true"/>
<add verb="PUT" allowed="true"/>
<add verb="DELETE" allowed="true"/>
<add verb="OPTIONS" allowed="true"/>
</verbs>
</requestFiltering>
</security>
<directoryBrowse enabled="false"/>
<defaultDocument>
<files>
<clear />
<add value="login.html" />
</files>
</defaultDocument>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,264 @@
/**
* ============================================
* GX-WMS 左侧侧边栏导航组件
* 用法:
* 1. 页面 <head> 引入 nav.css:<link rel="stylesheet" href=".../common/nav.css">
* 2. <body> 顶部加一个容器:<div id="sidebar"></div>
* 3. 主内容区域包裹在 <div class="main-content"> 中
* 4. 页面底部引入本JS,自动初始化
*
* 维护点:仅修改本文件的 MENU_GROUPS 配置
* ============================================
*/
// ---------- 应用根路径自动探测 ----------
// 支持 IIS 子目录部署(如 /WebApi,名称可变)和 VS 调试(网站根目录)两种场景。
// 原理:根据本脚本自身 URL(<应用根>/View/common/nav.js)反推出应用根前缀。
// - 部署在子目录时自动得到 '/WebApi' 之类前缀
// - VS 调试 / 根目录部署时为空字符串,不影响原行为
var APP_BASE = '';
(function () {
try {
var scripts = document.getElementsByTagName('script');
for (var i = scripts.length - 1; i >= 0; i--) {
var src = scripts[i].getAttribute('src') || '';
if (src.indexOf('nav.js') >= 0) {
var a = document.createElement('a');
a.href = src;
var p = a.pathname.replace(/\\/g, '/');
var idx = p.indexOf('/View/common/nav.js');
if (idx >= 0) APP_BASE = p.substring(0, idx);
break;
}
}
} catch (e) { APP_BASE = ''; }
window.APP_BASE = APP_BASE;
})();
// ---------- 菜单配置(唯一维护点) ----------
// 顶级项:{ title, icon, role, children? } 有 children = 分组
// 子项:{ title, href, role }
// href 使用绝对路径(以 / 开头),渲染时会自动加上应用根前缀 APP_BASE
var MENU_GROUPS = [
{ title: '首页', icon: '🏠', href: '/home.html', hideOnHome: true },
{
title: '生产管理', icon: '🏭', role: 'Purchase01',
children: [
{ title: 'BOM主数据', href: '/View/Delivery/bom_master.html', role: 'Purchase01' },
{ title: '生产排程计划', href: '/View/Delivery/schedule.html', role: 'Purchase01' },
{ title: '线边仓库存', href: '/View/Delivery/production_delivery.html', role: 'Purchase01' },
{ title: 'MES追溯看板', href: '/View/MES/mes_dashboard.html', role: 'Produce02' }
]
},
{
title: '采购管理', icon: '📋', role: 'Purchase01',
children: [
{ title: '采购申请管理', href: '/procurement.html', role: 'Purchase01' },
{ title: '采购看板', href: '/procurement_dashboard.html', role: 'Purchase01' },
{ title: '采购物料交付状态看板', href: '/delivery_dashboard.html', role: 'Purchase01' },
{ title: '研发采购看板', href: '/dashboard.html', role: 'YF01' },
{ title: '研发采购全链路看板', href: '/procurement_board_list.html', role: 'YF01' },
{ title: '研发订单考核时效看板', href: '/procurement_audit_leadtime.html', role: 'YF01' },
{ title: '采购物料交付', href: '/View/Delivery/material_delivery.html', role: 'Purchase01' },
{ title: '采购物料交付计划看板', href: '/View/Delivery/delivery_dashboard.html', role: 'Purchase01' }
]
},
{
title: 'CRM', icon: '📊', role: 'CRM01',
children: [
{ title: '金蝶-CRM产品同步', href: '/index.html', role: 'CRM01' },
{ title: '金蝶-CRM销售订单新变更单同步', href: '/crm_sale_order_sync.html', role: 'CRM01' }
]
}
];
// ============================================
// 通用逻辑,一般无需修改
// ============================================
function getLoginUser() {
try {
var raw = sessionStorage.getItem('gx_user');
if (!raw) return null;
return JSON.parse(raw);
} catch (e) { return null; }
}
function hasRole(role) {
if (!role) return true;
var user = getLoginUser();
if (!user) return false;
var rn = user.roleNumbers;
if (Array.isArray(rn)) {
if (rn.indexOf(role) >= 0) return true;
for (var i = 0; i < rn.length; i++) {
if (String(rn[i]).toUpperCase() === String(role).toUpperCase()) return true;
}
}
var rs = user.roles;
if (Array.isArray(rs)) {
for (var j = 0; j < rs.length; j++) {
var item = rs[j] || {};
if (String(item.roleNumber || '').toUpperCase() === String(role).toUpperCase()) return true;
if (String(item.roleName || '').toUpperCase() === String(role).toUpperCase()) return true;
}
}
return false;
}
function isActive(href) {
try {
var u = new URL(APP_BASE + href, window.location.origin);
return window.location.pathname.replace(/\\/g, '/').indexOf(u.pathname) >= 0;
} catch (e) { return false; }
}
function getLoginPath() {
// 用 APP_BASE(自动探测的应用根前缀)拼接登录页地址:
// - VS 调试/根目录部署:APP_BASE 为空,返回 '/login.html'
// - 子目录部署(如 /WebApi):返回 '/WebApi/login.html'
return APP_BASE + '/login.html';
}
function logout() {
sessionStorage.removeItem('gx_user');
window.location.href = getLoginPath();
}
/**
* 渲染侧边栏
*/
function renderSidebar() {
var user = getLoginUser();
if (!user) {
if (window.location.href.indexOf('login.html') < 0) {
window.location.href = getLoginPath();
}
return;
}
var html = '';
// 收缩按钮
html += '<button class="sidebar-toggle" title="收起/展开菜单" onclick="toggleSidebar()">☰</button>';
// 用户信息区
var name = user.userName || user.userId || user.name || '用户';
html += '<div class="sidebar-user">'
+ '<div class="avatar">' + (name || '?').charAt(0) + '</div>'
+ '<div class="user-text">'
+ ' <div class="user-name">' + name + '</div>'
+ ' <div class="user-action"><a href="javascript:void(0)" onclick="logout()">退出登录</a></div>'
+ '</div>'
+ '</div>';
// 找出当前页面所在分组(用于默认展开)
var activeGroupIdx = -1;
var activeChildIdx = -1;
// 渲染菜单
html += '<div class="sidebar-menu">';
for (var i = 0; i < MENU_GROUPS.length; i++) {
var g = MENU_GROUPS[i];
if (g.children && g.children.length) {
// 分组:先检查是否有子项当前激活
var hasActiveChild = false;
var activeChild = -1;
for (var k = 0; k < g.children.length; k++) {
if (hasRole(g.children[k].role) && isActive(g.children[k].href)) {
hasActiveChild = true;
activeChild = k;
if (activeGroupIdx < 0) activeGroupIdx = i;
}
}
// 过滤有权限的子项
var visibleChildren = [];
for (var k2 = 0; k2 < g.children.length; k2++) {
if (hasRole(g.children[k2].role)) visibleChildren.push(g.children[k2]);
}
if (visibleChildren.length === 0) continue;
var expanded = hasActiveChild ? ' expanded' : '';
var rotate = hasActiveChild ? ' rotate' : '';
html += '<div class="menu-group' + expanded + '" data-group="' + i + '">'
+ ' <div class="menu-group-title" data-title="' + g.title + '" onclick="toggleGroup(' + i + ')">'
+ ' <span class="menu-icon">' + (g.icon || '') + '</span>'
+ ' <span class="menu-label">' + g.title + '</span>'
+ ' <span class="menu-arrow' + rotate + '">▾</span>'
+ ' </div>'
+ ' <div class="menu-children">';
for (var c = 0; c < visibleChildren.length; c++) {
var child = visibleChildren[c];
var activeCls = (activeChild >= 0 && g.children[activeChild].href === child.href) ? ' active' : '';
html += '<a class="menu-child' + activeCls + '" href="' + APP_BASE + child.href + '">'
+ ' <span class="menu-child-dot">•</span>'
+ ' <span class="menu-label">' + child.title + '</span>'
+ '</a>';
}
html += ' </div>'
+ '</div>';
} else {
// 单项菜单:按 g.role 判断(分组由子项权限决定,不看 g.role)
if (!hasRole(g.role)) continue;
// 在首页本身不显示"首页"入口
if (g.href === '/home.html' && isActive(g.href)) continue;
var activeSingle = isActive(g.href) ? ' active' : '';
if (activeSingle) activeGroupIdx = i;
html += '<a class="menu-single' + activeSingle + '" href="' + APP_BASE + g.href + '" data-title="' + g.title + '">'
+ ' <span class="menu-icon">' + (g.icon || '') + '</span>'
+ ' <span class="menu-label">' + g.title + '</span>'
+ '</a>';
}
}
html += '</div>';
var el = document.getElementById('sidebar');
if (el) el.innerHTML = html;
// 主体内容左边距
document.body.classList.add('with-sidebar');
// 恢复折叠状态
if (localStorage.getItem('gx_sidebar_collapsed') === '1') {
document.body.classList.add('sidebar-collapsed');
}
}
/**
* 切换侧边栏折叠/展开
*/
function toggleSidebar() {
document.body.classList.toggle('sidebar-collapsed');
var collapsed = document.body.classList.contains('sidebar-collapsed');
if (collapsed) localStorage.setItem('gx_sidebar_collapsed', '1');
else localStorage.removeItem('gx_sidebar_collapsed');
}
/**
* 切换分组展开/折叠
*/
function toggleGroup(idx) {
// 折叠状态下点击分组:先展开侧边栏,再展开该分组
if (document.body.classList.contains('sidebar-collapsed')) {
toggleSidebar();
// 展开侧边栏后延迟让 CSS 过渡完成,再展开分组
var el = document.querySelector('.menu-group[data-group="' + idx + '"]');
if (el) el.classList.add('expanded');
return;
}
var el = document.querySelector('.menu-group[data-group="' + idx + '"]');
if (!el) return;
el.classList.toggle('expanded');
var arrow = el.querySelector('.menu-arrow');
if (arrow) arrow.classList.toggle('rotate');
}
function initNav() {
renderSidebar();
}
if (window.addEventListener) {
window.addEventListener('DOMContentLoaded', function () { initNav(); });
} else {
window.onload = function () { initNav(); };
}
@@ -0,0 +1,30 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下特性集控制
[assembly: AssemblyTitle("GXWebApi")]
[assembly: AssemblyDescription("金蝶云星空 WebApi 接口服务")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GXWebApi")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
// 对 COM 组件不可见
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("a1b2c3d4-e5f6-7890-abcd-ef1234567890")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gaussian 登录</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:'Microsoft YaHei','PingFang SC',sans-serif;background:linear-gradient(135deg,#1a73e8,#1557b0);min-height:100vh;display:flex;justify-content:center;align-items:center;padding:20px}
.login-box{background:#fff;border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,.2);width:100%;max-width:420px;padding:40px 36px}
.login-box .logo{text-align:center;font-size:22px;font-weight:700;color:#1a73e8;margin-bottom:6px}
.login-box .sub{text-align:center;font-size:13px;color:#999;margin-bottom:28px}
.form-group{margin-bottom:18px}
.form-group label{display:block;font-size:13px;font-weight:600;color:#333;margin-bottom:6px}
.form-group input{width:100%;height:44px;padding:0 14px;border:2px solid #e0e0e0;border-radius:8px;font-size:14px;outline:0;transition:border-color .25s,box-shadow .25s}
.form-group input:focus{border-color:#1a73e8;box-shadow:0 0 0 3px rgba(26,115,232,.12)}
.btn{width:100%;height:46px;border:0;border-radius:8px;font-size:16px;font-weight:600;cursor:pointer;transition:.2s;margin-top:6px}
.btn-primary{background:linear-gradient(135deg,#1a73e8,#1557b0);color:#fff}
.btn-primary:hover{opacity:.92}
.btn-primary:disabled{opacity:.6;cursor:default}
.btn-link{background:0 0;color:#1a73e8;font-size:13px;height:auto;padding:8px 0;text-decoration:underline}
.btn-link:hover{color:#1557b0}
.error{color:#e74c3c;font-size:13px;margin-top:10px;display:none;text-align:center}
.error.show{display:block}
.loading{display:inline-block;width:18px;height:18px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite;vertical-align:middle;margin-right:8px}
@keyframes spin{to{transform:rotate(360deg)}}
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:999;justify-content:center;align-items:center}
.modal-overlay.show{display:flex}
.modal{background:#fff;border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,.2);width:100%;max-width:400px;padding:32px 30px}
.modal h3{font-size:18px;color:#333;margin-bottom:20px;text-align:center}
.modal .form-group{margin-bottom:14px}
.modal .btn-row{display:flex;gap:10px;margin-top:8px}
.modal .btn-row .btn{flex:1}
.btn-secondary{background:#f0f0f0;color:#666}
.btn-secondary:hover{background:#e0e0e0}
.toast{position:fixed;top:14px;left:50%;transform:translateX(-50%);padding:10px 22px;border-radius:8px;font-size:13px;z-index:1001;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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
</style>
</head>
<body>
<div class="toast" id="toast"></div>
<div class="login-box">
<div class="logo">Gaussian</div>
<div class="sub">Gaussian IT管理系统</div>
<div id="loginForm">
<div class="form-group"><label>用户名</label><input type="text" id="txtUserId" placeholder="请输入用户账号" autocomplete="off" /></div>
<div class="form-group"><label>密码</label><input type="password" id="txtPassword" placeholder="请输入密码" /></div>
<div class="error" id="loginError"></div>
<button class="btn btn-primary" id="btnLogin" onclick="doLogin()">登 录</button>
<button class="btn btn-link" onclick="showChangePwd()">修改密码</button>
</div>
</div>
<div class="modal-overlay" id="pwdModal">
<div class="modal">
<h3>修改密码</h3>
<div class="form-group"><label>用户名</label><input type="text" id="cpUserId" placeholder="请输入用户账号" /></div>
<div class="form-group"><label>原密码</label><input type="password" id="cpOldPwd" placeholder="请输入原密码" /></div>
<div class="form-group"><label>新密码</label><input type="password" id="cpNewPwd" placeholder="请输入新密码" /></div>
<div class="error" id="cpError"></div>
<div class="btn-row">
<button class="btn btn-secondary" onclick="hideChangePwd()">取消</button>
<button class="btn btn-primary" id="btnChangePwd" onclick="doChangePwd()">确认修改</button>
</div>
</div>
</div>
<script>
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 showChangePwd(){document.getElementById('pwdModal').classList.add('show');document.getElementById('cpError').classList.remove('show')}
function hideChangePwd(){document.getElementById('pwdModal').classList.remove('show');document.getElementById('cpError').classList.remove('show')}
function doLogin(){
var userId=document.getElementById('txtUserId').value.trim();
var pwd=document.getElementById('txtPassword').value.trim();
if(!userId){document.getElementById('loginError').textContent='请输入用户名';document.getElementById('loginError').classList.add('show');return}
document.getElementById('loginError').classList.remove('show');
var btn=document.getElementById('btnLogin');btn.disabled=true;btn.innerHTML='<span class="loading"></span>登录中...';
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Auth/Login',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
btn.disabled=false;btn.innerHTML='登 录';
try{
var r=JSON.parse(xhr.responseText);
if(r.success){
sessionStorage.setItem('gx_user',JSON.stringify(r.data));
var roles=r.data.roleNumbers||[];
if(roles.indexOf('Produce02')>=0)window.location.href='View/MES/mes_dashboard.html';
else if(roles.indexOf('Purchase01')>=0)window.location.href='procurement.html';
else if(roles.indexOf('YF01')>=0)window.location.href='dashboard.html';
else if(roles.indexOf('CRM01')>=0)window.location.href='index.html';
else window.location.href='procurement.html';
}else{
document.getElementById('loginError').textContent=r.message||'登录失败';
document.getElementById('loginError').classList.add('show');
}
}catch(e){document.getElementById('loginError').textContent='登录异常';document.getElementById('loginError').classList.add('show')}
};
xhr.onerror=function(){btn.disabled=false;btn.innerHTML='登 录';document.getElementById('loginError').textContent='网络连接失败';document.getElementById('loginError').classList.add('show')};
xhr.send(JSON.stringify({userId:userId,password:pwd}));
}
function doChangePwd(){
var userId=document.getElementById('cpUserId').value.trim();
var oldPwd=document.getElementById('cpOldPwd').value.trim();
var newPwd=document.getElementById('cpNewPwd').value.trim();
if(!userId){document.getElementById('cpError').textContent='请输入用户名';document.getElementById('cpError').classList.add('show');return}
document.getElementById('cpError').classList.remove('show');
var btn=document.getElementById('btnChangePwd');btn.disabled=true;btn.innerHTML='提交中...';
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Auth/ChangePassword',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
btn.disabled=false;btn.innerHTML='确认修改';
try{var r=JSON.parse(xhr.responseText);
if(r.success){toast('密码修改成功','success');hideChangePwd();document.getElementById('cpUserId').value='';document.getElementById('cpOldPwd').value='';document.getElementById('cpNewPwd').value=''}
else{document.getElementById('cpError').textContent=r.message||'修改失败';document.getElementById('cpError').classList.add('show')}
}catch(e){document.getElementById('cpError').textContent='请求异常';document.getElementById('cpError').classList.add('show')}
};
xhr.onerror=function(){btn.disabled=false;btn.innerHTML='确认修改';toast('网络连接失败','error')};
xhr.send(JSON.stringify({userId:userId,oldPassword:oldPwd,newPassword:newPwd}));
}
document.getElementById('txtPassword').addEventListener('keydown',function(e){if(e.key==='Enter')doLogin()});
document.getElementById('txtUserId').addEventListener('keydown',function(e){if(e.key==='Enter')document.getElementById('txtPassword').focus()});
(function(){
var user=sessionStorage.getItem('gx_user');
if(user){
try{var data=JSON.parse(user);var roles=data.roleNumbers||[];
if(roles.indexOf('Produce02')>=0)window.location.href='View/MES/mes_dashboard.html';
else if(roles.indexOf('Purchase01')>=0)window.location.href='procurement.html';
else if(roles.indexOf('YF01')>=0)window.location.href='dashboard.html';
else if(roles.indexOf('CRM01')>=0)window.location.href='index.html';
else window.location.href='procurement.html';
}catch(e){}
}
})();
</script>
</body>
</html>
@@ -0,0 +1,266 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
namespace GXWebApi.Common
{
public class DBHelpe
{
// private readonly static string config = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
private string PriConnectionString = string.Empty;
private static DBHelpe _instance = null;//单例
public DBHelpe()
{
//获取连接字符串
try
{
PriConnectionString = ConfigurationManager.ConnectionStrings["GXWMS"].ToString();
}
catch (Exception ex)
{
throw new Exception(string.Format("未配置{0}库:{1}", "GXWMS", ex.Message));
}
}
/// <summary>
/// 单例模式
/// </summary>
/// <returns></returns>
public static DBHelpe GetInstance()
{
if (_instance == null)
{
_instance = new DBHelpe();
}
return _instance;
}
#region 执行查询,返回要查询的结果集 DataTable
/// <summary>
/// 执行查询,返回要查询的结果集
/// </summary>
/// <param name="sql">sql语句</param>
/// <returns></returns>
public DataTable ExecuteTable(string par_SqlStr)
{
return ExecuteTable(par_SqlStr, CommandType.Text, null);
}
/// <summary>
/// 创建一个DataTable对象
/// </summary>
/// <param name="M_str_par_SqlStr">SQL语句</param>
/// <param name="M_str_table">表名</param>
/// <returns>返回DataSet对象</returns>
/// <summary>
/// 执行查询,返回要查询的结果集
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <returns></returns>
public DataTable ExecuteTable(string par_SqlStr, CommandType par_CommandType = CommandType.Text)
{
return ExecuteTable(par_SqlStr, par_CommandType, null);
}
/// <summary>
/// 执行查询,返回要查询的结果集
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <param name="parameters">参数列表</param>
/// <returns></returns>
public DataTable ExecuteTable(string sql, CommandType par_CommandType, params System.Data.SqlClient.SqlParameter[] pParameters)
{
// 保存要查询的结果
DataTable table = new DataTable("dt");
//SqlCommand command;
using (SqlConnection Connection = new SqlConnection(PriConnectionString))
{
//command = new SqlCommand(sql, Connection);
using (SqlCommand command = new SqlCommand(sql, Connection))
{
try
{
if (Connection.State != ConnectionState.Open)
Connection.Open();
// 设置SQL语句的类型
command.CommandType = par_CommandType;
command.CommandTimeout = 36000;
// 如果传入了参数,则添加到命令对象中
if (pParameters != null)
{
for (int i = command.Parameters.Count - 1; i >= 0; i--)
{
command.Parameters.RemoveAt(i);
}
command.Parameters.AddRange(pParameters);
}
// 创建一个适配器对象,用以将结果填充到DataTable中
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(table);
}
catch (System.Data.SqlClient.SqlException E)
{
throw new Exception(E.Message);
}
finally
{
command.Parameters.Clear();
command.Dispose();
Connection.Close();
}
}
}
return table;
}
#endregion
#region 执行增、删、改操作,返回受影响的行数
/// <summary>
/// 执行增、删、改操作,返回受影响的行数
/// </summary>
/// <param name="sql">存储过程名</param>
/// <returns></returns>
public int ExecuteNonQuery(string par_sql)
{
return ExecuteNonQuery(par_sql, CommandType.Text, null);
}
/// <summary>
/// 执行增、删、改操作,返回受影响的行数
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <returns></returns>
public int ExecuteNonQuery(string par_sql, CommandType par_CommandType)
{
return ExecuteNonQuery(par_sql, par_CommandType, null);
}
/// <summary>
/// 执行增、删、改操作,返回受影响的行数
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <param name="parameters">参数列表</param>
/// <returns></returns>
public int ExecuteNonQuery(string par_sql, CommandType par_CommandType, params System.Data.SqlClient.SqlParameter[] pParameters)
{
// 受影响的行数
int count = 0;
using (SqlConnection Connection = new SqlConnection(PriConnectionString))
{
using (SqlCommand command = new SqlCommand(par_sql, Connection))
{
try
{
if (Connection.State != ConnectionState.Open)
Connection.Open();
// 设置SQL语句的类型
command.CommandType = par_CommandType;
command.CommandTimeout = 36000;
// 如果传入了参数,则添加到命令对象中
if (pParameters != null)
{
for (int i = command.Parameters.Count - 1; i >= 0; i--)
{
command.Parameters.RemoveAt(i);
}
command.Parameters.AddRange(pParameters);
}
count = command.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException E)
{
throw new Exception(E.Message);
}
finally
{
command.Parameters.Clear();
command.Dispose();
Connection.Close();
}
}
}
return count;
}
#endregion
/// <summary>
/// 防止数据库参数为NULL
/// </summary>
/// <param name="param">参数名</param>
/// <param name="value">参数值</param>
/// <returns>数据库参数</returns>
public static SqlParameter SetParam(string param, object value)
{
if (value == null)
return new SqlParameter(param, "");
return new SqlParameter(param, value);
}
/// <summary>
/// 判断存储过程是否存在
/// </summary>
/// <param name="storeProcedureName">存储过程名</param>
/// <returns></returns>
public bool IsStoreProcedureExist(string storeProcedureName)
{
string existSql = string.Format(@"select * from sysobjects where id = object_id(N'[{0}]') and OBJECTPROPERTY(id, N'IsProcedure') = 1", storeProcedureName);
DataTable dt = this.ExecuteTable(existSql);
if (dt.Rows.Count > 0)
{
return true;
}
return false;
}
public static DataTable ConvertDataReaderToDataTable(SqlDataReader reader)
{
try
{
DataTable objDataTable = new DataTable();
int intFieldCount = reader.FieldCount;
for (int intCounter = 0; intCounter < intFieldCount; ++intCounter)
{
objDataTable.Columns.Add(reader.GetName(intCounter), reader.GetFieldType(intCounter));
}
objDataTable.BeginLoadData();
object[] objValues = new object[intFieldCount];
while (reader.Read())
{
reader.GetValues(objValues);
objDataTable.LoadDataRow(objValues, true);
}
reader.Close();
objDataTable.EndLoadData();
return objDataTable;
}
catch (Exception ex)
{
throw new Exception("转换出错!", ex);
}
}
}
}
@@ -0,0 +1,54 @@
using System;
using System.Reflection;
using System.Web.Http;
namespace GXWebApi
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
// 处理 Kingdee.BOS.WebApi.Client 引用 Newtonsoft.Json 4.0.0.0 (PublicKeyToken=null) 的问题
// 将其重定向到当前加载的 Newtonsoft.Json 13.0 版本
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
GlobalConfiguration.Configure(WebApiConfig.Register);
}
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var assemblyName = new AssemblyName(args.Name);
// Kingdee.BOS.WebApi.Client 引用的是 Newtonsoft.Json 4.0.0.0, PublicKeyToken=null
// 将其重定向到已加载的 Newtonsoft.Json 版本
if (assemblyName.Name.Equals("Newtonsoft.Json", StringComparison.OrdinalIgnoreCase))
{
// 返回当前 AppDomain 中已加载的 Newtonsoft.Json 程序集
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (assembly.GetName().Name.Equals("Newtonsoft.Json", StringComparison.OrdinalIgnoreCase))
{
return assembly;
}
}
// 如果尚未加载,尝试从文件加载
try
{
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
var dllPath = System.IO.Path.Combine(baseDir, "bin", "Newtonsoft.Json.dll");
if (System.IO.File.Exists(dllPath))
{
return Assembly.LoadFrom(dllPath);
}
}
catch
{
// ignore
}
}
return null;
}
}
}
@@ -0,0 +1,432 @@
using GXWebApi.Common;
using log4net;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web.Http;
namespace GXWebApi.Controllers
{
/// <summary>
/// MES 扫码物料追溯看板
/// 数据来源:GXWMS 库 ODK_ScanCodeIntercept / ODK_ScanCodeInterceptEntry
/// </summary>
public class MesController : ApiController
{
private static readonly ILog Logger = LogManager.GetLogger(typeof(MesController));
/// <summary>
/// 获取看板配置(自动刷新间隔,秒)
/// </summary>
[HttpGet]
public IHttpActionResult GetConfig()
{
int seconds = 600; // 默认10分钟
try
{
string val = ConfigurationManager.AppSettings["MesAutoRefreshSeconds"];
if (!string.IsNullOrEmpty(val) && int.TryParse(val.Trim(), out int tmp))
{
seconds = tmp < 0 ? 0 : tmp; // 不允许负数,0表示关闭
}
}
catch (Exception ex)
{
Logger.Error("读取MesAutoRefreshSeconds配置异常:", ex);
}
return Ok(new { success = true, data = new { autoRefreshSeconds = seconds } });
}
/// <summary>
/// 获取全部机型汇总数据(对比视图)
/// </summary>
[HttpGet]
public IHttpActionResult GetDashboardData()
{
try
{
DBHelpe db = DBHelpe.GetInstance();
// 1. 按机型汇总主表(仅统计当天)
string sqlMachine = @"
SELECT FType,
COUNT(*) AS ProductCount,
ISNULL(SUM(FNeedQty), 0) AS TotalNeedQty,
ISNULL(SUM(FRealityQty), 0) AS TotalRealityQty,
SUM(CASE WHEN FRealityQty >= FNeedQty THEN 1 ELSE 0 END) AS NormalCount,
SUM(CASE WHEN FRealityQty > 0 AND FRealityQty < FNeedQty THEN 1 ELSE 0 END) AS AbnormalCount,
SUM(CASE WHEN FRealityQty = 0 THEN 1 ELSE 0 END) AS NotStartCount
FROM ODK_ScanCodeIntercept
WHERE FDate >= CONVERT(date, GETDATE())
GROUP BY FType
ORDER BY FType";
DataTable dtMachine = db.ExecuteTable(sqlMachine);
// 2. 按机型+工序汇总子表扫码数量(仅统计当天)
string sqlProcess = @"
SELECT A.FType,
B.FProcessNumber,
B.FProcessName,
ISNULL(SUM(B.FQty), 0) AS TotalQty
FROM ODK_ScanCodeIntercept A
INNER JOIN ODK_ScanCodeInterceptEntry B ON A.FINTERID = B.FINTERID
WHERE A.FDate >= CONVERT(date, GETDATE())
GROUP BY A.FType, B.FProcessNumber, B.FProcessName
ORDER BY A.FType, B.FProcessNumber";
DataTable dtProcess = db.ExecuteTable(sqlProcess);
var machines = new List<object>();
int totalCount = 0;
foreach (DataRow mRow in dtMachine.Rows)
{
string fType = mRow["FType"].ToStringEx();
int count = mRow["ProductCount"].ToInt();
int totalNeed = mRow["TotalNeedQty"].ToInt();
int totalReality = mRow["TotalRealityQty"].ToInt();
int normalCount = mRow["NormalCount"].ToInt();
totalCount += count;
// 找出该机型所有工序的最大扫码数(用于条形图相对宽度)
int maxProcessQty = 0;
var processList = new List<object>();
foreach (DataRow pRow in dtProcess.Rows)
{
if (pRow["FType"].ToStringEx() != fType) continue;
int qty = pRow["TotalQty"].ToInt();
if (qty > maxProcessQty) maxProcessQty = qty;
}
foreach (DataRow pRow in dtProcess.Rows)
{
if (pRow["FType"].ToStringEx() != fType) continue;
int qty = pRow["TotalQty"].ToInt();
processList.Add(new
{
code = pRow["FProcessNumber"].ToStringEx(),
name = pRow["FProcessName"].ToStringEx(),
scanned = qty,
barPct = maxProcessQty > 0 ? Math.Round((double)qty / maxProcessQty * 100, 1) : 0
});
}
machines.Add(new
{
fType = fType,
count = count,
totalNeedQty = totalNeed,
totalRealityQty = totalReality,
coverage = count > 0 ? Math.Round((double)normalCount / count * 100, 1) : 0,
status = new
{
normal = normalCount,
abnormal = mRow["AbnormalCount"].ToInt(),
notstart = mRow["NotStartCount"].ToInt()
},
processes = processList
});
}
return Ok(new { success = true, data = new { machines = machines, totalCount = totalCount } });
}
catch (Exception ex)
{
Logger.Error("GetDashboardData异常:", ex);
return Ok(new { success = false, message = "获取数据异常: " + ex.Message });
}
}
/// <summary>
/// 获取单机型详情(含产品列表、异常列表、工序汇总)
/// </summary>
[HttpGet]
public IHttpActionResult GetMachineDetail(string fType)
{
try
{
WmsCommonFunction.UpUserCount("20260817001", "MES物料扫码追溯看板");
string safeType = fType.Replace("'", "''");
DBHelpe db = DBHelpe.GetInstance();
// 1. 机型汇总(仅统计当天)
string sqlSummary = $@"
SELECT COUNT(*) AS ProductCount,
ISNULL(SUM(FNeedQty), 0) AS TotalNeedQty,
ISNULL(SUM(FRealityQty), 0) AS TotalRealityQty,
SUM(CASE WHEN FRealityQty >= FNeedQty THEN 1 ELSE 0 END) AS NormalCount,
SUM(CASE WHEN FRealityQty > 0 AND FRealityQty < FNeedQty THEN 1 ELSE 0 END) AS AbnormalCount,
SUM(CASE WHEN FRealityQty = 0 THEN 1 ELSE 0 END) AS NotStartCount
FROM ODK_ScanCodeIntercept
WHERE FType = '{safeType}'
AND FDate >= CONVERT(date, GETDATE())";
DataTable dtSummary = db.ExecuteTable(sqlSummary);
if (dtSummary.Rows.Count == 0)
return Ok(new { success = false, message = "未找到该机型数据" });
DataRow sRow = dtSummary.Rows[0];
int count = sRow["ProductCount"].ToInt();
int totalNeed = sRow["TotalNeedQty"].ToInt();
int totalReality = sRow["TotalRealityQty"].ToInt();
// 2. 工序汇总(仅统计当天)
string sqlProcess = $@"
SELECT B.FProcessNumber, B.FProcessName, ISNULL(SUM(B.FQty), 0) AS TotalQty
FROM ODK_ScanCodeIntercept A
INNER JOIN ODK_ScanCodeInterceptEntry B ON A.FINTERID = B.FINTERID
WHERE A.FType = '{safeType}'
AND A.FDate >= CONVERT(date, GETDATE())
GROUP BY B.FProcessNumber, B.FProcessName
ORDER BY B.FProcessNumber";
DataTable dtProcess = db.ExecuteTable(sqlProcess);
var processList = new List<object>();
int maxProcessQty = 0;
foreach (DataRow pRow in dtProcess.Rows)
{
int qty = pRow["TotalQty"].ToInt();
if (qty > maxProcessQty) maxProcessQty = qty;
}
foreach (DataRow pRow in dtProcess.Rows)
{
int qty = pRow["TotalQty"].ToInt();
processList.Add(new
{
code = pRow["FProcessNumber"].ToStringEx(),
name = pRow["FProcessName"].ToStringEx(),
scanned = qty,
barPct = maxProcessQty > 0 ? Math.Round((double)qty / maxProcessQty * 100, 1) : 0
});
}
// 3. 产品列表 + 每个产品的缺失工序(仅统计当天)
string sqlProducts = $@"
SELECT FINTERID, FNO, FSN, FNeedQty, FRealityQty, FDate
FROM ODK_ScanCodeIntercept
WHERE FType = '{safeType}'
AND FDate >= CONVERT(date, GETDATE())
ORDER BY FDate DESC";
DataTable dtProducts = db.ExecuteTable(sqlProducts);
// 4. 近一周每日扫码率趋势(按 FDate 分组统计每天实扫/应扫总量)
string sqlTrend = $@"
SELECT CONVERT(varchar(10), FDate, 120) AS ScanDay,
ISNULL(SUM(FRealityQty), 0) AS DayRealityQty,
ISNULL(SUM(FNeedQty), 0) AS DayNeedQty
FROM ODK_ScanCodeIntercept
WHERE FType = '{safeType}'
AND FDate >= DATEADD(day, -6, CONVERT(date, GETDATE()))
GROUP BY CONVERT(varchar(10), FDate, 120)
ORDER BY ScanDay";
DataTable dtTrend = db.ExecuteTable(sqlTrend);
// 构造近7天序列(无数据的日期补0),X轴仅显示 月-日
var trend = new List<object>();
var trendMap = new Dictionary<string, KeyValuePair<int, int>>();
foreach (DataRow tRow in dtTrend.Rows)
{
trendMap[tRow["ScanDay"].ToStringEx()] = new KeyValuePair<int, int>(
tRow["DayRealityQty"].ToInt(),
tRow["DayNeedQty"].ToInt()
);
}
DateTime todayTrend = DateTime.Today;
for (int i = 6; i >= 0; i--)
{
DateTime day = todayTrend.AddDays(-i);
string key = day.ToString("yyyy-MM-dd");
int dReality = 0, dNeed = 0;
if (trendMap.ContainsKey(key))
{
dReality = trendMap[key].Key;
dNeed = trendMap[key].Value;
}
trend.Add(new
{
date = key,
label = day.ToString("MM-dd"),
needQty = dNeed,
realityQty = dReality,
ratio = dNeed > 0 ? Math.Round((double)dReality / dNeed * 100, 1) : 0
});
}
// 5. 一次性查出该机型所有产品的子表数据(避免 N+1 查询,仅统计当天)
string sqlAllEntries = $@"
SELECT A.FINTERID, B.FProcessNumber, B.FQty
FROM ODK_ScanCodeIntercept A
INNER JOIN ODK_ScanCodeInterceptEntry B ON A.FINTERID = B.FINTERID
WHERE A.FType = '{safeType}'
AND A.FDate >= CONVERT(date, GETDATE())";
DataTable dtAllEntries = db.ExecuteTable(sqlAllEntries);
// 构建 finterid -> [(工序编号, FQty)] 映射
var entryMap = new Dictionary<string, List<KeyValuePair<string, int>>>();
foreach (DataRow eRow in dtAllEntries.Rows)
{
string fid = eRow["FINTERID"].ToStringEx();
if (!entryMap.ContainsKey(fid))
entryMap[fid] = new List<KeyValuePair<string, int>>();
entryMap[fid].Add(new KeyValuePair<string, int>(
eRow["FProcessNumber"].ToStringEx(),
eRow["FQty"].ToInt()
));
}
var products = new List<object>();
foreach (DataRow pRow in dtProducts.Rows)
{
string fInterID = pRow["FINTERID"].ToStringEx();
string fno = pRow["FNO"].ToStringEx();
string fsn = pRow["FSN"].ToStringEx();
int need = pRow["FNeedQty"].ToInt();
int reality = pRow["FRealityQty"].ToInt();
string status = reality >= need ? "normal" : (reality > 0 ? "abnormal" : "notstart");
// 解析产线(车号前缀,如 517-GSS-xxxx -> 517)
string line = "";
if (fno.Contains("-")) line = fno.Split('-')[0];
// 解析时间
DateTime? dt = pRow["FDate"].ToDateTimeNullable();
string fDateStr = dt.HasValue ? dt.Value.ToString("yyyy-MM-dd HH:mm:ss") : "--";
// 计算缺失工序(子表中 FQty = 0 的工序编号)
string missingProcs = "";
if (status == "notstart")
{
missingProcs = "全部";
}
else if (entryMap.ContainsKey(fInterID))
{
var missing = new List<string>();
foreach (var kv in entryMap[fInterID])
{
if (kv.Value == 0) missing.Add(kv.Key);
}
missingProcs = string.Join(",", missing);
}
products.Add(new
{
fInterID = fInterID,
carNo = fno,
sn = fsn,
fType = fType,
expected = need,
actual = reality,
status = status,
fDate = fDateStr,
missingProcs = missingProcs,
line = line
});
}
return Ok(new
{
success = true,
data = new
{
fType = fType,
count = count,
totalNeedQty = totalNeed,
totalRealityQty = totalReality,
coverage = count > 0 ? Math.Round((double)sRow["NormalCount"].ToInt() / count * 100, 1) : 0,
status = new
{
normal = sRow["NormalCount"].ToInt(),
abnormal = sRow["AbnormalCount"].ToInt(),
notstart = sRow["NotStartCount"].ToInt()
},
processes = processList,
products = products,
trend = trend
}
});
}
catch (Exception ex)
{
Logger.Error("GetMachineDetail异常:", ex);
return Ok(new { success = false, message = "获取数据异常: " + ex.Message });
}
}
/// <summary>
/// 获取单个产品的工序级扫码详情
/// </summary>
[HttpGet]
public IHttpActionResult GetProductDetail(string fInterID)
{
try
{
string safeId = fInterID.Replace("'", "''");
DBHelpe db = DBHelpe.GetInstance();
// 1. 产品主表信息
string sqlProduct = $@"
SELECT FINTERID, FNO, FSN, FType, FNeedQty, FRealityQty, FDate
FROM ODK_ScanCodeIntercept
WHERE FINTERID = '{safeId}'";
DataTable dtProduct = db.ExecuteTable(sqlProduct);
if (dtProduct.Rows.Count == 0)
return Ok(new { success = false, message = "产品不存在" });
DataRow row = dtProduct.Rows[0];
int need = row["FNeedQty"].ToInt();
int reality = row["FRealityQty"].ToInt();
string status = reality >= need ? "normal" : (reality > 0 ? "abnormal" : "notstart");
DateTime? dt = row["FDate"].ToDateTimeNullable();
string fDateStr = dt.HasValue ? dt.Value.ToString("yyyy-MM-dd HH:mm:ss") : "--";
// 2. 工序级扫码明细
string sqlEntries = $@"
SELECT FEntryID, FProcessNumber, FProcessName, FQty
FROM ODK_ScanCodeInterceptEntry
WHERE FINTERID = '{safeId}'
ORDER BY FProcessNumber";
DataTable dtEntries = db.ExecuteTable(sqlEntries);
var processList = new List<object>();
foreach (DataRow eRow in dtEntries.Rows)
{
int qty = eRow["FQty"].ToInt();
processList.Add(new
{
entryId = eRow["FEntryID"].ToStringEx(),
code = eRow["FProcessNumber"].ToStringEx(),
name = eRow["FProcessName"].ToStringEx(),
qty = qty,
scanned = qty > 0
});
}
return Ok(new
{
success = true,
data = new
{
fInterID = fInterID,
carNo = row["FNO"].ToStringEx(),
sn = row["FSN"].ToStringEx(),
fType = row["FType"].ToStringEx(),
expected = need,
actual = reality,
status = status,
fDate = fDateStr,
processes = processList
}
});
}
catch (Exception ex)
{
Logger.Error("GetProductDetail异常:", ex);
return Ok(new { success = false, message = "获取数据异常: " + ex.Message });
}
}
}
}
@@ -0,0 +1,71 @@
<!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>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,281 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>产品BOM主数据维护</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="../common/nav.css">
<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 24px;display:flex;align-items:center;height:56px;box-shadow:0 2px 8px rgba(0,0,0,.15);position:sticky;top:0;z-index:100}
.top-bar .logo{font-size:18px;font-weight:600;letter-spacing:1px;margin-right:32px}
.top-bar .nav-tabs{display:flex;gap:4px;height:100%}
.top-bar .nav-tabs a{color:rgba(255,255,255,.75);text-decoration:none;padding:0 16px;display:flex;align-items:center;font-size:13px;border-radius:4px 4px 0 0;transition:all .2s}
.top-bar .nav-tabs a:hover{color:#fff;background:rgba(255,255,255,.1)}
.top-bar .nav-tabs a.active{color:#fff;background:rgba(255,255,255,.2)}
.top-bar .user-info{margin-left:auto;font-size:13px;opacity:.85}
.main-container{max-width:1500px;margin:0 auto;padding:16px 20px}
.panel{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:16px;margin-bottom:14px}
.panel h3{font-size:15px;color:#333;font-weight:600;margin-bottom:12px}
.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.toolbar input,.toolbar select{height:32px;padding:0 10px;border:2px solid #e0e0e0;border-radius:5px;font-size:13px;outline:none}
.toolbar input:focus,.toolbar select:focus{border-color:#1a73e8}
.btn{height:32px;padding:0 16px;border:none;border-radius:5px;font-size:12px;font-weight:600;cursor:pointer;transition:all .2s;color:#fff}
.btn-primary{background:linear-gradient(135deg,#1a73e8,#1557b0)}
.btn-primary:hover{opacity:.92}
.btn-green{background:#22c55e}
.btn-green:hover{opacity:.92}
.btn-orange{background:#f59e0b}
.btn-orange:hover{opacity:.92}
.btn-red{background:#ef4444}
.btn-red:hover{opacity:.92}
.btn-outline{background:#fff;color:#666;border:2px solid #e0e0e0}
.btn-outline:hover{border-color:#1a73e8;color:#1a73e8}
table{width:100%;border-collapse:collapse;font-size:13px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:9px 12px;text-align:left;border:1px solid #999;border-bottom:2px solid #999;white-space:nowrap}
tbody td{padding:9px 12px;border:1px solid #ddd;color:#333}
tbody tr:hover{background:#f0f6ff}
.badge{display:inline-block;padding:2px 10px;border-radius:12px;font-size:12px;font-weight:500}
.badge-success{background:#dcfce7;color:#166534}
.badge-muted{background:#f1f5f9;color:#64748b}
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:999;justify-content:center;align-items:center;padding:24px}
body.with-sidebar:not(.sidebar-collapsed) .modal-overlay{padding-left:240px}
body.with-sidebar.sidebar-collapsed .modal-overlay{padding-left:60px}
.modal-overlay.show{display:flex}
.modal{background:#fff;border-radius:10px;width:560px;max-width:95vw;max-height:90vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.2);padding:24px}
.modal h3{font-size:17px;color:#333;margin-bottom:16px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.form-group{display:flex;flex-direction:column}
.form-group.full{grid-column:1/-1}
.form-group label{font-size:12px;color:#555;font-weight:600;margin-bottom:4px}
.form-group input,.form-group select{height:34px;padding:0 10px;border:2px solid #e0e0e0;border-radius:5px;font-size:13px;outline:none}
.form-group input:focus,.form-group select:focus{border-color:#1a73e8}
.form-group input.readonly{background:#f8f9fa;color:#999}
.modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:18px}
.toast{position:fixed;top:14px;left:50%;transform:translateX(-50%);padding:10px 22px;border-radius:8px;font-size:13px;z-index:1001;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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
.detail-table{max-height:60vh;overflow-y:auto}
.expand-btn{cursor:pointer;color:#1a73e8;font-weight:600}
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="panel">
<h3>产品BOM主数据维护</h3>
<div class="toolbar">
<input type="text" id="txtKeyword" placeholder="搜索 产品编码 / 产品名称" style="width:220px">
<select id="selStatus">
<option value="-1">状态:全部</option>
<option value="1">启用</option>
<option value="0">禁用</option>
</select>
<button class="btn btn-primary" onclick="loadList()">查询</button>
<button class="btn btn-outline" onclick="resetSearch()">重置</button>
<div style="flex:1"></div>
<button class="btn btn-green" onclick="openAddModal()">+ 新增产品</button>
</div>
<table>
<thead>
<tr>
<th>产品编码</th><th>BOM版本</th><th>产品名称</th>
<th>状态</th><th>BOM明细数</th><th>操作</th>
</tr>
</thead>
<tbody id="tbodyList"></tbody>
</table>
</div>
</div>
<div class="modal-overlay" id="editModal">
<div class="modal">
<h3 id="modalTitle">新增产品</h3>
<div class="form-grid">
<div class="form-group">
<label>产品编码 <span style="color:#ef4444">*</span></label>
<input type="text" id="fProductCode" placeholder="如 KHT10">
</div>
<div class="form-group">
<label>BOM版本 <span style="color:#ef4444">*</span></label>
<input type="text" id="fBOMVersion" placeholder="如 V1.0">
</div>
<div class="form-group full">
<label>产品名称</label>
<input type="text" id="fProductName" placeholder="产品名称">
</div>
<div class="form-group">
<label>状态</label>
<select id="fStatus">
<option value="1">启用</option>
<option value="0">禁用</option>
</select>
</div>
</div>
<div class="modal-actions">
<button class="btn btn-outline" onclick="closeModal('editModal')">取消</button>
<button class="btn btn-primary" onclick="saveBom()">保存</button>
</div>
</div>
</div>
<div class="modal-overlay" id="detailModal">
<div class="modal" style="width:90vw">
<h3 id="detailTitle">BOM明细</h3>
<div class="toolbar">
<button class="btn btn-orange" onclick="expandBom()">从金蝶同步展开BOM</button>
<span id="detailCount" style="font-size:13px;color:#666"></span>
</div>
<div class="detail-table">
<table>
<thead>
<tr>
<th>层级</th><th>父物料编码</th><th>子物料编码</th><th>子物料名称</th>
<th>规格型号</th><th>单位</th><th>用量</th>
</tr>
</thead>
<tbody id="tbodyDetail"></tbody>
</table>
</div>
<div class="modal-actions">
<button class="btn btn-outline" onclick="closeModal('detailModal')">关闭</button>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
<script>
var curId=0;
var curProductCode='';
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'},3000)}
function api(url,method,data,cb){
var opts={method:method||'GET',headers:{'Content-Type':'application/json'}};
if(data)opts.body=JSON.stringify(data);
fetch(url,opts).then(function(r){return r.json()}).then(function(res){
if(res&&res.success===false){toast(res.message||'操作失败','error');return}
cb&&cb(res);
}).catch(function(e){toast('请求失败:'+e.message,'error')});
}
function getApiUrl(){
return '../../api/deliver/';
}
function baseUrl(){
return window.location.protocol+'//'+window.location.host;
}
function loadList(){
var kw=document.getElementById('txtKeyword').value.trim();
var st=document.getElementById('selStatus').value;
api(getApiUrl()+'GetBomMasterList?keyword='+encodeURIComponent(kw)+'&status='+st,'GET',null,function(res){
var rows=res.data||[];
var html='';
if(rows.length===0){html='<tr class="empty"><td colspan="6" style="text-align:center;padding:36px;color:#bbb">暂无数据</td></tr>'}
rows.forEach(function(r){
var stBadge=r.Status=='1'?'<span class="badge badge-success">启用</span>':'<span class="badge badge-muted">禁用</span>';
html+='<tr>'+
'<td>'+r.ProductCode+'</td>'+
'<td>'+r.BOMVersion+'</td>'+
'<td>'+r.ProductName+'</td>'+
'<td>'+stBadge+'</td>'+
'<td><span class="expand-btn" onclick="openDetail(\''+r.ProductCode+'\',\''+r.BOMVersion+'\')">查看BOM</span></td>'+
'<td style="white-space:nowrap">'+
'<button class="btn btn-primary" style="height:26px;padding:0 10px;font-size:11px" onclick="openEdit('+r.Id+')">编辑</button> '+
'<button class="btn btn-red" style="height:26px;padding:0 10px;font-size:11px" onclick="delBom('+r.Id+')">删除</button>'+
'</td></tr>';
});
document.getElementById('tbodyList').innerHTML=html;
});
}
function resetSearch(){document.getElementById('txtKeyword').value='';document.getElementById('selStatus').value='-1';loadList()}
function openAddModal(){
curId=0;
document.getElementById('modalTitle').textContent='新增产品';
document.getElementById('fProductCode').value='';
document.getElementById('fBOMVersion').value='';
document.getElementById('fProductName').value='';
document.getElementById('fStatus').value='1';
document.getElementById('editModal').classList.add('show');
}
function openEdit(id){
api(getApiUrl()+'GetBomMasterList?keyword=&status=-1','GET',null,function(res){
var list=res.data||[];
var r=list.find(function(x){return x.Id==id});
if(!r){toast('未找到记录','error');return}
curId=id;
document.getElementById('modalTitle').textContent='编辑产品';
document.getElementById('fProductCode').value=r.ProductCode;
document.getElementById('fBOMVersion').value=r.BOMVersion;
document.getElementById('fProductName').value=r.ProductName;
document.getElementById('fStatus').value=r.Status||'1';
document.getElementById('editModal').classList.add('show');
});
}
function saveBom(){
var data={
Id:curId,
ProductCode:document.getElementById('fProductCode').value.trim(),
BOMVersion:document.getElementById('fBOMVersion').value.trim(),
ProductName:document.getElementById('fProductName').value.trim(),
Status:document.getElementById('fStatus').value
};
if(!data.ProductCode){toast('请填写产品编码','error');return}
if(!data.BOMVersion){toast('请填写BOM版本','error');return}
api(getApiUrl()+'SaveBomMaster','POST',data,function(res){
if(res.success){toast('保存成功','success');closeModal('editModal');loadList()}
});
}
function delBom(id){
if(!confirm('确认删除该产品?其BOM明细将一并删除'))return;
api(getApiUrl()+'DeleteBomMaster','POST',{Id:id},function(res){
if(res.success){toast('删除成功','success');loadList()}
});
}
function openDetail(productCode,bomVersion){
curProductCode=productCode;
document.getElementById('detailTitle').textContent='BOM明细 - '+productCode+' ('+bomVersion+')';
document.getElementById('detailModal').classList.add('show');
loadDetail();
}
function loadDetail(){
api(getApiUrl()+'GetBomDetail?productCode='+encodeURIComponent(curProductCode),'GET',null,function(res){
var rows=res.data||[];
document.getElementById('detailCount').textContent='共 '+rows.length+' 条';
var html='';
if(rows.length===0)html='<tr><td colspan="7" style="text-align:center;padding:36px;color:#bbb">暂无明细,请点击"从金蝶同步展开BOM"</td></tr>';
rows.forEach(function(r){
html+='<tr><td>L'+r.Level+'</td><td>'+r.ParentMaterialId+'</td><td>'+r.ChildMaterialId+'</td><td>'+r.MaterialName+'</td><td>'+r.Spec+'</td><td>'+r.Unit+'</td><td>'+r.UsageQty+'</td></tr>';
});
document.getElementById('tbodyDetail').innerHTML=html;
});
}
function expandBom(){
var p=prompt('请输入要展开的产品编码(如 KHT10):',curProductCode);
if(!p)return;
curProductCode=p.trim();
api(getApiUrl()+'ExpandBom','POST',{ProductCode:curProductCode,BOMVersion:''},function(res){
if(res.success){toast(res.message,'success');document.getElementById('detailTitle').textContent='BOM明细 - '+curProductCode;loadDetail()}
});
}
function closeModal(id){document.getElementById(id).classList.remove('show')}
loadList();
</script>
<!-- 公共导航栏组件(菜单维护点:View/common/nav.js) -->
<script src="../common/nav.js"></script>
</body>
</html>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,178 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gaussian 首页</title>
<link rel="stylesheet" href="View/common/nav.css">
<style>
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{
font-family:'Microsoft YaHei','PingFang SC','Segoe UI',sans-serif;
/* 干净的浅灰蓝渐变背景,替代原 IDC 机房图 */
background:linear-gradient(135deg,#eef3fb 0%,#e4eaf4 45%,#dbe4f0 100%);
color:#2c3e50;
min-height:100vh;
}
/* 顶部欢迎横幅 */
.main-content{min-height:100vh;padding:26px 30px 40px}
.hero{
max-width:1280px;margin:0 auto 26px;
background:linear-gradient(135deg,#1a56db 0%,#2563eb 55%,#3b82f6 100%);
color:#fff;border-radius:18px;padding:30px 34px;
box-shadow:0 14px 40px rgba(37,99,235,.30);
display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:18px;
}
.hero .greeting h1{font-size:28px;font-weight:700;letter-spacing:.5px;margin-bottom:6px}
.hero .greeting .sub{font-size:14px;opacity:.88}
.hero .greeting .user-line{font-size:13px;opacity:.92;margin-top:10px}
.hero .date-badge{
background:rgba(255,255,255,.16);backdrop-filter:blur(6px);
border:1px solid rgba(255,255,255,.28);border-radius:14px;
padding:18px 24px;text-align:center;min-width:150px;
}
.hero .date-badge .day{font-size:30px;font-weight:700;line-height:1.1}
.hero .date-badge .wd{font-size:13px;opacity:.9;margin-top:2px}
.hero .date-badge .yr{font-size:12px;opacity:.75}
/* 分组标题条 */
.home-group-title{
max-width:1280px;margin:0 auto 14px;
background:#fff;border-radius:12px;padding:13px 20px;
font-size:15px;font-weight:700;color:#1a3a6b;
box-shadow:0 2px 10px rgba(0,0,0,.05);
display:flex;align-items:center;gap:10px;
border-left:4px solid #2563eb;
}
.home-group-title .gicon{font-size:18px}
/* 卡片网格 */
.home-grid{
max-width:1280px;margin:0 auto 26px;
display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:16px;
}
.home-card{
background:#fff;border-radius:14px;padding:22px 20px;
text-decoration:none;color:#2c3e50;
display:flex;flex-direction:column;gap:10px;
transition:transform .18s,box-shadow .18s,border-color .18s;
border:1px solid #e8eef7;
box-shadow:0 2px 10px rgba(0,0,0,.04);
position:relative;overflow:hidden;
}
.home-card::before{
content:'';position:absolute;top:0;left:0;bottom:0;width:4px;
background:linear-gradient(180deg,#2563eb,#3b82f6);
transform:scaleY(0);transform-origin:top;transition:transform .2s;
}
.home-card:hover{transform:translateY(-4px);box-shadow:0 12px 30px rgba(37,99,235,.20);border-color:#c7dcff}
.home-card:hover::before{transform:scaleY(1)}
.home-card .icon{
width:46px;height:46px;border-radius:12px;
background:linear-gradient(135deg,#eef3ff,#e8f0fe);
display:flex;align-items:center;justify-content:center;
font-size:24px;
}
.home-card .title{font-size:15px;font-weight:700;color:#1a3a6b}
.home-card .desc{font-size:12px;color:#8a93a6;line-height:1.5}
.home-card .arrow{font-size:12px;color:#2563eb;margin-top:auto;opacity:0;transition:opacity .2s,transform .2s}
.home-card:hover .arrow{opacity:1;transform:translateX(3px)}
/* 空状态 */
.home-empty{
max-width:1280px;margin:30px auto 0;
background:#fff;border-radius:12px;padding:40px;text-align:center;color:#999;
box-shadow:0 2px 10px rgba(0,0,0,.04);
}
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="hero">
<div class="greeting">
<h1>欢迎回来</h1>
<div class="sub">Gaussian IT 管理系统 · 工作台</div>
<div class="user-line" id="userLine"></div>
</div>
<div class="date-badge">
<div class="day" id="heroDay">--</div>
<div class="wd" id="heroWd">--</div>
<div class="yr" id="heroYr">--</div>
</div>
</div>
<div id="homeGroups"></div>
</div>
<script src="View/common/nav.js"></script>
<script>
// 读取当前登录用户,未登录跳回登录页
var user = getLoginUser();
if (!user) { window.location.href = 'login.html'; }
(function () {
var line = document.getElementById('userLine');
if (line && user) {
var name = user.userName || user.userId || user.name || '未知';
line.textContent = '当前用户:' + name + ' 登录时间:' + new Date().toLocaleString();
}
// 右上日期徽章
var d = new Date();
var dayMap = ['日','一','二','三','四','五','六'];
var dd = document.getElementById('heroDay');
var dw = document.getElementById('heroWd');
var dy = document.getElementById('heroYr');
if (dd) dd.textContent = d.getDate();
if (dw) dw.textContent = '周' + dayMap[d.getDay()];
if (dy) dy.textContent = d.getFullYear() + '年' + (d.getMonth()+1) + '月';
})();
// 依据 MENU_GROUPS 渲染功能入口卡片(按角色权限过滤,递归收集所有叶子项)
function collectLeafItems(items, out) {
for (var i = 0; i < items.length; i++) {
var it = items[i];
if (!hasRole(it.role)) continue;
if (it.children && it.children.length) {
// 子分组:继续递归收集,不作为卡片
collectLeafItems(it.children, out);
} else if (it.href) {
out.push(it);
}
}
}
function renderHome() {
var wrap = document.getElementById('homeGroups');
if (!wrap) return;
var html = '';
var shown = 0;
for (var i = 0; i < MENU_GROUPS.length; i++) {
var g = MENU_GROUPS[i];
// 首页入口在首页本身不展示
if (g.hideOnHome) continue;
var items = [];
if (g.children && g.children.length) {
collectLeafItems(g.children, items);
} else {
if (hasRole(g.role)) items.push({ title: g.title, href: g.href, icon: g.icon });
}
if (items.length === 0) continue;
shown += items.length;
html += '<div class="home-group-title"><span class="gicon">' + (g.icon || '📁') + '</span>' + g.title + '</div>';
html += '<div class="home-grid">';
for (var j = 0; j < items.length; j++) {
html += '<a class="home-card" href="' + APP_BASE + items[j].href + '">'
+ '<div class="icon">' + (items[j].icon || '📄') + '</div>'
+ '<div class="title">' + items[j].title + '</div>'
+ '<div class="desc">点击进入</div>'
+ '<div class="arrow">→</div>'
+ '</a>';
}
html += '</div>';
}
if (shown === 0) html = '<div class="home-empty">当前账号暂无可用的功能入口</div>';
wrap.innerHTML = html;
}
renderHome();
</script>
</body>
</html>
@@ -0,0 +1,634 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购申请单详情 - 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;transition:.2s}
.top-bar .back:hover{background:rgba(255,255,255,.15);color:#fff}
.top-bar .title{font-size:15px;font-weight:600;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.main-container{max-width:1500px;margin:0 auto;padding:12px 16px}
/* ===== 主信息栏 ===== */
.master-bar{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:12px 16px;margin-bottom:10px;display:flex;flex-wrap:wrap;gap:6px 24px;font-size:13px}
.master-bar .item{display:flex;gap:4px}
.master-bar .item .lbl{color:#999}
.master-bar .item .val{color:#333;font-weight:500}
/* ===== Tabs ===== */
.tabs{border-bottom:2px solid #e0e0e0;display:flex;gap:2px;margin-bottom:10px;background:#fff;border-radius:8px 8px 0 0;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:0 12px}
.tabs .tab{padding:10px 18px;font-size:13px;color:#888;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:.2s;white-space:nowrap}
.tabs .tab:hover{color:#1a73e8}
.tabs .tab.active{color:#1a73e8;border-bottom-color:#1a73e8;font-weight:600}
.tab-content{display:none;background:#fff;border-radius:0 0 8px 8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:hidden}
.tab-content.active{display:block}
/* ===== 表格通用 ===== */
.table-wrap{overflow:auto;max-height:calc(100vh - 260px)}
table{min-width:100%;border-collapse:collapse;font-size:12px}
/* ===== 可拖动列 ===== */
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:7px 6px;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;overflow:hidden}
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:5px 6px;border:1px solid #ddd;color:#333;overflow:hidden;text-overflow:ellipsis}
tbody tr:hover{background:#f0f6ff}
.empty td{text-align:center;padding:32px;color:#bbb}
/* ===== 其他表格默认宽度 ===== */
.link-table th:nth-child(1){min-width:160px;width:160px}
.link-table th:nth-child(2){min-width:120px;width:120px}
.link-table th:nth-child(3){min-width:100px;width:100px}
.link-table th:nth-child(4){min-width:200px;width:200px}
.summary-table th:nth-child(1){min-width:48px;width:48px}
.summary-table th:nth-child(2){min-width:120px;width:120px}
.summary-table th:nth-child(3){min-width:150px;width:150px}
.summary-table th:nth-child(4){min-width:80px;width:80px}
.summary-table th:nth-child(5){min-width:80px;width:80px}
.summary-table th:nth-child(6){min-width:80px;width:80px}
.summary-table th:nth-child(7){min-width:110px;width:110px}
.summary-table th:nth-child(8){min-width:80px;width:80px}
.summary-table th:nth-child(9){min-width:130px;width:130px}
.summary-table th:nth-child(10){min-width:120px;width:120px}
/* ===== 维护表格 ===== */
.maint-table td,.maint-table th{padding:4px 5px;font-size:12px;overflow:hidden;text-overflow:ellipsis;border:1px solid #ddd}
.maint-table input,.maint-table select{width:100%;height:26px;padding:0 5px;border:1px solid #ddd;border-radius:3px;font-size:11px;outline:0;min-width:40px}
.maint-table input:focus,.maint-table select:focus{border-color:#1a73e8;box-shadow:0 0 0 2px rgba(26,115,232,.1)}
.maint-table input[type=number]{text-align:right}
.maint-table .fixed-col{min-width:48px;width:48px}
.maint-table .mat-code{min-width:110px}
.maint-table .mat-name{min-width:100px}
.maint-table .mat-spec{min-width:100px;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.maint-table .col-supplier{min-width:200px;width:200px}
.maint-table .col-dhrq{min-width:100px;width:100px}
.maint-table .col-ywzt{min-width:180px;width:180px}
.maint-table .col-jffxdj{min-width:120px;width:120px}
.maint-table .col-jfjz{min-width:120px;width:120px}
.maint-table .col-date{min-width:110px;width:110px}
.maint-table .col-price{min-width:120px;width:120px}
.maint-table thead th{white-space:nowrap;border-color:#999;border-bottom-width:2px}
.maint-toolbar{display:flex;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid #f0f0f0;}
.maint-toolbar .count{font-size:13px;color:#666}
.save-btn{height:28px;padding:0 16px;border:0;border-radius:4px;background:linear-gradient(135deg,#1a73e8,#1557b0);color:#fff;font-size:12px;font-weight:600;cursor:pointer;transition:.2s;margin-left:auto}
.save-btn:hover{opacity:.9}
.save-btn:disabled{opacity:.5;cursor:default}
.maint-toolbar .filter-group{display:flex;align-items:center;gap:6px;font-size:12px;color:#555}
.maint-toolbar .filter-group label{font-weight:600;white-space:nowrap}
.maint-toolbar select,.maint-toolbar input{height:28px;border:1px solid #ddd;border-radius:4px;font-size:12px;outline:0;padding:0 8px;transition:border-color .2s}
.maint-toolbar select:focus,.maint-toolbar input:focus{border-color:#1a73e8}
.maint-toolbar .copy-btn{height:28px;padding:0 16px;border:0;border-radius:4px;background:linear-gradient(135deg,#34a853,#1e8e3e);color:#fff;font-size:12px;font-weight:600;cursor:pointer;transition:.2s}
.maint-toolbar .copy-btn:hover{opacity:.9}
.maint-toolbar .qry-btn{height:28px;padding:0 14px;border:0;border-radius:4px;background:linear-gradient(135deg,#1a73e8,#1557b0);color:#fff;font-size:12px;cursor:pointer;transition:.2s}
.maint-toolbar .qry-btn:hover{opacity:.9}
.maint-toolbar .save-btn{margin-left:auto}
.maint-toolbar .count strong{color:#1a73e8}
.maint-toolbar .filter-count{font-size:12px;color:#e67e22;font-weight:600}
/* ===== 联动表格 ===== */
.link-table td{padding:5px 6px;border:1px solid #ddd}
.link-table .oa-ref{display:inline-block;padding:1px 6px;border-radius:3px;background:#e8f0fe;color:#1a73e8;font-weight:600;font-size:11px;margin-right:4px}
.link-table .oa-ref:hover{background:#d2e3fc}
/* ===== 汇总表 ===== */
.summary-table td{padding:6px 8px;border:1px solid #ddd}
.status-badge{display:inline-block;padding:1px 8px;border-radius:10px;font-size:11px;font-weight:600}
.status-badge.completed{background:#e6f9ed;color:#1a7a3a}
.status-badge.partial{background:#fff8e1;color:#e67e22}
.status-badge.pending{background:#f0f0f0;color:#999}
/* ===== 加载/通知 ===== */
.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}
.loading-spinner{width:32px;height:32px;border:3px solid #e0e0e0;border-top-color:#1a73e8;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
.toast.info{background:#e3f2fd;color:#1565c0;display:block}
</style>
</head>
<body>
<div class="loading-overlay" id="loadingOverlay"><div class="loading-spinner"></div></div>
<div class="toast" id="toast"></div>
<div class="top-bar">
<a class="back" href="procurement.html">← 返回列表</a>
<span class="title" id="pageTitle">采购申请单详情</span>
<span class="user-info" id="userInfo" style="margin-left:auto;font-size:12px;opacity:.85;"></span>
</div>
<div class="main-container">
<div class="master-bar" id="masterBar"></div>
<div class="tabs">
<div class="tab active" data-tab="maintain" onclick="switchTab(this)">物料维护</div>
<div class="tab" data-tab="po" onclick="switchTab(this)">采购订单</div>
<div class="tab" data-tab="rn" onclick="switchTab(this)">收料通知</div>
<div class="tab" data-tab="summary" onclick="switchTab(this)">收货汇总</div>
</div>
<!-- 物料维护 Tab -->
<div class="tab-content active" id="tabMaintain">
<div id="maintContainer"></div>
</div>
<!-- 采购订单 Tab -->
<div class="tab-content" id="tabPo">
<div class="table-wrap"><table class="link-table">
<thead><tr><th>采购订单号<span class="resizer"></span></th><th>单据日期<span class="resizer"></span></th><th>转单时效(天)<span class="resizer"></span></th><th>对应申请单物料(行号)<span class="resizer"></span></th></tr></thead>
<tbody id="poBody"><tr class="empty"><td colspan="3">加载中...</td></tr></tbody>
</table></div>
</div>
<!-- 收料通知 Tab -->
<div class="tab-content" id="tabRn">
<div class="table-wrap"><table class="link-table">
<thead><tr><th>通知单号<span class="resizer"></span></th><th>单据日期<span class="resizer"></span></th><th>对应申请单物料(行号)<span class="resizer"></span></th></tr></thead>
<tbody id="rnBody"><tr class="empty"><td colspan="3">加载中...</td></tr></tbody>
</table></div>
</div>
<!-- 收货汇总 Tab -->
<div class="tab-content" id="tabSummary">
<div class="table-wrap"><table class="summary-table">
<thead><tr><th>行号<span class="resizer"></span></th><th>物料编码<span class="resizer"></span></th><th>物料名称<span class="resizer"></span></th><th>申请数量<span class="resizer"></span></th><th>已收数量<span class="resizer"></span></th><th>剩余数量<span class="resizer"></span></th><th>最近到货日期<span class="resizer"></span></th><th>状态<span class="resizer"></span></th><th>项目目标交付延期<span class="resizer"></span></th><th>标准交付延期<span class="resizer"></span></th></tr></thead>
<tbody id="summaryBody"><tr class="empty"><td colspan="8">加载中...</td></tr></tbody>
</table></div>
</div>
</div>
<script>
// ===== 业务状态映射 =====
function logout(){sessionStorage.removeItem('gx_user');window.location.href='login.html'}
var ywztMap={'1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回(无图纸/方案没确认)','7':'研发-采购申请撤回(改需求)','8':'研发-采购申请取消','9':'研发-量产复用件'};
var jffxdjMap={'1':'超高','2':'高','3':'中','4':'低','5':'已完成','6':'取消'};
var jfjzMap={'1':'整批交付','2':'分批交付','3':'取消'};
// ===== URL参数 =====
function getParams(){
var p={};location.search.substr(1).split('&').forEach(function(s){var kv=s.split('=');if(kv[0])p[decodeURIComponent(kv[0])]=decodeURIComponent(kv[1]||'')});
return p;
}
var params=getParams();
var lcbh=params.lcbh||'',djbh=params.djbh||'',requestId=params.requestId||'';
// ===== 工具 =====
function escapeHtml(s){if(!s)return '';var d=document.createElement('div');d.appendChild(document.createTextNode(String(s)));return d.innerHTML}
function showLoading(){document.getElementById('loadingOverlay').classList.add('show')}
function hideLoading(){document.getElementById('loadingOverlay').classList.remove('show')}
function showToast(msg,type){
var el=document.getElementById('toast');
el.textContent=msg;el.className='toast '+type;
clearTimeout(el._timer);el._timer=setTimeout(function(){el.className='toast'},3500);
}
// ===== 初始化主信息 =====
document.getElementById('pageTitle').textContent='流程编号:'+lcbh;
document.getElementById('masterBar').innerHTML=
'<div class="item"><span class="lbl">流程编号:</span><span class="val">'+escapeHtml(lcbh)+'</span></div>'+
'<div class="item"><span class="lbl">单据编号:</span><span class="val">'+escapeHtml(params.djbh||'')+'</span></div>'+
'<div class="item"><span class="lbl">申请日期:</span><span class="val">'+escapeHtml(params.sqrq||'')+'</span></div>'+
'<div class="item"><span class="lbl">研发项目:</span><span class="val">'+escapeHtml(params.yfxmmc||'')+'</span></div>'+
'<div class="item"><span class="lbl">专项名称:</span><span class="val">'+escapeHtml(params.reqName||'')+'</span></div>'+
'<div class="item"><span class="lbl">申请人:</span><span class="val">'+escapeHtml(params.sqrxm||'')+'</span></div>'+
'<div class="item"><span class="lbl">项目经理审批:</span><span class="val">'+escapeHtml(params.pmTime||'')+'</span></div>';
// ===== Tab切换 =====
function switchTab(el){
document.querySelectorAll('.tabs .tab').forEach(function(t){t.classList.remove('active')});
el.classList.add('active');
var tab=el.getAttribute('data-tab');
document.querySelectorAll('.tab-content').forEach(function(c){c.classList.remove('active')});
document.getElementById('tab'+tab.charAt(0).toUpperCase()+tab.slice(1)).classList.add('active');
}
// ===== 加载数据 =====
var detailItems=[];
var trace={summary:[],receiveNotices:[],traceDetails:[],purchaseOrders:[]};
var poList=[];
function loadAll(){
showLoading();
var done=0;
function checkDone(){
done++;
if(done>=3){hideLoading();renderMaintain();renderPO();renderRN();renderSummary();}
}
// 加载物料明细
var x1=new XMLHttpRequest();
x1.open('GET','api/Procurement/GetRequestDetail?requestId='+encodeURIComponent(requestId||lcbh),true);
x1.onload=function(){
try{var r=JSON.parse(x1.responseText);if(r.success)detailItems=r.data||[]}catch(e){}
checkDone();
};
x1.onerror=function(){checkDone()};
x1.send();
// 加载追溯汇总
var x2=new XMLHttpRequest();
x2.open('GET','api/Procurement/GetTraceSummary?reqBillNo='+encodeURIComponent(djbh),true);
x2.onload=function(){
try{var r=JSON.parse(x2.responseText);if(r.success){trace.summary=r.summary||[];trace.receiveNotices=r.receiveNotices||[];trace.traceDetails=r.traceDetails||[];trace.purchaseOrders=r.purchaseOrders||[]}}catch(e){}
checkDone();
};
x2.onerror=function(){checkDone()};
x2.send();
// 加载采购订单(含转单时效)
var x3=new XMLHttpRequest();
x3.open('GET','api/Procurement/GetPurchaseOrders?reqBillNo='+encodeURIComponent(djbh)+'&pmAuditTime='+encodeURIComponent(params.pmTime||''),true);
x3.onload=function(){
try{var r=JSON.parse(x3.responseText);if(r.success)poList=r.data||[]}catch(e){}
checkDone();
};
x3.onerror=function(){checkDone()};
x3.send();
}
// ===== 渲染物料维护表格 =====
var maintainFilter={gys:{type:'all',val:''},cncgfzr:{type:'all',val:''}};
// 判断记录是否通过某个筛选(type/val/field 取值函数)
function passFilter(item,f){
var fType=f.type||'all',fVal=(f.val||'').trim();
var v=f.get?f.get(item):item[f.field];
if(fType==='empty')return !v||!String(v).trim();
if(fType==='notEmpty')return v&&String(v).trim();
if(fType==='value'&&fVal)return v&&String(v).indexOf(fVal)>=0;
return true;
}
function applyMaintainFilter(){
var gysType=document.getElementById('maintGysType')?.value||'all';
var cgType=document.getElementById('maintCgType')?.value||'all';
maintainFilter.gys.type=gysType;maintainFilter.gys.val='';
maintainFilter.cncgfzr.type=cgType;maintainFilter.cncgfzr.val='';
// 指定值模式下显示输入框和查询按钮
['gys','cg'].forEach(function(p){
var valEl=document.getElementById('maint'+p.toUpperCase().slice(0,1)+'ysVal'); // maintGysVal / maintCysVal
var btnEl=document.getElementById('maint'+p.toUpperCase().slice(0,1)+'ysBtn');
var type=(p==='gys'?gysType:cgType);
if(valEl)valEl.style.display=(type==='value'?'':'none');
if(btnEl)btnEl.style.display=(type==='value'?'':'none');
});
renderMaintain();
}
function queryGysFilter(){
maintainFilter.gys.val=(document.getElementById('maintGysVal')?.value||'').trim();
renderMaintain();
}
function queryCgFilter(){
maintainFilter.cncgfzr.val=(document.getElementById('maintCysVal')?.value||'').trim();
renderMaintain();
}
function copyMatCodes(){
// 按当前筛选条件取物料编码列(不受分页影响,遍历全量 detailItems)
var rows=detailItems.filter(function(it){
return passFilter(it,Object.assign({field:'gys'},maintainFilter.gys))
&& passFilter(it,Object.assign({field:'cncgfzr'},maintainFilter.cncgfzr));
});
var codes=rows.map(function(it){return String(it.wlbmCode||'')}).filter(function(c){return c!==''});
if(!codes.length){showToast('没有可复制的物料编码','error');return}
var text=codes.join('\n');
var done=function(){showToast('已复制 '+codes.length+' 条物料编码','success')};
if(navigator.clipboard&&navigator.clipboard.writeText){
navigator.clipboard.writeText(text).then(done).catch(function(){fallbackCopy(text);done()});
}else{
fallbackCopy(text);done();
}
}
function fallbackCopy(text){
var ta=document.createElement('textarea');
ta.value=text;ta.style.position='fixed';ta.style.opacity='0';
document.body.appendChild(ta);ta.select();
try{document.execCommand('copy')}catch(e){}
document.body.removeChild(ta);
}
function renderMaintain(){
var container=document.getElementById('maintContainer');
if(!detailItems||!detailItems.length){
container.innerHTML='<div style="padding:32px;text-align:center;color:#bbb">暂无物料明细</div>';
return;
}
var sumOne=0,sumTwo=0;
detailItems.forEach(function(item){sumOne+=parseFloat(item.onezje)||0;sumTwo+=parseFloat(item.twozje)||0});
// 前端筛选(不调后端):供应商 + 策略采购负责人 组合过滤
var filtered=detailItems.filter(function(it){
return passFilter(it,Object.assign({field:'gys'},maintainFilter.gys))
&& passFilter(it,Object.assign({field:'cncgfzr'},maintainFilter.cncgfzr));
});
var h='<div class="maint-toolbar">';
h+='<span class="count">共 <strong>'+detailItems.length+'</strong> 行物料明细</span>';
h+='<span style="margin-left:16px;font-size:12px;color:#1a73e8;font-weight:600">第一轮总金额合计: <span id="sumOneVal">'+sumOne.toFixed(2)+'</span> | 第二轮总金额合计: <span id="sumTwoVal">'+sumTwo.toFixed(2)+'</span></span>';
h+='</div>';
var gysF=maintainFilter.gys||{type:'all',val:''},cgF=maintainFilter.cncgfzr||{type:'all',val:''};
var gysType=gysF.type||'all',gysVal=(gysF.val||'').trim(),cgType=cgF.type||'all',cgVal=(cgF.val||'').trim();
function mkFilterSel(id,type,curType){
var opts=['all','empty','notEmpty','value'];
var labels={all:'全部',empty:'为空',notEmpty:'不为空',value:'指定值'};
var s='<select id="'+id+'" onchange="applyMaintainFilter()">';
opts.forEach(function(o){s+='<option value="'+o+'" '+(curType===o?'selected':'')+'>'+labels[o]+'</option>'});
return s+'</select>';
}
h+='<div class="maint-toolbar" style="border-bottom:0;padding-top:4px">';
h+='<button class="copy-btn" onclick="copyMatCodes()">块复制物料编码</button>';
h+='<span class="filter-group" style="margin-left:14px"><label>供应商:</label>';
h+=mkFilterSel('maintGysType','gys',gysType);
h+='<input type="text" id="maintGysVal" placeholder="输入供应商名称" value="'+escapeHtml(gysVal)+'" style="display:'+(gysType==='value'?'':'none')+';width:150px" />';
h+='<button id="maintGysBtn" class="qry-btn" style="display:'+(gysType==='value'?'':'none')+'" onclick="queryGysFilter()">查询</button>';
h+='</span>';
h+='<span class="filter-group" style="margin-left:14px"><label>策略采购负责人:</label>';
h+=mkFilterSel('maintCgType','cg',cgType);
h+='<input type="text" id="maintCysVal" placeholder="输入策略采购负责人" value="'+escapeHtml(cgVal)+'" style="display:'+(cgType==='value'?'':'none')+';width:150px" />';
h+='<button id="maintCysBtn" class="qry-btn" style="display:'+(cgType==='value'?'':'none')+'" onclick="queryCgFilter()">查询</button>';
h+='</span>';
if(gysType!=='all'||cgType!=='all')h+='<span class="filter-count">筛选出 '+filtered.length+' 行</span>';
h+='<button class="save-btn" onclick="saveMaintain()">保存维护</button>';
h+='</div>';
h+='<div class="table-wrap"><table class="maint-table">';
var ths=[
{text:'#',cls:'fixed-col'},
{text:'物料编码',cls:'mat-code'},
{text:'物料名称',cls:'mat-name'},
{text:'规格型号',cls:'mat-spec'},
{text:'数量',cls:'fixed-col'},
{text:'要求交付日期',cls:'col-dhrq'},
{text:'物料标准L/T',cls:''},
{text:'第一轮报价',cls:'col-price'},{text:'第一轮总金额',cls:'col-price'},{text:'第二轮报价',cls:'col-price'},{text:'第二轮总金额',cls:'col-price'},
{text:'供应商',cls:'col-supplier'},
{text:'策略采购负责人',cls:''},{text:'研发采购负责人',cls:''},
{text:'业务状态',cls:'col-ywzt'},
{text:'交付风险',cls:'col-jffxdj'},
{text:'交付节奏',cls:'col-jfjz'},
{text:'计划交付日期(策略采购)',cls:'col-date'},
{text:'计划交付日期(研发采购)',cls:'col-date'}
];
h+='<thead><tr>';
ths.forEach(function(t){h+='<th class="'+t.cls+'">'+t.text+'<span class="resizer"></span></th>'});
h+='</tr></thead><tbody>';
if(!filtered.length){
h+='<tr><td colspan="19" style="text-align:center;padding:32px;color:#bbb">筛选结果为空</td></tr>';
}
filtered.forEach(function(item,idx){
h+='<tr>'+
'<td>'+escapeHtml(item.xh)+'</td>'+
'<td>'+escapeHtml(item.wlbmCode)+'</td>'+
'<td class="mat-name" title="'+escapeHtml(item.wlmc)+'">'+escapeHtml(item.wlmc)+'</td>'+
'<td class="mat-spec" title="'+escapeHtml(item.wlgg)+'">'+escapeHtml(item.wlgg)+'</td>'+
'<td>'+escapeHtml(item.sqsl)+'</td>'+
'<td>'+escapeHtml(item.dhrq)+'</td>'+
'<td><input class="f-wlbz" value="'+escapeHtml(item.wlbz)+'" /></td>'+
'<td class="td-sqsl" data-sqsl="'+escapeHtml(item.sqsl)+'"><input type="number" step="0.01" class="f-onebj" value="'+escapeHtml(item.onebj)+'" /></td>'+
'<td><input type="number" step="0.01" class="f-onezje" value="'+escapeHtml(item.onezje)+'" readonly style="background:#f5f5f5;cursor:default" /></td>'+
'<td><input type="number" step="0.01" class="f-twobj" value="'+escapeHtml(item.twobj)+'" /></td>'+
'<td><input type="number" step="0.01" class="f-twozje" value="'+escapeHtml(item.twozje)+'" readonly style="background:#f5f5f5;cursor:default" /></td>'+
'<td><input class="f-gys" value="'+escapeHtml(item.gys)+'" /></td>'+
'<td><input class="f-cncgfzr" value="'+escapeHtml(item.cncgfzr)+'" /></td>'+
'<td><input class="f-yfcgfzr" value="'+escapeHtml(item.yfcgfzr)+'" /></td>'+
'<td><select class="f-ywzt">'+optHtml(ywztMap,item.ywzt)+'</select></td>'+
'<td><select class="f-jffxdj">'+optHtml(jffxdjMap,item.jffxdj)+'</select></td>'+
'<td><select class="f-jfjz">'+optHtml(jfjzMap,item.jfjz)+'</select></td>'+
'<td><input type="date" class="f-cnjhjfrq" value="'+escapeHtml(item.cnjhjfrq)+'" /></td>'+
'<td><input type="date" class="f-yfjhjfrq" value="'+escapeHtml(item.yfjhjfrq)+'" /></td>'+
'</tr>';
});
h+='</tbody></table></div>';
container.innerHTML=h;
// 重新绑定自动计算(筛选后 DOM 重建也需要绑定)
bindAutoCalc();
}
function optHtml(map,selected){var h='<option value="">--</option>';for(var k in map)h+='<option value="'+k+'" '+(selected===k?'selected':'')+'>'+map[k]+'</option>';return h}
// ===== 自动计算总金额 =====
function bindAutoCalc(){
document.querySelectorAll('.maint-table tbody tr').forEach(function(row){
var sqsl=parseFloat(row.querySelector('.td-sqsl')?.getAttribute('data-sqsl'))||0;
var onebj=row.querySelector('.f-onebj'),onezje=row.querySelector('.f-onezje');
var twobj=row.querySelector('.f-twobj'),twozje=row.querySelector('.f-twozje');
onebj.addEventListener('input',function(){onezje.value=(parseFloat(this.value)||0)*sqsl;updateSummaryTotals()});
twobj.addEventListener('input',function(){twozje.value=(parseFloat(this.value)||0)*sqsl;updateSummaryTotals()});
});
}
function updateSummaryTotals(){
var s1=0,s2=0;
document.querySelectorAll('.maint-table tbody tr').forEach(function(row){
s1+=parseFloat(row.querySelector('.f-onezje')?.value)||0;
s2+=parseFloat(row.querySelector('.f-twozje')?.value)||0;
});
var el1=document.getElementById('sumOneVal'),el2=document.getElementById('sumTwoVal');
if(el1)el1.textContent=s1.toFixed(2);
if(el2)el2.textContent=s2.toFixed(2);
}
// ===== 保存维护 =====
function saveMaintain(){
var items=[];
var rows=document.querySelectorAll('.maint-table tbody tr');
if(!rows||!rows.length)return;
rows.forEach(function(row,idx){
var item=detailItems[idx];
if(!item)return;
items.push({
id:item.id,
wlbz:row.querySelector('.f-wlbz').value,
onebj:row.querySelector('.f-onebj').value||'0',
onezje:row.querySelector('.f-onezje').value||'0',
twobj:row.querySelector('.f-twobj').value||'0',
twozje:row.querySelector('.f-twozje').value||'0',
gys:row.querySelector('.f-gys').value,
cncgfzr:row.querySelector('.f-cncgfzr').value,
yfcgfzr:row.querySelector('.f-yfcgfzr').value,
ywzt:row.querySelector('.f-ywzt').value||'0',
jffxdj:row.querySelector('.f-jffxdj').value||'0',
jfjz:row.querySelector('.f-jfjz').value||'0',
cnjhjfrq:row.querySelector('.f-cnjhjfrq').value,
yfjhjfrq:row.querySelector('.f-yfjhjfrq').value
});
});
showLoading();
var btn=document.querySelector('.save-btn');
btn.disabled=true;btn.textContent='保存中...';
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/SaveDetail',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();btn.disabled=false;btn.textContent='保存维护';
try{var r=JSON.parse(xhr.responseText);showToast(r.success?'保存成功':r.message||'保存失败',r.success?'success':'error')}catch(e){showToast('响应异常','error')}
};
xhr.onerror=function(){hideLoading();btn.disabled=false;btn.textContent='保存维护';showToast('网络请求失败','error')};
xhr.send(JSON.stringify({items:items}));
}
// ===== 渲染追溯关联数据 =====
function renderTrace(){
renderPO();
renderRN();
renderSummary();
}
// ---- 采购订单(关联物料行号+转单时效) ----
function renderPO(){
var tbody=document.getElementById('poBody');
var details=trace.traceDetails||[];
// 建立PO号→transferDays映射
var transferMap={};
var poDateMap={};
poList.forEach(function(po){
if(po.FBILLNO){transferMap[po.FBILLNO]=po.transferDays;poDateMap[po.FBILLNO]=po.FDATE}
});
// 按PO分组
var poMap={};
details.forEach(function(d){
var key=d.poBillNo;
if(!key)return;
if(!poMap[key])poMap[key]={billNo:key,date:'',transferDays:0,oaRows:[]};
// 从 poList 中取 PO 自己的单据日期
var poDate=poDateMap[key];
if(!poMap[key].date&&poDate)poMap[key].date=poDate;
var xh=d.oaXh;
if(xh&&poMap[key].oaRows.indexOf(xh)<0)poMap[key].oaRows.push(xh);
});
// 补充1:GetPurchaseOrders 直接查到的PO(追溯缺失时也能显示)
poList.forEach(function(po){
var key=po.FBILLNO;
if(!key)return;
if(!poMap[key]){
poMap[key]={billNo:key,date:po.FDATE||'',transferDays:po.transferDays||0,oaRows:[]};
}else{
if(!poMap[key].date&&po.FDATE)poMap[key].date=po.FDATE;
}
});
// 补充2:trace.purchaseOrders(GetTraceSummary 返回的PO号,追溯缺失兜底)
(trace.purchaseOrders||[]).forEach(function(billNo){
if(!billNo)return;
if(!poMap[billNo]){
poMap[billNo]={billNo:billNo,date:'',transferDays:0,oaRows:[]};
}
});
var list=Object.keys(poMap).map(function(k){return poMap[k]});
if(!list.length){
tbody.innerHTML='<tr class="empty"><td colspan="4">暂无采购订单</td></tr>';
return;
}
var h='';
list.forEach(function(item){
if(transferMap[item.billNo]!==undefined)item.transferDays=transferMap[item.billNo];
h+='<tr><td><strong>'+escapeHtml(item.billNo)+'</strong></td><td>'+escapeHtml(item.date)+'</td>';
h+='<td>'+escapeHtml(item.transferDays)+'</td>';
h+='<td>';
item.oaRows.forEach(function(xh){
h+='<span class="oa-ref" title="对应第'+xh+'行物料">第'+xh+'行</span>';
});
h+='</td></tr>';
});
tbody.innerHTML=h;
}
// ---- 收料通知(关联物料行号) ----
function renderRN(){
var tbody=document.getElementById('rnBody');
var details=trace.traceDetails||[];
// 按RN分组
var rnMap={};
details.forEach(function(d){
var key=d.rnBillNo;
if(!key)return;
if(!rnMap[key])rnMap[key]={billNo:key,date:d.rnDate||'',oaRows:[]};
var xh=d.oaXh;
if(xh&&rnMap[key].oaRows.indexOf(xh)<0)rnMap[key].oaRows.push(xh);
});
var list=Object.keys(rnMap).map(function(k){return rnMap[k]});
if(!list.length){
tbody.innerHTML='<tr class="empty"><td colspan="3">暂无收料通知</td></tr>';
return;
}
var h='';
list.forEach(function(item){
h+='<tr><td><strong>'+escapeHtml(item.billNo)+'</strong></td><td>'+escapeHtml(item.date)+'</td><td>';
item.oaRows.forEach(function(xh){
h+='<span class="oa-ref" title="对应第'+xh+'行物料">第'+xh+'行</span>';
});
h+='</td></tr>';
});
tbody.innerHTML=h;
}
// ---- 收货汇总(无规格型号+延期天数) ----
function renderSummary(){
var tbody=document.getElementById('summaryBody');
var data=trace.summary||[];
if(!data.length){
tbody.innerHTML='<tr class="empty"><td colspan="10">暂无汇总数据</td></tr>';
return;
}
var h='';
data.forEach(function(item){
var sc='pending';
if(item.status==='已完成')sc='completed';
else if(item.status==='部分收货')sc='partial';
h+='<tr>'+
'<td>'+escapeHtml(item.xh)+'</td>'+
'<td>'+escapeHtml(item.wlbmCode)+'</td>'+
'<td>'+escapeHtml(item.wlmc)+'</td>'+
'<td>'+escapeHtml(item.sqsl)+'</td>'+
'<td><strong>'+escapeHtml(item.yssl)+'</strong></td>'+
'<td>'+escapeHtml(item.syst)+'</td>'+
'<td>'+escapeHtml(item.latestReceiveDate)+'</td>'+
'<td><span class="status-badge '+sc+'">'+escapeHtml(item.status)+'</span></td>'+
'<td>'+(item.projectDelay!==undefined?item.projectDelay:0)+'</td>'+
'<td>'+(item.stdDelay!==undefined?item.stdDelay:0)+'</td>'+
'</tr>';
});
tbody.innerHTML=h;
}
// ===== 列宽拖动(事件委托,支持动态生成的表格) =====
(function(){
var resizeTarget=null,startX=0,startWidth=0,startIdx=0,startTable=null;
document.addEventListener('mousedown',function(e){
var resizer=e.target.closest('.resizer');
if(!resizer)return;
var th=resizer.parentElement;
if(!th||th.tagName!='TH')return;
resizeTarget=th;
startX=e.clientX;
startWidth=th.offsetWidth;
startTable=th.closest('table');
startIdx=Array.prototype.indexOf.call(th.parentNode.children,th);
document.body.style.cursor='col-resize';
e.preventDefault();
});
document.addEventListener('mousemove',function(e){
if(!resizeTarget)return;
var diff=e.clientX-startX;
var newWidth=Math.max(40,startWidth+diff);
resizeTarget.style.width=newWidth+'px';
resizeTarget.style.minWidth=newWidth+'px';
resizeTarget.style.maxWidth='none';
if(startTable){
startTable.querySelectorAll('tbody tr').forEach(function(tr){
var td=tr.children[startIdx];
if(td)td.style.width=newWidth+'px';
});
}
});
document.addEventListener('mouseup',function(){
if(resizeTarget){
resizeTarget=null;
startTable=null;
document.body.style.cursor='';
}
});
})();
// ===== 启动 =====
// ===== 登录校验 =====
(function(){if(!sessionStorage.getItem('gx_user')){window.location.href='login.html';return};try{var u=JSON.parse(sessionStorage.getItem('gx_user'));var r=u.roleNumbers||[];document.getElementById('userInfo').innerHTML=(u.userName||u.userId)+' | <a href="javascript:void(0)" onclick="logout()" style="color:rgba(255,255,255,.75);text-decoration:none;margin-left:8px;font-size:12px;">退出</a>';if(r.indexOf('Purchase01')<0&&r.indexOf('CRM01')<0&&r.indexOf('YF01')<0){alert('当前用户无权限');window.location.href='login.html'}}catch(e){alert('当前用户无权限');window.location.href='login.html'}})();
loadAll();
</script>
</body>
</html>
@@ -0,0 +1,338 @@
/**
* ============================================
* GX-WMS 左侧侧边栏导航组件
* 用法:
* 1. 页面 <head> 引入 nav.css:<link rel="stylesheet" href=".../common/nav.css">
* 2. <body> 顶部加一个容器:<div id="sidebar"></div>
* 3. 主内容区域包裹在 <div class="main-content"> 中
* 4. 页面底部引入本JS,自动初始化
*
* 维护点:仅修改本文件的 MENU_GROUPS 配置
* ============================================
*/
// ---------- 应用根路径自动探测 ----------
// 支持 IIS 子目录部署(如 /WebApi,名称可变)和 VS 调试(网站根目录)两种场景。
// 原理:根据本脚本自身 URL(<应用根>/View/common/nav.js)反推出应用根前缀。
// - 部署在子目录时自动得到 '/WebApi' 之类前缀
// - VS 调试 / 根目录部署时为空字符串,不影响原行为
var APP_BASE = '';
(function () {
try {
var scripts = document.getElementsByTagName('script');
for (var i = scripts.length - 1; i >= 0; i--) {
var src = scripts[i].getAttribute('src') || '';
if (src.indexOf('nav.js') >= 0) {
var a = document.createElement('a');
a.href = src;
var p = a.pathname.replace(/\\/g, '/');
var idx = p.indexOf('/View/common/nav.js');
if (idx >= 0) APP_BASE = p.substring(0, idx);
break;
}
}
} catch (e) { APP_BASE = ''; }
window.APP_BASE = APP_BASE;
})();
// ---------- 菜单配置(唯一维护点) ----------
// 顶级项:{ title, icon, role, children? } 有 children = 分组
// 子项:{ title, href, role }
// href 使用绝对路径(以 / 开头),渲染时会自动加上应用根前缀 APP_BASE
var MENU_GROUPS = [
{ title: '首页', icon: '🏠', href: '/home.html', hideOnHome: true },
{
title: '生产管理', icon: '🏭', role: 'Purchase01',
children: [
{ title: 'BOM主数据', href: '/View/Delivery/bom_master.html', icon: '🧩', role: 'Purchase01' },
{ title: '生产排程计划', href: '/View/Delivery/schedule.html', icon: '📅', role: 'Purchase01' },
{ title: '生产排程看板', href: '/View/Delivery/schedule_board.html', icon: '📊', role: 'Purchase01' },
{ title: '线边仓库存', href: '/View/Delivery/production_delivery.html', icon: '🏬', role: 'Purchase01' },
{ title: 'MES追溯看板', href: '/View/MES/mes_dashboard.html', icon: '🔍', role: 'Produce02' }
]
},
{
title: '采购管理', icon: '📋', role: ['YF01', 'Purchase01'],
children: [
{
title: '采购申请管理', icon: '📦', role: ['YF01', 'Purchase01'],
children: [
{ title: '采购申请管理', href: '/procurement.html', icon: '📋', role: 'Purchase01' },
{ title: '采购看板', href: '/procurement_dashboard.html', icon: '📊', role: 'Purchase01' },
{ title: '采购物料交付状态看板', href: '/delivery_dashboard.html', icon: '🚚', role: 'Purchase01' },
{ title: '研发采购看板', href: '/dashboard.html', icon: '🔬', role: 'YF01' },
{ title: '研发采购全链路看板', href: '/procurement_board_list.html', icon: '📈', role: ['YF01', 'Purchase01'] },
{ title: '研发订单考核时效看板', href: '/procurement_audit_leadtime.html', icon: '⏱️', role: ['YF01', 'Purchase01'] }
]
},
{
title: '采购物料交付', icon: '🚚', role: 'Purchase01',
children: [
{ title: '采购物料交付', href: '/View/Delivery/material_delivery.html', icon: '🚚', role: 'Purchase01' },
{ title: '采购物料交付计划看板', href: '/View/Delivery/delivery_dashboard.html', icon: '📊', role: 'Purchase01' }
]
}
]
},
{
title: 'CRM', icon: '📊', role: 'CRM01',
children: [
{ title: '金蝶-CRM产品同步', href: '/index.html', icon: '🔄', role: 'CRM01' },
{ title: '金蝶-CRM销售订单新变更单同步', href: '/crm_sale_order_sync.html', icon: '📄', role: 'CRM01' }
]
}
];
// ============================================
// 通用逻辑,一般无需修改
// ============================================
function getLoginUser() {
try {
var raw = sessionStorage.getItem('gx_user');
if (!raw) return null;
return JSON.parse(raw);
} catch (e) { return null; }
}
function hasRole(role) {
if (!role) return true;
// 支持 role 为数组:任一角色命中即通过(一个功能可分给多个角色)
if (Array.isArray(role)) {
for (var i = 0; i < role.length; i++) {
if (hasRole(role[i])) return true;
}
return false;
}
var user = getLoginUser();
if (!user) return false;
var rn = user.roleNumbers;
if (Array.isArray(rn)) {
if (rn.indexOf(role) >= 0) return true;
for (var i = 0; i < rn.length; i++) {
if (String(rn[i]).toUpperCase() === String(role).toUpperCase()) return true;
}
}
var rs = user.roles;
if (Array.isArray(rs)) {
for (var j = 0; j < rs.length; j++) {
var item = rs[j] || {};
if (String(item.roleNumber || '').toUpperCase() === String(role).toUpperCase()) return true;
if (String(item.roleName || '').toUpperCase() === String(role).toUpperCase()) return true;
}
}
return false;
}
function isActive(href) {
try {
var u = new URL(APP_BASE + href, window.location.origin);
return window.location.pathname.replace(/\\/g, '/').indexOf(u.pathname) >= 0;
} catch (e) { return false; }
}
function getLoginPath() {
// 用 APP_BASE(自动探测的应用根前缀)拼接登录页地址:
// - VS 调试/根目录部署:APP_BASE 为空,返回 '/login.html'
// - 子目录部署(如 /WebApi):返回 '/WebApi/login.html'
return APP_BASE + '/login.html';
}
function logout() {
sessionStorage.removeItem('gx_user');
window.location.href = getLoginPath();
}
/**
* 递归判断菜单项(含子孙)是否有激活项
*/
function isItemActive(item) {
if (item.href && isActive(item.href)) return true;
if (item.children) {
for (var i = 0; i < item.children.length; i++) {
if (isItemActive(item.children[i])) return true;
}
}
return false;
}
/**
* 递归判断菜单项是否有可见(有权限)的子孙
*/
function hasVisibleItem(item) {
if (!hasRole(item.role)) return false;
if (!item.children || !item.children.length) return true;
for (var i = 0; i < item.children.length; i++) {
if (hasVisibleItem(item.children[i])) return true;
}
return false;
}
/**
* 递归渲染子菜单项(支持任意层级)
* items: 菜单配置数组;depth: 当前层级(从1开始)
*/
function renderSubItems(items, depth) {
var html = '';
for (var i = 0; i < items.length; i++) {
var it = items[i];
if (!hasVisibleItem(it)) continue;
if (it.children && it.children.length) {
// 子分组(可继续递归)
var subActive = isItemActive(it) ? ' expanded' : '';
var subRotate = isItemActive(it) ? ' rotate' : '';
html += '<div class="menu-subgroup' + subActive + '" data-depth="' + depth + '">'
+ ' <div class="menu-subgroup-title" onclick="toggleSubGroup(this)" data-title="' + it.title + '">'
+ ' <span class="menu-icon">' + (it.icon || '') + '</span>'
+ ' <span class="menu-label">' + it.title + '</span>'
+ ' <span class="menu-arrow' + subRotate + '">▾</span>'
+ ' </div>'
+ ' <div class="menu-subgroup-children">'
+ renderSubItems(it.children, depth + 1)
+ ' </div>'
+ '</div>';
} else {
// 叶子项
var activeCls = isActive(it.href) ? ' active' : '';
html += '<a class="menu-child" data-depth="' + depth + '" href="' + APP_BASE + it.href + '" data-title="' + it.title + '">'
+ ' <span class="menu-child-dot">•</span>'
+ ' <span class="menu-label">' + it.title + '</span>'
+ '</a>';
}
}
return html;
}
/**
* 切换子分组展开/收起
*/
function toggleSubGroup(titleEl) {
var sub = titleEl.parentNode;
if (!sub) return;
sub.classList.toggle('expanded');
var arrow = titleEl.querySelector('.menu-arrow');
if (arrow) arrow.classList.toggle('rotate');
}
/**
* 渲染侧边栏
*/
function renderSidebar() {
var user = getLoginUser();
if (!user) {
if (window.location.href.indexOf('login.html') < 0) {
window.location.href = getLoginPath();
}
return;
}
var html = '';
// 收缩按钮
html += '<button class="sidebar-toggle" title="收起/展开菜单" onclick="toggleSidebar()">☰</button>';
// 用户信息区
var name = user.userName || user.userId || user.name || '用户';
html += '<div class="sidebar-user">'
+ '<div class="avatar">' + (name || '?').charAt(0) + '</div>'
+ '<div class="user-text">'
+ ' <div class="user-name">' + name + '</div>'
+ ' <div class="user-action"><a href="javascript:void(0)" onclick="logout()">退出登录</a></div>'
+ '</div>'
+ '</div>';
// 找出当前页面所在分组(用于默认展开)
var activeGroupIdx = -1;
var activeChildIdx = -1;
// 渲染菜单
html += '<div class="sidebar-menu">';
for (var i = 0; i < MENU_GROUPS.length; i++) {
var g = MENU_GROUPS[i];
if (g.children && g.children.length) {
// 分组自身有角色限制时先过滤(未配置 role 则不限制)
if (g.role && !hasRole(g.role)) continue;
// 递归检查组内是否有激活项(任意层级)
var hasActiveChild = isItemActive(g);
// 组内没有任何有权限的可见项则跳过
if (!hasVisibleItem(g)) continue;
if (hasActiveChild && activeGroupIdx < 0) activeGroupIdx = i;
var expanded = hasActiveChild ? ' expanded' : '';
var rotate = hasActiveChild ? ' rotate' : '';
html += '<div class="menu-group' + expanded + '" data-group="' + i + '">'
+ ' <div class="menu-group-title" data-title="' + g.title + '" onclick="toggleGroup(' + i + ')">'
+ ' <span class="menu-icon">' + (g.icon || '') + '</span>'
+ ' <span class="menu-label">' + g.title + '</span>'
+ ' <span class="menu-arrow' + rotate + '">▾</span>'
+ ' </div>'
+ ' <div class="menu-children">'
+ renderSubItems(g.children, 1)
+ ' </div>'
+ '</div>';
} else {
// 单项菜单:按 g.role 判断(分组由子项权限决定,不看 g.role)
if (!hasRole(g.role)) continue;
// 在首页本身不显示"首页"入口
if (g.href === '/home.html' && isActive(g.href)) continue;
var activeSingle = isActive(g.href) ? ' active' : '';
if (activeSingle) activeGroupIdx = i;
html += '<a class="menu-single' + activeSingle + '" href="' + APP_BASE + g.href + '" data-title="' + g.title + '">'
+ ' <span class="menu-icon">' + (g.icon || '') + '</span>'
+ ' <span class="menu-label">' + g.title + '</span>'
+ '</a>';
}
}
html += '</div>';
var el = document.getElementById('sidebar');
if (el) el.innerHTML = html;
// 主体内容左边距
document.body.classList.add('with-sidebar');
// 恢复折叠状态
if (localStorage.getItem('gx_sidebar_collapsed') === '1') {
document.body.classList.add('sidebar-collapsed');
}
}
/**
* 切换侧边栏折叠/展开
*/
function toggleSidebar() {
document.body.classList.toggle('sidebar-collapsed');
var collapsed = document.body.classList.contains('sidebar-collapsed');
if (collapsed) localStorage.setItem('gx_sidebar_collapsed', '1');
else localStorage.removeItem('gx_sidebar_collapsed');
}
/**
* 切换分组展开/折叠
*/
function toggleGroup(idx) {
// 折叠状态下点击分组:先展开侧边栏,再展开该分组
if (document.body.classList.contains('sidebar-collapsed')) {
toggleSidebar();
// 展开侧边栏后延迟让 CSS 过渡完成,再展开分组
var el = document.querySelector('.menu-group[data-group="' + idx + '"]');
if (el) el.classList.add('expanded');
return;
}
var el = document.querySelector('.menu-group[data-group="' + idx + '"]');
if (!el) return;
el.classList.toggle('expanded');
var arrow = el.querySelector('.menu-arrow');
if (arrow) arrow.classList.toggle('rotate');
}
function initNav() {
renderSidebar();
}
if (window.addEventListener) {
window.addEventListener('DOMContentLoaded', function () { initNav(); });
} else {
window.onload = function () { initNav(); };
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GXWebApi</RootNamespace>
<AssemblyName>GXWebApi</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<Use64BitIISExpress />
<IISUrl>http://localhost:8080/</IISUrl>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\GuangFu.StringTracing\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\GuangFu.StringTracing\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\OPSOFT\OPSOFTV60\AP\BIN\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Kingdee.BOS.WebApi.Client">
<HintPath>Kingdee.BOS.WebApi.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting">
<HintPath>packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.Cors">
<HintPath>packages\Microsoft.AspNet.Cors.5.2.7\lib\net45\System.Web.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http">
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.Cors">
<HintPath>packages\Microsoft.AspNet.WebApi.Cors.5.2.7\lib\net45\System.Web.Http.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Common\CrmApi.cs" />
<Compile Include="Common\DBHelpe.cs" />
<Compile Include="Common\Extensions.cs" />
<Compile Include="Common\LogHelper.cs" />
<Compile Include="Common\MySqlUtils.cs" />
<Compile Include="Common\ResponseStatus.cs" />
<Compile Include="Common\WmsCommonFunction.cs" />
<Compile Include="Controllers\AuthController.cs" />
<Compile Include="Controllers\DifferentialController.cs" />
<Compile Include="Controllers\ProcurementController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="delivery_dashboard.html" />
<Content Include="delivery_dashboard_L21.html" />
<Content Include="delivery_dashboard_L22.html" />
<Content Include="delivery_dashboard_L31.html" />
<Content Include="delivery_dashboard_L32.html" />
<Content Include="delivery_dashboard_noorder2.html" />
<Content Include="delivery_dashboard_noorder3.html" />
<Content Include="delivery_dashboard_noorder4.html" />
<Content Include="Global.asax" />
<Content Include="login.html" />
<Content Include="index.html" />
<Content Include="procurement.html" />
<Content Include="procurement_dashboard.html" />
<Content Include="procurement_dashboard_detail.html" />
<Content Include="procurement_dashboard_detail_items.html" />
<Content Include="procurement_dashboard_level4.html" />
<Content Include="procurement_detail.html" />
<Content Include="dashboard.html" />
<Content Include="dashboard_detail.html" />
<Content Include="multi_detail.html" />
<Content Include="Web.config" />
<Content Include="log4net.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="View\" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>8080</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8080/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,163 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购看板 - 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}
.top-bar .logo{font-size:17px;font-weight:600;margin-right:24px}
.top-links a{color:rgba(255,255,255,.75);text-decoration:none;padding:0 16px;height:100%;display:flex;align-items:center;font-size:13px;border-radius:4px 4px 0 0;transition:.2s}
.top-links a:hover,.top-links a.active{color:#fff;background:rgba(255,255,255,.1)}
.user-info{margin-left:auto;font-size:12px;opacity:.85}
.main{max-width:1500px;margin:0 auto;padding:12px 16px}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;align-items:center}
.card-header h3{font-size:14px;color:#333;font-weight:600}
.table-wrap{overflow:auto;max-height:calc(100vh-180px)}
table{min-width:100%;border-collapse:collapse;font-size:12px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:8px 8px;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:7px 8px;border:1px solid #ddd;color:#333;text-align:center}
tbody tr:hover{background:#f0f6ff}
tbody td.month-cell{text-align:left;font-weight:600;color:#1a73e8}
tbody tr.total-row td{background:#f0f6ff;font-weight:700;color:#1a73e8}
.count-link{color:#1a73e8;cursor:pointer;text-decoration:underline;font-weight:600}
.count-link:hover{color:#1557b0}
.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}
.loading-spinner{width:34px;height:34px;border:3px solid #e0e0e0;border-top-color:#1a73e8;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
</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">
<span class="logo">Gaussian</span>
<div class="top-links" id="navTabs" style="display:flex;gap:4px;height:100%;"></div>
<span class="user-info" id="userInfo"></span>
</div>
<div class="main">
<div class="card">
<div class="card-header"><h3>采购看板 - 按月业务状态汇总</h3></div>
<div class="table-wrap">
<table>
<thead><tr id="headerRow"></tr></thead>
<tbody id="dataBody"><tr class="empty"><td colspan="2">加载中...</td></tr></tbody>
</table>
</div>
</div>
</div>
<script>
var ywztMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
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/GetProcurementDashboard',true);
xhr.onload=function(){
loading(false);
try{
var r=JSON.parse(xhr.responseText);
if(r.success)renderTable(r.data,r.ywzts,r.ywztMap);
else toast(r.message||'查询失败','error')
}catch(e){toast('数据异常','error')}
};
xhr.onerror=function(){loading(false);toast('网络请求失败','error')};
xhr.send();
}
function renderTable(data,ywzts,_ywztMap){
var header=document.getElementById('headerRow');
var tbody=document.getElementById('dataBody');
if(!data||!data.length){header.innerHTML='<th>月份</th>';tbody.innerHTML='<tr class="empty"><td colspan="2">暂无数据</td></tr>';return}
// 表头
var hh='<th style="min-width:100px">月份<span class="resizer"></span></th>';
ywzts.forEach(function(y){hh+='<th style="min-width:110px">'+(ywztMap[y]||y)+'<span class="resizer"></span></th>'});
hh+='<th style="min-width:80px">合计<span class="resizer"></span></th>';
header.innerHTML=hh;
// 数据行
var h='';
data.forEach(function(row,idx){
var isTotal=(idx===data.length-1);
var trCls=isTotal?' class="total-row"':'';
h+='<tr'+trCls+'>';
h+='<td class="month-cell">'+escapeHtml(row.month)+'</td>';
var rowTotal=0;
ywzts.forEach(function(y){
var cnt=parseInt(row[y])||0;
rowTotal+=cnt;
if(cnt>0&&!isTotal)
h+='<td><span class="count-link" onclick="openDetail(\''+escapeHtml(row.month)+'\',\''+y+'\')">'+cnt+'</span></td>';
else
h+='<td>'+(cnt||'')+'</td>';
});
h+='<td>'+(isTotal?rowTotal:'')+'</td>';
h+='</tr>';
});
tbody.innerHTML=h;
}
function openDetail(month,ywzt){
// 暂时跳转到看板详情(后续开发二级列表)
window.location.href='procurement_dashboard_detail.html?month='+encodeURIComponent(month)+'&ywzt='+encodeURIComponent(ywzt);
}
// ===== 登录校验 =====
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var user=JSON.parse(userData);
var roles=user.roleNumbers||[];
var nav='';
if(roles.indexOf('CRM01')>=0)nav+='<a href="index.html">CRM同步</a>';
if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement.html">采购申请管理</a>';
if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement_dashboard.html" class="active">采购看板</a>';
if(roles.indexOf('Purchase01')>=0)nav+='<a href="delivery_dashboard.html">采购物料交付状态看板</a>';
if(roles.indexOf('YF01')>=0)nav+='<a href="dashboard.html">研发采购看板</a>';
document.getElementById('navTabs').innerHTML=nav;
document.getElementById('userInfo').innerHTML=(user.userName||user.userId)+' | <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){alert('当前用户无权限');window.location.href='login.html'}
})();
// 列宽拖动
(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=''}});
})();
loadData();
</script>
</body>
</html>
@@ -0,0 +1,359 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
namespace GXWebApi.Common
{
public class DBHelpe
{
// private readonly static string config = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
private string PriConnectionString = string.Empty;
private static DBHelpe _instance = null;//单例
private SqlConnection _transactionConnection = null;
private SqlTransaction _transaction = null;
public DBHelpe()
{
//获取连接字符串
try
{
PriConnectionString = ConfigurationManager.ConnectionStrings["GXWMS"].ToString();
}
catch (Exception ex)
{
throw new Exception(string.Format("未配置{0}库:{1}", "GXWMS", ex.Message));
}
}
#region 事务支持
public void BeginTransaction()
{
if (_transactionConnection != null) return;
_transactionConnection = new SqlConnection(PriConnectionString);
_transactionConnection.Open();
_transaction = _transactionConnection.BeginTransaction();
}
public void CommitTransaction()
{
if (_transactionConnection == null) return;
try
{
_transaction?.Commit();
}
finally
{
_transactionConnection.Close();
_transaction = null;
_transactionConnection = null;
}
}
public void RollbackTransaction()
{
if (_transactionConnection == null) return;
try
{
_transaction?.Rollback();
}
finally
{
_transactionConnection.Close();
_transaction = null;
_transactionConnection = null;
}
}
#endregion
/// <summary>
/// 单例模式
/// </summary>
/// <returns></returns>
public static DBHelpe GetInstance()
{
if (_instance == null)
{
_instance = new DBHelpe();
}
return _instance;
}
#region 执行查询,返回要查询的结果集 DataTable
/// <summary>
/// 执行查询,返回要查询的结果集
/// </summary>
/// <param name="sql">sql语句</param>
/// <returns></returns>
public DataTable ExecuteTable(string par_SqlStr)
{
return ExecuteTable(par_SqlStr, CommandType.Text, null);
}
/// <summary>
/// 创建一个DataTable对象
/// </summary>
/// <param name="M_str_par_SqlStr">SQL语句</param>
/// <param name="M_str_table">表名</param>
/// <returns>返回DataSet对象</returns>
/// <summary>
/// 执行查询,返回要查询的结果集
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <returns></returns>
public DataTable ExecuteTable(string par_SqlStr, CommandType par_CommandType = CommandType.Text)
{
return ExecuteTable(par_SqlStr, par_CommandType, null);
}
/// <summary>
/// 执行查询,返回要查询的结果集
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <param name="parameters">参数列表</param>
/// <returns></returns>
public DataTable ExecuteTable(string sql, CommandType par_CommandType, params System.Data.SqlClient.SqlParameter[] pParameters)
{
// 保存要查询的结果
DataTable table = new DataTable("dt");
// 如果存在活动事务,使用事务连接执行
if (_transactionConnection != null)
{
using (SqlCommand command = new SqlCommand(sql, _transactionConnection, _transaction))
{
try
{
command.CommandType = par_CommandType;
command.CommandTimeout = 36000;
if (pParameters != null)
command.Parameters.AddRange(pParameters);
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(table);
}
catch (System.Data.SqlClient.SqlException E)
{
throw new Exception(E.Message);
}
finally
{
command.Parameters.Clear();
command.Dispose();
}
}
return table;
}
//SqlCommand command;
using (SqlConnection Connection = new SqlConnection(PriConnectionString))
{
//command = new SqlCommand(sql, Connection);
using (SqlCommand command = new SqlCommand(sql, Connection))
{
try
{
if (Connection.State != ConnectionState.Open)
Connection.Open();
// 设置SQL语句的类型
command.CommandType = par_CommandType;
command.CommandTimeout = 36000;
// 如果传入了参数,则添加到命令对象中
if (pParameters != null)
{
for (int i = command.Parameters.Count - 1; i >= 0; i--)
{
command.Parameters.RemoveAt(i);
}
command.Parameters.AddRange(pParameters);
}
// 创建一个适配器对象,用以将结果填充到DataTable中
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(table);
}
catch (System.Data.SqlClient.SqlException E)
{
throw new Exception(E.Message);
}
finally
{
command.Parameters.Clear();
command.Dispose();
Connection.Close();
}
}
}
return table;
}
#endregion
#region 执行增、删、改操作,返回受影响的行数
/// <summary>
/// 执行增、删、改操作,返回受影响的行数
/// </summary>
/// <param name="sql">存储过程名</param>
/// <returns></returns>
public int ExecuteNonQuery(string par_sql)
{
return ExecuteNonQuery(par_sql, CommandType.Text, null);
}
/// <summary>
/// 执行增、删、改操作,返回受影响的行数
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <returns></returns>
public int ExecuteNonQuery(string par_sql, CommandType par_CommandType)
{
return ExecuteNonQuery(par_sql, par_CommandType, null);
}
/// <summary>
/// 执行增、删、改操作,返回受影响的行数
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
/// <param name="parameters">参数列表</param>
/// <returns></returns>
public int ExecuteNonQuery(string par_sql, CommandType par_CommandType, params System.Data.SqlClient.SqlParameter[] pParameters)
{
// 如果存在活动事务,使用事务连接执行
if (_transactionConnection != null)
{
using (SqlCommand command = new SqlCommand(par_sql, _transactionConnection, _transaction))
{
try
{
command.CommandType = par_CommandType;
command.CommandTimeout = 36000;
if (pParameters != null)
command.Parameters.AddRange(pParameters);
return command.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException E)
{
throw new Exception(E.Message);
}
finally
{
command.Parameters.Clear();
command.Dispose();
}
}
}
// 受影响的行数
int count = 0;
using (SqlConnection Connection = new SqlConnection(PriConnectionString))
{
using (SqlCommand command = new SqlCommand(par_sql, Connection))
{
try
{
if (Connection.State != ConnectionState.Open)
Connection.Open();
// 设置SQL语句的类型
command.CommandType = par_CommandType;
command.CommandTimeout = 36000;
// 如果传入了参数,则添加到命令对象中
if (pParameters != null)
{
for (int i = command.Parameters.Count - 1; i >= 0; i--)
{
command.Parameters.RemoveAt(i);
}
command.Parameters.AddRange(pParameters);
}
count = command.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException E)
{
throw new Exception(E.Message);
}
finally
{
command.Parameters.Clear();
command.Dispose();
Connection.Close();
}
}
}
return count;
}
#endregion
/// <summary>
/// 防止数据库参数为NULL
/// </summary>
/// <param name="param">参数名</param>
/// <param name="value">参数值</param>
/// <returns>数据库参数</returns>
public static SqlParameter SetParam(string param, object value)
{
if (value == null)
return new SqlParameter(param, "");
return new SqlParameter(param, value);
}
/// <summary>
/// 判断存储过程是否存在
/// </summary>
/// <param name="storeProcedureName">存储过程名</param>
/// <returns></returns>
public bool IsStoreProcedureExist(string storeProcedureName)
{
string existSql = string.Format(@"select * from sysobjects where id = object_id(N'[{0}]') and OBJECTPROPERTY(id, N'IsProcedure') = 1", storeProcedureName);
DataTable dt = this.ExecuteTable(existSql);
if (dt.Rows.Count > 0)
{
return true;
}
return false;
}
public static DataTable ConvertDataReaderToDataTable(SqlDataReader reader)
{
try
{
DataTable objDataTable = new DataTable();
int intFieldCount = reader.FieldCount;
for (int intCounter = 0; intCounter < intFieldCount; ++intCounter)
{
objDataTable.Columns.Add(reader.GetName(intCounter), reader.GetFieldType(intCounter));
}
objDataTable.BeginLoadData();
object[] objValues = new object[intFieldCount];
while (reader.Read())
{
reader.GetValues(objValues);
objDataTable.LoadDataRow(objValues, true);
}
reader.Close();
objDataTable.EndLoadData();
return objDataTable;
}
catch (Exception ex)
{
throw new Exception("转换出错!", ex);
}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>研发订单考核时效 - 三级明细</title>
<link rel="stylesheet" href="View/common/nav.css" />
<style>
* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", Arial, sans-serif; background: #f4f6fb; color: #1f2937; }
.main-content { padding: 18px 24px; }
.header { background: linear-gradient(90deg, #2f6df6 0%, #4f8bff 100%); color: #fff; padding: 18px 24px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.header h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.header .meta { font-size: 13px; opacity: .9; }
.table-wrap { background: #fff; border-radius: 12px; margin-top: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.toolbar { padding: 14px 18px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 10px; }
.toolbar .title { font-size: 14px; font-weight: 600; color: #374151; }
.toolbar .back { background: #fff; border: 1px solid #d1d5db; color: #374151; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.toolbar .back:hover { background: #f3f4f6; }
.gx-grid { max-height: calc(100vh - 280px); min-height: 600px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 8px 10px; border: 1px solid #e5e7eb; text-align: left; white-space: nowrap; }
table th { background: #f3f4f6; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.empty { color: #9ca3af; }
.page-bar { padding: 12px 18px; border-top: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: flex-end; gap: 10px; font-size: 12px; color: #6b7280; }
.page-bar button { background: #fff; border: 1px solid #d1d5db; color: #374151; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.page-bar button:hover { background: #f3f4f6; }
.page-bar button:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.tag-cg { background: #fee2e2; color: #b91c1c; }
.tag-gao { background: #ffedd5; color: #c2410c; }
.tag-zhong { background: #fef9c3; color: #a16207; }
.tag-di { background: #dcfce7; color: #15803d; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="header">
<h1>研发订单考核时效 · 三级明细</h1>
<div class="meta" id="meta"></div>
</div>
<div class="table-wrap">
<div class="toolbar">
<button class="back" onclick="window.close()">返回</button>
<div class="title" id="title"></div>
</div>
<div class="gx-grid" id="grid"></div>
<div class="page-bar" id="pageBar"></div>
</div>
</div>
<script>
var params = new URLSearchParams(window.location.search);
var yfxmId = params.get('yfxmId') || '';
var yfxmName = params.get('yfxmName') || '未指定';
var buyer = params.get('buyer') || '';
var yt = params.get('yt') || '';
var riskLevel = params.get('riskLevel') || '';
var page = 1, pageSize = 50;
function ytName(y) { return { '0': '生产', '1': '研发', '2': '售后' }[y] || '全部'; }
function riskTag(r) {
var cls = r === '超高' ? 'tag-cg' : r === '高' ? 'tag-gao' : r === '中' ? 'tag-zhong' : 'tag-di';
return '<span class="tag ' + cls + '">' + r + '</span>';
}
document.getElementById('title').innerHTML = yfxmName + ' / ' + (buyer || '全部') + ' / ' + ytName(yt) + ' / ' + (riskLevel || '全部');
document.getElementById('meta').innerHTML = '用途:<strong>' + ytName(yt) + '</strong> &nbsp;|&nbsp; 风险等级:<strong>' + (riskLevel || '全部') + '</strong> &nbsp;|&nbsp; 研发项目:<strong>' + yfxmName + '</strong> &nbsp;|&nbsp; 负责人:<strong>' + (buyer || '全部') + '</strong>';
function load() {
var grid = document.getElementById('grid');
grid.innerHTML = '<div style="color:#9ca3af;padding:20px 0;">加载中...</div>';
var url = 'api/Procurement/GetAuditLeadtimeLevel3?page=' + page + '&pageSize=' + pageSize +
'&yfxmId=' + encodeURIComponent(yfxmId) +
'&riskLevel=' + encodeURIComponent(riskLevel) +
'&yt=' + encodeURIComponent(yt) +
'&buyer=' + encodeURIComponent(buyer);
fetch(url).then(function (r) { return r.json(); }).then(function (res) {
if (!res.success) { grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">加载失败: ' + res.message + '</div>'; return; }
render(res);
}).catch(function (e) {
grid.innerHTML = '<div style="color:#ef4444;padding:20px 0;">请求异常: ' + e + '</div>';
});
}
function render(res) {
if (!res.items || res.items.length === 0) {
document.getElementById('grid').innerHTML = '<div style="color:#9ca3af;padding:20px 0;">暂无数据</div>';
document.getElementById('pageBar').innerHTML = '共 0 条';
return;
}
var items = res.items;
var html = '<table><thead><tr><th>序号</th><th>流程编号</th><th>单据编号</th><th>用途</th><th>策略采购员</th><th>研发项目</th><th>PM审批时间</th><th>PO日期</th><th>时效(天)</th><th>风险等级</th></tr></thead><tbody>';
items.forEach(function (it, idx) {
html += '<tr>';
html += '<td>' + ((page - 1) * pageSize + idx + 1) + '</td>';
html += '<td>' + it.lcbh + '</td>';
html += '<td>' + (it.djbh || '<span class="empty">-</span>') + '</td>';
html += '<td>' + ytName(it.ytUse) + '</td>';
html += '<td>' + (it.yfcgfzr || '<span class="empty">-</span>') + '</td>';
html += '<td>' + (it.yfxmName || '<span class="empty">-</span>') + '</td>';
html += '<td>' + it.pmSpsj + '</td>';
html += '<td>' + (it.firstPoDate || '<span class="empty">无</span>') + '</td>';
html += '<td>' + it.days + '</td>';
html += '<td>' + riskTag(it.riskLevel) + '</td>';
html += '</tr>';
});
html += '</tbody></table>';
document.getElementById('grid').innerHTML = html;
// 分页
var total = res.total;
var totalPage = Math.ceil(total / pageSize);
var bar = '<span>共 ' + total + ' 条 / 第 ' + page + ' 页 / 共 ' + totalPage + ' 页</span>';
bar += '<button onclick="prevPage()" ' + (page <= 1 ? 'disabled' : '') + '>上一页</button>';
bar += '<button onclick="nextPage()" ' + (page >= totalPage ? 'disabled' : '') + '>下一页</button>';
document.getElementById('pageBar').innerHTML = bar;
}
function prevPage() { if (page > 1) { page--; load(); } }
function nextPage() { page++; load(); }
load();
</script>
<script src="View/common/nav.js"></script>
</body>
</html>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,297 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购物料交付计划看板</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="../common/nav.css">
<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 24px;display:flex;align-items:center;height:56px;box-shadow:0 2px 8px rgba(0,0,0,.15);position:sticky;top:0;z-index:100}
.top-bar .logo{font-size:18px;font-weight:600;letter-spacing:1px;margin-right:32px}
.top-bar .nav-tabs{display:flex;gap:4px;height:100%}
.top-bar .nav-tabs a{color:rgba(255,255,255,.75);text-decoration:none;padding:0 16px;display:flex;align-items:center;font-size:13px;border-radius:4px 4px 0 0;transition:all .2s}
.top-bar .nav-tabs a:hover{color:#fff;background:rgba(255,255,255,.1)}
.top-bar .nav-tabs a.active{color:#fff;background:rgba(255,255,255,.2)}
.top-bar .user-info{margin-left:auto;font-size:13px;opacity:.85}
.main-container{max-width:1500px;margin:0 auto;padding:16px 20px}
/* 统计卡片 */
.stat-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:16px}
.stat-card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:18px;text-align:center;border-top:3px solid #3b82f6}
.stat-card .stat-value{font-size:32px;font-weight:700;margin-bottom:4px}
.stat-card .stat-label{font-size:13px;color:#64748b}
.stat-card.stat-danger{border-top-color:#ef4444}.stat-card.stat-danger .stat-value{color:#ef4444}
.stat-card.stat-warning{border-top-color:#f59e0b}.stat-card.stat-warning .stat-value{color:#f59e0b}
.stat-card.stat-safe{border-top-color:#22c55e}.stat-card.stat-safe .stat-value{color:#22c55e}
.stat-card.stat-total{border-top-color:#3b82f6}.stat-card.stat-total .stat-value{color:#3b82f6}
.panel{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:16px;margin-bottom:14px}
.panel h3{font-size:15px;color:#333;font-weight:600;margin-bottom:12px}
.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.toolbar select,.toolbar input{height:32px;padding:0 10px;border:2px solid #e0e0e0;border-radius:5px;font-size:13px;outline:none}
.toolbar select:focus,.toolbar input:focus{border-color:#1a73e8}
.btn{height:32px;padding:0 16px;border:none;border-radius:5px;font-size:12px;font-weight:600;cursor:pointer;transition:all .2s;color:#fff}
.btn-primary{background:linear-gradient(135deg,#1a73e8,#1557b0)}
.btn-primary:hover{opacity:.92}
.btn-outline{background:#fff;color:#666;border:2px solid #e0e0e0}
.btn-outline:hover{border-color:#1a73e8;color:#1a73e8}
/* 分组列表 */
.group-row{display:flex;align-items:center;gap:10px;padding:10px 14px;border:1px solid #e2e8f0;border-radius:6px;margin-bottom:8px;cursor:pointer;background:#fff;transition:all .15s}
.group-row:hover{background:#f0f6ff}
.group-row .expand{font-size:12px;color:#1a73e8;width:16px}
.group-row .group-name{font-weight:600;color:#333;min-width:150px}
.group-row .group-sub{color:#64748b;font-size:13px;flex:1}
.badge{display:inline-block;padding:2px 10px;border-radius:12px;font-size:12px;font-weight:500}
.badge-danger{background:#fee2e2;color:#991b1b}
.badge-warning{background:#fef3c7;color:#92400e}
.badge-success{background:#dcfce7;color:#166534}
.badge-info{background:#dbeafe;color:#1e40af}
table{width:100%;border-collapse:collapse;font-size:13px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:9px 12px;text-align:left;border:1px solid #999;border-bottom:2px solid #999;white-space:nowrap}
tbody td{padding:9px 12px;border:1px solid #ddd;color:#333}
tbody tr:hover{background:#f0f6ff}
.pagination{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:12px;font-size:13px;color:#666}
.pagination button{min-width:30px;height:30px;border:1px solid #e0e0e0;border-radius:4px;background:#fff;cursor:pointer}
.pagination button.active{background:#1a73e8;color:#fff;border-color:#1a73e8}
/* 甘特图 */
.gantt-container{overflow-x:auto;margin-top:8px}
.gantt-grid{display:grid;grid-template-columns:160px repeat(var(--gantt-cols),minmax(36px,1fr));gap:1px;font-size:11px;min-width:100%}
.gantt-header{background:#f1f5f9;padding:6px 4px;text-align:center;font-weight:600;color:#64748b;border-bottom:2px solid #e2e8f0}
.gantt-header.weekend{background:#e2e8f0;color:#94a3b8}
.gantt-name{background:#f8fafc;padding:6px 8px;font-weight:500;border-bottom:1px solid #e2e8f0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gantt-cell{padding:4px 2px;text-align:center;border-bottom:1px solid #e2e8f0;min-height:28px}
.gantt-cell.req{background:#dbeafe;color:#1e40af;font-weight:600}
.gantt-cell.arrival{background:#dcfce7;color:#166534}
.gantt-cell.stop{background:#fee2e2;color:#991b1b}
.gantt-cell.empty{background:#fff}
.toast{position:fixed;top:14px;left:50%;transform:translateX(-50%);padding:10px 22px;border-radius:8px;font-size:13px;z-index:1001;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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
.detail-wrap{display:none;margin-bottom:8px}
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="stat-cards">
<div class="stat-card stat-total"><div class="stat-value" id="statTotal">0</div><div class="stat-label">物料总数</div></div>
<div class="stat-card stat-danger"><div class="stat-value" id="statDanger">0</div><div class="stat-label">断线风险</div></div>
<div class="stat-card stat-warning"><div class="stat-value" id="statWarn">0</div><div class="stat-label">预警关注</div></div>
<div class="stat-card stat-safe"><div class="stat-value" id="statSafe">0</div><div class="stat-label">安全供应</div></div>
</div>
<div class="panel">
<h3>物料交付分组(按产品)</h3>
<div class="toolbar">
<select id="selProductType" style="min-width:140px"><option value="">产品类型:全部</option></select>
<select id="selRisk">
<option value="">风险:全部</option>
<option value="断线">断线</option>
<option value="预警">预警</option>
<option value="安全">安全</option>
</select>
<input type="text" id="txtKeyword" placeholder="物料编码/名称" style="min-width:160px">
<div style="flex:1"></div>
<button class="btn btn-outline" onclick="loadBoard()">刷新</button>
</div>
<div id="groupList"></div>
</div>
<div class="panel">
<h3>物料交付明细</h3>
<table>
<thead>
<tr>
<th>物料编码</th><th>物料名称</th><th>层级</th><th>产品类型</th><th>日需求</th><th>总需求</th>
<th>可用库存</th><th>在途</th><th>已到货</th><th>预计停线日</th><th>预计到货日</th><th>风险</th>
</tr>
</thead>
<tbody id="tbodyDetail"></tbody>
</table>
<div class="pagination" id="detailPagination"></div>
</div>
<div class="panel">
<h3>交付甘特图(需求/到货)</h3>
<div class="gantt-container">
<div class="gantt-grid" id="ganttGrid"></div>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
<script>
var options=null;
var currentProductType='';
var currentRisk='';
var ganttData=[];
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'},3000)}
function api(url,method,data,cb){
var opts={method:method||'GET',headers:{'Content-Type':'application/json'}};
if(data)opts.body=JSON.stringify(data);
fetch(url,opts).then(function(r){return r.json()}).then(function(res){
if(res&&res.success===false){toast(res.message||'操作失败','error');return}
cb&&cb(res);
}).catch(function(e){toast('请求失败:'+e.message,'error')});
}
function getApiUrl(){return '../../api/deliver/'}
function loadOptions(cb){
// 产品类型下拉:从分组接口取
api(getApiUrl()+'GetBoardGroups','GET',null,function(res){
var h='<option value="">产品类型:全部</option>';
(res.data||[]).forEach(function(g){h+='<option value="'+g.ProductType+'">'+g.ProductType+'</option>'});
document.getElementById('selProductType').innerHTML=h;
cb&&cb();
});
}
function loadBoard(){
currentProductType=document.getElementById('selProductType').value;
currentRisk=document.getElementById('selRisk').value;
loadStats();
loadGroups();
loadDetail();
loadGantt();
}
function loadStats(){
api(getApiUrl()+'GetBoardStats?productType='+encodeURIComponent(currentProductType)+'&risk='+encodeURIComponent(currentRisk),'GET',null,function(res){
var d=res.data||{};
document.getElementById('statTotal').textContent=d.total||0;
document.getElementById('statDanger').textContent=d.danger||0;
document.getElementById('statWarn').textContent=d.warn||0;
document.getElementById('statSafe').textContent=d.safe||0;
});
}
function loadGroups(){
api(getApiUrl()+'GetBoardGroups','GET',null,function(res){
var rows=res.data||[];
var html='';
if(rows.length===0)html='<div style="text-align:center;padding:30px;color:#bbb">暂无数据</div>';
rows.forEach(function(g){
var stClass=g.Status=='需处理'?'badge-danger':(g.Status=='关注'?'badge-warning':'badge-success');
html+='<div class="group-row" onclick="toggleGroup(\''+g.ProductType+'\',this)">'+
'<span class="expand">▶</span>'+
'<span class="group-name">'+g.ProductType+'</span>'+
'<span style="color:#64748b;font-size:13px">'+g.MaterialCount+'个物料</span>'+
'<span class="badge badge-danger">断线'+g.DangerCount+'</span>'+
'<span class="badge badge-warning">预警'+g.WarnCount+'</span>'+
'<span class="badge '+stClass+'">'+g.Status+'</span>'+
'</div>';
});
document.getElementById('groupList').innerHTML=html;
});
}
function toggleGroup(productType,el){
currentProductType=productType;
document.getElementById('selProductType').value=productType;
var expand=el.querySelector('.expand');
if(expand.textContent==='▶'){expand.textContent='▼'}else{expand.textContent='▶'}
loadDetail();
loadGantt();
}
function loadDetail(page){
page=page||1;
var kw=document.getElementById('txtKeyword').value.trim();
api(getApiUrl()+'GetBoardDetail?productType='+encodeURIComponent(currentProductType)+'&risk='+encodeURIComponent(currentRisk)+'&keyword='+encodeURIComponent(kw)+'&page='+page+'&pageSize=50','GET',null,function(res){
var rows=res.data||[];
var html='';
if(rows.length===0)html='<tr><td colspan="12" style="text-align:center;padding:36px;color:#bbb">暂无明细数据</td></tr>';
rows.forEach(function(r){
var cls=r.DeliveryRisk=='断线'?'badge-danger':(r.DeliveryRisk=='预警'?'badge-warning':'badge-success');
html+='<tr>'+
'<td>'+r.ChildMaterialId+'</td>'+
'<td>'+r.MaterialName+'</td>'+
'<td>L'+r.BOMLevel+'</td>'+
'<td>'+(r.ProductTypes||'')+'</td>'+
'<td>'+r.DailyReq+'</td>'+
'<td>'+r.TotalRequirement+'</td>'+
'<td>'+r.AvailableStock+'</td>'+
'<td>'+r.InTransitQty+'</td>'+
'<td>'+r.ArrivedQty+'</td>'+
'<td>'+r.ExpectedStopDate+'</td>'+
'<td>'+r.ExpectedArrivalDate+'</td>'+
'<td><span class="badge '+cls+'">'+r.DeliveryRisk+'</span></td>'+
'</tr>';
});
document.getElementById('tbodyDetail').innerHTML=html;
renderPagination(res.total,res.page);
});
}
function renderPagination(total,page){
var pages=Math.ceil(total/50);
if(pages<=1){document.getElementById('detailPagination').innerHTML='';return}
var html='';
for(var i=1;i<=pages;i++)html+='<button class="'+(i==page?'active':'')+'" onclick="loadDetail('+i+')">'+i+'</button>';
document.getElementById('detailPagination').innerHTML=html;
}
function loadGantt(){
api(getApiUrl()+'GetGanttData?productType='+encodeURIComponent(currentProductType)+'&risk=断线,预警','GET',null,function(res){
ganttData=res.data||[];
var start=res.startDate;
var end=res.endDate;
if(!start||!end){document.getElementById('ganttGrid').innerHTML='<div style="padding:20px;color:#bbb">暂无排程数据</div>';return}
renderGantt(start,end,ganttData);
});
}
function renderGantt(start,end,data){
var dates=[];
var cur=new Date(start),last=new Date(end);
while(cur<=last){dates.push(formatDate(cur));cur.setDate(cur.getDate()+1)}
document.getElementById('ganttGrid').style.setProperty('--gantt-cols',dates.length);
// 按物料分组
var groups={};
data.forEach(function(d){
var key=d.ChildMaterialId;
if(!groups[key])groups[key]={material:d.ChildMaterialId,name:d.MaterialName,risk:d.DeliveryRisk,stop:d.ExpectedStopDate,reqs:{},arrivals:[]};
if(d.PlanDate)groups[key].reqs[d.PlanDate]=(groups[key].reqs[d.PlanDate]||0)+(parseFloat(d.DailyRequirement)||0);
if(d.ArrivalExpectedDate||d.ActualArrivalDate)groups[key].arrivals.push(d);
});
// 表头
var html='<div class="gantt-header" style="grid-column:1">物料</div>';
dates.forEach(function(d){
var dt=new Date(d);var wk=['日','一','二','三','四','五','六'][dt.getDay()];
var isWk=(dt.getDay()==0||dt.getDay()==6);
html+='<div class="gantt-header'+(isWk?' weekend':'')+'">'+(d.slice(5))+'<br>周'+wk+'</div>';
});
// 物料行
Object.keys(groups).forEach(function(key){
var g=groups[key];
html+='<div class="gantt-name" title="'+g.name+'">'+g.material+' <span style="color:#94a3b8">L'+(key.split('|')[0]||'')+'</span></div>';
dates.forEach(function(d){
var cls='empty';
var txt='';
if(g.stop==d){cls='stop';txt='停'}
if(g.reqs[d]){cls=cls=='stop'?'stop':'req';txt=(txt||'')+(g.reqs[d]||'')}
// 到货
g.arrivals.forEach(function(a){
var ad=a.ArrivalExpectedDate;
if(ad==d){cls='arrival';txt=(txt||'')+'>'+a.ArrivalQty}
});
html+='<div class="gantt-cell '+cls+'">'+txt+'</div>';
});
});
document.getElementById('ganttGrid').innerHTML=html;
}
function formatDate(d){var y=d.getFullYear(),m=('0'+(d.getMonth()+1)).slice(-2),dd=('0'+d.getDate()).slice(-2);return y+'-'+m+'-'+dd}
loadOptions(function(){loadBoard()});
</script>
<!-- 公共导航栏组件(菜单维护点:View/common/nav.js) -->
<script src="../common/nav.js"></script>
</body>
</html>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,530 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购申请单详情 - 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;transition:.2s}
.top-bar .back:hover{background:rgba(255,255,255,.15);color:#fff}
.top-bar .title{font-size:15px;font-weight:600;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.main-container{max-width:1500px;margin:0 auto;padding:12px 16px}
/* ===== 主信息栏 ===== */
.master-bar{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:12px 16px;margin-bottom:10px;display:flex;flex-wrap:wrap;gap:6px 24px;font-size:13px}
.master-bar .item{display:flex;gap:4px}
.master-bar .item .lbl{color:#999}
.master-bar .item .val{color:#333;font-weight:500}
/* ===== Tabs ===== */
.tabs{border-bottom:2px solid #e0e0e0;display:flex;gap:2px;margin-bottom:10px;background:#fff;border-radius:8px 8px 0 0;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:0 12px}
.tabs .tab{padding:10px 18px;font-size:13px;color:#888;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:.2s;white-space:nowrap}
.tabs .tab:hover{color:#1a73e8}
.tabs .tab.active{color:#1a73e8;border-bottom-color:#1a73e8;font-weight:600}
.tab-content{display:none;background:#fff;border-radius:0 0 8px 8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:hidden}
.tab-content.active{display:block}
/* ===== 表格通用 ===== */
.table-wrap{overflow:auto;max-height:calc(100vh - 260px)}
table{min-width:100%;border-collapse:collapse;font-size:12px}
/* ===== 可拖动列 ===== */
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:7px 6px;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;overflow:hidden}
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:5px 6px;border:1px solid #ddd;color:#333;overflow:hidden;text-overflow:ellipsis}
tbody tr:hover{background:#f0f6ff}
.empty td{text-align:center;padding:32px;color:#bbb}
/* ===== 其他表格默认宽度 ===== */
.link-table th:nth-child(1){min-width:160px;width:160px}
.link-table th:nth-child(2){min-width:120px;width:120px}
.link-table th:nth-child(3){min-width:100px;width:100px}
.link-table th:nth-child(4){min-width:200px;width:200px}
.summary-table th:nth-child(1){min-width:48px;width:48px}
.summary-table th:nth-child(2){min-width:120px;width:120px}
.summary-table th:nth-child(3){min-width:150px;width:150px}
.summary-table th:nth-child(4){min-width:80px;width:80px}
.summary-table th:nth-child(5){min-width:80px;width:80px}
.summary-table th:nth-child(6){min-width:80px;width:80px}
.summary-table th:nth-child(7){min-width:110px;width:110px}
.summary-table th:nth-child(8){min-width:80px;width:80px}
.summary-table th:nth-child(9){min-width:130px;width:130px}
.summary-table th:nth-child(10){min-width:120px;width:120px}
/* ===== 维护表格 ===== */
.maint-table td,.maint-table th{padding:4px 5px;font-size:12px;overflow:hidden;text-overflow:ellipsis;border:1px solid #ddd}
.maint-table input,.maint-table select{width:100%;height:26px;padding:0 5px;border:1px solid #ddd;border-radius:3px;font-size:11px;outline:0;min-width:40px}
.maint-table input:focus,.maint-table select:focus{border-color:#1a73e8;box-shadow:0 0 0 2px rgba(26,115,232,.1)}
.maint-table input[type=number]{text-align:right}
.maint-table .fixed-col{min-width:48px;width:48px}
.maint-table .mat-code{min-width:110px}
.maint-table .mat-name{min-width:100px}
.maint-table .mat-spec{min-width:100px;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.maint-table .col-supplier{min-width:200px;width:200px}
.maint-table .col-dhrq{min-width:100px;width:100px}
.maint-table .col-ywzt{min-width:180px;width:180px}
.maint-table .col-jffxdj{min-width:120px;width:120px}
.maint-table .col-jfjz{min-width:120px;width:120px}
.maint-table .col-date{min-width:110px;width:110px}
.maint-table .col-price{min-width:120px;width:120px}
.maint-table thead th{white-space:nowrap;border-color:#999;border-bottom-width:2px}
.maint-toolbar{display:flex;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid #f0f0f0;}
.maint-toolbar .count{font-size:13px;color:#666}
.save-btn{height:28px;padding:0 16px;border:0;border-radius:4px;background:linear-gradient(135deg,#1a73e8,#1557b0);color:#fff;font-size:12px;font-weight:600;cursor:pointer;transition:.2s;margin-left:auto}
.save-btn:hover{opacity:.9}
.save-btn:disabled{opacity:.5;cursor:default}
/* ===== 联动表格 ===== */
.link-table td{padding:5px 6px;border:1px solid #ddd}
.link-table .oa-ref{display:inline-block;padding:1px 6px;border-radius:3px;background:#e8f0fe;color:#1a73e8;font-weight:600;font-size:11px;margin-right:4px}
.link-table .oa-ref:hover{background:#d2e3fc}
/* ===== 汇总表 ===== */
.summary-table td{padding:6px 8px;border:1px solid #ddd}
.status-badge{display:inline-block;padding:1px 8px;border-radius:10px;font-size:11px;font-weight:600}
.status-badge.completed{background:#e6f9ed;color:#1a7a3a}
.status-badge.partial{background:#fff8e1;color:#e67e22}
.status-badge.pending{background:#f0f0f0;color:#999}
/* ===== 加载/通知 ===== */
.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}
.loading-spinner{width:32px;height:32px;border:3px solid #e0e0e0;border-top-color:#1a73e8;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
.toast.info{background:#e3f2fd;color:#1565c0;display:block}
</style>
</head>
<body>
<div class="loading-overlay" id="loadingOverlay"><div class="loading-spinner"></div></div>
<div class="toast" id="toast"></div>
<div class="top-bar">
<a class="back" href="procurement.html">← 返回列表</a>
<span class="title" id="pageTitle">采购申请单详情</span>
<span class="user-info" id="userInfo" style="margin-left:auto;font-size:12px;opacity:.85;"></span>
</div>
<div class="main-container">
<div class="master-bar" id="masterBar"></div>
<div class="tabs">
<div class="tab active" data-tab="maintain" onclick="switchTab(this)">物料维护</div>
<div class="tab" data-tab="po" onclick="switchTab(this)">采购订单</div>
<div class="tab" data-tab="rn" onclick="switchTab(this)">收料通知</div>
<div class="tab" data-tab="summary" onclick="switchTab(this)">收货汇总</div>
</div>
<!-- 物料维护 Tab -->
<div class="tab-content active" id="tabMaintain">
<div id="maintContainer"></div>
</div>
<!-- 采购订单 Tab -->
<div class="tab-content" id="tabPo">
<div class="table-wrap"><table class="link-table">
<thead><tr><th>采购订单号<span class="resizer"></span></th><th>单据日期<span class="resizer"></span></th><th>转单时效(天)<span class="resizer"></span></th><th>对应申请单物料(行号)<span class="resizer"></span></th></tr></thead>
<tbody id="poBody"><tr class="empty"><td colspan="3">加载中...</td></tr></tbody>
</table></div>
</div>
<!-- 收料通知 Tab -->
<div class="tab-content" id="tabRn">
<div class="table-wrap"><table class="link-table">
<thead><tr><th>通知单号<span class="resizer"></span></th><th>单据日期<span class="resizer"></span></th><th>对应申请单物料(行号)<span class="resizer"></span></th></tr></thead>
<tbody id="rnBody"><tr class="empty"><td colspan="3">加载中...</td></tr></tbody>
</table></div>
</div>
<!-- 收货汇总 Tab -->
<div class="tab-content" id="tabSummary">
<div class="table-wrap"><table class="summary-table">
<thead><tr><th>行号<span class="resizer"></span></th><th>物料编码<span class="resizer"></span></th><th>物料名称<span class="resizer"></span></th><th>申请数量<span class="resizer"></span></th><th>已收数量<span class="resizer"></span></th><th>剩余数量<span class="resizer"></span></th><th>最近到货日期<span class="resizer"></span></th><th>状态<span class="resizer"></span></th><th>项目目标交付延期<span class="resizer"></span></th><th>标准交付延期<span class="resizer"></span></th></tr></thead>
<tbody id="summaryBody"><tr class="empty"><td colspan="8">加载中...</td></tr></tbody>
</table></div>
</div>
</div>
<script>
// ===== 业务状态映射 =====
function logout(){sessionStorage.removeItem('gx_user');window.location.href='login.html'}
var ywztMap={'1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回(无图纸/方案没确认)','7':'研发-采购申请撤回(改需求)','8':'研发-采购申请取消','9':'研发-量产复用件'};
var jffxdjMap={'1':'超高','2':'高','3':'中','4':'低','5':'已完成','6':'取消'};
var jfjzMap={'1':'整批交付','2':'分批交付','3':'取消'};
// ===== URL参数 =====
function getParams(){
var p={};location.search.substr(1).split('&').forEach(function(s){var kv=s.split('=');if(kv[0])p[decodeURIComponent(kv[0])]=decodeURIComponent(kv[1]||'')});
return p;
}
var params=getParams();
var lcbh=params.lcbh||'',djbh=params.djbh||'',requestId=params.requestId||'';
// ===== 工具 =====
function escapeHtml(s){if(!s)return '';var d=document.createElement('div');d.appendChild(document.createTextNode(String(s)));return d.innerHTML}
function showLoading(){document.getElementById('loadingOverlay').classList.add('show')}
function hideLoading(){document.getElementById('loadingOverlay').classList.remove('show')}
function showToast(msg,type){
var el=document.getElementById('toast');
el.textContent=msg;el.className='toast '+type;
clearTimeout(el._timer);el._timer=setTimeout(function(){el.className='toast'},3500);
}
// ===== 初始化主信息 =====
document.getElementById('pageTitle').textContent='流程编号:'+lcbh;
document.getElementById('masterBar').innerHTML=
'<div class="item"><span class="lbl">流程编号:</span><span class="val">'+escapeHtml(lcbh)+'</span></div>'+
'<div class="item"><span class="lbl">单据编号:</span><span class="val">'+escapeHtml(params.djbh||'')+'</span></div>'+
'<div class="item"><span class="lbl">申请日期:</span><span class="val">'+escapeHtml(params.sqrq||'')+'</span></div>'+
'<div class="item"><span class="lbl">研发项目:</span><span class="val">'+escapeHtml(params.yfxmmc||'')+'</span></div>'+
'<div class="item"><span class="lbl">专项名称:</span><span class="val">'+escapeHtml(params.reqName||'')+'</span></div>'+
'<div class="item"><span class="lbl">申请人:</span><span class="val">'+escapeHtml(params.sqrxm||'')+'</span></div>'+
'<div class="item"><span class="lbl">项目经理审批:</span><span class="val">'+escapeHtml(params.pmTime||'')+'</span></div>';
// ===== Tab切换 =====
function switchTab(el){
document.querySelectorAll('.tabs .tab').forEach(function(t){t.classList.remove('active')});
el.classList.add('active');
var tab=el.getAttribute('data-tab');
document.querySelectorAll('.tab-content').forEach(function(c){c.classList.remove('active')});
document.getElementById('tab'+tab.charAt(0).toUpperCase()+tab.slice(1)).classList.add('active');
}
// ===== 加载数据 =====
var detailItems=[];
var trace={summary:[],receiveNotices:[],traceDetails:[],purchaseOrders:[]};
var poList=[];
function loadAll(){
showLoading();
var done=0;
function checkDone(){
done++;
if(done>=3){hideLoading();renderMaintain();bindAutoCalc();renderPO();renderRN();renderSummary();}
}
// 加载物料明细
var x1=new XMLHttpRequest();
x1.open('GET','api/Procurement/GetRequestDetail?requestId='+encodeURIComponent(requestId||lcbh),true);
x1.onload=function(){
try{var r=JSON.parse(x1.responseText);if(r.success)detailItems=r.data||[]}catch(e){}
checkDone();
};
x1.onerror=function(){checkDone()};
x1.send();
// 加载追溯汇总
var x2=new XMLHttpRequest();
x2.open('GET','api/Procurement/GetTraceSummary?reqBillNo='+encodeURIComponent(djbh),true);
x2.onload=function(){
try{var r=JSON.parse(x2.responseText);if(r.success){trace.summary=r.summary||[];trace.receiveNotices=r.receiveNotices||[];trace.traceDetails=r.traceDetails||[];trace.purchaseOrders=r.purchaseOrders||[]}}catch(e){}
checkDone();
};
x2.onerror=function(){checkDone()};
x2.send();
// 加载采购订单(含转单时效)
var x3=new XMLHttpRequest();
x3.open('GET','api/Procurement/GetPurchaseOrders?reqBillNo='+encodeURIComponent(djbh)+'&pmAuditTime='+encodeURIComponent(params.pmTime||''),true);
x3.onload=function(){
try{var r=JSON.parse(x3.responseText);if(r.success)poList=r.data||[]}catch(e){}
checkDone();
};
x3.onerror=function(){checkDone()};
x3.send();
}
// ===== 渲染物料维护表格 =====
function renderMaintain(){
var container=document.getElementById('maintContainer');
if(!detailItems||!detailItems.length){
container.innerHTML='<div style="padding:32px;text-align:center;color:#bbb">暂无物料明细</div>';
return;
}
var sumOne=0,sumTwo=0;
detailItems.forEach(function(item){sumOne+=parseFloat(item.onezje)||0;sumTwo+=parseFloat(item.twozje)||0});
var h='<div class="maint-toolbar"><span class="count">共 <strong>'+detailItems.length+'</strong> 行物料明细</span><span style="margin-left:16px;font-size:12px;color:#1a73e8;font-weight:600">第一轮总金额合计: <span id="sumOneVal">'+sumOne.toFixed(2)+'</span> | 第二轮总金额合计: <span id="sumTwoVal">'+sumTwo.toFixed(2)+'</span></span><button class="save-btn" onclick="saveMaintain()">保存维护</button></div>';
h+='<div class="table-wrap"><table class="maint-table">';
var ths=[
{text:'#',cls:'fixed-col'},
{text:'物料编码',cls:'mat-code'},
{text:'物料名称',cls:'mat-name'},
{text:'规格型号',cls:'mat-spec'},
{text:'数量',cls:'fixed-col'},
{text:'要求交付日期',cls:'col-dhrq'},
{text:'物料标准L/T',cls:''},
{text:'第一轮报价',cls:'col-price'},{text:'第一轮总金额',cls:'col-price'},{text:'第二轮报价',cls:'col-price'},{text:'第二轮总金额',cls:'col-price'},
{text:'供应商',cls:'col-supplier'},
{text:'策略采购负责人',cls:''},{text:'研发采购负责人',cls:''},
{text:'业务状态',cls:'col-ywzt'},
{text:'交付风险',cls:'col-jffxdj'},
{text:'交付节奏',cls:'col-jfjz'},
{text:'计划交付日期(策略采购)',cls:'col-date'},
{text:'计划交付日期(研发采购)',cls:'col-date'}
];
h+='<thead><tr>';
ths.forEach(function(t){h+='<th class="'+t.cls+'">'+t.text+'<span class="resizer"></span></th>'});
h+='</tr></thead><tbody>';
detailItems.forEach(function(item,idx){
h+='<tr>'+
'<td>'+escapeHtml(item.xh)+'</td>'+
'<td>'+escapeHtml(item.wlbmCode)+'</td>'+
'<td class="mat-name" title="'+escapeHtml(item.wlmc)+'">'+escapeHtml(item.wlmc)+'</td>'+
'<td class="mat-spec" title="'+escapeHtml(item.wlgg)+'">'+escapeHtml(item.wlgg)+'</td>'+
'<td>'+escapeHtml(item.sqsl)+'</td>'+
'<td>'+escapeHtml(item.dhrq)+'</td>'+
'<td><input class="f-wlbz" value="'+escapeHtml(item.wlbz)+'" /></td>'+
'<td class="td-sqsl" data-sqsl="'+escapeHtml(item.sqsl)+'"><input type="number" step="0.01" class="f-onebj" value="'+escapeHtml(item.onebj)+'" /></td>'+
'<td><input type="number" step="0.01" class="f-onezje" value="'+escapeHtml(item.onezje)+'" readonly style="background:#f5f5f5;cursor:default" /></td>'+
'<td><input type="number" step="0.01" class="f-twobj" value="'+escapeHtml(item.twobj)+'" /></td>'+
'<td><input type="number" step="0.01" class="f-twozje" value="'+escapeHtml(item.twozje)+'" readonly style="background:#f5f5f5;cursor:default" /></td>'+
'<td><input class="f-gys" value="'+escapeHtml(item.gys)+'" /></td>'+
'<td><input class="f-cncgfzr" value="'+escapeHtml(item.cncgfzr)+'" /></td>'+
'<td><input class="f-yfcgfzr" value="'+escapeHtml(item.yfcgfzr)+'" /></td>'+
'<td><select class="f-ywzt">'+optHtml(ywztMap,item.ywzt)+'</select></td>'+
'<td><select class="f-jffxdj">'+optHtml(jffxdjMap,item.jffxdj)+'</select></td>'+
'<td><select class="f-jfjz">'+optHtml(jfjzMap,item.jfjz)+'</select></td>'+
'<td><input type="date" class="f-cnjhjfrq" value="'+escapeHtml(item.cnjhjfrq)+'" /></td>'+
'<td><input type="date" class="f-yfjhjfrq" value="'+escapeHtml(item.yfjhjfrq)+'" /></td>'+
'</tr>';
});
h+='</tbody></table></div>';
container.innerHTML=h;
}
function optHtml(map,selected){var h='<option value="">--</option>';for(var k in map)h+='<option value="'+k+'" '+(selected===k?'selected':'')+'>'+map[k]+'</option>';return h}
// ===== 自动计算总金额 =====
function bindAutoCalc(){
document.querySelectorAll('.maint-table tbody tr').forEach(function(row){
var sqsl=parseFloat(row.querySelector('.td-sqsl')?.getAttribute('data-sqsl'))||0;
var onebj=row.querySelector('.f-onebj'),onezje=row.querySelector('.f-onezje');
var twobj=row.querySelector('.f-twobj'),twozje=row.querySelector('.f-twozje');
onebj.addEventListener('input',function(){onezje.value=(parseFloat(this.value)||0)*sqsl;updateSummaryTotals()});
twobj.addEventListener('input',function(){twozje.value=(parseFloat(this.value)||0)*sqsl;updateSummaryTotals()});
});
}
function updateSummaryTotals(){
var s1=0,s2=0;
document.querySelectorAll('.maint-table tbody tr').forEach(function(row){
s1+=parseFloat(row.querySelector('.f-onezje')?.value)||0;
s2+=parseFloat(row.querySelector('.f-twozje')?.value)||0;
});
var el1=document.getElementById('sumOneVal'),el2=document.getElementById('sumTwoVal');
if(el1)el1.textContent=s1.toFixed(2);
if(el2)el2.textContent=s2.toFixed(2);
}
// ===== 保存维护 =====
function saveMaintain(){
var items=[];
var rows=document.querySelectorAll('.maint-table tbody tr');
if(!rows||!rows.length)return;
rows.forEach(function(row,idx){
var item=detailItems[idx];
if(!item)return;
items.push({
id:item.id,
wlbz:row.querySelector('.f-wlbz').value,
onebj:row.querySelector('.f-onebj').value||'0',
onezje:row.querySelector('.f-onezje').value||'0',
twobj:row.querySelector('.f-twobj').value||'0',
twozje:row.querySelector('.f-twozje').value||'0',
gys:row.querySelector('.f-gys').value,
cncgfzr:row.querySelector('.f-cncgfzr').value,
yfcgfzr:row.querySelector('.f-yfcgfzr').value,
ywzt:row.querySelector('.f-ywzt').value||'0',
jffxdj:row.querySelector('.f-jffxdj').value||'0',
jfjz:row.querySelector('.f-jfjz').value||'0',
cnjhjfrq:row.querySelector('.f-cnjhjfrq').value,
yfjhjfrq:row.querySelector('.f-yfjhjfrq').value
});
});
showLoading();
var btn=document.querySelector('.save-btn');
btn.disabled=true;btn.textContent='保存中...';
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/SaveDetail',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();btn.disabled=false;btn.textContent='保存维护';
try{var r=JSON.parse(xhr.responseText);showToast(r.success?'保存成功':r.message||'保存失败',r.success?'success':'error')}catch(e){showToast('响应异常','error')}
};
xhr.onerror=function(){hideLoading();btn.disabled=false;btn.textContent='保存维护';showToast('网络请求失败','error')};
xhr.send(JSON.stringify({items:items}));
}
// ===== 渲染追溯关联数据 =====
function renderTrace(){
renderPO();
renderRN();
renderSummary();
}
// ---- 采购订单(关联物料行号+转单时效) ----
function renderPO(){
var tbody=document.getElementById('poBody');
var details=trace.traceDetails||[];
// 建立PO号→transferDays映射
var transferMap={};
var poDateMap={};
poList.forEach(function(po){
if(po.FBILLNO){transferMap[po.FBILLNO]=po.transferDays;poDateMap[po.FBILLNO]=po.FDATE}
});
// 按PO分组
var poMap={};
details.forEach(function(d){
var key=d.poBillNo;
if(!key)return;
if(!poMap[key])poMap[key]={billNo:key,date:'',transferDays:0,oaRows:[]};
// 从 poList 中取 PO 自己的单据日期
var poDate=poDateMap[key];
if(!poMap[key].date&&poDate)poMap[key].date=poDate;
var xh=d.oaXh;
if(xh&&poMap[key].oaRows.indexOf(xh)<0)poMap[key].oaRows.push(xh);
});
// 补充1:GetPurchaseOrders 直接查到的PO(追溯缺失时也能显示)
poList.forEach(function(po){
var key=po.FBILLNO;
if(!key)return;
if(!poMap[key]){
poMap[key]={billNo:key,date:po.FDATE||'',transferDays:po.transferDays||0,oaRows:[]};
}else{
if(!poMap[key].date&&po.FDATE)poMap[key].date=po.FDATE;
}
});
// 补充2:trace.purchaseOrders(GetTraceSummary 返回的PO号,追溯缺失兜底)
(trace.purchaseOrders||[]).forEach(function(billNo){
if(!billNo)return;
if(!poMap[billNo]){
poMap[billNo]={billNo:billNo,date:'',transferDays:0,oaRows:[]};
}
});
var list=Object.keys(poMap).map(function(k){return poMap[k]});
if(!list.length){
tbody.innerHTML='<tr class="empty"><td colspan="4">暂无采购订单</td></tr>';
return;
}
var h='';
list.forEach(function(item){
if(transferMap[item.billNo]!==undefined)item.transferDays=transferMap[item.billNo];
h+='<tr><td><strong>'+escapeHtml(item.billNo)+'</strong></td><td>'+escapeHtml(item.date)+'</td>';
h+='<td>'+escapeHtml(item.transferDays)+'</td>';
h+='<td>';
item.oaRows.forEach(function(xh){
h+='<span class="oa-ref" title="对应第'+xh+'行物料">第'+xh+'行</span>';
});
h+='</td></tr>';
});
tbody.innerHTML=h;
}
// ---- 收料通知(关联物料行号) ----
function renderRN(){
var tbody=document.getElementById('rnBody');
var details=trace.traceDetails||[];
// 按RN分组
var rnMap={};
details.forEach(function(d){
var key=d.rnBillNo;
if(!key)return;
if(!rnMap[key])rnMap[key]={billNo:key,date:d.rnDate||'',oaRows:[]};
var xh=d.oaXh;
if(xh&&rnMap[key].oaRows.indexOf(xh)<0)rnMap[key].oaRows.push(xh);
});
var list=Object.keys(rnMap).map(function(k){return rnMap[k]});
if(!list.length){
tbody.innerHTML='<tr class="empty"><td colspan="3">暂无收料通知</td></tr>';
return;
}
var h='';
list.forEach(function(item){
h+='<tr><td><strong>'+escapeHtml(item.billNo)+'</strong></td><td>'+escapeHtml(item.date)+'</td><td>';
item.oaRows.forEach(function(xh){
h+='<span class="oa-ref" title="对应第'+xh+'行物料">第'+xh+'行</span>';
});
h+='</td></tr>';
});
tbody.innerHTML=h;
}
// ---- 收货汇总(无规格型号+延期天数) ----
function renderSummary(){
var tbody=document.getElementById('summaryBody');
var data=trace.summary||[];
if(!data.length){
tbody.innerHTML='<tr class="empty"><td colspan="10">暂无汇总数据</td></tr>';
return;
}
var h='';
data.forEach(function(item){
var sc='pending';
if(item.status==='已完成')sc='completed';
else if(item.status==='部分收货')sc='partial';
h+='<tr>'+
'<td>'+escapeHtml(item.xh)+'</td>'+
'<td>'+escapeHtml(item.wlbmCode)+'</td>'+
'<td>'+escapeHtml(item.wlmc)+'</td>'+
'<td>'+escapeHtml(item.sqsl)+'</td>'+
'<td><strong>'+escapeHtml(item.yssl)+'</strong></td>'+
'<td>'+escapeHtml(item.syst)+'</td>'+
'<td>'+escapeHtml(item.latestReceiveDate)+'</td>'+
'<td><span class="status-badge '+sc+'">'+escapeHtml(item.status)+'</span></td>'+
'<td>'+(item.projectDelay!==undefined?item.projectDelay:0)+'</td>'+
'<td>'+(item.stdDelay!==undefined?item.stdDelay:0)+'</td>'+
'</tr>';
});
tbody.innerHTML=h;
}
// ===== 列宽拖动(事件委托,支持动态生成的表格) =====
(function(){
var resizeTarget=null,startX=0,startWidth=0,startIdx=0,startTable=null;
document.addEventListener('mousedown',function(e){
var resizer=e.target.closest('.resizer');
if(!resizer)return;
var th=resizer.parentElement;
if(!th||th.tagName!='TH')return;
resizeTarget=th;
startX=e.clientX;
startWidth=th.offsetWidth;
startTable=th.closest('table');
startIdx=Array.prototype.indexOf.call(th.parentNode.children,th);
document.body.style.cursor='col-resize';
e.preventDefault();
});
document.addEventListener('mousemove',function(e){
if(!resizeTarget)return;
var diff=e.clientX-startX;
var newWidth=Math.max(40,startWidth+diff);
resizeTarget.style.width=newWidth+'px';
resizeTarget.style.minWidth=newWidth+'px';
resizeTarget.style.maxWidth='none';
if(startTable){
startTable.querySelectorAll('tbody tr').forEach(function(tr){
var td=tr.children[startIdx];
if(td)td.style.width=newWidth+'px';
});
}
});
document.addEventListener('mouseup',function(){
if(resizeTarget){
resizeTarget=null;
startTable=null;
document.body.style.cursor='';
}
});
})();
// ===== 启动 =====
// ===== 登录校验 =====
(function(){if(!sessionStorage.getItem('gx_user')){window.location.href='login.html';return};try{var u=JSON.parse(sessionStorage.getItem('gx_user'));var r=u.roleNumbers||[];document.getElementById('userInfo').innerHTML=(u.userName||u.userId)+' | <a href="javascript:void(0)" onclick="logout()" style="color:rgba(255,255,255,.75);text-decoration:none;margin-left:8px;font-size:12px;">退出</a>';if(r.indexOf('Purchase01')<0&&r.indexOf('CRM01')<0&&r.indexOf('YF01')<0){alert('当前用户无权限');window.location.href='login.html'}}catch(e){alert('当前用户无权限');window.location.href='login.html'}})();
loadAll();
</script>
</body>
</html>
@@ -0,0 +1,325 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>生产计划排程看板</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="../common/nav.css">
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:'Microsoft YaHei','PingFang SC',sans-serif;background:#f0f2f5;min-height:100vh}
.main-content{max-width:100%;margin:0 auto;padding:16px 20px}
.panel{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:16px;margin-bottom:14px}
.panel h3{font-size:15px;color:#333;font-weight:600;margin-bottom:4px}
.panel .sub{font-size:12px;color:#94a3b8;margin-bottom:12px}
.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.toolbar select,.toolbar input{height:32px;padding:0 10px;border:2px solid #e0e0e0;border-radius:5px;font-size:13px;outline:none}
.toolbar select:focus,.toolbar input:focus{border-color:#1a73e8}
.btn{height:32px;padding:0 16px;border:none;border-radius:5px;font-size:12px;font-weight:600;cursor:pointer;transition:all .2s;color:#fff}
.btn-primary{background:linear-gradient(135deg,#1a73e8,#1557b0)}
.btn-primary:hover{opacity:.92}
.btn-outline{background:#fff;color:#666;border:2px solid #e0e0e0}
.btn-outline:hover{border-color:#1a73e8;color:#1a73e8}
.toast{position:fixed;top:14px;left:50%;transform:translateX(-50%);padding:10px 22px;border-radius:8px;font-size:13px;z-index:1001;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}
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
.badge{display:inline-block;padding:2px 10px;border-radius:12px;font-size:12px;font-weight:500}
.badge-success{background:#dcfce7;color:#166534}
.badge-warning{background:#fef3c7;color:#92400e}
.badge-info{background:#dbeafe;color:#1e40af}
.badge-muted{background:#f1f5f9;color:#64748b}
/* ===== 看板:左侧固定信息列 + 右侧横向日期甘特 ===== */
.board-wrap{overflow:auto;border:1px solid #e2e8f0;border-radius:8px;background:#fff;max-height:75vh}
.board-table{border-collapse:separate;border-spacing:0;font-size:12px;min-width:100%}
.board-table thead th{position:sticky;top:0;z-index:4;background:#f8f9fa;color:#555;font-weight:600;padding:9px 10px;text-align:center;border-bottom:2px solid #cbd5e1;border-right:1px solid #e2e8f0;white-space:nowrap}
.board-table tbody td{padding:7px 10px;border-bottom:1px solid #f1f5f9;border-right:1px solid #f1f5f9;color:#334155;text-align:center}
.board-table tbody tr:hover{background:#f0f6ff}
/* 左侧信息列固定 */
.col-fix1{position:sticky;left:0;z-index:3;background:#fff;text-align:left!important;min-width:110px;box-shadow:1px 0 0 #e2e8f0}
thead .col-fix1{background:#f8f9fa;z-index:5}
.col-fix2{position:sticky;left:110px;z-index:3;background:#fff;text-align:left!important;min-width:130px;box-shadow:1px 0 0 #e2e8f0}
thead .col-fix2{background:#f8f9fa;z-index:5}
.col-fix3{position:sticky;left:240px;z-index:3;background:#fff;text-align:left!important;min-width:150px;box-shadow:1px 0 0 #e2e8f0}
thead .col-fix3{background:#f8f9fa;z-index:5}
.col-fix4{position:sticky;left:390px;z-index:3;background:#fff;text-align:left!important;min-width:150px;box-shadow:1px 0 0 #e2e8f0}
thead .col-fix4{background:#f8f9fa;z-index:5}
.board-table tbody tr:hover .col-fix1,
.board-table tbody tr:hover .col-fix2,
.board-table tbody tr:hover .col-fix3,
.board-table tbody tr:hover .col-fix4{background:#f0f6ff}
/* 合计行 */
.board-table tbody tr.total-row{background:#fef3c7;font-weight:600}
.board-table tbody tr.total-row td{color:#92400e}
.board-table tbody tr.type-row{background:#f1f5f9;font-weight:600}
.board-table tbody tr.type-row td{color:#475569}
/* 日期格子 */
.cell-date{text-align:center;padding:4px 2px;min-width:44px}
.cell-date .day{font-size:10px;color:#94a3b8;display:block;margin-bottom:2px}
.cell-date .qty{display:inline-block;min-width:30px;padding:2px 6px;border-radius:4px;font-size:12px;font-weight:600;color:#fff;background:transparent}
.cell-date.has .qty{background:linear-gradient(135deg,#3b82f6,#2563eb)}
.cell-date.today{background:#fef9c3}
.weekend{background:#fafbfc}
.legend{display:flex;gap:16px;align-items:center;font-size:12px;color:#64748b;margin-top:8px}
.legend .dot{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:4px;vertical-align:middle}
.legend .dot.blue{background:#3b82f6}
.legend .dot.yellow{background:#fef9c3;border:1px solid #eab308}
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="panel">
<h3>生产计划排程 - 看板</h3>
<div class="sub">横向展示各排程在每日的产量分布(数据来源:生产计划排程)</div>
<div class="toolbar">
<select id="selFactory" style="min-width:120px"><option value="">工厂:全部</option></select>
<select id="selProductType" style="min-width:120px"><option value="">产品类型:全部</option></select>
<select id="selRegion" style="min-width:120px"><option value="">区域:全部</option></select>
<select id="selCountry" style="min-width:120px"><option value="">国家:全部</option></select>
<select id="selStatus" style="min-width:100px">
<option value="">状态:全部</option>
<option value="待开始">待开始</option>
<option value="进行中">进行中</option>
<option value="已完成">已完成</option>
<option value="已暂停">已暂停</option>
</select>
<input type="text" id="txtKeyword" placeholder="搜索 产品编码 / 产品名称" style="width:200px">
<button class="btn btn-primary" onclick="renderBoard()">查询</button>
<button class="btn btn-outline" onclick="resetFilter()">重置</button>
<div style="flex:1"></div>
<button class="btn btn-outline" onclick="location.reload()">🔄 刷新</button>
</div>
<div class="board-wrap">
<table class="board-table" id="boardTable">
<thead id="boardHead"></thead>
<tbody id="boardBody"></tbody>
</table>
</div>
<div class="legend">
<span><span class="dot blue"></span>有排产量</span>
<span><span class="dot yellow"></span>今天</span>
<span id="legendTotal"></span>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
<script>
var boardData=[];
var dateList=[];
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'},3000)}
function api(url,method,data,cb){
var opts={method:method||'GET',headers:{'Content-Type':'application/json'}};
if(data)opts.body=JSON.stringify(data);
fetch(url,opts).then(function(r){return r.json()}).then(function(res){
if(res&&res.success===false){toast(res.message||'操作失败','error');return}
cb&&cb(res);
}).catch(function(e){toast('请求失败:'+e.message,'error')});
}
function getApiUrl(){return '../../api/deliver/'}
// 生成本月的所有日期(yyyy-MM-dd,1号到月末)
function buildMonthDates(){
var arr=[];
var now=new Date();
var y=now.getFullYear(),m=now.getMonth();
var first=new Date(y,m,1);
var last=new Date(y,m+1,0); // 下月0号 = 本月最后一天
var s=first;
while(s<=last){
var yy=s.getFullYear(),mm=('0'+(s.getMonth()+1)).slice(-2),dd=('0'+s.getDate()).slice(-2);
arr.push(yy+'-'+mm+'-'+dd);
s=new Date(s.getTime()+86400000);
}
return arr;
}
function fmtDate(d){
if(!d)return '';
var dt=new Date(d);
if(isNaN(dt.getTime()))return d;
return dt.getFullYear()+'-'+('0'+(dt.getMonth()+1)).slice(-2)+'-'+('0'+dt.getDate()).slice(-2);
}
function isWeekend(dateStr){
var d=new Date(dateStr);
var w=d.getDay();
return w===0||w===6;
}
function todayStr(){return fmtDate(new Date())}
// 从数据提取筛选选项
function fillFilters(){
var f={},pt={},rg={},ct={};
boardData.forEach(function(row){
if(row.Factory){f[row.Factory]=1}
if(row.ProductType){pt[row.ProductType]=1}
if(row.Region){rg[row.Region]=1}
if(row.Country){ct[row.Country]=1}
});
function fill(id,map,label){
var el=document.getElementById(id);
var cur=el.value;
var h='<option value="">'+label+':全部</option>';
Object.keys(map).sort().forEach(function(k){h+='<option value="'+k+'">'+k+'</option>'});
el.innerHTML=h;
el.value=cur;
}
fill('selFactory',f,'工厂');
fill('selProductType',pt,'产品类型');
fill('selRegion',rg,'区域');
fill('selCountry',ct,'国家');
}
// 渲染看板
function renderBoard(){
var kw=(document.getElementById('txtKeyword').value||'').trim().toLowerCase();
var f=document.getElementById('selFactory').value;
var pt=document.getElementById('selProductType').value;
var rg=document.getElementById('selRegion').value;
var ct=document.getElementById('selCountry').value;
var st=document.getElementById('selStatus').value;
var rows=boardData.filter(function(row){
if(f&&row.Factory!==f)return false;
if(pt&&row.ProductType!==pt)return false;
if(rg&&row.Region!==rg)return false;
if(ct&&row.Country!==ct)return false;
if(st&&row.Status!==st)return false;
if(kw){
var code=(row.ProductCode||'').toLowerCase();
var name=(row.ProductName||'').toLowerCase();
if(code.indexOf(kw)<0&&name.indexOf(kw)<0)return false;
}
return true;
});
// 按产品类型分组排序
var typeOrder={};
var types=[];
rows.forEach(function(row){
var t=row.ProductType||'(未分类)';
if(!(t in typeOrder)){typeOrder[t]=[];types.push(t)}
typeOrder[t].push(row);
});
types.sort();
var today=todayStr();
// 表头:工厂 / 产品类型 / 区域 / 国家 / 产品编码BOM / 产品名称 / 总产量 / 日期列
var headHtml='<tr>';
headHtml+='<th class="col-fix" style="min-width:90px">工厂</th>';
headHtml+='<th class="col-fix-info" style="left:90px;min-width:100px">产品类型</th>';
headHtml+='<th class="col-fix-info" style="left:190px;min-width:100px">区域</th>';
headHtml+='<th class="col-fix-info" style="left:290px;min-width:100px">国家</th>';
headHtml+='<th class="col-fix-info" style="left:390px;min-width:120px">产品编码 / BOM</th>';
headHtml+='<th class="col-fix-info" style="left:510px;min-width:130px">产品名称</th>';
headHtml+='<th>总产量</th>';
dateList.forEach(function(d){
var cls='cell-date';
if(isWeekend(d))cls+=' weekend';
if(d===today)cls+=' today';
var label=d.slice(5);
headHtml+='<th class="'+cls+'">'+label+'</th>';
});
headHtml+='</tr>';
document.getElementById('boardHead').innerHTML=headHtml;
// 表体
var bodyHtml='';
var totalRowCount=0;
if(rows.length===0){
bodyHtml='<tr><td colspan="'+(7+dateList.length)+'" style="text-align:center;padding:36px;color:#bbb">暂无数据</td></tr>';
}
// 每组:先列明细行,最后加一行"产品类型合计"
types.forEach(function(t){
var group=typeOrder[t];
// 明细行
group.forEach(function(row){
var stCls=row.Status==='进行中'?'badge-success':(row.Status==='待开始'?'badge-warning':(row.Status==='已完成'?'badge-info':'badge-muted'));
var dailyMap={};
(row.Daily||[]).forEach(function(d){dailyMap[d.PlanDate]=Number(d.DailyOutput)||0});
bodyHtml+='<tr>';
bodyHtml+='<td class="col-fix">'+row.Factory+'</td>';
bodyHtml+='<td class="col-fix-info" style="left:90px">'+row.ProductType+'</td>';
bodyHtml+='<td class="col-fix-info" style="left:190px">'+row.Region+'</td>';
bodyHtml+='<td class="col-fix-info" style="left:290px">'+row.Country+'</td>';
bodyHtml+='<td class="col-fix-info" style="left:390px"><div style="font-weight:600">'+row.ProductCode+'</div><div style="font-size:11px;color:#94a3b8">'+row.BOMVersion+'</div></td>';
bodyHtml+='<td class="col-fix-info" style="left:510px">'+row.ProductName+'</td>';
bodyHtml+='<td style="font-weight:600">'+(row.TotalOutput||0)+'</td>';
dateList.forEach(function(d){
var cls='cell-date';
if(isWeekend(d))cls+=' weekend';
if(d===today)cls+=' today';
var q=dailyMap[d];
if(q>0)cls+=' has';
bodyHtml+='<td class="'+cls+'"><span class="qty">'+(q>0?q:'')+'</span></td>';
});
bodyHtml+='</tr>';
totalRowCount++;
});
// 合计行(该产品类型下所有排程按日汇总 + 总产量合计)
var sumDaily={},sumTotal=0;
group.forEach(function(row){
(row.Daily||[]).forEach(function(d){
var dd=d.PlanDate, v=Number(d.DailyOutput)||0;
sumDaily[dd]=(sumDaily[dd]||0)+v;
sumTotal+=v;
});
});
bodyHtml+='<tr class="sum-row" style="background:#eef4ff;font-weight:600">';
bodyHtml+='<td class="col-fix" style="background:#eef4ff"></td>';
bodyHtml+='<td class="col-fix-info" style="left:90px;background:#eef4ff">'+t+' 合计</td>';
bodyHtml+='<td class="col-fix-info" style="left:190px;background:#eef4ff"></td>';
bodyHtml+='<td class="col-fix-info" style="left:290px;background:#eef4ff"></td>';
bodyHtml+='<td class="col-fix-info" style="left:390px;background:#eef4ff"></td>';
bodyHtml+='<td class="col-fix-info" style="left:510px;background:#eef4ff"></td>';
bodyHtml+='<td style="background:#eef4ff;font-weight:700">'+sumTotal+'</td>';
dateList.forEach(function(d){
var cls='cell-date';
if(isWeekend(d))cls+=' weekend';
if(d===today)cls+=' today';
var q=sumDaily[d]||0;
if(q>0)cls+=' has';
bodyHtml+='<td class="'+cls+'" style="background:#eef4ff"><span class="qty">'+(q>0?q:'')+'</span></td>';
});
bodyHtml+='</tr>';
});
document.getElementById('boardBody').innerHTML=bodyHtml;
document.getElementById('legendTotal').textContent='共 '+totalRowCount+' 条排程,'+types.length+' 个产品类型';
}
function resetFilter(){
document.getElementById('txtKeyword').value='';
document.getElementById('selFactory').value='';
document.getElementById('selProductType').value='';
document.getElementById('selRegion').value='';
document.getElementById('selCountry').value='';
document.getElementById('selStatus').value='';
renderBoard();
}
// 加载看板数据
function loadBoard(){
api(getApiUrl()+'GetScheduleBoard','GET',null,function(res){
boardData=res.data||[];
dateList=buildMonthDates(); // 本月所有日期
fillFilters();
renderBoard();
});
}
loadBoard();
</script>
<!-- 公共侧边栏组件(菜单维护点:View/common/nav.js) -->
<script src="../common/nav.js"></script>
</body>
</html>
@@ -0,0 +1,489 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OA研发物料采购申请管理</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 24px;
display: flex;
align-items: center;
height: 56px;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
position: sticky;
top: 0;
z-index: 100;
}
.top-bar .logo { font-size: 18px; font-weight: 600; letter-spacing: 1px; margin-right: 32px; }
.top-bar .nav-tabs { display: flex; gap: 4px; height: 100%; }
.top-bar .nav-tabs a {
color: rgba(255,255,255,0.75);
text-decoration: none;
padding: 0 20px;
display: flex;
align-items: center;
font-size: 14px;
border-radius: 4px 4px 0 0;
transition: all 0.2s;
}
.top-bar .nav-tabs a:hover { color: #fff; background: rgba(255,255,255,0.1); }
.top-bar .nav-tabs a.active { color: #fff; background: rgba(255,255,255,0.2); }
.top-bar .user-info { margin-left: auto; font-size: 13px; opacity: 0.85; }
/* ===== 主容器 ===== */
.main-container { max-width: 1500px; margin: 0 auto; padding: 16px 20px; }
/* ===== 查询栏 ===== */
.search-bar {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
padding: 12px 16px; margin-bottom: 12px;
display: grid; grid-template-columns: repeat(4,1fr); gap: 8px 14px; align-items:center;
}
.search-bar label { font-size: 12px; color: #555; font-weight: 600; white-space: nowrap; }
.search-bar .field{display:inline-flex;align-items:center;gap:4px}
.search-bar input,.search-bar select {
height: 32px; padding: 0 10px; border: 2px solid #e0e0e0; border-radius: 5px;
font-size: 13px; outline: none; transition: border-color 0.2s; box-sizing:border-box;
}
.search-bar .field input{flex:1;min-width:0}
.search-bar input:focus,.search-bar select:focus{border-color:#1a73e8}
.search-bar .btn {
height: 32px; padding: 0 16px; border: none; border-radius: 5px;
font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.search-bar .btn-primary { background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff; }
.search-bar .btn-primary:hover { opacity: 0.92; }
.search-bar .btn-outline { background: #fff; color: #666; border: 2px solid #e0e0e0; }
.search-bar .btn-outline:hover { border-color: #1a73e8; color: #1a73e8; }
/* ===== 内容区(列表+详情) ===== */
.content-area { display: flex; gap: 14px; min-height: 600px; }
/* ===== 列表卡片 ===== */
.list-card {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.list-card .card-header {
padding: 12px 20px; border-bottom: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center;
}
.list-card .card-header h3 { font-size: 15px; color: #333; font-weight: 600; }
.list-card .card-header .count { font-size: 13px; color: #999; }
.list-card .card-header .count em { font-style: normal; color: #1a73e8; font-weight: 700; }
.table-wrap { overflow-x: auto; flex: 1; }
table { min-width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
background: #f8f9fa; color: #555; font-weight: 600;
padding: 9px 12px; text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 9px 12px; border: 1px solid #ddd; color: #333; }
tbody tr { transition: background 0.15s; cursor: pointer; }
tbody tr:hover { background: #f0f6ff; }
tbody tr.active { background: #e8f0fe; }
.empty-row td { text-align: center; padding: 36px; color: #bbb; font-size: 14px; }
.table-wrap { overflow-y: auto; max-height: calc(100vh - 280px); }
.row-chk { width: 18px; height: 18px; cursor: pointer; vertical-align: middle; }
td:first-child { text-align: center; }
/* ===== 分页 ===== */
.pagination {
padding: 10px 20px; border-top: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #666;
}
.pagination .page-btns { display: flex; gap: 4px; }
.pagination .page-btns button {
min-width: 30px; height: 30px; border: 1px solid #e0e0e0; border-radius: 4px;
background: #fff; color: #333; cursor: pointer; font-size: 12px; transition: all 0.15s;
}
.pagination .page-btns button:hover { border-color: #1a73e8; color: #1a73e8; }
.pagination .page-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.pagination .page-btns button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .size-btns button {
min-width: 40px; height: 24px; border: 1px solid #e0e0e0; border-radius: 3px;
background: #fff; color: #666; cursor: pointer; font-size: 11px; transition: all 0.15s; margin: 0 1px;
}
.pagination .size-btns button:hover { border-color: #1a73e8; color: #1a73e8; }
.pagination .size-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
/* ===== 详情侧栏 ===== */
.detail-panel {
background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
width: 0; overflow: hidden; transition: width 0.3s ease;
display: flex; flex-direction: column;
}
.detail-panel.open { width: 620px; min-width: 620px; }
.detail-panel .panel-header {
padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
display: flex; justify-content: space-between; align-items: center;
}
.detail-panel .panel-header h3 { font-size: 14px; color: #333; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-panel .panel-header .close-btn {
width: 26px; height: 26px; border: none; background: #f5f5f5; border-radius: 4px;
cursor: pointer; font-size: 15px; color: #999;
display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0;
}
.detail-panel .panel-header .close-btn:hover { background: #fee; color: #e74c3c; }
.detail-panel .panel-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
/* ===== 主信息区 ===== */
.master-info {
display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px;
padding: 10px 14px; background: #fafbfc; border-radius: 6px; margin-bottom: 12px;
}
.master-info .info-row { display: flex; font-size: 12px; }
.master-info .info-row .lbl { color: #999; width: 80px; flex-shrink: 0; }
.master-info .info-row .val { color: #333; font-weight: 500; }
/* ===== Tabs ===== */
.detail-tabs {
display: flex; border-bottom: 2px solid #f0f0f0; margin-bottom: 10px;
}
.detail-tabs .tab {
padding: 7px 14px; font-size: 13px; color: #999; cursor: pointer;
border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.detail-tabs .tab:hover { color: #1a73e8; }
.detail-tabs .tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }
.detail-tab-content { display: none; }
.detail-tab-content.active { display: block; }
/* ===== 子表格 ===== */
.sub-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sub-table thead th {
background: #f8f9fa; color: #555; font-weight: 600;
padding: 6px 8px; text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap;
}
.sub-table tbody td { padding: 5px 8px; border: 1px solid #ddd; color: #333; }
.sub-table tbody tr:hover { background: #f8f9fa; }
.sub-table .status-badge {
display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.status-badge.completed { background: #e6f9ed; color: #1a7a3a; }
.status-badge.partial { background: #fff8e1; color: #e67e22; }
.status-badge.pending { background: #f0f0f0; color: #999; }
.sub-table .link-btn { color: #1a73e8; cursor: pointer; text-decoration: underline; font-size: 12px; }
.sub-table .link-btn:hover { color: #1557b0; }
/* ===== 维护字段输入 ===== */
.maintain-grid {
display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 12px;
padding: 8px 10px; background: #fafbfc; border-radius: 6px; margin: 6px 0;
}
.maintain-field { display: flex; flex-direction: column; gap: 2px; }
.maintain-field .mf-label { font-size: 11px; color: #999; }
.maintain-field input, .maintain-field select {
height: 28px; padding: 0 8px; border: 1px solid #ddd; border-radius: 4px;
font-size: 12px; outline: none; transition: border-color 0.15s;
}
.maintain-field input:focus, .maintain-field select:focus { border-color: #1a73e8; }
.maintain-field input[type="number"] { text-align: right; }
.detail-header-bar {
display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.detail-header-bar .row-label { font-size: 13px; font-weight: 600; color: #333; }
.save-btn {
height: 28px; padding: 0 16px; border: none; border-radius: 4px;
background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff;
font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.save-btn:hover { opacity: 0.9; }
.save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* ===== 加载/通知 ===== */
.loading-overlay {
display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.7); z-index: 999;
justify-content: center; align-items: center;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
width: 36px; height: 36px; border: 3px solid #e0e0e0; border-top-color: #1a73e8;
border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
padding: 10px 22px; border-radius: 8px; font-size: 13px; z-index: 1000;
box-shadow: 0 4px 20px rgba(0,0,0,0.15); display: none; min-width: 260px; text-align: center;
}
.toast.error { background: #fdeaea; color: #b71c1c; display: block; }
.toast.success { background: #e6f9ed; color: #1a7a3a; display: block; }
.toast.info { background: #e3f2fd; color: #1565c0; display: block; }
@media (max-width: 1100px) {
.content-area { flex-direction: column; }
.detail-panel.open { width: 100%; min-width: 0; }
.maintain-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
.maintain-grid { grid-template-columns: 1fr; }
.master-info { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="loading-overlay" id="loadingOverlay"><div class="loading-spinner"></div></div>
<div class="toast" id="toast"></div>
<div class="top-bar">
<div class="logo" style="font-size:17px;font-weight:600;letter-spacing:1px;margin-right:24px;">Gaussian</div>
<div class="nav-tabs" id="navTabs"></div>
<div class="user-info" id="userInfo"></div>
</div>
<div class="main-container">
<div class="search-bar">
<span class="field"><label>流程编号:</label><input type="text" id="txtLcbh" placeholder="流程编号" autocomplete="off" /></span>
<span class="field"><label>申请日期:</label><input type="date" id="txtSqrq" /></span>
<span class="field"><label>研发项目:</label><input type="text" id="txtYfxm" placeholder="研发项目" autocomplete="off" /></span>
<span class="field"><label>专项名称:</label><input type="text" id="txtReqName" placeholder="专项名称" autocomplete="off" /></span>
<span class="field"><label>申请人:</label><input type="text" id="txtSqrxm" placeholder="申请人" autocomplete="off" /></span>
<span class="field"><label>物料编码:</label><input type="text" id="txtWlbmCode" placeholder="物料编码" autocomplete="off" /></span>
<span class="field"><label>策略采购负责人:</label><input type="text" id="txtCncgfzr" placeholder="策略采购负责人 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>研发采购负责人:</label><input type="text" id="txtYfcgfzr" placeholder="研发采购负责人 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>供应商:</label><input type="text" id="txtGys" placeholder="供应商 / 空查空值" autocomplete="off" /></span>
<span class="field"><label>业务状态:</label>
<select id="txtDjzk"><option value="">全部</option><option value="0">--</option><option value="1">采购订单-转单追踪</option><option value="2">供应链-待供应商报价</option><option value="3">供应链-待ED审批</option><option value="4">供应链-ED驳回,重新议价</option><option value="5">供应链-ED已审批</option><option value="6">研发-采购申请驳回</option><option value="7">研发-采购申请撤回</option><option value="8">研发-采购申请取消</option><option value="9">研发-量产复用件</option></select>
</span>
<span style="grid-column:3/-1;text-align:right;display:flex;gap:12px;justify-content:flex-end;align-items:center">
<span style="font-size:12px;color:#999">共 <em id="totalCount" style="font-style:normal;color:#1a73e8;font-weight:700">0</em> 条</span>
<button class="btn btn-primary" onclick="loadList()">查询</button>
<button class="btn btn-outline" onclick="resetSearch()">重置</button>
</span>
</div>
<div class="content-area">
<!-- 列表 -->
<div class="list-card">
<div class="card-header">
<h3>研发物料采购申请单</h3>
<span class="count">
当前页 <em id="pageCount">0</em>
&nbsp; <button class="btn-batch" id="btnBatch" onclick="openBatch()" disabled style="height:28px;padding:0 12px;border:0;border-radius:4px;background:#1a73e8;color:#fff;font-size:12px;cursor:pointer;vertical-align:middle;opacity:.5">批量汇总</button>
&nbsp; <button onclick="exportXlsx()" style="height:28px;padding:0 12px;border:1px solid #1a73e8;border-radius:4px;background:#fff;color:#1a73e8;font-size:12px;cursor:pointer;vertical-align:middle">导出Excel</button>
&nbsp; <button onclick="document.getElementById('fileInput').click()" style="height:28px;padding:0 12px;border:1px solid #1a73e8;border-radius:4px;background:#fff;color:#1a73e8;font-size:12px;cursor:pointer;vertical-align:middle">导入Excel</button>
<input type="file" id="fileInput" accept=".xls,.xlsx" style="display:none" onchange="importXlsx(this)" />
</span>
</div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th style="width:32px;text-align:center"><input type="checkbox" id="chkAll" onclick="toggleAll(this)" /></th>
<th style="width:28px;">#</th>
<th>流程编号</th>
<th>申请日期</th>
<th>研发项目</th>
<th>专项名称</th>
<th>申请人</th>
<th>单据状态</th>
<th>项目经理审批时间</th>
</tr>
</thead>
<tbody id="listBody">
<tr class="empty-row"><td colspan="9">暂无数据,请点击查询按钮加载</td></tr>
</tbody>
</table>
</div>
<div class="pagination" id="pagination">
<div>
<span>共 <em id="totalPages">0</em> 页,</span>
<span>每页显示
<span class="size-btns" id="sizeBtns"></span>
</span>
</div>
<div class="page-btns" id="pageBtns"></div>
</div>
</div>
</div>
<script>
var currentPage=1,pageSize=50,currentData=[],selectedIds={};
var pageSizeOptions=[50,100,200,1000,2000];
var djzkMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
function escapeHtml(s){if(!s)return '';var d=document.createElement('div');d.appendChild(document.createTextNode(String(s)));return d.innerHTML}
function showLoading(){document.getElementById('loadingOverlay').classList.add('show')}
function hideLoading(){document.getElementById('loadingOverlay').classList.remove('show')}
function showToast(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 getVal(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value.trim()):''}
function getSel(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value):''}
function loadList(){
saveFilters();showLoading();currentPage=1;
var p='lcbh='+getVal('txtLcbh')+'&sqrq='+getVal('txtSqrq')+'&yfxm='+getVal('txtYfxm')+'&reqName='+getVal('txtReqName')+'&sqrxm='+getVal('txtSqrxm')+'&djzk='+getSel('txtDjzk')+'&wlbmCode='+getVal('txtWlbmCode')+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&gys='+getVal('txtGys')+'&page=1&pageSize='+pageSize;
var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetRequestList?'+p,true);
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success){try{currentData=r.data||[];renderList(currentData);renderPagination(r.total||0);document.getElementById('totalCount').textContent=r.total||0}catch(er){showToast('渲染异常:'+er.message,'error')}}
else showToast(r.message||'查询失败','error')
}catch(e){showToast('数据解析异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send();
}
function loadPage(page){
saveFilters();showLoading();currentPage=page;
var p='lcbh='+getVal('txtLcbh')+'&sqrq='+getVal('txtSqrq')+'&yfxm='+getVal('txtYfxm')+'&reqName='+getVal('txtReqName')+'&sqrxm='+getVal('txtSqrxm')+'&djzk='+getSel('txtDjzk')+'&wlbmCode='+getVal('txtWlbmCode')+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&gys='+getVal('txtGys')+'&page='+page+'&pageSize='+pageSize;
var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetRequestList?'+p,true);
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success){currentData=r.data||[];renderList(currentData);renderPagination(r.total||0);document.getElementById('totalCount').textContent=r.total||0}
else showToast(r.message||'查询失败','error')
}catch(e){showToast('数据解析异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send();
}
var filterIds=['txtLcbh','txtSqrq','txtYfxm','txtReqName','txtSqrxm','txtDjzk','txtWlbmCode','txtCncgfzr','txtYfcgfzr','txtGys'];
function saveFilters(){
filterIds.forEach(function(id){if(document.getElementById(id))sessionStorage.setItem('pro_'+id,document.getElementById(id).value)});
}
function restoreFilters(){
filterIds.forEach(function(id){var v=sessionStorage.getItem('pro_'+id);if(v!==null){var el=document.getElementById(id);if(el)el.value=v}});
var ps=sessionStorage.getItem('pro_pageSize');
if(ps!==null&&pageSizeOptions.indexOf(parseInt(ps))>=0)pageSize=parseInt(ps);
}
function resetSearch(){
filterIds.forEach(function(id){sessionStorage.removeItem('pro_'+id);var el=document.getElementById(id);if(el)el.value=''});
selectedIds={};loadList();
}
function renderList(data){
var tbody=document.getElementById('listBody');
if(!data||!data.length){tbody.innerHTML='<tr class="empty-row"><td colspan="9">暂无匹配数据</td></tr>';document.getElementById('pageCount').textContent='0';return}
var h='';
data.forEach(function(item,idx){
var checked=selectedIds[item.id]?'checked':'';
h+='<tr class="list-row" data-id="'+escapeHtml(item.id)+'" data-lcbh="'+escapeHtml(item.lcbh)+'" data-djbh="'+escapeHtml(item.djbh)+'" data-requestid="'+escapeHtml(item.requestId)+'" onclick="selectRow(this)">';
h+='<td style="text-align:center"><input type="checkbox" class="row-chk" data-id="'+escapeHtml(item.id)+'" '+checked+' onclick="event.stopPropagation();toggleRow(this)"/></td>';
h+='<td>'+((currentPage-1)*pageSize+idx+1)+'</td>';
h+='<td><strong>'+escapeHtml(item.lcbh)+'</strong></td>';
h+='<td>'+escapeHtml(item.sqrq)+'</td>';
h+='<td>'+escapeHtml(item.yfxmmc)+'</td>';
h+='<td style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="'+escapeHtml(item.REQUESTNAME)+'">'+escapeHtml(item.REQUESTNAME)+'</td>';
h+='<td>'+escapeHtml(item.sqrxm)+'</td>';
h+='<td>'+(djzkMap[item.djzk]||'')+'</td>';
h+='<td>'+escapeHtml(item.pmAuditTime)+'</td>';
h+='</tr>';
});
tbody.innerHTML=h;document.getElementById('pageCount').textContent=data.length;updateBatchBtn();
}
function selectRow(el){
var lcbh=el.getAttribute('data-lcbh'),djbh=el.getAttribute('data-djbh'),requestId=el.getAttribute('data-requestid');
var row=currentData.find(function(d){return d.lcbh===lcbh});
var sqrq=row?row.sqrq:'',sqrxm=row?row.sqrxm:'',yfxmmc=row?row.yfxmmc:'',reqName=row?encodeURIComponent(row.REQUESTNAME||''):'',pmTime=row?encodeURIComponent(row.pmAuditTime||''):'';
window.location.href='procurement_detail.html?lcbh='+encodeURIComponent(lcbh)+'&djbh='+encodeURIComponent(djbh)+'&requestId='+encodeURIComponent(requestId)+'&sqrq='+encodeURIComponent(sqrq)+'&sqrxm='+encodeURIComponent(sqrxm)+'&yfxmmc='+encodeURIComponent(yfxmmc)+'&reqName='+reqName+'&pmTime='+pmTime;
}
function toggleRow(cb){var id=cb.getAttribute('data-id');if(cb.checked)selectedIds[id]=true;else delete selectedIds[id];updateBatchBtn()}
function toggleAll(cb){document.querySelectorAll('.row-chk').forEach(function(c){c.checked=cb.checked;var id=c.getAttribute('data-id');if(cb.checked)selectedIds[id]=true;else delete selectedIds[id]});updateBatchBtn()}
function setPageSize(size){
pageSize=size;
sessionStorage.setItem('pro_pageSize',size);
loadList();
}
function renderPagination(total){
var tp=Math.ceil(total/pageSize)||1;document.getElementById('totalPages').textContent=tp;
// 每页条数按钮
var sb=document.getElementById('sizeBtns');
var sh='';pageSizeOptions.forEach(function(s){sh+='<button class="'+(s===pageSize?'active':'')+'" onclick="setPageSize('+s+')">'+s+'条</button>'});
sb.innerHTML=sh;
// 页码按钮
var c=document.getElementById('pageBtns');if(tp<=1){c.innerHTML='';return}
var h='';h+='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage(1)">首页</button>';h+='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage('+(currentPage-1)+')">‹</button>';var start=Math.max(1,currentPage-2),end=Math.min(tp,currentPage+2);
for(var i=start;i<=end;i++)h+='<button class="'+(i===currentPage?'active':'')+'" onclick="loadPage('+i+')">'+i+'</button>';h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+(currentPage+1)+')">›</button>';h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+tp+')">末页</button>';c.innerHTML=h;
}
function updateBatchBtn(){var btn=document.getElementById('btnBatch');if(!btn)return;var cnt=Object.keys(selectedIds).length;btn.disabled=cnt===0;btn.style.opacity=cnt===0?'.5':'1';btn.textContent='批量汇总 ('+cnt+')'}
function openBatch(){var ids=Object.keys(selectedIds);if(!ids.length){showToast('请先选择申请单','error');return}window.location.href='multi_detail.html?ids='+ids.join(',')}
function exportXlsx(){
var ids=Object.keys(selectedIds);
if(!ids.length){showToast('请先勾选要导出的申请单','error');return}
showLoading();
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/ExportXlsx',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();
try{
var r=JSON.parse(xhr.responseText);
if(r.success&&r.data){
var blob=new Blob(['\uFEFF'+r.data],{type:'text/plain;charset=utf-8'});
var a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='采购申请维护数据_'+new Date().toISOString().slice(0,10)+'.xls';a.click();
showToast('导出成功,共 '+r.total+' 条','success');
}else showToast(r.message||'导出失败','error')
}catch(e){showToast('导出异常','error')}
};
xhr.onerror=function(){hideLoading();showToast('网络请求失败','error')};
xhr.send(JSON.stringify({ids:ids}));
}
function importXlsx(input){
var file=input.files[0];if(!file)return;
var reader=new FileReader();
reader.onload=function(){
showLoading();
var bytes=new Uint8Array(reader.result);
var binary='';
for(var i=0;i<bytes.length;i++)binary+=String.fromCharCode(bytes[i]);
var base64=btoa(binary);
var xhr=new XMLHttpRequest();
xhr.open('POST','api/Procurement/ImportXlsx',true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.onload=function(){
hideLoading();input.value='';
try{var r=JSON.parse(xhr.responseText);showToast(r.message||(r.success?'导入成功':'导入失败'),r.success?'success':'error')}catch(e){showToast('导入响应异常','error')}
};
xhr.onerror=function(){hideLoading();input.value='';showToast('网络请求失败','error')};
xhr.send(JSON.stringify({file:base64}));
};
reader.readAsArrayBuffer(file);
}
function logout(){sessionStorage.removeItem('gx_user');window.location.href='login.html'}
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var user=JSON.parse(userData);var roles=user.roleNumbers||[];
if(roles.indexOf('Purchase01')<0){alert('当前用户无权限');sessionStorage.removeItem('gx_user');window.location.href='login.html';return}
var nav='';if(roles.indexOf('CRM01')>=0)nav+='<a href="index.html">CRM同步</a>';if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement.html" class="active">采购申请管理</a>';if(roles.indexOf('Purchase01')>=0)nav+='<a href="procurement_dashboard.html">采购看板</a>';if(roles.indexOf('Purchase01')>=0)nav+='<a href="delivery_dashboard.html">采购物料交付状态看板</a>';if(roles.indexOf('YF01')>=0)nav+='<a href="dashboard.html">研发采购看板</a>';if(roles.indexOf('Produce02')>=0)nav+='<a href="View/MES/mes_dashboard.html">MES追溯看板</a>';
document.getElementById('navTabs').innerHTML=nav;document.getElementById('userInfo').innerHTML=(user.userName||user.userId)+' | <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){alert('当前用户无权限');window.location.href='login.html'}
})();
restoreFilters();
loadList();
</script>
</body>
</html>
@@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>2号三级 - 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:1500px;margin:0 auto;padding:12px 16px}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;font-size:14px;color:#333;font-weight:600}
.table-wrap{overflow:auto}
table{min-width:100%;border-collapse:collapse;font-size:12px}
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:6px 8px;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:5px 8px;border:1px solid #ddd;color:#333}
tbody tr:hover{background:#f0f6ff}
.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}
.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}
</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="javascript:history.back()">← 返回</a><span class="title" id="pageTitle">2号三级</span><span class="user-info" id="userInfo"></span></div>
<div class="main"><div class="card"><div class="card-header" id="subTitle">明细列表</div><div class="table-wrap"><table><thead><tr>
<th>流程编号<span class="resizer"></span></th><th>单据编号<span class="resizer"></span></th><th>行号<span class="resizer"></span></th><th>物料编码<span class="resizer"></span></th><th>物料名称<span class="resizer"></span></th><th>数量<span class="resizer"></span></th><th>供应商<span class="resizer"></span></th><th>策略采购负责人<span class="resizer"></span></th><th>研发采购负责人<span class="resizer"></span></th><th>要求交付日期<span class="resizer"></span></th><th>计划交付日期(研发)<span class="resizer"></span></th><th>延期天数<span class="resizer"></span></th>
</tr></thead><tbody id="dataBody"><tr class="empty"><td colspan="12">加载中...</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||'',gys=params.gys||'',range=params.range||'';
var rangeMap={d3:'0-3天',d7:'3-7天',d14:'7-14天',d99:'14天以上'};
var typeMap={inProgress:'进行中',overdue:'延期中'};
document.getElementById('pageTitle').textContent='2号三级 - '+gys;
document.getElementById('subTitle').textContent=yfxm+' | '+(typeMap[type]||type)+' | '+gys+' | '+(rangeMap[range]||range);
var pageSizeOptions=[20,50,100,200],pageSize=20,currentPage=1,allData=[];
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 loadData(){
loading(true);var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetDeliveryLevel32?yfxm='+encodeURIComponent(yfxm)+'&type='+type+'&gys='+encodeURIComponent(gys)+'&range='+range,true);
xhr.onload=function(){loading(false);try{var r=JSON.parse(xhr.responseText);if(r.success)renderList(r.data);else toast(r.message||'查询失败','error')}catch(e){toast('数据解析异常','error')}};
xhr.onerror=function(){loading(false);toast('网络请求失败','error')};xhr.send();
}
function setPageSize(size){pageSize=size;currentPage=1;renderPage()}
function renderPagination(){var t=allData.length,tp=Math.ceil(t/pageSize)||1;var pc=document.getElementById('pagination');if(t<=pageSize&&t<=20){pc.style.display='none';return}pc.style.display='flex';document.getElementById('totalCnt').textContent=t;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="12">暂无数据</td></tr>';return}var start=(currentPage-1)*pageSize,end=Math.min(start+pageSize,allData.length);var h='';for(var i=start;i<end;i++){var item=allData[i];h+='<tr><td>'+escapeHtml(item.lcbh)+'</td><td>'+escapeHtml(item.djbh)+'</td><td>'+escapeHtml(item.xh)+'</td><td>'+escapeHtml(item.wlbmCode)+'</td><td>'+escapeHtml(item.wlmc)+'</td><td>'+escapeHtml(item.sqsl)+'</td><td>'+escapeHtml(item.gys)+'</td><td>'+escapeHtml(item.cncgfzr)+'</td><td>'+escapeHtml(item.yfcgfzr)+'</td><td>'+escapeHtml(item.dhrq)+'</td><td>'+escapeHtml(item.yfjhjfrq)+'</td><td>'+escapeHtml(item.dayDiff)+'</td></tr>'}tb.innerHTML=h;renderPagination()}
function renderList(data){allData=data||[];renderPage()}
// 列宽拖动
(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>
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace GXWebApi.Common
{
public class K3Response
{
public K3Result Result { get; set; }
}
public class NeedReturnData
{
public List<K3FEntity> FEntity { get; set; }
}
public class K3FEntity
{
public string FID { get; set; }
public int FENTRYID { get; set; }
}
public class K3Result
{
public ResponseStatus ResponseStatus { get; set; }
public string Id { get; set; }
public List<NeedReturnData> NeedReturnData { get; set; }
}
public class ResponseStatus
{
public string ErrorCode { get; set; }
public bool IsSuccess { get; set; }
public List<K3Error> Errors { get; set; }
public List<SuccessEntity> SuccessEntitys { get; set; }
public List<SuccessMessage> SuccessMessages { get; set; }
}
public class K3Error
{
public string FieldName { get; set; }
public string Message { get; set; }
public int DIndex { get; set; }
}
public class SuccessEntity
{
public string Id { get; set; }
public string Number { get; set; }
public int DIndex { get; set; }
}
public class SuccessMessage
{
public string FieldName { get; set; }
public string Message { get; set; }
public int DIndex { get; set; }
}
}
@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GXWebApi</RootNamespace>
<AssemblyName>GXWebApi</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<Use64BitIISExpress />
<IISUrl>http://localhost:8080/</IISUrl>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\GuangFu.StringTracing\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\GuangFu.StringTracing\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\OPSOFT\OPSOFTV60\AP\BIN\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Kingdee.BOS.WebApi.Client">
<HintPath>Kingdee.BOS.WebApi.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting">
<HintPath>packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.Cors">
<HintPath>packages\Microsoft.AspNet.Cors.5.2.7\lib\net45\System.Web.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http">
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.Cors">
<HintPath>packages\Microsoft.AspNet.WebApi.Cors.5.2.7\lib\net45\System.Web.Http.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Common\CrmApi.cs" />
<Compile Include="Common\DBHelpe.cs" />
<Compile Include="Common\Extensions.cs" />
<Compile Include="Common\LogHelper.cs" />
<Compile Include="Common\MySqlUtils.cs" />
<Compile Include="Common\ResponseStatus.cs" />
<Compile Include="Common\WmsCommonFunction.cs" />
<Compile Include="Controllers\AuthController.cs" />
<Compile Include="Controllers\DifferentialController.cs" />
<Compile Include="Controllers\ProcurementController.cs" />
<Compile Include="Controllers\MesController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="delivery_dashboard.html" />
<Content Include="delivery_dashboard_L21.html" />
<Content Include="delivery_dashboard_L22.html" />
<Content Include="delivery_dashboard_L31.html" />
<Content Include="delivery_dashboard_L32.html" />
<Content Include="delivery_dashboard_noorder2.html" />
<Content Include="delivery_dashboard_noorder3.html" />
<Content Include="delivery_dashboard_noorder4.html" />
<Content Include="Global.asax" />
<Content Include="login.html" />
<Content Include="index.html" />
<Content Include="procurement.html" />
<Content Include="procurement_dashboard.html" />
<Content Include="procurement_dashboard_detail.html" />
<Content Include="procurement_dashboard_detail_items.html" />
<Content Include="procurement_dashboard_level4.html" />
<Content Include="procurement_detail.html" />
<Content Include="dashboard.html" />
<Content Include="dashboard_detail.html" />
<Content Include="multi_detail.html" />
<Content Include="Web.config" />
<Content Include="log4net.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="View\MES\mes_dashboard.html" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>8080</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8080/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\1</_PublishTargetUrl>
<History>True|2026-08-17T01:42:27.8156190Z||;True|2026-08-14T16:52:13.7440900+08:00||;True|2026-08-14T16:42:38.4548286+08:00||;True|2026-08-14T14:52:14.8351128+08:00||;True|2026-08-13T15:15:49.8409025+08:00||;True|2026-08-13T14:07:36.8370386+08:00||;True|2026-08-06T10:36:00.8099402+08:00||;True|2026-08-05T14:43:23.1856296+08:00||;True|2026-08-04T09:34:44.8282856+08:00||;True|2026-07-31T14:15:17.8924066+08:00||;True|2026-07-29T17:42:14.7465984+08:00||;True|2026-07-28T14:34:03.8612324+08:00||;True|2026-07-28T14:29:24.5766446+08:00||;True|2026-07-28T14:11:27.5824603+08:00||;True|2026-07-28T09:28:49.8005658+08:00||;True|2026-07-28T09:28:39.3771641+08:00||;True|2026-07-28T09:28:26.9653303+08:00||;True|2026-07-27T14:33:17.8556875+08:00||;True|2026-07-27T14:28:25.8121460+08:00||;True|2026-07-24T16:51:55.7769810+08:00||;True|2026-07-24T15:25:29.8947525+08:00||;True|2026-07-24T10:49:03.6003286+08:00||;True|2026-07-22T16:23:35.6347492+08:00||;True|2026-07-22T16:17:35.8799930+08:00||;True|2026-07-22T15:49:28.6121559+08:00||;True|2026-07-22T14:55:18.2703822+08:00||;True|2026-07-22T14:51:59.4718336+08:00||;True|2026-07-01T10:02:04.5477902+08:00||;True|2026-06-17T17:46:44.1504757+08:00||;True|2026-06-17T17:38:09.4990885+08:00||;True|2026-06-17T17:37:55.6743611+08:00||;False|2026-06-17T17:37:51.8483598+08:00||;True|2026-06-17T17:33:33.5540476+08:00||;False|2026-06-17T17:33:29.8580593+08:00||;True|2026-06-17T17:29:10.0025733+08:00||;False|2026-06-17T17:28:56.0140964+08:00||;True|2026-06-17T17:23:13.5724326+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
<File Include="bin/GXWebApi.dll">
<publishTime>08/17/2026 09:42:27</publishTime>
</File>
<File Include="bin/GXWebApi.pdb">
<publishTime>08/17/2026 09:42:27</publishTime>
</File>
<File Include="bin/Kingdee.BOS.WebApi.Client.dll">
<publishTime>11/24/2023 11:11:32</publishTime>
</File>
<File Include="bin/log4net.dll">
<publishTime>08/11/2022 14:57:47</publishTime>
</File>
<File Include="bin/Microsoft.Web.Infrastructure.dll">
<publishTime>08/11/2022 14:57:46</publishTime>
</File>
<File Include="bin/MySql.Data.dll">
<publishTime>11/28/2023 13:03:41</publishTime>
</File>
<File Include="bin/Newtonsoft.Json.dll">
<publishTime>03/18/2021 04:03:36</publishTime>
</File>
<File Include="bin/System.Net.Http.Formatting.dll">
<publishTime>11/28/2018 21:00:36</publishTime>
</File>
<File Include="bin/System.Web.Cors.dll">
<publishTime>11/28/2018 20:58:44</publishTime>
</File>
<File Include="bin/System.Web.Http.Cors.dll">
<publishTime>11/28/2018 21:01:26</publishTime>
</File>
<File Include="bin/System.Web.Http.dll">
<publishTime>11/28/2018 21:01:00</publishTime>
</File>
<File Include="bin/System.Web.Http.WebHost.dll">
<publishTime>11/28/2018 21:02:56</publishTime>
</File>
<File Include="dashboard.html">
<publishTime>08/14/2026 11:14:15</publishTime>
</File>
<File Include="dashboard_detail.html">
<publishTime>08/04/2026 09:33:06</publishTime>
</File>
<File Include="delivery_dashboard.html">
<publishTime>08/14/2026 11:14:24</publishTime>
</File>
<File Include="delivery_dashboard_L21.html">
<publishTime>07/30/2026 14:17:33</publishTime>
</File>
<File Include="delivery_dashboard_L22.html">
<publishTime>07/30/2026 14:18:43</publishTime>
</File>
<File Include="delivery_dashboard_L31.html">
<publishTime>07/30/2026 14:18:11</publishTime>
</File>
<File Include="delivery_dashboard_L32.html">
<publishTime>07/30/2026 11:11:36</publishTime>
</File>
<File Include="delivery_dashboard_noorder2.html">
<publishTime>08/03/2026 15:11:22</publishTime>
</File>
<File Include="delivery_dashboard_noorder3.html">
<publishTime>08/03/2026 15:11:42</publishTime>
</File>
<File Include="delivery_dashboard_noorder4.html">
<publishTime>08/03/2026 15:18:49</publishTime>
</File>
<File Include="Global.asax">
<publishTime>06/17/2026 17:02:54</publishTime>
</File>
<File Include="index.html">
<publishTime>08/14/2026 11:14:19</publishTime>
</File>
<File Include="log4net.config">
<publishTime>06/17/2026 17:03:07</publishTime>
</File>
<File Include="login.html">
<publishTime>08/14/2026 11:14:13</publishTime>
</File>
<File Include="multi_detail.html">
<publishTime>07/29/2026 17:07:56</publishTime>
</File>
<File Include="procurement.html">
<publishTime>08/14/2026 11:14:20</publishTime>
</File>
<File Include="procurement_dashboard.html">
<publishTime>08/14/2026 11:14:22</publishTime>
</File>
<File Include="procurement_dashboard_detail.html">
<publishTime>07/29/2026 10:12:54</publishTime>
</File>
<File Include="procurement_dashboard_detail_items.html">
<publishTime>07/29/2026 10:12:57</publishTime>
</File>
<File Include="procurement_dashboard_level4.html">
<publishTime>07/29/2026 10:12:59</publishTime>
</File>
<File Include="procurement_detail.html">
<publishTime>08/13/2026 15:12:38</publishTime>
</File>
<File Include="View/MES/mes_dashboard.html">
<publishTime>08/14/2026 16:50:58</publishTime>
</File>
<File Include="Web.config">
<publishTime>08/14/2026 15:46:19</publishTime>
</File>
</ItemGroup>
</Project>
@@ -0,0 +1,747 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>研发物料采购看板 - Gaussian</title>
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
<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: 4px
}
.top-bar .logo {
font-size: 17px;
font-weight: 600;
margin-right: 24px
}
.top-links a {
color: rgba(255,255,255,.75);
text-decoration: none;
padding: 0 16px;
height: 100%;
display: flex;
align-items: center;
font-size: 13px;
border-radius: 4px 4px 0 0;
transition: .2s
}
.top-links a:hover {
color: #fff;
background: rgba(255,255,255,.1)
}
.top-links a.active {
color: #fff;
background: rgba(255,255,255,.2)
}
.user-info {
margin-left: auto;
font-size: 12px;
opacity: .85
}
.main {
max-width: 1500px;
margin: 0 auto;
padding: 12px 16px
}
/* ===== 搜索栏 ===== */
.search-bar {
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 4px rgba(0,0,0,.08);
padding: 12px 16px;
margin-bottom: 10px;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px 14px;
align-items: center
}
.search-bar label {
font-size: 12px;
color: #555;
font-weight: 600;
white-space: nowrap
}
.search-bar .field {
display: inline-flex;
align-items: center;
gap: 4px
}
.search-bar input,.search-bar select {
height: 32px;
padding: 0 10px;
border: 2px solid #e0e0e0;
border-radius: 5px;
font-size: 13px;
outline: 0;
transition: border-color .2s;box-sizing:border-box
}
.search-bar .field input{flex:1;min-width:0}
.multi-select{position:relative;flex:1;min-width:0}
.multi-select .ms-box{height:32px;padding:0 10px;border:1px solid #d5d9e0;border-radius:5px;font-size:13px;background:#fff;display:flex;align-items:center;justify-content:space-between;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;color:#333}
.multi-select .ms-box:hover{border-color:#1a73e8}
.multi-select .ms-arrow{font-size:10px;color:#888;margin-left:6px;flex-shrink:0}
.multi-select .ms-drop{display:none;position:absolute;top:calc(100% + 2px);left:0;min-width:200px;z-index:50;background:#fff;border:1px solid #d5d9e0;border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,.12);max-height:280px;overflow:auto;padding:2px 0}
.multi-select.open .ms-drop{display:block}
.multi-select .ms-drop label{display:flex;align-items:center;gap:6px;padding:0 10px;height:26px;font-size:12px;color:#333;cursor:pointer;white-space:nowrap;transition:background .15s;line-height:1}
.multi-select .ms-drop label:hover{background:#f0f6ff}
.multi-select .ms-drop label input{margin:0;width:14px;height:14px;min-width:14px;min-height:14px;flex-shrink:0;flex:0 0 14px;vertical-align:middle;accent-color:#1a73e8;outline:none;cursor:pointer}
.multi-select .ms-drop .ms-divider{height:1px;background:#eee;margin:2px 0}
.search-bar input:focus {
border-color: #1a73e8;
box-shadow: 0 0 0 3px rgba(26,115,232,.12)
}
.search-bar .btn {
height: 32px;
padding: 0 16px;
border: 0;
border-radius: 5px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: .2s
}
.search-bar .btn-primary {
background: linear-gradient(135deg,#1a73e8,#1557b0);
color: #fff
}
.search-bar .btn-primary:hover {
opacity: .92
}
.search-bar .btn-outline {
background: #fff;
color: #666;
border: 2px solid #e0e0e0
}
.search-bar .btn-outline:hover {
border-color: #1a73e8;
color: #1a73e8
}
.search-bar .total em {
font-style: normal;
color: #1a73e8;
font-weight: 700
}
/* ===== 表格 ===== */
.list-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 4px rgba(0,0,0,.08);
overflow: visible
}
.list-card .card-header {
padding: 10px 16px;
border-bottom: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center
}
.list-card .card-header h3 {
font-size: 14px;
color: #333;
font-weight: 600
}
.list-card .card-header .count {
font-size: 12px;
color: #999;
margin-left: auto;
margin-right: 12px
}
.list-card .btn-export {
height: 28px; padding: 0 16px; border: 0; border-radius: 4px;
background: linear-gradient(135deg,#34a853,#1e8e3e); color: #fff;
font-size: 12px; font-weight: 600; cursor: pointer; transition: .2s
}
.list-card .btn-export:hover { opacity: .9 }
.list-card .btn-export:disabled { opacity: .4; cursor: not-allowed }
table th input[type=checkbox], table td input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: #1a73e8; vertical-align: middle }
.table-wrap {
overflow: auto;
max-height: calc(100vh - 220px)
}
table {
min-width: 100%;
border-collapse: collapse;
font-size: 12px
}
thead th {
background: #f8f9fa;
color: #555;
font-weight: 600;
padding: 8px 8px;
text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap;
position: sticky;
top: 0;
z-index: 1;
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: 7px 8px;
border: 1px solid #ddd;
color: #333
}
tbody tr {
transition: background .15s;
cursor: pointer
}
tbody tr:hover {
background: #f0f6ff
}
.empty td {
text-align: center;
padding: 36px;
color: #bbb
}
.pagination {
padding: 10px 16px;
border-top: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
color: #666
}
.pagination .btns {
display: flex;
gap: 3px
}
.pagination .btns button {
min-width: 28px;
height: 28px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background: #fff;
color: #333;
cursor: pointer;
font-size: 12px;
transition: .15s
}
.pagination .btns button:hover {
border-color: #1a73e8;
color: #1a73e8
}
.pagination .btns button.active {
background: #1a73e8;
color: #fff;
border-color: #1a73e8
}
.pagination .btns button:disabled {
opacity: .4;
cursor: default
}
.pagination .size-btns button {
min-width: 40px; height: 24px; border: 1px solid #e0e0e0; border-radius: 3px;
background: #fff; color: #666; cursor: pointer; font-size: 11px; margin: 0 1px; transition: .15s
}
.pagination .size-btns button:hover { border-color: #1a73e8; color: #1a73e8 }
.pagination .size-btns button.active { background: #1a73e8; color: #fff; border-color: #1a73e8 }
.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
}
.loading-spinner {
width: 34px;
height: 34px;
border: 3px solid #e0e0e0;
border-top-color: #1a73e8;
border-radius: 50%;
animation: spin .7s linear infinite
}
@keyframes spin {
to {
transform: rotate(360deg)
}
}
.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
}
.toast.success {
background: #e6f9ed;
color: #1a7a3a;
display: block
}
</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">
<span class="logo">Gaussian</span>
<div class="top-links" id="navTabs" style="display:flex;gap:4px;height:100%;"></div>
<span class="user-info" id="userInfo"></span>
</div>
<div class="main">
<div class="search-bar">
<span class="field"><label>流程编号:</label><input type="text" id="txtLcbh" placeholder="流程编号" autocomplete="off" /></span>
<span class="field"><label>申请人:</label><input type="text" id="txtSqrxm" placeholder="申请人" autocomplete="off" /></span>
<span class="field"><label>专项名称:</label><input type="text" id="txtReqName" placeholder="专项名称" autocomplete="off" /></span>
<span class="field"><label>研发项目:</label><input type="text" id="txtYfxmmc" placeholder="研发项目" autocomplete="off" /></span>
<span class="field"><label>物料编码:</label><input type="text" id="txtMatCode" placeholder="物料编码" autocomplete="off" /></span>
<span class="field"><label>物料名称:</label><input type="text" id="txtMatName" placeholder="物料名称" autocomplete="off" /></span>
<span class="field"><label>策略采购负责人:</label><input type="text" id="txtCncgfzr" placeholder="策略采购负责人" autocomplete="off" /></span>
<span class="field"><label>研发采购负责人:</label><input type="text" id="txtYfcgfzr" placeholder="研发采购负责人" autocomplete="off" /></span>
<span class="field" style="grid-column:1"><label>业务状态:</label>
<div class="multi-select" id="ywztMulti">
<div class="ms-box" onclick="toggleYwzt()"><span class="ms-text">全部</span><span class="ms-arrow">▾</span></div>
<div class="ms-drop" id="ywztDrop">
<label><input type="checkbox" value="" checked onclick="onAllCheck(this)">全部</label>
<div class="ms-divider"></div>
<label><input type="checkbox" value="1" onclick="onItemCheck(this)">采购订单-转单追踪</label>
<label><input type="checkbox" value="2" onclick="onItemCheck(this)">供应链-待供应商报价</label>
<label><input type="checkbox" value="3" onclick="onItemCheck(this)">供应链-待ED审批</label>
<label><input type="checkbox" value="4" onclick="onItemCheck(this)">供应链-ED驳回,重新议价</label>
<label><input type="checkbox" value="5" onclick="onItemCheck(this)">供应链-ED已审批</label>
<label><input type="checkbox" value="6" onclick="onItemCheck(this)">研发-采购申请驳回</label>
<label><input type="checkbox" value="7" onclick="onItemCheck(this)">研发-采购申请撤回</label>
<label><input type="checkbox" value="8" onclick="onItemCheck(this)">研发-采购申请取消</label>
<label><input type="checkbox" value="9" onclick="onItemCheck(this)">研发-量产复用件</label>
</div>
</div>
</span>
<span style="grid-column:2/-1;text-align:right;display:flex;gap:12px;justify-content:flex-end;align-items:center">
<span style="font-size:12px;color:#999">共 <em id="totalCount" style="font-style:normal;color:#1a73e8;font-weight:700">0</em> 条</span>
<button class="btn btn-primary" onclick="loadList()">查询</button>
<button class="btn btn-outline" onclick="resetSearch()">重置</button>
</span>
</div>
<div class="list-card">
<div class="card-header"><h3>研发物料采购明细</h3><span class="count">当前页 <em id="pageCount">0</em></span><button class="btn btn-export" onclick="exportSelected()" id="exportBtn" disabled>导出Excel</button></div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th style="width:30px"><input type="checkbox" id="checkAll" onclick="onCheckAll(this)" title="全选" /></th>
<th>#<span class="resizer"></span></th>
<th>流程编号<span class="resizer"></span></th>
<th>申请日期<span class="resizer"></span></th>
<th>物料编码<span class="resizer"></span></th>
<th>物料名称<span class="resizer"></span></th>
<th>申请数量<span class="resizer"></span></th>
<th>研发项目<span class="resizer"></span></th>
<th>申请人<span class="resizer"></span></th>
<th>专项名称<span class="resizer"></span></th>
<th>业务状态<span class="resizer"></span></th>
<th>策略采购负责人<span class="resizer"></span></th>
<th>研发采购负责人<span class="resizer"></span></th>
<th>计划交付日期(策略采购)<span class="resizer"></span></th>
<th>计划交付日期(研发采购)<span class="resizer"></span></th>
</tr>
</thead>
<tbody id="listBody"><tr class="empty"><td colspan="15">加载中...</td></tr></tbody>
</table>
</div>
<div class="pagination">
<div><span>共 <em id="totalPages">0</em> 页,</span><span>每页显示 <span class="size-btns" id="sizeBtns"></span></span></div>
<div class="btns" id="pageBtns"></div>
</div>
</div>
</div>
<script>
var currentPage = 1, pageSize = 20, currentData = [];
var pageSizeOptions=[20,50,100,200];
var selectedMap = {}; // 勾选的行(key=requestId+lcbh)
var ywztMap={'1':'转单追踪','2':'待报价','3':'待ED审批','4':'ED驳回','5':'ED已审批','6':'驳回','7':'撤回','8':'取消','9':'量产复用'};
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' }
// ===== 业务状态多选 =====
var ywztMap2={'1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
function toggleYwzt(){var el=document.getElementById('ywztMulti');if(el)el.classList.toggle('open')}
document.addEventListener('click',function(e){
var ms=document.getElementById('ywztMulti');
if(ms&&!ms.contains(e.target))ms.classList.remove('open');
});
function getSelectedYwzt(){
var boxes=document.querySelectorAll('#ywztDrop input[type=checkbox]');
var selected=[];
boxes.forEach(function(b){if(b.checked&&b.value!=='')selected.push(b.value)});
return selected;
}
function updateYwztBoxText(){
var textEl=document.querySelector('#ywztMulti .ms-text');
if(!textEl)return;
var selected=getSelectedYwzt();
if(!selected.length){textEl.textContent='全部';return}
var names=selected.map(function(v){return ywztMap2[v]||v});
textEl.textContent=(names.length>2?names.slice(0,2).join('、')+' 等':names.join('、'));
}
function onAllCheck(allChk){
// 点击"全部":清空所有其他选项
if(allChk.checked){
document.querySelectorAll('#ywztDrop input[type=checkbox]').forEach(function(b){if(b!==allChk)b.checked=false});
}
updateYwztBoxText();
}
function onItemCheck(checkbox){
// 点击具体状态:取消"全部"勾选
if(checkbox.checked){
var allChk=document.querySelector('#ywztDrop input[value=""]');
if(allChk)allChk.checked=false;
}else{
// 如果所有具体状态都未选,自动勾回"全部"
var boxes=document.querySelectorAll('#ywztDrop input[type=checkbox]');
var anySel=Array.prototype.some.call(boxes,function(b){return b.value!==''&&b.checked});
if(!anySel){
var allChk=document.querySelector('#ywztDrop input[value=""]');
if(allChk)allChk.checked=true;
}
}
updateYwztBoxText();
}
function restoreYwzt(sel){
var allChk=document.querySelector('#ywztDrop input[value=""]');
document.querySelectorAll('#ywztDrop input[type=checkbox]').forEach(function(b){b.checked=false});
if(!sel||!sel.length){if(allChk)allChk.checked=true}
else{sel.forEach(function(v){var b=document.querySelector('#ywztDrop input[value="'+v+'"]');if(b)b.checked=true})}
updateYwztBoxText();
}
// 持久化搜索条件
function saveFilters() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var el=document.getElementById(id);if(el)sessionStorage.setItem('dash_'+id,el.value)
});
sessionStorage.setItem('dash_ywztMulti',getSelectedYwzt().join(','));
}
function restoreFilters() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var v=sessionStorage.getItem('dash_'+id);if(v!==null){var el=document.getElementById(id);if(el)el.value=v}
});
var yw=sessionStorage.getItem('dash_ywztMulti');
if(yw!==null)restoreYwzt(yw?yw.split(','):[]);
var ps=sessionStorage.getItem('dash_pageSize');
if(ps!==null&&pageSizeOptions.indexOf(parseInt(ps))>=0)pageSize=parseInt(ps);
}
function getVal(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value.trim()):''}
function loadList() {
loading(true);
saveFilters();
currentPage = 1;
var yw=document.getElementById('txtYwzt')?document.getElementById('txtYwzt').value:getSelectedYwzt().join(',');
var url = 'api/Procurement/GetDashboardList?lcbhNo='+getVal('txtLcbh')+'&sqrxm='+getVal('txtSqrxm')+'&reqName='+getVal('txtReqName')+'&yfxmmc='+getVal('txtYfxmmc')+'&matCode='+getVal('txtMatCode')+'&matName='+getVal('txtMatName')+'&ywzt='+encodeURIComponent(yw)+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&page=1&pageSize='+pageSize;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function () {
loading(false);
try { var r = JSON.parse(xhr.responseText); if (r.success) { currentData = r.data || []; renderList(currentData); renderPagination(r.total || 0); document.getElementById('totalCount').textContent = r.total || 0; } else { toast(r.message || '查询失败', 'error') } }
catch (e) { toast('数据解析异常', 'error') }
};
xhr.onerror = function () { loading(false); toast('网络请求失败', 'error') };
xhr.send();
}
function loadPage(page) {
loading(true);
currentPage = page;
var yw=document.getElementById('txtYwzt')?document.getElementById('txtYwzt').value:getSelectedYwzt().join(',');
var url = 'api/Procurement/GetDashboardList?lcbhNo='+getVal('txtLcbh')+'&sqrxm='+getVal('txtSqrxm')+'&reqName='+getVal('txtReqName')+'&yfxmmc='+getVal('txtYfxmmc')+'&matCode='+getVal('txtMatCode')+'&matName='+getVal('txtMatName')+'&ywzt='+encodeURIComponent(yw)+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&page='+page+'&pageSize='+pageSize;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function () {
loading(false);
try { var r = JSON.parse(xhr.responseText); if (r.success) { currentData = r.data || []; renderList(currentData); renderPagination(r.total || 0); document.getElementById('totalCount').textContent = r.total || 0; } else { toast(r.message || '查询失败', 'error') } }
catch (e) { toast('数据解析异常', 'error') }
};
xhr.onerror = function () { loading(false); toast('网络请求失败', 'error') };
xhr.send();
}
function resetSearch() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var el=document.getElementById(id);if(el)el.value='';sessionStorage.removeItem('dash_'+id)
});
sessionStorage.removeItem('dash_ywztMulti');
restoreYwzt([]);
loadList();
}
function renderList(data) {
var tbody = document.getElementById('listBody');
if (!data || !data.length) {
tbody.innerHTML = '<tr class="empty"><td colspan="15">暂无数据</td></tr>';
document.getElementById('pageCount').textContent = '0';
return;
}
var h = '';
data.forEach(function (item, idx) {
var key = item.requestId + '_' + item.lcbh;
h += '<tr onclick="selectRow(this)" data-key="' + escapeHtml(key) + '" data-lcbh="' + escapeHtml(item.lcbh) + '" data-djbh="' + escapeHtml(item.djbh) + '" data-requestid="' + escapeHtml(item.requestId) + '" data-reqname="' + escapeHtml(item.reqName || '') + '" data-yfxmmc="' + escapeHtml(item.yfxmmc || '') + '" data-sqrxm="' + escapeHtml(item.sqrxm || '') + '" data-sqrq="' + escapeHtml(item.sqrq || '') + '" data-cncgfzr="' + escapeHtml(item.cncgfzr || '') + '" data-yfcgfzr="' + escapeHtml(item.yfcgfzr || '') + '">';
h += '<td><input type="checkbox" onclick="event.stopPropagation();onRowCheck(this)" ' + (selectedMap[key] ? 'checked' : '') + ' /></td>';
h += '<td>' + ((currentPage - 1) * pageSize + idx + 1) + '</td>';
h += '<td><strong>' + escapeHtml(item.lcbh) + '</strong></td>';
h += '<td>' + escapeHtml(item.sqrq) + '</td>';
h += '<td>' + escapeHtml(item.wlbmCode) + '</td>';
h += '<td>' + escapeHtml(item.wlmc) + '</td>';
h += '<td>' + escapeHtml(item.sqsl) + '</td>';
h += '<td>' + escapeHtml(item.yfxmmc) + '</td>';
h += '<td>' + escapeHtml(item.sqrxm) + '</td>';
h += '<td style="max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="' + escapeHtml(item.reqName || '') + '">' + escapeHtml(item.reqName || '') + '</td>';
h += '<td>' + (ywztMap[item.ywzt]||item.ywzt||'') + '</td>';
h += '<td>' + escapeHtml(item.cncgfzr || '') + '</td>';
h += '<td>' + escapeHtml(item.yfcgfzr || '') + '</td>';
h += '<td>' + escapeHtml(item.cnjhjfrq || '') + '</td>';
h += '<td>' + escapeHtml(item.yfjhjfrq || '') + '</td>';
h += '</tr>';
});
tbody.innerHTML = h;
document.getElementById('pageCount').textContent = data.length;
}
function setPageSize(size){pageSize=size;currentPage=1;sessionStorage.setItem('dash_pageSize',size);loadList()}
function renderPagination(total) {
var tp = Math.ceil(total / pageSize) || 1;
document.getElementById('totalPages').textContent = tp;
// 每页条数按钮
var sb = document.getElementById('sizeBtns');
sb.innerHTML = pageSizeOptions.map(function(s){return '<button class="'+(s===pageSize?'active':'')+'" onclick="setPageSize('+s+')">'+s+'条</button>'}).join('');
var c = document.getElementById('pageBtns');
if (tp <= 1) { c.innerHTML = ''; return }
var h = '';
h += '<button ' + (currentPage <= 1 ? 'disabled' : '') + ' onclick="loadPage(1)">首页</button>';
h += '<button ' + (currentPage <= 1 ? 'disabled' : '') + ' onclick="loadPage(' + (currentPage - 1) + ')">‹</button>';
var start = Math.max(1, currentPage - 2), end = Math.min(tp, currentPage + 2);
for (var i = start; i <= end; i++)h += '<button class="' + (i === currentPage ? 'active' : '') + '" onclick="loadPage(' + i + ')">' + i + '</button>';
h += '<button ' + (currentPage >= tp ? 'disabled' : '') + ' onclick="loadPage(' + (currentPage + 1) + ')">›</button>';
h += '<button ' + (currentPage >= tp ? 'disabled' : '') + ' onclick="loadPage(' + tp + ')">末页</button>';
c.innerHTML = h;
}
// ===== 多选 =====
function onRowCheck(cb) {
var tr = cb.closest('tr');
var key = tr.getAttribute('data-key');
if (cb.checked) selectedMap[key] = true; else delete selectedMap[key];
updateCheckAll();
}
function onCheckAll(cb) {
document.querySelectorAll('#listBody input[type=checkbox]').forEach(function (b) {
if (b === cb) return;
b.checked = cb.checked;
var tr = b.closest('tr');
var key = tr ? tr.getAttribute('data-key') : '';
if (cb.checked) { if (key) selectedMap[key] = true } else { if (key) delete selectedMap[key] }
});
updateExportBtn();
}
function updateCheckAll() {
var all = document.querySelectorAll('#listBody input[type=checkbox]');
var allChk = document.getElementById('checkAll');
var anyUnchecked = Array.prototype.some.call(all, function (b) { return !b.checked });
if (allChk) allChk.checked = all.length > 0 && !anyUnchecked;
updateExportBtn();
}
function updateExportBtn() {
var cnt = Object.keys(selectedMap).length;
document.getElementById('exportBtn').disabled = cnt === 0;
}
function exportSelected() {
// 从 currentData 中提取勾选的行(跨分页通过 selectedMap 的 key 匹配)
var rows = currentData.filter(function (item) {
return selectedMap[item.requestId + '_' + item.lcbh];
});
if (!rows.length) { toast('请先勾选要导出的数据', 'error'); return }
exportRowsToExcel(rows);
}
function exportRowsToExcel(rows) {
var headers = ['流程编号','申请日期','研发项目','申请人','专项名称','物料编码','物料名称','申请数量','业务状态','策略采购负责人','研发采购负责人','计划交付日期(策略采购)','计划交付日期(研发采购)'];
var data = [headers];
rows.forEach(function (r) {
data.push([r.lcbh||'', r.sqrq||'', r.yfxmmc||'', r.sqrxm||'', r.reqName||'', r.wlbmCode||'', r.wlmc||'', r.sqsl||'', ywztMap[r.ywzt]||r.ywzt||'', r.cncgfzr||'', r.yfcgfzr||'', r.cnjhjfrq||'', r.yfjhjfrq||'']);
});
// 列宽自适应
var wscols = headers.map(function (h, i) {
var max = h.length;
rows.forEach(function (r) {
var v = String((r[['lcbh','sqrq','yfxmmc','sqrxm','reqName','wlbmCode','wlmc','sqsl','ywzt','cncgfzr','yfcgfzr','cnjhjfrq','yfjhjfrq'][i]]||''));
if (v.length > max) max = v.length;
});
return { wch: Math.min(max + 2, 40) };
});
var ws = XLSX.utils.aoa_to_sheet(data);
ws['!cols'] = wscols;
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, '研发采购看板');
XLSX.writeFile(wb, '研发采购看板_' + new Date().toISOString().slice(0,10) + '.xlsx');
toast('已导出 ' + rows.length + ' 条数据', 'success');
}
function selectRow(el) {
var lcbh = el.getAttribute('data-lcbh');
var djbh = el.getAttribute('data-djbh');
var requestId = el.getAttribute('data-requestid');
var reqName = el.getAttribute('data-reqname') || '';
var yfxmmc = el.getAttribute('data-yfxmmc') || '';
var sqrxm = el.getAttribute('data-sqrxm') || '';
var sqrq = el.getAttribute('data-sqrq') || '';
window.location.href = 'dashboard_detail.html?lcbh=' + encodeURIComponent(lcbh)
+ '&djbh=' + encodeURIComponent(djbh)
+ '&requestId=' + encodeURIComponent(requestId)
+ '&sqrq=' + encodeURIComponent(sqrq)
+ '&sqrxm=' + encodeURIComponent(sqrxm)
+ '&yfxmmc=' + encodeURIComponent(yfxmmc)
+ '&reqName=' + encodeURIComponent(reqName);
}
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName'].forEach(function(id){
var el=document.getElementById(id);if(el)el.addEventListener('keydown',function(e){if(e.key==='Enter')loadList()})
});
// ===== 登录校验 =====
(function () {
var userData = sessionStorage.getItem('gx_user');
if (!userData) { window.location.href = 'login.html'; return }
try {
var user = JSON.parse(userData);
var roles = user.roleNumbers || [];
if (roles.indexOf('YF01') < 0) { alert('当前用户无权限'); sessionStorage.removeItem('gx_user'); window.location.href = 'login.html'; return }
var nav = '';
if (roles.indexOf('CRM01') >= 0) nav += '<a href="index.html">CRM同步</a>';
if (roles.indexOf('Purchase01') >= 0) nav += '<a href="procurement.html">采购申请管理</a>';
if (roles.indexOf('Purchase01') >= 0) nav += '<a href="procurement_dashboard.html">采购看板</a>';
if (roles.indexOf('Purchase01') >= 0) nav += '<a href="delivery_dashboard.html">采购物料交付状态看板</a>';
if (roles.indexOf('YF01') >= 0) nav += '<a href="dashboard.html" class="active">研发采购看板</a>';
document.getElementById('navTabs').innerHTML = nav;
document.getElementById('userInfo').innerHTML = (user.userName || user.userId) + ' | <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) { alert('当前用户无权限'); window.location.href = 'login.html' }
})();
restoreFilters();
loadList();
// 列宽拖动
(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=''}});
})();
</script>
</body>
</html>
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>未转单二级 - 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}
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;font-size:14px;color:#333;font-weight:600}
.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 td.left{text-align:left}
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}
.empty td{text-align:center;padding:36px;color:#bbb}
.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}
.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}
.loading-spinner{width:34px;height:34px;border:3px solid #e0e0e0;border-top-color:#1a73e8;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.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}
</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">未转单 - 时间汇总</span><span class="user-info" id="userInfo"></span></div>
<div class="main"><div class="card"><div class="card-header" id="subTitle">按研发项目 + 时间范围汇总</div><div class="table-wrap"><table><thead><tr><th style="min-width:160px">研发项目<span class="resizer"></span></th><th style="min-width:90px">1天以内<span class="resizer"></span></th><th style="min-width:90px">1-3天<span class="resizer"></span></th><th style="min-width:90px">3天以上<span class="resizer"></span></th></tr></thead><tbody id="dataBody"><tr class="empty"><td colspan="4">加载中...</td></tr></tbody></table></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||'';
document.getElementById('subTitle').textContent='未转单 - '+yfxm+' - 时间汇总';
var rangeMap={r1:'d1',r2:'d3',r3:'d99'};
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 loadData(){
loading(true);var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetDeliveryNoOrder2?yfxm='+encodeURIComponent(yfxm),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();
}
function renderTable(data){
var tb=document.getElementById('dataBody');
if(!data||!data.length){tb.innerHTML='<tr class="empty"><td colspan="4">暂无数据</td></tr>';return}
var h='';
data.forEach(function(row,idx){
var isTotal=(idx===data.length-1);
h+='<tr'+(isTotal?' class="total-row"':'')+'><td class="left">'+escapeHtml(row.yfxmmc)+'</td>';
['r1','r2','r3'].forEach(function(rk){var v=row[rk]||0;if(!isTotal&&v>0)h+='<td><span class="count-link" onclick="openLevel3(\''+rk+'\')">'+v+'</span></td>';else h+='<td>'+v+'</td>'});
h+='</tr>';
});
tb.innerHTML=h;
}
function openLevel3(rk){window.location.href='delivery_dashboard_noorder3.html?yfxm='+encodeURIComponent(yfxm)+'&range='+rangeMap[rk]}
// 列宽拖动
(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>
@@ -0,0 +1,296 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>交付物料风险明细</title>
<link rel="stylesheet" href="../common/nav.css">
<link rel="stylesheet" href="../common/grid.css">
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Microsoft YaHei','PingFang SC',sans-serif; background: #f3f5fa; color: #2c3e50; padding: 14px 18px; }
.head { display: flex; align-items: center; margin-bottom: 12px; gap: 12px; }
.head h2 { font-size: 20px; }
.head .back { padding: 6px 14px; background: #fff; border: 1px solid #dcdfe6; border-radius: 6px; cursor: pointer; font-size: 13px; }
.head .back:hover { border-color: #409eff; color: #409eff; }
.head .meta { font-size: 13px; color: #909399; margin-left: auto; }
.filter { background: #fff; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.filter span { font-size: 13px; color: #606266; }
.filter input, .filter select { height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 13px; outline: none; background: #fff; }
.filter input { width: 220px; }
.filter input:focus, .filter select:focus { border-color: #409eff; }
.filter button { height: 30px; padding: 0 14px; border: 1px solid #409eff; background: #409eff; color: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
.filter button:hover { background: #66b1ff; border-color: #66b1ff; }
.filter button.gray { background: #fff; color: #606266; border-color: #dcdfe6; }
.filter button.gray:hover { border-color: #409eff; color: #409eff; }
.filter .spacer { flex: 1; }
.filter .count { font-size: 12px; color: #909399; }
.loading, .empty { text-align: center; padding: 60px 0; color: #909399; font-size: 14px; }
.pagination { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border-radius: 0 0 10px 10px; }
.pagination .info { font-size: 12px; color: #909399; }
.pagination .ctrl { display: flex; align-items: center; gap: 6px; }
.pagination button { height: 28px; min-width: 32px; padding: 0 8px; border: 1px solid #dcdfe6; background: #fff; border-radius: 4px; cursor: pointer; font-size: 12px; }
.pagination button:hover { border-color: #409eff; color: #409eff; }
.pagination button.active { background: #409eff; color: #fff; border-color: #409eff; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination span { font-size: 12px; color: #909399; }
.pagination select { height: 28px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 6px; font-size: 12px; }
.pagination input { width: 50px; height: 28px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 6px; text-align: center; font-size: 12px; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="head">
<button class="back" onclick="window.location.href='delivery_dashboard.html'">← 返回看板</button>
<h2 id="pageTitle">物料明细</h2>
<span class="meta" id="metaInfo"></span>
</div>
<div class="filter">
<span>产品类型:</span>
<select id="filterProductType"><option value="">全部</option></select>
<span>风险:</span>
<select id="filterRisk">
<option value="">全部</option>
<option value="断线">断线</option>
<option value="预警">预警</option>
<option value="安全">安全</option>
</select>
<span>供应商:</span>
<select id="filterSupplier"><option value="">全部</option></select>
<span>采购员:</span>
<select id="filterPurchaser"><option value="">全部</option></select>
<input type="text" id="filterKeyword" placeholder="搜索物料编码/名称/产品编码" />
<button onclick="loadData(1)">查询</button>
<button class="gray" onclick="resetFilter()">重置</button>
<div class="spacer"></div>
<span class="count" id="countInfo"></span>
</div>
<div class="gx-grid" id="grid">
<table>
<thead>
<tr>
<th style="width:48px">序号</th>
<th style="width:110px">物料编码</th>
<th style="width:140px">物料名称</th>
<th style="width:90px">产品类型</th>
<th style="width:140px">供应商</th>
<th style="width:100px">采购员</th>
<th style="width:100px">预计停线日</th>
<th style="width:100px">预计到货日</th>
<th style="width:60px">风险</th>
<th style="width:60px">日需求</th>
<th style="width:75px">震泽库存</th>
<th style="width:75px">晋江库存</th>
<th style="width:75px">资阳库存</th>
<th style="width:75px">可用库存</th>
<th style="width:70px">量产在途</th>
<th style="width:70px">研发在途</th>
<th style="width:70px">线边库存</th>
<th style="width:70px">已收货</th>
<th style="width:100px">交付进度</th>
<th style="width:140px">备注</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
<div id="status" class="loading">加载中...</div>
</div>
<div class="pagination">
<div class="info" id="pageInfo">共 0 条</div>
<div class="ctrl">
<span>每页</span>
<select id="pageSize" onchange="loadData(1)">
<option value="20">20</option>
<option value="50" selected>50</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="500">500</option>
</select>
<span>条</span>
<button onclick="goPage(1)">«</button>
<button onclick="prevPage()">‹ 上一页</button>
<span>第 <input type="text" id="curPage" value="1" /> / <span id="totalPages">1</span> 页</span>
<button onclick="nextPage()">下一页 ›</button>
<button onclick="goPage(-1)">»</button>
</div>
</div>
<script>
const API_BASE = '../../api/Deliver';
let currentPage = 1;
let currentTotal = 0;
let currentPageSize = 50;
let initRisk = '';
let initProductType = '';
const urlParams = new URLSearchParams(window.location.search);
initRisk = urlParams.get('risk') || '';
initProductType = urlParams.get('productType') || '';
const titleMap = { '': '全部物料', '断线': '断线风险物料', '预警': '预警关注物料', '安全': '安全供应物料' };
const titleColorMap = { '': '#303133', '断线': '#f56c6c', '预警': '#e6a23c', '安全': '#67c23a' };
document.getElementById('pageTitle').textContent = titleMap[initRisk] || '物料明细';
document.getElementById('pageTitle').style.color = titleColorMap[initRisk] || '#303133';
document.getElementById('filterRisk').value = initRisk;
function num(v) { return Grid.num(v); }
function loadFilterOptions() {
// 产品类型
fetch(API_BASE + '/GetSchedules?keyword=').then(r => r.json()).then(res => {
if (res.success) {
const sel = document.getElementById('filterProductType');
const set = new Set();
res.data.forEach(s => { if (s.ProductType) set.add(s.ProductType); });
[...set].sort().forEach(t => {
const opt = document.createElement('option');
opt.value = t; opt.textContent = t;
sel.appendChild(opt);
});
sel.value = initProductType;
}
});
// 供应商/采购员(从当前列表数据汇总,所以首次加载完成后再调用)
}
function loadData(page) {
if (page) currentPage = page;
const tbody = document.getElementById('tbody');
const status = document.getElementById('status');
tbody.innerHTML = '';
status.className = 'loading';
status.style.display = 'block';
status.textContent = '加载中...';
currentPageSize = parseInt(document.getElementById('pageSize').value) || 50;
const risk = document.getElementById('filterRisk').value;
const productType = document.getElementById('filterProductType').value;
const supplier = document.getElementById('filterSupplier').value;
const purchaser = document.getElementById('filterPurchaser').value;
const keyword = document.getElementById('filterKeyword').value.trim();
const params = new URLSearchParams();
if (risk) params.append('risk', risk);
if (productType) params.append('productType', productType);
if (supplier) params.append('supplier', supplier);
if (purchaser) params.append('purchaser', purchaser);
if (keyword) params.append('keyword', keyword);
params.append('page', currentPage);
params.append('pageSize', currentPageSize);
fetch(API_BASE + '/GetBoardRiskList?' + params).then(r => r.json()).then(res => {
if (!res.success) {
status.className = 'empty';
status.textContent = '加载失败:' + (res.message || '');
return;
}
currentTotal = res.total || 0;
document.getElementById('curPage').value = currentPage;
const totalPages = Math.max(1, Math.ceil(currentTotal / currentPageSize));
document.getElementById('totalPages').textContent = totalPages;
document.getElementById('pageInfo').textContent = '共 ' + currentTotal + ' 条';
document.getElementById('countInfo').textContent = '当前显示 ' + ((currentPage-1)*currentPageSize+1) + ' - ' + Math.min(currentPage*currentPageSize, currentTotal) + ' 条';
if (res.data.length === 0) {
status.className = 'empty';
status.textContent = '无数据';
tbody.innerHTML = '';
return;
}
status.style.display = 'none';
tbody.innerHTML = res.data.map((m, i) => {
const seqNo = (currentPage - 1) * currentPageSize + i + 1;
return `<tr>
<td>${seqNo}</td>
<td title="${m.ChildMaterialId}"><strong>${m.ChildMaterialId}</strong></td>
<td title="${m.MaterialName || ''}">${m.MaterialName || '<span class="muted">-</span>'}</td>
<td>${m.ProductType || '<span class="muted">-</span>'}</td>
<td title="${m.Supplier || ''}">${m.Supplier || '<span class="muted">-</span>'}</td>
<td>${m.Purchaser || '<span class="muted">-</span>'}</td>
<td>${m.ExpectedStopDate || '<span class="muted">-</span>'}</td>
<td>${m.ExpectedArrivalDate || '<span class="muted">-</span>'}</td>
<td>${Grid.riskTag(m.DeliveryRisk)}</td>
<td>${num(m.DailyRequirement)}</td>
<td>${num(m.ZhenZeStock)}</td>
<td>${num(m.JinJiangStock)}</td>
<td>${num(m.ZiYangStock)}</td>
<td>${num(m.AvailableStock)}</td>
<td>${num(m.MassInTransit)}</td>
<td>${num(m.ResearchInTransit)}</td>
<td>${num(m.LineSideStock)}</td>
<td>${num(m.ReceivedQty)}</td>
<td>${m.DeliveryProgress || '<span class="muted">-</span>'}</td>
<td title="${m.Remark || ''}">${m.Remark || '<span class="muted">-</span>'}</td>
</tr>`;
}).join('');
// 加载完后更新供应商/采购员下拉(用本次数据)
refreshDropdowns(res.data);
});
}
function refreshDropdowns(data) {
const supplierSet = new Set();
const purchaserSet = new Set();
data.forEach(m => { if (m.Supplier) supplierSet.add(m.Supplier); if (m.Purchaser) purchaserSet.add(m.Purchaser); });
const currentSupplier = document.getElementById('filterSupplier').value;
const currentPurchaser = document.getElementById('filterPurchaser').value;
const supplierSel = document.getElementById('filterSupplier');
const purchaserSel = document.getElementById('filterPurchaser');
// 保留当前选中
supplierSel.innerHTML = '<option value="">全部</option>';
purchaserSel.innerHTML = '<option value="">全部</option>';
[...supplierSet].sort().forEach(v => {
const opt = document.createElement('option'); opt.value = v; opt.textContent = v; supplierSel.appendChild(opt);
});
[...purchaserSet].sort().forEach(v => {
const opt = document.createElement('option'); opt.value = v; opt.textContent = v; purchaserSel.appendChild(opt);
});
supplierSel.value = currentSupplier;
purchaserSel.value = currentPurchaser;
}
function prevPage() { if (currentPage > 1) loadData(currentPage - 1); }
function nextPage() {
const totalPages = Math.max(1, Math.ceil(currentTotal / currentPageSize));
if (currentPage < totalPages) loadData(currentPage + 1);
}
function goPage(p) {
const totalPages = Math.max(1, Math.ceil(currentTotal / currentPageSize));
if (p === -1) loadData(totalPages);
else if (p === 1) loadData(1);
else {
const v = parseInt(document.getElementById('curPage').value);
if (!isNaN(v) && v >= 1 && v <= totalPages) loadData(v);
}
}
function resetFilter() {
document.getElementById('filterRisk').value = initRisk;
document.getElementById('filterProductType').value = initProductType;
document.getElementById('filterSupplier').value = '';
document.getElementById('filterPurchaser').value = '';
document.getElementById('filterKeyword').value = '';
document.getElementById('pageSize').value = '50';
loadData(1);
}
document.getElementById('curPage').addEventListener('keydown', e => { if (e.key === 'Enter') goPage(0); });
document.getElementById('filterKeyword').addEventListener('keydown', e => { if (e.key === 'Enter') loadData(1); });
loadFilterOptions();
loadData(1);
setTimeout(() => Grid.bind('grid'), 200);
</script>
<!-- 公共组件 -->
<script src="../common/grid.js"></script>
<script src="../common/nav.js"></script>
</body>
</html>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>2号二级 - 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:1400px;margin:0 auto;padding:12px 16px}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;font-size:14px;color:#333;font-weight:600}
.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 8px;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 8px;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">2号二级</span><span class="user-info" id="userInfo"></span></div>
<div class="main"><div class="card"><div class="card-header" id="subTitle">按供应商+时间范围汇总</div><div class="table-wrap"><table><thead><tr><th style="min-width:140px">供应商<span class="resizer"></span></th><th style="min-width:90px">0-3天<span class="resizer"></span></th><th style="min-width:90px">3-7天<span class="resizer"></span></th><th style="min-width:90px">7-14天<span class="resizer"></span></th><th style="min-width:90px">14天以上<span class="resizer"></span></th></tr></thead><tbody id="dataBody"><tr class="empty"><td colspan="5">加载中...</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></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={inProgress:'进行中',overdue:'延期中'};
var rangeLabels={r1:'0-3天',r2:'3-7天',r3:'7-14天',r4:'14天以上'};
document.getElementById('pageTitle').textContent='2号二级 - '+yfxm+' - '+(typeMap[type]||type);
document.getElementById('subTitle').textContent=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 loadData(){
loading(true);var xhr=new XMLHttpRequest();
xhr.open('GET','api/Procurement/GetDeliveryLevel22?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="5">暂无数据</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>'+escapeHtml(row.gys)+'</td>';['r1','r2','r3','r4'].forEach(function(rk){var v=row[rk]||0;if(!isTotal&&v>0)h+='<td><span class="count-link" onclick="openLevel3(\''+escapeHtml(row.gys).replace(/\'/g,"\\'")+'\',\''+rk+'\')">'+v+'</span></td>';else h+='<td>'+v+'</td>'});h+='</tr>'}tb.innerHTML=h;renderPagination()}
function renderTable(data){allData=data||[];renderPage()}
function openLevel3(gys,rk){
var rangeMap={r1:'d3',r2:'d7',r3:'d14',r4:'d99'};
window.location.href='delivery_dashboard_L32.html?yfxm='+encodeURIComponent(yfxm)+'&type='+type+'&gys='+encodeURIComponent(gys)+'&range='+rangeMap[rk];
}
// 列宽拖动
(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>
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\1</_PublishTargetUrl>
<History>True|2026-08-04T01:34:44.8282856Z||;True|2026-07-31T14:15:17.8924066+08:00||;True|2026-07-29T17:42:14.7465984+08:00||;True|2026-07-28T14:34:03.8612324+08:00||;True|2026-07-28T14:29:24.5766446+08:00||;True|2026-07-28T14:11:27.5824603+08:00||;True|2026-07-28T09:28:49.8005658+08:00||;True|2026-07-28T09:28:39.3771641+08:00||;True|2026-07-28T09:28:26.9653303+08:00||;True|2026-07-27T14:33:17.8556875+08:00||;True|2026-07-27T14:28:25.8121460+08:00||;True|2026-07-24T16:51:55.7769810+08:00||;True|2026-07-24T15:25:29.8947525+08:00||;True|2026-07-24T10:49:03.6003286+08:00||;True|2026-07-22T16:23:35.6347492+08:00||;True|2026-07-22T16:17:35.8799930+08:00||;True|2026-07-22T15:49:28.6121559+08:00||;True|2026-07-22T14:55:18.2703822+08:00||;True|2026-07-22T14:51:59.4718336+08:00||;True|2026-07-01T10:02:04.5477902+08:00||;True|2026-06-17T17:46:44.1504757+08:00||;True|2026-06-17T17:38:09.4990885+08:00||;True|2026-06-17T17:37:55.6743611+08:00||;False|2026-06-17T17:37:51.8483598+08:00||;True|2026-06-17T17:33:33.5540476+08:00||;False|2026-06-17T17:33:29.8580593+08:00||;True|2026-06-17T17:29:10.0025733+08:00||;False|2026-06-17T17:28:56.0140964+08:00||;True|2026-06-17T17:23:13.5724326+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
<File Include="bin/GXWebApi.dll">
<publishTime>08/04/2026 09:34:13</publishTime>
</File>
<File Include="bin/GXWebApi.pdb">
<publishTime>08/04/2026 09:34:13</publishTime>
</File>
<File Include="bin/Kingdee.BOS.WebApi.Client.dll">
<publishTime>11/24/2023 11:11:32</publishTime>
</File>
<File Include="bin/log4net.dll">
<publishTime>08/11/2022 14:57:47</publishTime>
</File>
<File Include="bin/Microsoft.Web.Infrastructure.dll">
<publishTime>08/11/2022 14:57:46</publishTime>
</File>
<File Include="bin/MySql.Data.dll">
<publishTime>11/28/2023 13:03:41</publishTime>
</File>
<File Include="bin/Newtonsoft.Json.dll">
<publishTime>03/18/2021 04:03:36</publishTime>
</File>
<File Include="bin/System.Net.Http.Formatting.dll">
<publishTime>11/28/2018 21:00:36</publishTime>
</File>
<File Include="bin/System.Web.Cors.dll">
<publishTime>11/28/2018 20:58:44</publishTime>
</File>
<File Include="bin/System.Web.Http.Cors.dll">
<publishTime>11/28/2018 21:01:26</publishTime>
</File>
<File Include="bin/System.Web.Http.dll">
<publishTime>11/28/2018 21:01:00</publishTime>
</File>
<File Include="bin/System.Web.Http.WebHost.dll">
<publishTime>11/28/2018 21:02:56</publishTime>
</File>
<File Include="dashboard.html">
<publishTime>07/30/2026 15:08:23</publishTime>
</File>
<File Include="dashboard_detail.html">
<publishTime>08/04/2026 09:33:06</publishTime>
</File>
<File Include="delivery_dashboard.html">
<publishTime>08/03/2026 15:15:21</publishTime>
</File>
<File Include="delivery_dashboard_L21.html">
<publishTime>07/30/2026 14:17:33</publishTime>
</File>
<File Include="delivery_dashboard_L22.html">
<publishTime>07/30/2026 14:18:43</publishTime>
</File>
<File Include="delivery_dashboard_L31.html">
<publishTime>07/30/2026 14:18:11</publishTime>
</File>
<File Include="delivery_dashboard_L32.html">
<publishTime>07/30/2026 11:11:36</publishTime>
</File>
<File Include="delivery_dashboard_noorder2.html">
<publishTime>08/03/2026 15:11:22</publishTime>
</File>
<File Include="delivery_dashboard_noorder3.html">
<publishTime>08/03/2026 15:11:42</publishTime>
</File>
<File Include="delivery_dashboard_noorder4.html">
<publishTime>08/03/2026 15:18:49</publishTime>
</File>
<File Include="Global.asax">
<publishTime>06/17/2026 17:02:54</publishTime>
</File>
<File Include="index.html">
<publishTime>07/28/2026 14:33:50</publishTime>
</File>
<File Include="log4net.config">
<publishTime>06/17/2026 17:03:07</publishTime>
</File>
<File Include="login.html">
<publishTime>07/22/2026 15:45:02</publishTime>
</File>
<File Include="multi_detail.html">
<publishTime>07/29/2026 17:07:56</publishTime>
</File>
<File Include="procurement.html">
<publishTime>07/30/2026 17:19:09</publishTime>
</File>
<File Include="procurement_dashboard.html">
<publishTime>07/30/2026 10:57:34</publishTime>
</File>
<File Include="procurement_dashboard_detail.html">
<publishTime>07/29/2026 10:12:54</publishTime>
</File>
<File Include="procurement_dashboard_detail_items.html">
<publishTime>07/29/2026 10:12:57</publishTime>
</File>
<File Include="procurement_dashboard_level4.html">
<publishTime>07/29/2026 10:12:59</publishTime>
</File>
<File Include="procurement_detail.html">
<publishTime>08/04/2026 09:23:55</publishTime>
</File>
<File Include="Web.config">
<publishTime>07/22/2026 15:25:46</publishTime>
</File>
</ItemGroup>
</Project>
@@ -0,0 +1,587 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>研发物料采购看板 - 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: 4px
}
.top-bar .logo {
font-size: 17px;
font-weight: 600;
margin-right: 24px
}
.top-links a {
color: rgba(255,255,255,.75);
text-decoration: none;
padding: 0 16px;
height: 100%;
display: flex;
align-items: center;
font-size: 13px;
border-radius: 4px 4px 0 0;
transition: .2s
}
.top-links a:hover {
color: #fff;
background: rgba(255,255,255,.1)
}
.top-links a.active {
color: #fff;
background: rgba(255,255,255,.2)
}
.user-info {
margin-left: auto;
font-size: 12px;
opacity: .85
}
.main {
max-width: 1500px;
margin: 0 auto;
padding: 12px 16px
}
/* ===== 搜索栏 ===== */
.search-bar {
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 4px rgba(0,0,0,.08);
padding: 12px 16px;
margin-bottom: 10px;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px 14px;
align-items: center
}
.search-bar label {
font-size: 12px;
color: #555;
font-weight: 600;
white-space: nowrap
}
.search-bar .field {
display: inline-flex;
align-items: center;
gap: 4px
}
.search-bar input,.search-bar select {
height: 32px;
padding: 0 10px;
border: 2px solid #e0e0e0;
border-radius: 5px;
font-size: 13px;
outline: 0;
transition: border-color .2s;box-sizing:border-box
}
.search-bar .field input{flex:1;min-width:0}
.search-bar input:focus {
border-color: #1a73e8;
box-shadow: 0 0 0 3px rgba(26,115,232,.12)
}
.search-bar .btn {
height: 32px;
padding: 0 16px;
border: 0;
border-radius: 5px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: .2s
}
.search-bar .btn-primary {
background: linear-gradient(135deg,#1a73e8,#1557b0);
color: #fff
}
.search-bar .btn-primary:hover {
opacity: .92
}
.search-bar .btn-outline {
background: #fff;
color: #666;
border: 2px solid #e0e0e0
}
.search-bar .btn-outline:hover {
border-color: #1a73e8;
color: #1a73e8
}
.search-bar .total em {
font-style: normal;
color: #1a73e8;
font-weight: 700
}
/* ===== 表格 ===== */
.list-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 4px rgba(0,0,0,.08);
overflow: hidden
}
.list-card .card-header {
padding: 10px 16px;
border-bottom: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center
}
.list-card .card-header h3 {
font-size: 14px;
color: #333;
font-weight: 600
}
.list-card .card-header .count {
font-size: 12px;
color: #999
}
.table-wrap {
overflow: auto;
max-height: calc(100vh - 220px)
}
table {
min-width: 100%;
border-collapse: collapse;
font-size: 12px
}
thead th {
background: #f8f9fa;
color: #555;
font-weight: 600;
padding: 8px 8px;
text-align: left;
border: 1px solid #999;
border-bottom: 2px solid #999;
white-space: nowrap;
position: sticky;
top: 0;
z-index: 1;
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: 7px 8px;
border: 1px solid #ddd;
color: #333
}
tbody tr {
transition: background .15s;
cursor: pointer
}
tbody tr:hover {
background: #f0f6ff
}
.empty td {
text-align: center;
padding: 36px;
color: #bbb
}
.pagination {
padding: 10px 16px;
border-top: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
color: #666
}
.pagination .btns {
display: flex;
gap: 3px
}
.pagination .btns button {
min-width: 28px;
height: 28px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background: #fff;
color: #333;
cursor: pointer;
font-size: 12px;
transition: .15s
}
.pagination .btns button:hover {
border-color: #1a73e8;
color: #1a73e8
}
.pagination .btns button.active {
background: #1a73e8;
color: #fff;
border-color: #1a73e8
}
.pagination .btns button:disabled {
opacity: .4;
cursor: default
}
.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
}
.loading-spinner {
width: 34px;
height: 34px;
border: 3px solid #e0e0e0;
border-top-color: #1a73e8;
border-radius: 50%;
animation: spin .7s linear infinite
}
@keyframes spin {
to {
transform: rotate(360deg)
}
}
.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
}
.toast.success {
background: #e6f9ed;
color: #1a7a3a;
display: block
}
</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">
<span class="logo">Gaussian</span>
<div class="top-links" id="navTabs" style="display:flex;gap:4px;height:100%;"></div>
<span class="user-info" id="userInfo"></span>
</div>
<div class="main">
<div class="search-bar">
<span class="field"><label>流程编号:</label><input type="text" id="txtLcbh" placeholder="流程编号" autocomplete="off" /></span>
<span class="field"><label>申请人:</label><input type="text" id="txtSqrxm" placeholder="申请人" autocomplete="off" /></span>
<span class="field"><label>专项名称:</label><input type="text" id="txtReqName" placeholder="专项名称" autocomplete="off" /></span>
<span class="field"><label>研发项目:</label><input type="text" id="txtYfxmmc" placeholder="研发项目" autocomplete="off" /></span>
<span class="field"><label>物料编码:</label><input type="text" id="txtMatCode" placeholder="物料编码" autocomplete="off" /></span>
<span class="field"><label>物料名称:</label><input type="text" id="txtMatName" placeholder="物料名称" autocomplete="off" /></span>
<span class="field"><label>策略采购负责人:</label><input type="text" id="txtCncgfzr" placeholder="策略采购负责人" autocomplete="off" /></span>
<span class="field"><label>研发采购负责人:</label><input type="text" id="txtYfcgfzr" placeholder="研发采购负责人" autocomplete="off" /></span>
<span class="field" style="grid-column:1"><label>业务状态:</label>
<select id="txtYwzt" style="height:32px;border:2px solid #e0e0e0;border-radius:5px;font-size:13px;outline:0;padding:0 6px;">
<option value="">全部</option>
<option value="1">采购订单-转单追踪</option>
<option value="2">供应链-待供应商报价</option>
<option value="3">供应链-待ED审批</option>
<option value="4">供应链-ED驳回,重新议价</option>
<option value="5">供应链-ED已审批</option>
<option value="6">研发-采购申请驳回</option>
<option value="7">研发-采购申请撤回</option>
<option value="8">研发-采购申请取消</option>
<option value="9">研发-量产复用件</option>
</select>
</span>
<span style="grid-column:2/-1;text-align:right;display:flex;gap:12px;justify-content:flex-end;align-items:center">
<span style="font-size:12px;color:#999">共 <em id="totalCount" style="font-style:normal;color:#1a73e8;font-weight:700">0</em> 条</span>
<button class="btn btn-primary" onclick="loadList()">查询</button>
<button class="btn btn-outline" onclick="resetSearch()">重置</button>
</span>
</div>
<div class="list-card">
<div class="card-header"><h3>研发物料采购明细</h3><span class="count">当前页 <em id="pageCount">0</em></span></div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>#<span class="resizer"></span></th>
<th>流程编号<span class="resizer"></span></th>
<th>申请日期<span class="resizer"></span></th>
<th>物料编码<span class="resizer"></span></th>
<th>物料名称<span class="resizer"></span></th>
<th>申请数量<span class="resizer"></span></th>
<th>研发项目<span class="resizer"></span></th>
<th>申请人<span class="resizer"></span></th>
<th>专项名称<span class="resizer"></span></th>
<th>业务状态<span class="resizer"></span></th>
<th>策略采购负责人<span class="resizer"></span></th>
<th>研发采购负责人<span class="resizer"></span></th>
<th>计划交付日期(策略采购)<span class="resizer"></span></th>
<th>计划交付日期(研发采购)<span class="resizer"></span></th>
</tr>
</thead>
<tbody id="listBody"><tr class="empty"><td colspan="14">加载中...</td></tr></tbody>
</table>
</div>
<div class="pagination">
<span>共 <em id="totalPages">0</em> 页</span>
<div class="btns" id="pageBtns"></div>
</div>
</div>
</div>
<script>
var currentPage = 1, pageSize = 20, currentData = [];
var ywztMap={'1':'转单追踪','2':'待报价','3':'待ED审批','4':'ED驳回','5':'ED已审批','6':'驳回','7':'撤回','8':'取消','9':'量产复用'};
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 saveFilters() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtYwzt','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var el=document.getElementById(id);if(el)sessionStorage.setItem('dash_'+id,el.value)
});
}
function restoreFilters() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtYwzt','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var v=sessionStorage.getItem('dash_'+id);if(v!==null){var el=document.getElementById(id);if(el)el.value=v}
});
}
function getVal(id){var el=document.getElementById(id);return el?encodeURIComponent(el.value.trim()):''}
function loadList() {
loading(true);
saveFilters();
currentPage = 1;
var url = 'api/Procurement/GetDashboardList?lcbhNo='+getVal('txtLcbh')+'&sqrxm='+getVal('txtSqrxm')+'&reqName='+getVal('txtReqName')+'&yfxmmc='+getVal('txtYfxmmc')+'&matCode='+getVal('txtMatCode')+'&matName='+getVal('txtMatName')+'&ywzt='+document.getElementById('txtYwzt').value+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&page=1&pageSize='+pageSize;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function () {
loading(false);
try { var r = JSON.parse(xhr.responseText); if (r.success) { currentData = r.data || []; renderList(currentData); renderPagination(r.total || 0); document.getElementById('totalCount').textContent = r.total || 0; } else { toast(r.message || '查询失败', 'error') } }
catch (e) { toast('数据解析异常', 'error') }
};
xhr.onerror = function () { loading(false); toast('网络请求失败', 'error') };
xhr.send();
}
function loadPage(page) {
loading(true);
currentPage = page;
var url = 'api/Procurement/GetDashboardList?lcbhNo='+getVal('txtLcbh')+'&sqrxm='+getVal('txtSqrxm')+'&reqName='+getVal('txtReqName')+'&yfxmmc='+getVal('txtYfxmmc')+'&matCode='+getVal('txtMatCode')+'&matName='+getVal('txtMatName')+'&ywzt='+document.getElementById('txtYwzt').value+'&cncgfzr='+getVal('txtCncgfzr')+'&yfcgfzr='+getVal('txtYfcgfzr')+'&page='+page+'&pageSize='+pageSize;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function () {
loading(false);
try { var r = JSON.parse(xhr.responseText); if (r.success) { currentData = r.data || []; renderList(currentData); renderPagination(r.total || 0); document.getElementById('totalCount').textContent = r.total || 0; } else { toast(r.message || '查询失败', 'error') } }
catch (e) { toast('数据解析异常', 'error') }
};
xhr.onerror = function () { loading(false); toast('网络请求失败', 'error') };
xhr.send();
}
function resetSearch() {
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName','txtYwzt','txtCncgfzr','txtYfcgfzr'].forEach(function(id){
var el=document.getElementById(id);if(el)el.value='';sessionStorage.removeItem('dash_'+id)
});
loadList();
}
function renderList(data) {
var tbody = document.getElementById('listBody');
if (!data || !data.length) {
tbody.innerHTML = '<tr class="empty"><td colspan="14">暂无数据</td></tr>';
document.getElementById('pageCount').textContent = '0';
return;
}
var h = '';
data.forEach(function (item, idx) {
h += '<tr onclick="selectRow(this)" data-lcbh="' + escapeHtml(item.lcbh) + '" data-djbh="' + escapeHtml(item.djbh) + '" data-requestid="' + escapeHtml(item.requestId) + '" data-reqname="' + escapeHtml(item.reqName || '') + '" data-yfxmmc="' + escapeHtml(item.yfxmmc || '') + '" data-sqrxm="' + escapeHtml(item.sqrxm || '') + '" data-sqrq="' + escapeHtml(item.sqrq || '') + '" data-cncgfzr="' + escapeHtml(item.cncgfzr || '') + '" data-yfcgfzr="' + escapeHtml(item.yfcgfzr || '') + '">';
h += '<td>' + ((currentPage - 1) * pageSize + idx + 1) + '</td>';
h += '<td><strong>' + escapeHtml(item.lcbh) + '</strong></td>';
h += '<td>' + escapeHtml(item.sqrq) + '</td>';
h += '<td>' + escapeHtml(item.wlbmCode) + '</td>';
h += '<td>' + escapeHtml(item.wlmc) + '</td>';
h += '<td>' + escapeHtml(item.sqsl) + '</td>';
h += '<td>' + escapeHtml(item.yfxmmc) + '</td>';
h += '<td>' + escapeHtml(item.sqrxm) + '</td>';
h += '<td style="max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="' + escapeHtml(item.reqName || '') + '">' + escapeHtml(item.reqName || '') + '</td>';
h += '<td>' + (ywztMap[item.ywzt]||item.ywzt||'') + '</td>';
h += '<td>' + escapeHtml(item.cncgfzr || '') + '</td>';
h += '<td>' + escapeHtml(item.yfcgfzr || '') + '</td>';
h += '<td>' + escapeHtml(item.cnjhjfrq || '') + '</td>';
h += '<td>' + escapeHtml(item.yfjhjfrq || '') + '</td>';
h += '</tr>';
});
tbody.innerHTML = h;
document.getElementById('pageCount').textContent = data.length;
}
function renderPagination(total) {
var tp = Math.ceil(total / pageSize) || 1;
document.getElementById('totalPages').textContent = tp;
var c = document.getElementById('pageBtns');
if (tp <= 1) { c.innerHTML = ''; return }
var h = '';
h += '<button ' + (currentPage <= 1 ? 'disabled' : '') + ' onclick="loadPage(1)">首页</button>';
h += '<button ' + (currentPage <= 1 ? 'disabled' : '') + ' onclick="loadPage(' + (currentPage - 1) + ')">‹</button>';
var start = Math.max(1, currentPage - 2), end = Math.min(tp, currentPage + 2);
for (var i = start; i <= end; i++)h += '<button class="' + (i === currentPage ? 'active' : '') + '" onclick="loadPage(' + i + ')">' + i + '</button>';
h += '<button ' + (currentPage >= tp ? 'disabled' : '') + ' onclick="loadPage(' + (currentPage + 1) + ')">›</button>';
h += '<button ' + (currentPage >= tp ? 'disabled' : '') + ' onclick="loadPage(' + tp + ')">末页</button>';
c.innerHTML = h;
}
function selectRow(el) {
var lcbh = el.getAttribute('data-lcbh');
var djbh = el.getAttribute('data-djbh');
var requestId = el.getAttribute('data-requestid');
var reqName = el.getAttribute('data-reqname') || '';
var yfxmmc = el.getAttribute('data-yfxmmc') || '';
var sqrxm = el.getAttribute('data-sqrxm') || '';
var sqrq = el.getAttribute('data-sqrq') || '';
window.location.href = 'dashboard_detail.html?lcbh=' + encodeURIComponent(lcbh)
+ '&djbh=' + encodeURIComponent(djbh)
+ '&requestId=' + encodeURIComponent(requestId)
+ '&sqrq=' + encodeURIComponent(sqrq)
+ '&sqrxm=' + encodeURIComponent(sqrxm)
+ '&yfxmmc=' + encodeURIComponent(yfxmmc)
+ '&reqName=' + encodeURIComponent(reqName);
}
['txtLcbh','txtSqrxm','txtReqName','txtYfxmmc','txtMatCode','txtMatName'].forEach(function(id){
var el=document.getElementById(id);if(el)el.addEventListener('keydown',function(e){if(e.key==='Enter')loadList()})
});
// ===== 登录校验 =====
(function () {
var userData = sessionStorage.getItem('gx_user');
if (!userData) { window.location.href = 'login.html'; return }
try {
var user = JSON.parse(userData);
var roles = user.roleNumbers || [];
if (roles.indexOf('YF01') < 0) { alert('当前用户无权限'); sessionStorage.removeItem('gx_user'); window.location.href = 'login.html'; return }
var nav = '';
if (roles.indexOf('CRM01') >= 0) nav += '<a href="index.html">CRM同步</a>';
if (roles.indexOf('Purchase01') >= 0) nav += '<a href="procurement.html">采购申请管理</a>';
if (roles.indexOf('Purchase01') >= 0) nav += '<a href="procurement_dashboard.html">采购看板</a>';
if (roles.indexOf('Purchase01') >= 0) nav += '<a href="delivery_dashboard.html">采购物料交付状态看板</a>';
if (roles.indexOf('YF01') >= 0) nav += '<a href="dashboard.html" class="active">研发采购看板</a>';
document.getElementById('navTabs').innerHTML = nav;
document.getElementById('userInfo').innerHTML = (user.userName || user.userId) + ' | <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) { alert('当前用户无权限'); window.location.href = 'login.html' }
})();
restoreFilters();
loadList();
// 列宽拖动
(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=''}});
})();
</script>
</body>
</html>
@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\1</_PublishTargetUrl>
<History>True|2026-09-14T08:03:31.1287120Z||;True|2026-09-10T17:10:29.7209215+08:00||;True|2026-09-09T10:57:48.5945782+08:00||;True|2026-09-09T10:57:12.2360364+08:00||;True|2026-09-08T16:04:14.0178395+08:00||;True|2026-09-08T09:31:18.0062650+08:00||;True|2026-09-07T10:26:31.5838394+08:00||;True|2026-09-07T10:20:49.1129599+08:00||;True|2026-09-07T09:37:30.1979509+08:00||;True|2026-09-04T16:31:49.4596927+08:00||;True|2026-09-04T16:06:31.3259073+08:00||;True|2026-08-18T09:51:59.3666691+08:00||;True|2026-08-17T17:06:43.4568135+08:00||;True|2026-08-17T09:42:27.8156190+08:00||;True|2026-08-14T16:52:13.7440900+08:00||;True|2026-08-14T16:42:38.4548286+08:00||;True|2026-08-14T14:52:14.8351128+08:00||;True|2026-08-13T15:15:49.8409025+08:00||;True|2026-08-13T14:07:36.8370386+08:00||;True|2026-08-06T10:36:00.8099402+08:00||;True|2026-08-05T14:43:23.1856296+08:00||;True|2026-08-04T09:34:44.8282856+08:00||;True|2026-07-31T14:15:17.8924066+08:00||;True|2026-07-29T17:42:14.7465984+08:00||;True|2026-07-28T14:34:03.8612324+08:00||;True|2026-07-28T14:29:24.5766446+08:00||;True|2026-07-28T14:11:27.5824603+08:00||;True|2026-07-28T09:28:49.8005658+08:00||;True|2026-07-28T09:28:39.3771641+08:00||;True|2026-07-28T09:28:26.9653303+08:00||;True|2026-07-27T14:33:17.8556875+08:00||;True|2026-07-27T14:28:25.8121460+08:00||;True|2026-07-24T16:51:55.7769810+08:00||;True|2026-07-24T15:25:29.8947525+08:00||;True|2026-07-24T10:49:03.6003286+08:00||;True|2026-07-22T16:23:35.6347492+08:00||;True|2026-07-22T16:17:35.8799930+08:00||;True|2026-07-22T15:49:28.6121559+08:00||;True|2026-07-22T14:55:18.2703822+08:00||;True|2026-07-22T14:51:59.4718336+08:00||;True|2026-07-01T10:02:04.5477902+08:00||;True|2026-06-17T17:46:44.1504757+08:00||;True|2026-06-17T17:38:09.4990885+08:00||;True|2026-06-17T17:37:55.6743611+08:00||;False|2026-06-17T17:37:51.8483598+08:00||;True|2026-06-17T17:33:33.5540476+08:00||;False|2026-06-17T17:33:29.8580593+08:00||;True|2026-06-17T17:29:10.0025733+08:00||;False|2026-06-17T17:28:56.0140964+08:00||;True|2026-06-17T17:23:13.5724326+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
<File Include="bin/GXWebApi.dll">
<publishTime>09/14/2026 16:03:30</publishTime>
</File>
<File Include="bin/GXWebApi.pdb">
<publishTime>09/14/2026 16:03:30</publishTime>
</File>
<File Include="bin/Kingdee.BOS.WebApi.Client.dll">
<publishTime>11/24/2023 11:11:32</publishTime>
</File>
<File Include="bin/log4net.dll">
<publishTime>08/11/2022 14:57:47</publishTime>
</File>
<File Include="bin/Microsoft.mshtml.dll">
<publishTime>02/09/2023 19:58:24</publishTime>
</File>
<File Include="bin/Microsoft.Web.Infrastructure.dll">
<publishTime>08/11/2022 14:57:46</publishTime>
</File>
<File Include="bin/MySql.Data.dll">
<publishTime>11/28/2023 13:03:41</publishTime>
</File>
<File Include="bin/Newtonsoft.Json.dll">
<publishTime>03/18/2021 04:03:36</publishTime>
</File>
<File Include="bin/Spire.License.dll">
<publishTime>02/09/2023 19:58:30</publishTime>
</File>
<File Include="bin/Spire.Pdf.Wpf.dll">
<publishTime>02/09/2023 19:58:30</publishTime>
</File>
<File Include="bin/Spire.XLS.Wpf.dll">
<publishTime>02/09/2023 19:58:30</publishTime>
</File>
<File Include="bin/System.Net.Http.Formatting.dll">
<publishTime>11/28/2018 21:00:36</publishTime>
</File>
<File Include="bin/System.Web.Cors.dll">
<publishTime>11/28/2018 20:58:44</publishTime>
</File>
<File Include="bin/System.Web.Http.Cors.dll">
<publishTime>11/28/2018 21:01:26</publishTime>
</File>
<File Include="bin/System.Web.Http.dll">
<publishTime>11/28/2018 21:01:00</publishTime>
</File>
<File Include="bin/System.Web.Http.WebHost.dll">
<publishTime>11/28/2018 21:02:56</publishTime>
</File>
<File Include="crm_sale_order_sync.html">
<publishTime>09/08/2026 09:29:29</publishTime>
</File>
<File Include="dashboard.html">
<publishTime>08/18/2026 16:36:19</publishTime>
</File>
<File Include="dashboard_detail.html">
<publishTime>08/04/2026 09:33:06</publishTime>
</File>
<File Include="delivery_dashboard.html">
<publishTime>08/18/2026 16:35:29</publishTime>
</File>
<File Include="delivery_dashboard_L21.html">
<publishTime>07/30/2026 14:17:33</publishTime>
</File>
<File Include="delivery_dashboard_L22.html">
<publishTime>07/30/2026 14:18:43</publishTime>
</File>
<File Include="delivery_dashboard_L31.html">
<publishTime>07/30/2026 14:18:11</publishTime>
</File>
<File Include="delivery_dashboard_L32.html">
<publishTime>07/30/2026 11:11:36</publishTime>
</File>
<File Include="delivery_dashboard_noorder2.html">
<publishTime>08/03/2026 15:11:22</publishTime>
</File>
<File Include="delivery_dashboard_noorder3.html">
<publishTime>08/03/2026 15:11:42</publishTime>
</File>
<File Include="delivery_dashboard_noorder4.html">
<publishTime>08/03/2026 15:18:49</publishTime>
</File>
<File Include="Global.asax">
<publishTime>06/17/2026 17:02:54</publishTime>
</File>
<File Include="home.html">
<publishTime>09/09/2026 10:57:31</publishTime>
</File>
<File Include="Images/idc_Eng.jpg">
<publishTime>08/18/2026 17:32:08</publishTime>
</File>
<File Include="index.html">
<publishTime>08/18/2026 16:38:18</publishTime>
</File>
<File Include="log4net.config">
<publishTime>06/17/2026 17:03:07</publishTime>
</File>
<File Include="login.html">
<publishTime>09/02/2026 09:02:55</publishTime>
</File>
<File Include="multi_detail.html">
<publishTime>07/29/2026 17:07:56</publishTime>
</File>
<File Include="procurement.html">
<publishTime>09/07/2026 10:24:57</publishTime>
</File>
<File Include="procurement_audit_leadtime.html">
<publishTime>09/04/2026 15:23:18</publishTime>
</File>
<File Include="procurement_audit_leadtime_l2.html">
<publishTime>09/04/2026 11:13:28</publishTime>
</File>
<File Include="procurement_audit_leadtime_l3.html">
<publishTime>09/04/2026 11:18:55</publishTime>
</File>
<File Include="procurement_audit_receive_l2.html">
<publishTime>09/04/2026 14:06:59</publishTime>
</File>
<File Include="procurement_audit_receive_l3.html">
<publishTime>09/04/2026 15:23:23</publishTime>
</File>
<File Include="procurement_board_list.html">
<publishTime>09/04/2026 16:29:44</publishTime>
</File>
<File Include="procurement_dashboard.html">
<publishTime>08/18/2026 16:35:01</publishTime>
</File>
<File Include="procurement_dashboard_detail.html">
<publishTime>07/29/2026 10:12:54</publishTime>
</File>
<File Include="procurement_dashboard_detail_items.html">
<publishTime>07/29/2026 10:12:57</publishTime>
</File>
<File Include="procurement_dashboard_level4.html">
<publishTime>07/29/2026 10:12:59</publishTime>
</File>
<File Include="procurement_detail.html">
<publishTime>08/13/2026 15:12:38</publishTime>
</File>
<File Include="View/common/grid.css">
<publishTime>09/02/2026 14:54:52</publishTime>
</File>
<File Include="View/common/grid.js">
<publishTime>09/02/2026 14:54:55</publishTime>
</File>
<File Include="View/common/nav.css">
<publishTime>09/08/2026 13:59:53</publishTime>
</File>
<File Include="View/common/nav.js">
<publishTime>09/09/2026 10:44:16</publishTime>
</File>
<File Include="View/Delivery/bom_master.html">
<publishTime>09/14/2026 15:06:22</publishTime>
</File>
<File Include="View/Delivery/delivery_board.html">
<publishTime>09/04/2026 16:29:43</publishTime>
</File>
<File Include="View/Delivery/delivery_dashboard.html">
<publishTime>09/04/2026 16:29:43</publishTime>
</File>
<File Include="View/Delivery/delivery_dashboard_risk.html">
<publishTime>09/14/2026 15:17:34</publishTime>
</File>
<File Include="View/Delivery/material_delivery.html">
<publishTime>09/04/2026 16:29:42</publishTime>
</File>
<File Include="View/Delivery/production_delivery.html">
<publishTime>09/04/2026 16:29:41</publishTime>
</File>
<File Include="View/Delivery/schedule.html">
<publishTime>09/14/2026 15:05:46</publishTime>
</File>
<File Include="View/Delivery/schedule_board.html">
<publishTime>09/09/2026 10:40:50</publishTime>
</File>
<File Include="View/MES/mes_dashboard.html">
<publishTime>08/18/2026 16:43:31</publishTime>
</File>
<File Include="Web.config">
<publishTime>09/04/2026 14:05:45</publishTime>
</File>
</ItemGroup>
</Project>
@@ -0,0 +1,208 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GXWebApi</RootNamespace>
<AssemblyName>GXWebApi</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<Use64BitIISExpress />
<IISUrl>http://localhost:8080/</IISUrl>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\GuangFu.StringTracing\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\GuangFu.StringTracing\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\OPSOFT\OPSOFTV60\AP\BIN\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Kingdee.BOS.WebApi.Client">
<HintPath>Kingdee.BOS.WebApi.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Spire.XLS.Wpf">
<HintPath>Spire.XLS.Wpf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Spire.XLS.Wpf, Version=7.12.39.14240, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\OPSOFT\OPSOFTV60\Spire.XLS.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting">
<HintPath>packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.Cors">
<HintPath>packages\Microsoft.AspNet.Cors.5.2.7\lib\net45\System.Web.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http">
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.Cors">
<HintPath>packages\Microsoft.AspNet.WebApi.Cors.5.2.7\lib\net45\System.Web.Http.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Common\CrmApi.cs" />
<Compile Include="Common\DBHelpe.cs" />
<Compile Include="Common\ExcelHelper.cs" />
<Compile Include="Common\Extensions.cs" />
<Compile Include="Common\LogHelper.cs" />
<Compile Include="Common\MySqlUtils.cs" />
<Compile Include="Common\ResponseStatus.cs" />
<Compile Include="Common\WmsCommonFunction.cs" />
<Compile Include="Controllers\AuthController.cs" />
<Compile Include="Controllers\DifferentialController.cs" />
<Compile Include="Controllers\ProcurementController.cs" />
<Compile Include="Controllers\DeliverController.cs" />
<Compile Include="Controllers\MesController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="crm_sale_order_sync.html" />
<Content Include="delivery_dashboard.html" />
<Content Include="delivery_dashboard_L21.html" />
<Content Include="delivery_dashboard_L22.html" />
<Content Include="delivery_dashboard_L31.html" />
<Content Include="delivery_dashboard_L32.html" />
<Content Include="delivery_dashboard_noorder2.html" />
<Content Include="delivery_dashboard_noorder3.html" />
<Content Include="delivery_dashboard_noorder4.html" />
<Content Include="Global.asax" />
<Content Include="home.html" />
<Content Include="Images\idc_Eng.jpg" />
<Content Include="login.html" />
<Content Include="index.html" />
<Content Include="procurement.html" />
<Content Include="procurement_audit_leadtime.html" />
<Content Include="procurement_audit_leadtime_l2.html" />
<Content Include="procurement_audit_leadtime_l3.html" />
<Content Include="procurement_audit_receive_l2.html" />
<Content Include="procurement_audit_receive_l3.html" />
<Content Include="procurement_board_list.html" />
<Content Include="procurement_dashboard.html" />
<Content Include="procurement_dashboard_detail.html" />
<Content Include="procurement_dashboard_detail_items.html" />
<Content Include="procurement_dashboard_level4.html" />
<Content Include="procurement_detail.html" />
<Content Include="dashboard.html" />
<Content Include="dashboard_detail.html" />
<Content Include="multi_detail.html" />
<Content Include="View\common\grid.css" />
<Content Include="View\common\grid.js" />
<Content Include="View\Delivery\delivery_dashboard.html" />
<Content Include="View\Delivery\delivery_dashboard_risk.html" />
<Content Include="View\Delivery\production_delivery.html" />
<Content Include="Web.config" />
<Content Include="log4net.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="View\MES\mes_dashboard.html" />
</ItemGroup>
<ItemGroup>
<Content Include="View\Delivery\bom_master.html" />
<Content Include="View\Delivery\schedule.html" />
<Content Include="View\Delivery\material_delivery.html" />
<Content Include="View\Delivery\delivery_board.html" />
</ItemGroup>
<ItemGroup>
<Content Include="View\common\nav.js" />
<Content Include="View\common\nav.css" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>8080</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8080/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GXWebApi</RootNamespace>
<AssemblyName>GXWebApi</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<Use64BitIISExpress />
<IISUrl>http://localhost:8080/</IISUrl>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\GuangFu.StringTracing\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\GuangFu.StringTracing\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\OPSOFT\OPSOFTV60\AP\BIN\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Kingdee.BOS.WebApi.Client">
<HintPath>Kingdee.BOS.WebApi.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting">
<HintPath>packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.Cors">
<HintPath>packages\Microsoft.AspNet.Cors.5.2.7\lib\net45\System.Web.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http">
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.Cors">
<HintPath>packages\Microsoft.AspNet.WebApi.Cors.5.2.7\lib\net45\System.Web.Http.Cors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Common\CrmApi.cs" />
<Compile Include="Common\DBHelpe.cs" />
<Compile Include="Common\Extensions.cs" />
<Compile Include="Common\LogHelper.cs" />
<Compile Include="Common\MySqlUtils.cs" />
<Compile Include="Common\ResponseStatus.cs" />
<Compile Include="Common\WmsCommonFunction.cs" />
<Compile Include="Controllers\AuthController.cs" />
<Compile Include="Controllers\DifferentialController.cs" />
<Compile Include="Controllers\ProcurementController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="delivery_dashboard.html" />
<Content Include="delivery_dashboard_L21.html" />
<Content Include="delivery_dashboard_L22.html" />
<Content Include="delivery_dashboard_L31.html" />
<Content Include="delivery_dashboard_L32.html" />
<Content Include="delivery_dashboard_noorder2.html" />
<Content Include="delivery_dashboard_noorder3.html" />
<Content Include="delivery_dashboard_noorder4.html" />
<Content Include="Global.asax" />
<Content Include="login.html" />
<Content Include="index.html" />
<Content Include="procurement.html" />
<Content Include="procurement_dashboard.html" />
<Content Include="procurement_dashboard_detail.html" />
<Content Include="procurement_dashboard_detail_items.html" />
<Content Include="procurement_dashboard_level4.html" />
<Content Include="procurement_detail.html" />
<Content Include="dashboard.html" />
<Content Include="dashboard_detail.html" />
<Content Include="multi_detail.html" />
<Content Include="Web.config" />
<Content Include="log4net.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>8080</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8080/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,358 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>交付物料风险明细</title>
<link rel="stylesheet" href="../common/nav.css">
<link rel="stylesheet" href="../common/grid.css">
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Microsoft YaHei','PingFang SC',sans-serif; background: #f3f5fa; color: #2c3e50; padding: 14px 18px; }
.head { display: flex; align-items: center; margin-bottom: 12px; gap: 12px; }
.head h2 { font-size: 20px; }
.head .back { padding: 6px 14px; background: #fff; border: 1px solid #dcdfe6; border-radius: 6px; cursor: pointer; font-size: 13px; }
.head .back:hover { border-color: #409eff; color: #409eff; }
.head .meta { font-size: 13px; color: #909399; margin-left: auto; }
.filter { background: #fff; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.filter span { font-size: 13px; color: #606266; }
.filter input, .filter select { height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 13px; outline: none; background: #fff; }
.filter input { width: 220px; }
.filter input:focus, .filter select:focus { border-color: #409eff; }
.filter button { height: 30px; padding: 0 14px; border: 1px solid #409eff; background: #409eff; color: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
.filter button:hover { background: #66b1ff; border-color: #66b1ff; }
.filter button.gray { background: #fff; color: #606266; border-color: #dcdfe6; }
.filter button.gray:hover { border-color: #409eff; color: #409eff; }
.filter .spacer { flex: 1; }
.filter .count { font-size: 12px; color: #909399; }
.filter button.export { background: linear-gradient(135deg,#34a853,#1e8e3e); border-color: #34a853; }
.filter button.export:hover { opacity: .9; background: #34a853; border-color: #34a853; }
.loading, .empty { text-align: center; padding: 60px 0; color: #909399; font-size: 14px; }
.pagination { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border-radius: 0 0 10px 10px; }
.pagination .info { font-size: 12px; color: #909399; }
.pagination .ctrl { display: flex; align-items: center; gap: 6px; }
.pagination button { height: 28px; min-width: 32px; padding: 0 8px; border: 1px solid #dcdfe6; background: #fff; border-radius: 4px; cursor: pointer; font-size: 12px; }
.pagination button:hover { border-color: #409eff; color: #409eff; }
.pagination button.active { background: #409eff; color: #fff; border-color: #409eff; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination span { font-size: 12px; color: #909399; }
.pagination select { height: 28px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 6px; font-size: 12px; }
.pagination input { width: 50px; height: 28px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 6px; text-align: center; font-size: 12px; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="head">
<button class="back" onclick="window.location.href='delivery_dashboard.html'">← 返回看板</button>
<h2 id="pageTitle">物料明细</h2>
<span class="meta" id="metaInfo"></span>
</div>
<div class="filter">
<span>产品类型:</span>
<select id="filterProductType"><option value="">全部</option></select>
<span>风险:</span>
<select id="filterRisk">
<option value="">全部</option>
<option value="断线">断线</option>
<option value="预警">预警</option>
<option value="安全">安全</option>
</select>
<span>供应商:</span>
<select id="filterSupplier"><option value="">全部</option></select>
<span>采购员:</span>
<select id="filterPurchaser"><option value="">全部</option></select>
<input type="text" id="filterKeyword" placeholder="搜索物料编码/名称/产品编码" />
<button onclick="loadData(1)">查询</button>
<button class="gray" onclick="resetFilter()">重置</button>
<div class="spacer"></div>
<button class="export" onclick="exportExcel()">导出Excel</button>
<span class="count" id="countInfo"></span>
</div>
<div class="gx-grid" id="grid">
<table>
<thead>
<tr>
<th style="width:48px">序号</th>
<th style="width:110px">物料编码</th>
<th style="width:140px">物料名称</th>
<th style="width:90px">产品类型</th>
<th style="width:140px">供应商</th>
<th style="width:100px">采购员</th>
<th style="width:100px">预计停线日</th>
<th style="width:100px">预计到货日</th>
<th style="width:60px">风险</th>
<th style="width:60px">日需求</th>
<th style="width:75px">震泽库存</th>
<th style="width:75px">晋江库存</th>
<th style="width:75px">资阳库存</th>
<th style="width:75px">库存在途合计</th>
<th style="width:70px">量产在途</th>
<th style="width:70px">研发在途</th>
<th style="width:70px">线边库存</th>
<th style="width:70px">已收货</th>
<th style="width:80px">库存</th>
<th style="width:80px">在途</th>
<th style="width:90px">到货计划</th>
<th style="width:140px">备注</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
<div id="status" class="loading">加载中...</div>
</div>
<div class="pagination">
<div class="info" id="pageInfo">共 0 条</div>
<div class="ctrl">
<span>每页</span>
<select id="pageSize" onchange="loadData(1)">
<option value="20">20</option>
<option value="50" selected>50</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="500">500</option>
</select>
<span>条</span>
<button onclick="goPage(1)">«</button>
<button onclick="prevPage()">‹ 上一页</button>
<span>第 <input type="text" id="curPage" value="1" /> / <span id="totalPages">1</span> 页</span>
<button onclick="nextPage()">下一页 ›</button>
<button onclick="goPage(-1)">»</button>
</div>
</div>
<script>
const API_BASE = '../../api/Deliver';
let currentPage = 1;
let currentTotal = 0;
let currentPageSize = 50;
let initRisk = '';
let initProductType = '';
const urlParams = new URLSearchParams(window.location.search);
initRisk = urlParams.get('risk') || '';
initProductType = urlParams.get('productType') || '';
const titleMap = { '': '全部物料', '断线': '断线风险物料', '预警': '预警关注物料', '安全': '安全供应物料' };
const titleColorMap = { '': '#303133', '断线': '#f56c6c', '预警': '#e6a23c', '安全': '#67c23a' };
document.getElementById('pageTitle').textContent = titleMap[initRisk] || '物料明细';
document.getElementById('pageTitle').style.color = titleColorMap[initRisk] || '#303133';
document.getElementById('filterRisk').value = initRisk;
function num(v) { return Grid.num(v); }
function loadFilterOptions() {
// 产品类型
fetch(API_BASE + '/GetSchedules?keyword=').then(r => r.json()).then(res => {
if (res.success) {
const sel = document.getElementById('filterProductType');
const set = new Set();
res.data.forEach(s => { if (s.ProductType) set.add(s.ProductType); });
[...set].sort().forEach(t => {
const opt = document.createElement('option');
opt.value = t; opt.textContent = t;
sel.appendChild(opt);
});
sel.value = initProductType;
}
});
// 供应商/采购员(从当前列表数据汇总,所以首次加载完成后再调用)
}
function loadData(page) {
if (page) currentPage = page;
const tbody = document.getElementById('tbody');
const status = document.getElementById('status');
tbody.innerHTML = '';
status.className = 'loading';
status.style.display = 'block';
status.textContent = '加载中...';
currentPageSize = parseInt(document.getElementById('pageSize').value) || 50;
const risk = document.getElementById('filterRisk').value;
const productType = document.getElementById('filterProductType').value;
const supplier = document.getElementById('filterSupplier').value;
const purchaser = document.getElementById('filterPurchaser').value;
const keyword = document.getElementById('filterKeyword').value.trim();
const params = new URLSearchParams();
if (risk) params.append('risk', risk);
if (productType) params.append('productType', productType);
if (supplier) params.append('supplier', supplier);
if (purchaser) params.append('purchaser', purchaser);
if (keyword) params.append('keyword', keyword);
params.append('page', currentPage);
params.append('pageSize', currentPageSize);
fetch(API_BASE + '/GetBoardRiskList?' + params).then(r => r.json()).then(res => {
if (!res.success) {
status.className = 'empty';
status.textContent = '加载失败:' + (res.message || '');
return;
}
currentTotal = res.total || 0;
document.getElementById('curPage').value = currentPage;
const totalPages = Math.max(1, Math.ceil(currentTotal / currentPageSize));
document.getElementById('totalPages').textContent = totalPages;
document.getElementById('pageInfo').textContent = '共 ' + currentTotal + ' 条';
document.getElementById('countInfo').textContent = '当前显示 ' + ((currentPage-1)*currentPageSize+1) + ' - ' + Math.min(currentPage*currentPageSize, currentTotal) + ' 条';
if (res.data.length === 0) {
status.className = 'empty';
status.textContent = '无数据';
tbody.innerHTML = '';
return;
}
status.style.display = 'none';
tbody.innerHTML = res.data.map((m, i) => {
const seqNo = (currentPage - 1) * currentPageSize + i + 1;
return `<tr>
<td>${seqNo}</td>
<td title="${m.ChildMaterialId}"><strong>${m.ChildMaterialId}</strong></td>
<td title="${m.MaterialName || ''}">${m.MaterialName || '<span class="muted">-</span>'}</td>
<td>${m.ProductType || '<span class="muted">-</span>'}</td>
<td title="${m.Supplier || ''}">${m.Supplier || '<span class="muted">-</span>'}</td>
<td>${m.Purchaser || '<span class="muted">-</span>'}</td>
<td>${m.ExpectedStopDate || '<span class="muted">-</span>'}</td>
<td>${m.ExpectedArrivalDate || '<span class="muted">-</span>'}</td>
<td>${Grid.riskTag(m.DeliveryRisk)}</td>
<td>${num(m.DailyRequirement)}</td>
<td>${num(m.ZhenZeStock)}</td>
<td>${num(m.JinJiangStock)}</td>
<td>${num(m.ZiYangStock)}</td>
<td>${num(m.AvailableStock)}</td>
<td>${num(m.MassInTransit)}</td>
<td>${num(m.ResearchInTransit)}</td>
<td>${num(m.LineSideStock)}</td>
<td>${num(m.ReceivedQty)}</td>
<td>${num(m.StockQty)}</td>
<td>${num(m.InTransitQty)}</td>
<td>${num(m.ArrivalPlanQty)}</td>
<td title="${m.Remark || ''}">${m.Remark || '<span class="muted">-</span>'}</td>
</tr>`;
}).join('');
// 加载完后更新供应商/采购员下拉(用本次数据)
refreshDropdowns(res.data);
});
}
function refreshDropdowns(data) {
const supplierSet = new Set();
const purchaserSet = new Set();
data.forEach(m => { if (m.Supplier) supplierSet.add(m.Supplier); if (m.Purchaser) purchaserSet.add(m.Purchaser); });
const currentSupplier = document.getElementById('filterSupplier').value;
const currentPurchaser = document.getElementById('filterPurchaser').value;
const supplierSel = document.getElementById('filterSupplier');
const purchaserSel = document.getElementById('filterPurchaser');
// 保留当前选中
supplierSel.innerHTML = '<option value="">全部</option>';
purchaserSel.innerHTML = '<option value="">全部</option>';
[...supplierSet].sort().forEach(v => {
const opt = document.createElement('option'); opt.value = v; opt.textContent = v; supplierSel.appendChild(opt);
});
[...purchaserSet].sort().forEach(v => {
const opt = document.createElement('option'); opt.value = v; opt.textContent = v; purchaserSel.appendChild(opt);
});
supplierSel.value = currentSupplier;
purchaserSel.value = currentPurchaser;
}
function prevPage() { if (currentPage > 1) loadData(currentPage - 1); }
function nextPage() {
const totalPages = Math.max(1, Math.ceil(currentTotal / currentPageSize));
if (currentPage < totalPages) loadData(currentPage + 1);
}
function goPage(p) {
const totalPages = Math.max(1, Math.ceil(currentTotal / currentPageSize));
if (p === -1) loadData(totalPages);
else if (p === 1) loadData(1);
else {
const v = parseInt(document.getElementById('curPage').value);
if (!isNaN(v) && v >= 1 && v <= totalPages) loadData(v);
}
}
function resetFilter() {
document.getElementById('filterRisk').value = initRisk;
document.getElementById('filterProductType').value = initProductType;
document.getElementById('filterSupplier').value = '';
document.getElementById('filterPurchaser').value = '';
document.getElementById('filterKeyword').value = '';
document.getElementById('pageSize').value = '50';
loadData(1);
}
// ===== 导出Excel =====
const exportHeaders = ['序号', '物料编码', '物料名称', '产品类型', '供应商', '采购员', '预计停线日', '预计到货日', '风险', '日需求', '震泽库存', '晋江库存', '资阳库存','库存在途合计','量产在途','研发在途','线边库存','已收货','库存','在途','到货计划','备注'];
const exportKeys = ['','ChildMaterialId','MaterialName','ProductType','Supplier','Purchaser','ExpectedStopDate','ExpectedArrivalDate','DeliveryRisk','DailyRequirement','ZhenZeStock','JinJiangStock','ZiYangStock','AvailableStock','MassInTransit','ResearchInTransit','LineSideStock','ReceivedQty','StockQty','InTransitQty','ArrivalPlanQty','Remark'];
function exportExcel() {
const risk = document.getElementById('filterRisk').value;
const productType = document.getElementById('filterProductType').value;
const supplier = document.getElementById('filterSupplier').value;
const purchaser = document.getElementById('filterPurchaser').value;
const keyword = document.getElementById('filterKeyword').value.trim();
const params = new URLSearchParams();
if (risk) params.append('risk', risk);
if (productType) params.append('productType', productType);
if (supplier) params.append('supplier', supplier);
if (purchaser) params.append('purchaser', purchaser);
if (keyword) params.append('keyword', keyword);
params.append('page', 1);
params.append('pageSize', 100000);
const btn = document.querySelector('.filter button.export');
const oldText = btn.textContent;
btn.textContent = '导出中...';
btn.disabled = true;
fetch(API_BASE + '/GetBoardRiskList?' + params).then(r => r.json()).then(res => {
btn.textContent = oldText;
btn.disabled = false;
if (!res.success) { alert('导出失败:' + (res.message || '未知错误')); return; }
const rows = res.data || [];
if (!rows.length) { alert('当前条件下没有可导出的数据'); return; }
const data = [exportHeaders];
rows.forEach((m, i) => {
const row = [i + 1];
for (let k = 1; k < exportKeys.length; k++) row.push(m[exportKeys[k]] == null ? '' : m[exportKeys[k]]);
data.push(row);
});
const wscols = exportHeaders.map((h, i) => {
let max = i === 0 ? Math.max(h.length, String(rows.length).length) : h.length;
rows.forEach(r => { const v = String(r[exportKeys[i]] || ''); if (v.length > max) max = v.length; });
return { wch: Math.min(max + 2, 40) };
});
const ws = XLSX.utils.aoa_to_sheet(data);
ws['!cols'] = wscols;
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, '交付物料风险明细');
const riskName = ({'': '全部', '断线': '断线', '预警': '预警', '安全': '安全'})[risk] || '';
XLSX.writeFile(wb, '交付物料风险明细' + riskName + '_' + new Date().toISOString().slice(0, 10) + '.xlsx');
}).catch(() => {
btn.textContent = oldText;
btn.disabled = false;
alert('导出失败:网络错误');
});
}
document.getElementById('curPage').addEventListener('keydown', e => { if (e.key === 'Enter') goPage(0); });
document.getElementById('filterKeyword').addEventListener('keydown', e => { if (e.key === 'Enter') loadData(1); });
loadFilterOptions();
loadData(1);
setTimeout(() => Grid.bind('grid'), 200);
</script>
<!-- 公共组件 -->
<script src="../common/grid.js"></script>
<script src="../common/nav.js"></script>
</body>
</html>
@@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>金蝶CRM产品同步 - Gaussian</title>
<!-- 公共侧边栏组件 -->
<link rel="stylesheet" href="View/common/nav.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; }
.container { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); width: 100%; max-width: 520px; overflow: hidden; }
.header { background: linear-gradient(135deg, #1a73e8, #1557b0); color: #fff; padding: 28px 32px; text-align: center; }
.header h1 { font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.header p { font-size: 13px; opacity: 0.85; margin-top: 6px; }
.body { padding: 32px; }
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.form-group label .required { color: #e74c3c; margin-left: 2px; }
.form-group input { width: 100%; height: 48px; padding: 0 16px; font-size: 15px; border: 2px solid #e0e0e0; border-radius: 8px; outline: none; transition: border-color 0.25s, box-shadow 0.25s; }
.form-group input:focus { border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12); }
.form-group input::placeholder { color: #bbb; }
.api-hint { font-size: 12px; color: #999; margin-top: 4px; }
.btn { width: 100%; height: 50px; font-size: 16px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #1a73e8, #1557b0); border: none; border-radius: 8px; cursor: pointer; letter-spacing: 1px; transition: opacity 0.2s, transform 0.1s; }
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.result { margin-top: 24px; padding: 16px; border-radius: 8px; font-size: 14px; line-height: 1.7; display: none; word-break: break-all; white-space: pre-wrap; max-height: 400px; overflow-y: auto; }
.result.success { display: block; background: #e6f9ed; border: 1px solid #a3e4bc; color: #1a7a3a; }
.result.error { display: block; background: #fdeaea; border: 1px solid #f5b7b7; color: #b71c1c; }
.result .icon { font-size: 18px; margin-right: 6px; }
.history { margin-top: 28px; border-top: 1px solid #eee; padding-top: 20px; }
.history h3 { font-size: 15px; color: #555; margin-bottom: 12px; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8f9fa; border-radius: 6px; margin-bottom: 8px; font-size: 13px; cursor: pointer; transition: background 0.2s; }
.history-item:hover { background: #e8f0fe; }
.history-item .number { font-weight: 600; color: #1a73e8; }
.history-item .status { padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.history-item .status.ok { background: #e6f9ed; color: #1a7a3a; }
.history-item .status.fail { background: #fdeaea; color: #b71c1c; }
.loading-spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { text-align: center; padding: 0 32px 28px; font-size: 12px; color: #aaa; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content" style="padding-top:0;">
<div class="container">
<div class="header">
<h1>金蝶CRM产品同步</h1>
<p>调用 CrUpCrmProduct 接口同步物料数据</p>
</div>
<div class="body">
<div class="form-group">
<label>物料编码<span class="required">*</span></label>
<input type="text" id="txtFMaNumber" placeholder="请输入物料编码,如:900000344" autocomplete="off" />
<div class="api-hint">接口:POST /api/Differential/CrUpCrmProduct</div>
</div>
<button class="btn" id="btnSubmit" onclick="doSync()">开始同步</button>
<div class="result" id="result"></div>
<div class="history" id="history" style="display:none;">
<h3>操作记录</h3>
<div id="historyList"></div>
</div>
</div>
<div class="footer">GXWebApi &copy; 2026</div>
</div>
</div>
</div><!-- /main-content -->
<script>
var HISTORY_KEY = 'gx_sync_history';
function getHistory() { try { return JSON.parse(localStorage.getItem(HISTORY_KEY) || '[]'); } catch (e) { return []; } }
function saveHistory(item) { var list = getHistory(); list.unshift(item); if (list.length > 10) list = list.slice(0, 10); localStorage.setItem(HISTORY_KEY, JSON.stringify(list)); renderHistory(); }
function escapeHtml(str) { var div = document.createElement('div'); div.appendChild(document.createTextNode(str)); return div.innerHTML; }
function renderHistory() {
var list = getHistory(); var container = document.getElementById('historyList'); var wrap = document.getElementById('history');
if (list.length === 0) { wrap.style.display = 'none'; return; }
wrap.style.display = 'block'; var html = '';
list.forEach(function (item) {
var cls = item.success ? 'ok' : 'fail'; var txt = item.success ? '成功' : '失败';
var msgHtml = item.message ? '<div style="font-size:11px;color:#999;margin-top:3px;">' + escapeHtml(item.message) + '</div>' : '';
html += '<div class="history-item" onclick="fillNumber(\'' + item.number + '\')" style="display:block;cursor:pointer;">'
+ '<div style="display:flex;justify-content:space-between;align-items:center;">'
+ '<span class="number">' + item.number + '</span>'
+ '<span style="color:#999;font-size:12px;">' + item.time + '</span>'
+ '<span class="status ' + cls + '">' + txt + '</span></div>' + msgHtml + '</div>';
});
container.innerHTML = html;
}
function fillNumber(num) { document.getElementById('txtFMaNumber').value = num; }
function showResult(success, message) { var el = document.getElementById('result'); el.className = 'result ' + (success ? 'success' : 'error'); el.innerHTML = '<span class="icon">' + (success ? '&#10003;' : '&#10007;') + '</span>' + message; }
function hideResult() { var el = document.getElementById('result'); el.className = 'result'; el.style.display = 'none'; }
function doSync() {
var input = document.getElementById('txtFMaNumber'); var btn = document.getElementById('btnSubmit'); var FMaNumber = input.value.trim();
if (!FMaNumber) { showResult(false, '请输入物料编码'); input.focus(); return; }
hideResult(); btn.disabled = true; btn.innerHTML = '<span class="loading-spinner"></span>同步中...';
var xhr = new XMLHttpRequest();
xhr.open('POST', 'api/Differential/CrUpCrmProduct', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.timeout = 120000;
xhr.onload = function () {
btn.disabled = false; btn.innerHTML = '开始同步';
try { var resp = JSON.parse(xhr.responseText); var success = resp.success === 'true' || resp.success === true; var msg = resp.message || (success ? '同步成功' : '同步失败'); showResult(success, msg); saveHistory({ number: FMaNumber, success: success, message: msg, time: new Date().toLocaleString('zh-CN', { hour12: false }) }); }
catch (e) { var errMsg = '服务器返回异常:' + xhr.responseText.substring(0, 500); showResult(false, errMsg); saveHistory({ number: FMaNumber, success: false, message: errMsg, time: new Date().toLocaleString('zh-CN', { hour12: false }) }); }
};
xhr.onerror = function () { btn.disabled = false; btn.innerHTML = '开始同步'; showResult(false, '网络连接失败'); };
xhr.ontimeout = function () { btn.disabled = false; btn.innerHTML = '开始同步'; showResult(false, '请求超时(2分钟)'); };
xhr.send(JSON.stringify({ FMaNumber: FMaNumber }));
}
document.getElementById('txtFMaNumber').addEventListener('keydown', function (e) { if (e.key === 'Enter') { doSync(); } });
renderHistory();
// ===== 页面访问控制:CRM01;导航栏由公共组件提供 =====
(function(){
var userData=sessionStorage.getItem('gx_user');
if(!userData){window.location.href='login.html';return}
try{
var user=JSON.parse(userData);
var roles=user.roleNumbers||[];
if(roles.indexOf('CRM01')<0){alert('当前用户无权限');sessionStorage.removeItem('gx_user');window.location.href='login.html';return}
}catch(e){alert('当前用户无权限');window.location.href='login.html'}
})();
</script>
<!-- 公共侧边栏组件(菜单维护点:View/common/nav.js) -->
<script src="View/common/nav.js"></script>
</body>
</html>
Loaded 100 of 6522 files, more files were not shown because too many files have changed in this diff. Show more