Files
GX.O3.WMS/WebApi/.svn/pristine/88/88a0bd92f9800b76056c3bfc3b29a9a967a7f833.svn-base
T

588 lines
25 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>研发物料采购看板 - 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>