Files
GX.O3.WMS/WebApi/procurement_audit_receive_l2.html

119 lines
6.5 KiB
HTML
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<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>