baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
+479
@@ -0,0 +1,479 @@
|
||||
<!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="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>
|
||||
<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>
|
||||
<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>
|
||||
<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')+'&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')+'&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','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>
|
||||
Reference in new issue
Block a user