baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "D:\\Code\\WMS\\WebApi\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\controllers\\procurementcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:controllers\\procurementcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|d:\\code\\wms\\webapi\\multi_detail.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
|
||||
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:multi_detail.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\procurement.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
|
||||
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:procurement.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
|
||||
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\procurement_dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
|
||||
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:procurement_dashboard.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|D:\\Code\\WMS\\WebApi\\login.html||{40D31677-CBC0-4297-A9EF-89D907823A98}",
|
||||
"RelativeMoniker": "D:0:0:{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}|GXWebApi.csproj|solutionrelative:login.html||{40D31677-CBC0-4297-A9EF-89D907823A98}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 6,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "multi_detail.html",
|
||||
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\multi_detail.html",
|
||||
"RelativeDocumentMoniker": "multi_detail.html",
|
||||
"ToolTip": "D:\\Code\\WMS\\WebApi\\multi_detail.html",
|
||||
"RelativeToolTip": "multi_detail.html",
|
||||
"ViewState": "AgIAALUAAAAAAAAAAAAcwNcAAAAzAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
|
||||
"WhenOpened": "2026-07-29T09:07:47.812Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "procurement_dashboard.html",
|
||||
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\procurement_dashboard.html",
|
||||
"RelativeDocumentMoniker": "procurement_dashboard.html",
|
||||
"ToolTip": "D:\\Code\\WMS\\WebApi\\procurement_dashboard.html",
|
||||
"RelativeToolTip": "procurement_dashboard.html",
|
||||
"ViewState": "AgIAAFIAAAAAAAAAAAAuwF0AAAAsAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
|
||||
"WhenOpened": "2026-07-28T09:09:18.881Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "procurement.html",
|
||||
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\procurement.html",
|
||||
"RelativeDocumentMoniker": "procurement.html",
|
||||
"ToolTip": "D:\\Code\\WMS\\WebApi\\procurement.html",
|
||||
"RelativeToolTip": "procurement.html",
|
||||
"ViewState": "AgIAAPIAAAAAAAAAAADwvxEBAAAPAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
|
||||
"WhenOpened": "2026-07-28T07:53:40.173Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "dashboard.html",
|
||||
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\dashboard.html",
|
||||
"RelativeDocumentMoniker": "dashboard.html",
|
||||
"ToolTip": "D:\\Code\\WMS\\WebApi\\dashboard.html",
|
||||
"RelativeToolTip": "dashboard.html",
|
||||
"ViewState": "AgIAAB4CAAAAAAAAAADwvykCAABRAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
|
||||
"WhenOpened": "2026-07-23T06:13:39.023Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "login.html",
|
||||
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\login.html",
|
||||
"RelativeDocumentMoniker": "login.html",
|
||||
"ToolTip": "D:\\Code\\WMS\\WebApi\\login.html",
|
||||
"RelativeToolTip": "login.html",
|
||||
"ViewState": "AgIAACYAAAAAAAAAAAAIwD0AAAAdAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001512|",
|
||||
"WhenOpened": "2026-07-22T07:29:25.523Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "ProcurementController.cs",
|
||||
"DocumentMoniker": "D:\\Code\\WMS\\WebApi\\Controllers\\ProcurementController.cs",
|
||||
"RelativeDocumentMoniker": "Controllers\\ProcurementController.cs",
|
||||
"ToolTip": "D:\\Code\\WMS\\WebApi\\Controllers\\ProcurementController.cs",
|
||||
"RelativeToolTip": "Controllers\\ProcurementController.cs",
|
||||
"ViewState": "AgIAALACAAAAAAAAAAAnwCMDAABCAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-07-23T08:21:22.519Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GXWebApi.Common
|
||||
{
|
||||
|
||||
public class MySqlUtils : IDisposable
|
||||
{
|
||||
#region 构造函数
|
||||
public MySqlUtils()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 连接字符串
|
||||
private string _connectionString;
|
||||
public string ConnectionString
|
||||
{
|
||||
get { return _connectionString; }
|
||||
set { _connectionString = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据库连接
|
||||
/// <summary>
|
||||
/// 数据库连接
|
||||
/// </summary>
|
||||
public MySqlConnection Connection
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取连接
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public MySqlConnection GetConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Connection == null)
|
||||
{
|
||||
Connection = new MySqlConnection();
|
||||
Connection.ConnectionString = _connectionString;
|
||||
}
|
||||
if (Connection.State == ConnectionState.Broken)
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
if (Connection.State == ConnectionState.Closed)
|
||||
{
|
||||
Connection.ConnectionString = _connectionString;
|
||||
Connection.Open();
|
||||
}
|
||||
return Connection;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("获取连接失败.\r\n" + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 销毁对象
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (Connection != null)
|
||||
{
|
||||
if (Connection.State != ConnectionState.Closed)
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
Connection.Dispose();
|
||||
Connection = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 执行查询
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="strSQL"></param>
|
||||
/// <returns></returns>
|
||||
public DataTable ExecQuery(string strSQL)
|
||||
{
|
||||
DataSet dsTemp = new DataSet();
|
||||
try
|
||||
{
|
||||
using (MySqlDataAdapter daExcute = new MySqlDataAdapter(strSQL, GetConnection()))
|
||||
{
|
||||
daExcute.Fill(dsTemp);
|
||||
|
||||
if (DBNull.Value.Equals(dsTemp) || dsTemp.Tables.Count < 1 || DBNull.Value.Equals(dsTemp.Tables[0]))
|
||||
{
|
||||
throw new Exception("查询结果为空.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return dsTemp.Tables[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 执行增删改(不带参数)
|
||||
/// <summary>
|
||||
/// 执行增删改操作
|
||||
/// </summary>
|
||||
/// <param name="strSQL">SQL语句</param>
|
||||
/// <returns>受影响的行数</returns>
|
||||
public int ExecNonQuery(string strSQL)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand(strSQL, GetConnection()))
|
||||
{
|
||||
return cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("执行SQL失败: " + strSQL + "\r\n" + ex.Message, ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 执行增删改(带参数)
|
||||
/// <summary>
|
||||
/// 执行带参数的增删改操作
|
||||
/// </summary>
|
||||
/// <param name="strSQL">SQL语句</param>
|
||||
/// <param name="parameters">参数数组</param>
|
||||
/// <returns>受影响的行数</returns>
|
||||
public int ExecNonQuery(string strSQL, params MySqlParameter[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand(strSQL, GetConnection()))
|
||||
{
|
||||
if (parameters != null && parameters.Length > 0)
|
||||
{
|
||||
cmd.Parameters.AddRange(parameters);
|
||||
}
|
||||
return cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("执行SQL失败: " + strSQL + "\r\n" + ex.Message, ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<!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:12px}
|
||||
.top-bar .back{color:rgba(255,255,255,.85);text-decoration:none;font-size:14px;padding:4px 10px;border-radius:4px}
|
||||
.top-bar .back:hover{background:rgba(255,255,255,.15)}
|
||||
.top-bar .title{font-size:15px;font-weight:600;flex:1}
|
||||
.user-info{margin-left:auto;font-size:12px;opacity:.85}
|
||||
.main{max-width:1500px;margin:0 auto;padding:12px 16px}
|
||||
.card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow:visible}
|
||||
.card-header{padding:10px 16px;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;align-items:center}
|
||||
.card-header h3{font-size:14px;color:#333;font-weight:600}
|
||||
.table-wrap{overflow:auto;max-height:calc(100vh-160px)}
|
||||
table{min-width:100%;border-collapse:collapse;font-size:12px}
|
||||
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;position:sticky;top:0;z-index:2;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:5px 8px;border:1px solid #ddd;color:#333}
|
||||
tbody tr:hover{background:#f0f6ff}
|
||||
.empty td{text-align:center;padding:36px;color:#bbb}
|
||||
.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}
|
||||
.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}
|
||||
.pagination{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;border-top:1px solid #f0f0f0;font-size:12px;color:#999}
|
||||
.pagination .btns{display:flex;gap:2px}
|
||||
.pagination .btns button,.pagination .size-btn{min-width:32px;height:26px;border:1px solid #e0e0e0;border-radius:3px;background:#fff;color:#666;cursor:pointer;font-size:11px;padding:0 6px}
|
||||
.pagination .btns button:hover,.pagination .size-btn:hover{border-color:#1a73e8;color:#1a73e8}
|
||||
.pagination .btns button.active,.pagination .size-btn.active{background:#1a73e8;color:#fff;border-color:#1a73e8}
|
||||
.pagination .size-group{display:inline-flex;gap:2px;margin-left:6px}
|
||||
</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">
|
||||
<a class="back" href="javascript:history.back()">← 返回</a>
|
||||
<span class="title" id="pageTitle">物料明细</span>
|
||||
<span class="user-info" id="userInfo"></span>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="card">
|
||||
<div class="card-header"><h3 id="subTitle">物料明细列表</h3></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="dataBody"><tr class="empty"><td colspan="14">加载中...</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagination" id="pagination" style="display:none">
|
||||
<div><span>共 <em id="totalCnt">0</em> 条</span><span class="size-group" id="sizeBtns"></span></div>
|
||||
<div class="btns" id="pageBtns"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var params={};location.search.substr(1).split('&').forEach(function(s){var kv=s.split('=');if(kv[0])params[decodeURIComponent(kv[0])]=decodeURIComponent(kv[1]||'')});
|
||||
var month=params.month||'',ywzt=params.ywzt||'',yfxm=params.yfxm||'',rangeType=params.rangeType||'';
|
||||
var ywztMap={'0':'--','1':'采购订单-转单追踪','2':'供应链-待供应商报价','3':'供应链-待ED审批','4':'供应链-ED驳回,重新议价','5':'供应链-ED已审批','6':'研发-采购申请驳回','7':'研发-采购申请撤回','8':'研发-采购申请取消','9':'研发-量产复用件'};
|
||||
var pageSizeOptions=[20,50,100,200],pageSize=20,currentPage=1,allData=[];
|
||||
|
||||
document.getElementById('subTitle').textContent='研发项目:'+yfxm+' | '+(ywztMap[ywzt]||'')+' | '+rangeType;
|
||||
|
||||
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 loadData(){
|
||||
loading(true);
|
||||
var xhr=new XMLHttpRequest();
|
||||
xhr.open('GET','api/Procurement/GetProcurementDashboardLevel4?month='+encodeURIComponent(month)+'&yfxm='+encodeURIComponent(yfxm)+'&ywzt='+ywzt+'&rangeType='+encodeURIComponent(rangeType),true);
|
||||
xhr.onload=function(){
|
||||
loading(false);
|
||||
try{
|
||||
var r=JSON.parse(xhr.responseText);
|
||||
if(r.success)renderList(r.data);
|
||||
else toast(r.message||'查询失败','error')
|
||||
}catch(e){toast('数据解析异常','error')}
|
||||
};
|
||||
xhr.onerror=function(){loading(false);toast('网络请求失败','error')};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function setPageSize(size){pageSize=size;currentPage=1;renderPage()}
|
||||
function renderPagination(){
|
||||
var total=allData.length,tp=Math.ceil(total/pageSize)||1;
|
||||
var pc=document.getElementById('pagination');
|
||||
if(total<=pageSize&&total<=20){pc.style.display='none';return}
|
||||
pc.style.display='flex';
|
||||
document.getElementById('totalCnt').textContent=total;
|
||||
var sb=document.getElementById('sizeBtns');
|
||||
sb.innerHTML=pageSizeOptions.map(function(s){return '<button class="size-btn'+(s===pageSize?' active':'')+'" onclick="setPageSize('+s+')">'+s+'条</button>'}).join('');
|
||||
var pb=document.getElementById('pageBtns');
|
||||
if(tp<=1){pb.innerHTML='';return}
|
||||
var h='<button '+(currentPage<=1?'disabled':'')+' onclick="loadPage(1)">首页</button><button '+(currentPage<=1?'disabled':'')+' onclick="loadPage('+(currentPage-1)+')">‹</button>';
|
||||
for(var i=Math.max(1,currentPage-2);i<=Math.min(tp,currentPage+2);i++)h+='<button class="'+(i===currentPage?'active':'')+'" onclick="loadPage('+i+')">'+i+'</button>';
|
||||
h+='<button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+(currentPage+1)+')">›</button><button '+(currentPage>=tp?'disabled':'')+' onclick="loadPage('+tp+')">末页</button>';
|
||||
pb.innerHTML=h;
|
||||
}
|
||||
function loadPage(page){currentPage=page;renderPage()}
|
||||
function renderPage(){
|
||||
var tb=document.getElementById('dataBody');
|
||||
if(!allData.length){tb.innerHTML='<tr class="empty"><td colspan="14">暂无数据</td></tr>';return}
|
||||
var start=(currentPage-1)*pageSize,end=Math.min(start+pageSize,allData.length);
|
||||
var h='';
|
||||
for(var i=start;i<end;i++){
|
||||
var item=allData[i];
|
||||
h+='<tr><td>'+escapeHtml(item.lcbh)+'</td><td>'+escapeHtml(item.djbh)+'</td><td>'+escapeHtml(item.xh)+'</td><td>'+escapeHtml(item.wlbmCode)+'</td><td>'+escapeHtml(item.wlmc)+'</td><td>'+escapeHtml(item.sqsl)+'</td><td>'+escapeHtml(item.onebj)+'</td><td>'+escapeHtml(item.twobj)+'</td><td>'+escapeHtml(item.gys)+'</td><td>'+escapeHtml(item.cncgfzr)+'</td><td>'+escapeHtml(item.yfcgfzr)+'</td><td>'+escapeHtml(item.dhrq)+'</td><td>'+escapeHtml(item.pmDate)+'</td><td>'+escapeHtml(item.dayDiff)+'</td></tr>';
|
||||
}
|
||||
tb.innerHTML=h;
|
||||
renderPagination();
|
||||
}
|
||||
function renderList(data){
|
||||
allData=data||[];
|
||||
renderPage();
|
||||
}
|
||||
|
||||
(function(){
|
||||
var userData=sessionStorage.getItem('gx_user');
|
||||
if(!userData){window.location.href='login.html';return}
|
||||
try{
|
||||
var u=JSON.parse(userData);
|
||||
document.getElementById('userInfo').innerHTML=(u.userName||u.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){window.location.href='login.html'}
|
||||
})();
|
||||
|
||||
// 列宽拖动
|
||||
(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=''}});
|
||||
})();
|
||||
|
||||
loadData();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user