Files
GX.O3.WMS/WebApi/procurement_audit_leadtime_l3.html
T

131 lines
7.4 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; 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>