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

187 lines
11 KiB
HTML
Executable File

<!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 .btn-refresh { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.header .btn-refresh:hover { background: rgba(255,255,255,.28); }
.area { background: #fff; border-radius: 12px; padding: 20px 24px; margin-top: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.area h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: #1f2937; }
.area .sub { color: #6b7280; font-size: 12px; margin-bottom: 14px; }
.area .placeholder { color: #9ca3af; font-size: 13px; padding: 30px 0; text-align: center; border: 1px dashed #e5e7eb; border-radius: 8px; }
.level1-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; }
.card .title { font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 10px; }
.card .total { font-size: 12px; color: #6b7280; margin-bottom: 12px; }
.risk-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px dashed #e5e7eb; cursor: pointer; }
.risk-row:first-of-type { border-top: none; }
.risk-row .label { font-size: 13px; color: #4b5563; }
.risk-row .num { font-size: 18px; font-weight: 600; }
.risk-row.cg { color: #374151; } .risk-row.cg .num { color: #ef4444; }
.risk-row.gao { color: #374151; } .risk-row.gao .num { color: #f97316; }
.risk-row.zhong { color: #374151; } .risk-row.zhong .num { color: #eab308; }
.risk-row.di { color: #374151; } .risk-row.di .num { color: #10b981; }
.risk-row:hover { background: #f3f4f6; }
</style>
<style>
/* 第二区域:到料考核 */
.receive-block { border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.receive-block .receive-head { background: #f9fafb; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e5e7eb; }
.receive-block .receive-head .name { font-size: 14px; font-weight: 600; color: #1f2937; }
.receive-block .receive-head .desc { font-size: 12px; color: #6b7280; }
.receive-block .receive-body { padding: 14px; }
</style>
</head>
<body>
<div id="sidebar"></div>
<div class="main-content">
<div class="header">
<h1>研发订单考核时效看板</h1>
<button class="btn-refresh" onclick="loadLevel1()">刷新</button>
</div>
<!-- 第一块:研发订单审批与转单考核时效 -->
<div class="area">
<h2>① 研发订单审批与转单考核时效</h2>
<div class="sub">按采购申请单的"用途"(0=生产/1=研发/2=售后,空默认研发)统计风险等级数量;阈值可在 Web.config 的 AuditLeadtimeHigh / AuditLeadtimeLow 配置。</div>
<!-- 一级看板 -->
<div id="level1"></div>
</div>
<!-- 第二块:研发订单到料考核时效 -->
<div class="area">
<h2>② 研发订单到料考核时效</h2>
<div class="sub">按采购申请单的"用途"(0=生产/1=研发/2=售后,空默认研发)统计各考核分类的风险等级数量;时效 = GXWMS最早收料日期 - 计划/标准交付日期,未收料为"超高";阈值可在 Web.config 的 AuditReceiveHigh / AuditReceiveLow 配置。</div>
<!-- 到料一级看板 -->
<div id="level1Receive"></div>
</div>
</div>
<script>
function ytName(yt) {
return { '0': '生产', '1': '研发', '2': '售后' }[yt] || '研发';
}
function loadLevel1() {
document.getElementById('level1').innerHTML = '<div style="color:#9ca3af;padding:20px 0;">加载中...</div>';
fetch('api/Procurement/GetAuditLeadtimeLevel1').then(function (r) { return r.json(); }).then(function (res) {
if (!res.success) { document.getElementById('level1').innerHTML = '<div style="color:#ef4444;">加载失败: ' + res.message + '</div>'; return; }
renderLevel1(res);
}).catch(function (e) {
document.getElementById('level1').innerHTML = '<div style="color:#ef4444;">请求异常: ' + e + '</div>';
});
}
function renderLevel1(d) {
var html = '<div style="margin-bottom:10px;color:#6b7280;font-size:12px;">阈值:高 &gt; ' + d.highThreshold + ' 天,中 &gt; ' + d.lowThreshold + ' 且 ≤ ' + d.highThreshold + ',低 ≤ ' + d.lowThreshold + ';无PO超过 ' + d.highThreshold + ' 天为"超高(无采购订单)"</div>';
html += '<div class="level1-grid">';
var yts = [{ k: '0', n: '生产' }, { k: '1', n: '研发' }, { k: '2', n: '售后' }, { k: '*', n: '总计' }];
yts.forEach(function (yt) {
html += '<div class="card"><div class="title">' + yt.n + '</div>';
var total = 0;
['超高', '高', '中', '低'].forEach(function (rk) {
var cnt = yt.k === '*'
? (d.byRiskLevel[rk]['0'] + d.byRiskLevel[rk]['1'] + d.byRiskLevel[rk]['2'])
: d.byRiskLevel[rk][yt.k];
total += cnt;
});
html += '<div class="total">合计 ' + total + ' 单</div>';
['超高', '高', '中', '低'].forEach(function (rk) {
var cnt = yt.k === '*'
? (d.byRiskLevel[rk]['0'] + d.byRiskLevel[rk]['1'] + d.byRiskLevel[rk]['2'])
: d.byRiskLevel[rk][yt.k];
var cls = rk === '超高' ? 'cg' : rk === '高' ? 'gao' : rk === '中' ? 'zhong' : 'di';
var extra = rk === '超高' ? '<span style="font-size:11px;color:#9ca3af;margin-left:4px;">(无采购订单)</span>' : '';
// 点击跳二级(新窗口)
var url = 'procurement_audit_leadtime_l2.html?yt=' + encodeURIComponent(yt.k === '*' ? '' : yt.k) + '&riskLevel=' + encodeURIComponent(rk);
html += '<div class="risk-row ' + cls + '" onclick="window.open(\'' + url + '\', \'_blank\')">';
html += '<span class="label">' + rk + extra + '</span>';
html += '<span class="num">' + cnt + '</span>';
html += '</div>';
});
html += '</div>';
});
html += '</div>';
document.getElementById('level1').innerHTML = html;
}
// ============ 第二区域:研发订单到料考核时效 ============
var catDefs = [
{ key: 'project', name: '项目需求达成风险', desc: 'GXWMS最早收料日期 - 要求交付日期' },
{ key: 'promise', name: '采购承诺达成风险', desc: 'GXWMS最早收料日期 - 计划交付日期(研发采购)' },
{ key: 'std', name: '标准采购周期达成风险', desc: 'GXWMS最早收料日期 - 标准交付日期(要求交付日期+物料标准L/T)' }
];
function loadReceive() {
document.getElementById('level1Receive').innerHTML = '<div style="color:#9ca3af;padding:20px 0;">加载中...</div>';
fetch('api/Procurement/GetAuditReceiveLevel1').then(function (r) { return r.json(); }).then(function (res) {
if (!res.success) { document.getElementById('level1Receive').innerHTML = '<div style="color:#ef4444;">加载失败: ' + res.message + '</div>'; return; }
renderReceive(res);
}).catch(function (e) {
document.getElementById('level1Receive').innerHTML = '<div style="color:#ef4444;">请求异常: ' + e + '</div>';
});
}
function renderReceive(d) {
var html = '<div style="margin-bottom:10px;color:#6b7280;font-size:12px;">阈值:高 &gt; ' + d.highThreshold + ' 天,中 &gt; ' + d.lowThreshold + ' 且 ≤ ' + d.highThreshold + ',低 ≤ ' + d.lowThreshold + ';未收料为"超高(未到料)"</div>';
catDefs.forEach(function (cat) {
var catData = d.categories[cat.key] || {};
html += '<div class="receive-block"><div class="receive-head"><span class="name">' + cat.name + '</span><span class="desc">' + cat.desc + '</span></div>';
html += '<div class="receive-body"><div class="level1-grid">';
var yts = [{ k: '0', n: '生产' }, { k: '1', n: '研发' }, { k: '2', n: '售后' }, { k: '*', n: '总计' }];
yts.forEach(function (yt) {
html += '<div class="card"><div class="title">' + yt.n + '</div>';
var total = 0;
['超高', '高', '中', '低'].forEach(function (rk) {
var cnt = yt.k === '*'
? ((catData[rk] || {})['0'] || 0) + ((catData[rk] || {})['1'] || 0) + ((catData[rk] || {})['2'] || 0)
: (catData[rk] || {})[yt.k] || 0;
total += cnt;
});
html += '<div class="total">合计 ' + total + ' 单</div>';
['超高', '高', '中', '低'].forEach(function (rk) {
var cnt = yt.k === '*'
? ((catData[rk] || {})['0'] || 0) + ((catData[rk] || {})['1'] || 0) + ((catData[rk] || {})['2'] || 0)
: (catData[rk] || {})[yt.k] || 0;
var cls = rk === '超高' ? 'cg' : rk === '高' ? 'gao' : rk === '中' ? 'zhong' : 'di';
var extra = rk === '超高' ? '<span style="font-size:11px;color:#9ca3af;margin-left:4px;">(未到料)</span>' : '';
var url = 'procurement_audit_receive_l2.html?checkType=' + encodeURIComponent(cat.key) +
'&yt=' + encodeURIComponent(yt.k === '*' ? '' : yt.k) +
'&riskLevel=' + encodeURIComponent(rk);
html += '<div class="risk-row ' + cls + '" onclick="window.open(\'' + url + '\', \'_blank\')">';
html += '<span class="label">' + rk + extra + '</span>';
html += '<span class="num">' + cnt + '</span>';
html += '</div>';
});
html += '</div>';
});
html += '</div></div></div>';
});
document.getElementById('level1Receive').innerHTML = html;
}
loadLevel1();
loadReceive();
</script>
<script src="View/common/nav.js"></script>
</body>
</html>