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,437 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>采购物料交付计划看板</title>
|
||||
<link rel="stylesheet" href="../common/nav.css">
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
html, body { height: 100%; }
|
||||
body { font-family: 'Microsoft YaHei','PingFang SC',sans-serif; background: #f3f5fa; color: #2c3e50; padding: 14px 18px; }
|
||||
|
||||
/* 顶部 4 卡片 */
|
||||
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
|
||||
.card { background: #fff; border-radius: 8px; padding: 16px 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); cursor: pointer; transition: transform .15s, box-shadow .15s; border-left: 4px solid #c0c4cc; }
|
||||
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
|
||||
.card .label { font-size: 13px; color: #909399; margin-bottom: 6px; }
|
||||
.card .num { font-size: 30px; font-weight: 700; line-height: 1.2; }
|
||||
.card .sub { font-size: 12px; color: #b0b3ba; margin-top: 4px; }
|
||||
.card.total { border-left-color: #409eff; } .card.total .num { color: #409eff; }
|
||||
.card.broken { border-left-color: #f56c6c; } .card.broken .num { color: #f56c6c; }
|
||||
.card.warn { border-left-color: #e6a23c; } .card.warn .num { color: #e6a23c; }
|
||||
.card.safe { border-left-color: #67c23a; } .card.safe .num { color: #67c23a; }
|
||||
.card.active { box-shadow: 0 0 0 2px #409eff, 0 6px 16px rgba(0,0,0,0.1); }
|
||||
|
||||
/* 工具栏 */
|
||||
.toolbar { background: #fff; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
|
||||
.toolbar select, .toolbar button { height: 30px; padding: 0 12px; border: 1px solid #dcdfe6; border-radius: 6px; background: #fff; font-size: 13px; cursor: pointer; }
|
||||
.toolbar select:hover, .toolbar button:hover { border-color: #409eff; color: #409eff; }
|
||||
.toolbar .spacer { flex: 1; }
|
||||
.toolbar .meta { font-size: 12px; color: #909399; }
|
||||
|
||||
/* 甘特图容器 */
|
||||
.gantt-wrap { background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 16px 18px 14px; }
|
||||
.gantt-title { font-size: 16px; font-weight: 600; color: #303133; margin-bottom: 6px; }
|
||||
.gantt-sub { font-size: 12px; color: #909399; margin-bottom: 12px; }
|
||||
.gantt-legend { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; font-size: 12px; color: #606266; }
|
||||
.gantt-legend .item { display: flex; align-items: center; gap: 5px; }
|
||||
.gantt-legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
|
||||
.gantt-legend .dot.req { background: #409eff; }
|
||||
.gantt-legend .dot.arr { background: #67c23a; }
|
||||
.gantt-legend .dot.broken { background: #f56c6c; }
|
||||
.gantt-legend .dot.weekend { background: #f4f4f5; border: 1px solid #dcdfe6; }
|
||||
|
||||
.gantt-scroll { overflow-x: auto; overflow-y: visible; position: relative; padding-bottom: 6px; }
|
||||
.gantt-scroll::-webkit-scrollbar { height: 10px; }
|
||||
.gantt-scroll::-webkit-scrollbar-thumb { background: #c0c4cc; border-radius: 5px; }
|
||||
.gantt-scroll::-webkit-scrollbar-track { background: #f0f2f5; border-radius: 5px; }
|
||||
|
||||
.gantt { position: relative; min-width: 100%; border-collapse: collapse; }
|
||||
.gantt-row { display: flex; border-bottom: 1px solid #f0f2f5; min-height: 50px; max-height: 50px; overflow: hidden; align-items: stretch; }
|
||||
.gantt-row.head { background: #f7f9fc; border-bottom: 1px solid #ebeef5; min-height: 36px; max-height: 36px; align-items: stretch; overflow: hidden; }
|
||||
.gantt-row:hover:not(.head) { background: #fafbfc; }
|
||||
|
||||
/* 固定左列 */
|
||||
.gantt-fixed { position: sticky; left: 0; z-index: 4; background: #fff; display: flex; flex-shrink: 0; box-shadow: 2px 0 4px rgba(0,0,0,0.04); }
|
||||
.gantt-row.head .gantt-fixed { background: #f7f9fc; z-index: 6; }
|
||||
.gantt-cell { padding: 8px 10px; font-size: 12px; color: #303133; border-right: 1px solid #ebeef5; display: flex; flex-direction: column; justify-content: center; }
|
||||
.gantt-row.head .gantt-cell { font-weight: 600; color: #606266; padding: 6px 10px; }
|
||||
.f-name { width: 160px; min-width: 160px; max-width: 160px; overflow: hidden; }
|
||||
.f-name .nm { font-size: 13px; font-weight: 600; color: #303133; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.f-name .sub { font-size: 11px; color: #909399; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
|
||||
.f-tag { width: 70px; display: flex; align-items: center; }
|
||||
.f-tag .tag { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; text-align: center; }
|
||||
.f-tag .tag.broken { background: #fef0f0; color: #f56c6c; }
|
||||
.f-tag .tag.warn { background: #fdf6ec; color: #e6a23c; }
|
||||
.f-tag .tag.safe { background: #f0f9eb; color: #67c23a; }
|
||||
.f-tag .tag.empty { background: #f4f4f5; color: #909399; }
|
||||
|
||||
/* 时间轴区 */
|
||||
.gantt-timeline { position: relative; flex-shrink: 0; }
|
||||
.gantt-row.head .gantt-timeline { background: #f7f9fc; }
|
||||
.day-col { position: absolute; top: 0; height: 100%; display: flex; align-items: center; justify-content: center; border-right: 1px solid #f0f2f5; font-size: 12px; }
|
||||
.gantt-row.head .day-col { color: #606266; font-weight: 500; }
|
||||
.day-col.weekend { background: #fafafa; color: #909399; }
|
||||
.day-col.past { background: #f5f5f5; color: #c0c4cc; }
|
||||
.day-col.month-end { border-right: 2px solid #c0c4cc; }
|
||||
.day-col.today { background: #ecf5ff; color: #409eff; font-weight: 700; }
|
||||
.day-col .v { position: relative; display: flex; align-items: center; justify-content: center; padding: 4px; }
|
||||
|
||||
/* 单元格内的数据元素 */
|
||||
.cell-num { position: absolute; font-weight: 600; }
|
||||
.cell-num.req { color: #409eff; font-size: 12px; }
|
||||
.cell-num.arr { color: #67c23a; font-size: 12px; }
|
||||
.cell-arr-label { color: #67c23a; font-size: 10px; font-weight: 500; }
|
||||
|
||||
/* 停线标记 - 黄底橙边(预警) */
|
||||
.stop-mark { position: absolute; inset: 6px 4px; border: 2px solid #e6a23c; background: rgba(230, 162, 60, 0.12); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; color: #c8770f; font-weight: 600; }
|
||||
.stop-mark .icon { font-size: 11px; line-height: 1; }
|
||||
|
||||
/* 断线标记 - 红底红边(断线) */
|
||||
.break-mark { position: absolute; inset: 6px 4px; border: 2px solid #f56c6c; background: rgba(245, 108, 108, 0.12); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; color: #f56c6c; font-weight: 600; }
|
||||
|
||||
/* 库存说明(图表下方) */
|
||||
.gantt-summary { margin-top: 10px; padding: 8px 12px; background: #f7f9fc; border-radius: 6px; font-size: 12px; color: #909399; line-height: 1.7; }
|
||||
|
||||
.loading, .empty { text-align: center; padding: 50px 0; color: #909399; font-size: 14px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="sidebar"></div>
|
||||
|
||||
<div class="cards">
|
||||
<div class="card total" data-risk="">
|
||||
<div class="label">物料总数</div>
|
||||
<div class="num" id="cardTotal">-</div>
|
||||
<div class="sub">所有未结束排程物料</div>
|
||||
</div>
|
||||
<div class="card broken" data-risk="断线">
|
||||
<div class="label">断线风险</div>
|
||||
<div class="num" id="cardBroken">-</div>
|
||||
<div class="sub">到货晚于停线(紧急)</div>
|
||||
</div>
|
||||
<div class="card warn" data-risk="预警">
|
||||
<div class="label">预警关注</div>
|
||||
<div class="num" id="cardWarn">-</div>
|
||||
<div class="sub">到货日 = 停线日</div>
|
||||
</div>
|
||||
<div class="card safe" data-risk="安全">
|
||||
<div class="label">安全供应</div>
|
||||
<div class="num" id="cardSafe">-</div>
|
||||
<div class="sub">到货早于停线</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toolbar">
|
||||
<span>产品类型:</span>
|
||||
<select id="filterProductType"><option value="">全部</option></select>
|
||||
<span>风险:</span>
|
||||
<select id="filterRisk">
|
||||
<option value="">全部</option>
|
||||
<option value="断线">断线</option>
|
||||
<option value="预警">预警</option>
|
||||
<option value="安全">安全</option>
|
||||
</select>
|
||||
<button id="btnRefresh">刷新</button>
|
||||
<button id="btnAutoRefresh">自动刷新:开</button>
|
||||
<div class="spacer"></div>
|
||||
<span class="meta" id="metaInfo">加载中...</span>
|
||||
</div>
|
||||
|
||||
<div class="gantt-wrap">
|
||||
<div class="gantt-title">物料交付甘特图</div>
|
||||
<div class="gantt-sub">按日展示每个物料的当日需求、到货、停线预警/断线情况</div>
|
||||
<div class="gantt-legend">
|
||||
<div class="item"><span class="dot req"></span> 当日需求</div>
|
||||
<div class="item"><span class="dot arr"></span> 到货</div>
|
||||
<div class="item"><span class="dot broken"></span> 断线</div>
|
||||
<div class="item" style="border:2px solid #e6a23c;border-radius:3px;width:14px;height:12px;background:rgba(230,162,60,.12);"></div> 预警
|
||||
<div class="item"><span class="dot weekend"></span> 周末</div>
|
||||
</div>
|
||||
<div id="ganttContainer" class="gantt-scroll">
|
||||
<div class="loading">加载中...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 公共导航栏组件(菜单维护点:View/common/nav.js) -->
|
||||
<script src="../common/nav.js"></script>
|
||||
|
||||
<script>
|
||||
const API_BASE = '../../api/Deliver';
|
||||
const DAY_WIDTH = 56; // 每天宽度(按截图样式,约56px/列)
|
||||
const ROW_HEIGHT = 50; // 每行高度
|
||||
const HEAD_HEIGHT = 36; // 表头高度
|
||||
let autoRefreshTimer = null;
|
||||
let currentProductType = '';
|
||||
let currentRisk = '';
|
||||
|
||||
function parseDate(s) { return s ? new Date(s) : null; }
|
||||
function fmtDate(d) {
|
||||
return d.getFullYear() + '-' + String(d.getMonth()+1).padStart(2,'0') + '-' + String(d.getDate()).padStart(2,'0');
|
||||
}
|
||||
function dateDiffDays(a, b) { return Math.round((b - a) / 86400000); }
|
||||
function isWeekend(d) { const w = d.getDay(); return w === 0 || w === 6; }
|
||||
|
||||
function loadSummary() {
|
||||
fetch(API_BASE + '/GetBoardSummary').then(r => r.json()).then(res => {
|
||||
if (res.success) {
|
||||
document.getElementById('cardTotal').textContent = res.total;
|
||||
document.getElementById('cardBroken').textContent = res.broken;
|
||||
document.getElementById('cardWarn').textContent = res.warn;
|
||||
document.getElementById('cardSafe').textContent = res.safe;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadProductTypes() {
|
||||
fetch(API_BASE + '/GetSchedules?keyword=').then(r => r.json()).then(res => {
|
||||
if (res.success) {
|
||||
const sel = document.getElementById('filterProductType');
|
||||
const set = new Set();
|
||||
res.data.forEach(s => { if (s.ProductType) set.add(s.ProductType); });
|
||||
[...set].sort().forEach(t => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = t; opt.textContent = t;
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadGantt() {
|
||||
document.getElementById('ganttContainer').innerHTML = '<div class="loading">加载中...</div>';
|
||||
const params = new URLSearchParams();
|
||||
if (currentProductType) params.append('productType', currentProductType);
|
||||
if (currentRisk) params.append('risk', currentRisk);
|
||||
fetch(API_BASE + '/GetBoardGantt?' + params).then(r => r.json()).then(res => {
|
||||
if (!res.success) {
|
||||
document.getElementById('ganttContainer').innerHTML = '<div class="empty">加载失败:' + (res.message || '') + '</div>';
|
||||
return;
|
||||
}
|
||||
document.getElementById('metaInfo').textContent = '时间范围:' + res.startDate + ' ~ ' + res.endDate + '(共 ' + res.data.length + ' 个物料)';
|
||||
renderGantt(res);
|
||||
});
|
||||
}
|
||||
|
||||
function renderGantt(res) {
|
||||
const data = res.data;
|
||||
if (!data || data.length === 0) {
|
||||
document.getElementById('ganttContainer').innerHTML = '<div class="empty">暂无数据</div>';
|
||||
return;
|
||||
}
|
||||
const startD = parseDate(res.startDate);
|
||||
const endD = parseDate(res.endDate);
|
||||
const today = parseDate(res.today);
|
||||
if (!startD || !endD || endD < startD) {
|
||||
document.getElementById('ganttContainer').innerHTML = '<div class="empty">日期范围无效</div>';
|
||||
return;
|
||||
}
|
||||
const dayCount = dateDiffDays(startD, endD) + 1;
|
||||
const timelineWidth = dayCount * DAY_WIDTH;
|
||||
|
||||
// 计算每个物料的"日均需求"(用于"需求X/天"标注)
|
||||
function getDailyRate(reqMap) {
|
||||
let total = 0, days = 0;
|
||||
Object.values(reqMap).forEach(v => { if (v > 0) { total += v; days++; } });
|
||||
if (days === 0) return 0;
|
||||
// 计算频次
|
||||
const dates = Object.keys(reqMap).filter(d => reqMap[d] > 0).sort();
|
||||
if (dates.length < 2) return dates.length > 0 ? reqMap[dates[0]] : 0;
|
||||
// 频次 = 总需求 / (最后一天 - 第一天的天数)
|
||||
const d1 = parseDate(dates[0]), d2 = parseDate(dates[dates.length-1]);
|
||||
const span = Math.max(1, dateDiffDays(d1, d2) + 1);
|
||||
return Math.round(total / span);
|
||||
}
|
||||
|
||||
const root = document.createElement('div');
|
||||
root.className = 'gantt';
|
||||
root.style.width = (160 + 70 + timelineWidth) + 'px';
|
||||
|
||||
// 表头
|
||||
const head = document.createElement('div');
|
||||
head.className = 'gantt-row head';
|
||||
head.style.height = HEAD_HEIGHT + 'px';
|
||||
const hFixed = document.createElement('div');
|
||||
hFixed.className = 'gantt-fixed';
|
||||
hFixed.innerHTML =
|
||||
'<div class="gantt-cell f-name">物料</div>' +
|
||||
'<div class="gantt-cell f-tag">风险</div>';
|
||||
head.appendChild(hFixed);
|
||||
const hTime = document.createElement('div');
|
||||
hTime.className = 'gantt-timeline';
|
||||
hTime.style.width = timelineWidth + 'px';
|
||||
hTime.style.height = HEAD_HEIGHT + 'px';
|
||||
for (let i = 0; i < dayCount; i++) {
|
||||
const d = new Date(startD); d.setDate(d.getDate() + i);
|
||||
const cell = document.createElement('div');
|
||||
cell.className = 'day-col';
|
||||
if (isWeekend(d)) cell.classList.add('weekend');
|
||||
// 月末
|
||||
const nextD = new Date(d); nextD.setDate(nextD.getDate() + 1);
|
||||
if (nextD.getMonth() !== d.getMonth()) cell.classList.add('month-end');
|
||||
// 今天
|
||||
if (today && fmtDate(d) === fmtDate(today)) cell.classList.add('today');
|
||||
// 今天之前(过期)
|
||||
if (today && d < today && fmtDate(d) !== fmtDate(today)) cell.classList.add('past');
|
||||
cell.style.left = (i * DAY_WIDTH) + 'px';
|
||||
cell.style.width = DAY_WIDTH + 'px';
|
||||
cell.textContent = (d.getMonth() + 1) + '/' + d.getDate();
|
||||
hTime.appendChild(cell);
|
||||
}
|
||||
head.appendChild(hTime);
|
||||
root.appendChild(head);
|
||||
|
||||
// 物料行
|
||||
data.forEach(m => {
|
||||
const row = document.createElement('div');
|
||||
row.className = 'gantt-row';
|
||||
row.style.height = ROW_HEIGHT + 'px';
|
||||
|
||||
// 固定列
|
||||
const fx = document.createElement('div');
|
||||
fx.className = 'gantt-fixed';
|
||||
const riskCls = ({'断线':'broken','预警':'warn','安全':'safe'}[m.DeliveryRisk] || 'empty');
|
||||
const dailyRate = getDailyRate(m.Requirement || {});
|
||||
fx.innerHTML =
|
||||
'<div class="gantt-cell f-name"><div class="nm" title="' + m.ChildMaterialId + '">' + m.ChildMaterialId + '</div><div class="sub" title="' + (m.MaterialName || '-') + (dailyRate > 0 ? ' · 需求' + dailyRate + '/天' : '') + '">' + (m.MaterialName || '-') + (dailyRate > 0 ? ' · 需求' + dailyRate + '/天' : '') + '</div></div>' +
|
||||
'<div class="gantt-cell f-tag"><span class="tag ' + riskCls + '">' + (m.DeliveryRisk || '未判定') + '</span></div>';
|
||||
row.appendChild(fx);
|
||||
|
||||
// 时间轴
|
||||
const tl = document.createElement('div');
|
||||
tl.className = 'gantt-timeline';
|
||||
tl.style.width = timelineWidth + 'px';
|
||||
tl.style.height = ROW_HEIGHT + 'px';
|
||||
|
||||
const reqMap = m.Requirement || {};
|
||||
const arrList = m.Arrival || [];
|
||||
const arrByDate = {};
|
||||
arrList.forEach(a => {
|
||||
if (!arrByDate[a.date]) arrByDate[a.date] = 0;
|
||||
arrByDate[a.date] += a.qty;
|
||||
});
|
||||
|
||||
for (let i = 0; i < dayCount; i++) {
|
||||
const d = new Date(startD); d.setDate(d.getDate() + i);
|
||||
const dateStr = fmtDate(d);
|
||||
|
||||
// 周末/今天/过期 背景
|
||||
if (isWeekend(d)) {
|
||||
const bg = document.createElement('div');
|
||||
bg.className = 'day-col weekend';
|
||||
bg.style.left = (i * DAY_WIDTH) + 'px';
|
||||
bg.style.width = DAY_WIDTH + 'px';
|
||||
tl.appendChild(bg);
|
||||
} else if (today && d < today && fmtDate(d) !== fmtDate(today)) {
|
||||
const bg = document.createElement('div');
|
||||
bg.className = 'day-col past';
|
||||
bg.style.left = (i * DAY_WIDTH) + 'px';
|
||||
bg.style.width = DAY_WIDTH + 'px';
|
||||
tl.appendChild(bg);
|
||||
} else if (today && fmtDate(d) === fmtDate(today)) {
|
||||
const bg = document.createElement('div');
|
||||
bg.className = 'day-col today';
|
||||
bg.style.left = (i * DAY_WIDTH) + 'px';
|
||||
bg.style.width = DAY_WIDTH + 'px';
|
||||
tl.appendChild(bg);
|
||||
}
|
||||
const nextD = new Date(d); nextD.setDate(nextD.getDate() + 1);
|
||||
if (nextD.getMonth() !== d.getMonth()) {
|
||||
const bg = document.createElement('div');
|
||||
bg.className = 'day-col month-end';
|
||||
bg.style.left = (i * DAY_WIDTH) + 'px';
|
||||
bg.style.width = DAY_WIDTH + 'px';
|
||||
tl.appendChild(bg);
|
||||
}
|
||||
|
||||
// 内容容器(用于在格子里绝对定位)
|
||||
const wrap = document.createElement('div');
|
||||
wrap.className = 'v';
|
||||
wrap.style.position = 'absolute';
|
||||
wrap.style.left = (i * DAY_WIDTH) + 'px';
|
||||
wrap.style.width = DAY_WIDTH + 'px';
|
||||
wrap.style.height = '100%';
|
||||
|
||||
// 需求
|
||||
const reqQty = reqMap[dateStr] || 0;
|
||||
if (reqQty > 0) {
|
||||
const num = document.createElement('div');
|
||||
num.className = 'cell-num req';
|
||||
num.textContent = reqQty;
|
||||
num.style.top = '4px';
|
||||
num.style.left = '4px';
|
||||
wrap.appendChild(num);
|
||||
}
|
||||
|
||||
// 到货
|
||||
const arrQty = arrByDate[dateStr] || 0;
|
||||
if (arrQty > 0) {
|
||||
// 模拟图样式:到货/60 形式
|
||||
const num = document.createElement('div');
|
||||
num.className = 'cell-num arr';
|
||||
num.innerHTML = '到' + arrQty;
|
||||
num.style.bottom = '4px';
|
||||
num.style.left = '4px';
|
||||
wrap.appendChild(num);
|
||||
}
|
||||
|
||||
// 停线/断线
|
||||
if (m.ExpectedStopDate && dateStr === m.ExpectedStopDate) {
|
||||
const mark = document.createElement('div');
|
||||
if (m.DeliveryRisk === '断线') {
|
||||
mark.className = 'break-mark';
|
||||
mark.innerHTML = '<div class="icon">停</div><div>断线</div>';
|
||||
} else {
|
||||
mark.className = 'stop-mark';
|
||||
mark.innerHTML = '<div class="icon">停</div><div>预警</div>';
|
||||
}
|
||||
wrap.appendChild(mark);
|
||||
}
|
||||
|
||||
tl.appendChild(wrap);
|
||||
}
|
||||
row.appendChild(tl);
|
||||
root.appendChild(row);
|
||||
});
|
||||
|
||||
document.getElementById('ganttContainer').innerHTML = '';
|
||||
document.getElementById('ganttContainer').appendChild(root);
|
||||
|
||||
// 滚动到今天
|
||||
if (today) {
|
||||
const offset = dateDiffDays(startD, today) * DAY_WIDTH;
|
||||
const wrap = document.getElementById('ganttContainer');
|
||||
setTimeout(() => { wrap.scrollLeft = Math.max(0, offset - 100); }, 50);
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelectorAll('.card').forEach(card => {
|
||||
card.addEventListener('click', () => {
|
||||
const risk = card.dataset.risk;
|
||||
const params = new URLSearchParams();
|
||||
if (risk) params.append('risk', risk);
|
||||
if (currentProductType) params.append('productType', currentProductType);
|
||||
window.location.href = 'delivery_dashboard_risk.html?' + params.toString();
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('filterProductType').addEventListener('change', e => { currentProductType = e.target.value; loadGantt(); });
|
||||
document.getElementById('filterRisk').addEventListener('change', e => { currentRisk = e.target.value; loadGantt(); });
|
||||
document.getElementById('btnRefresh').addEventListener('click', () => { loadSummary(); loadGantt(); });
|
||||
let autoOn = true;
|
||||
document.getElementById('btnAutoRefresh').addEventListener('click', e => {
|
||||
autoOn = !autoOn;
|
||||
e.target.textContent = '自动刷新:' + (autoOn ? '开' : '关');
|
||||
if (autoOn) startAuto(); else stopAuto();
|
||||
});
|
||||
function startAuto() { stopAuto(); autoRefreshTimer = setInterval(() => { loadSummary(); loadGantt(); }, 60000); }
|
||||
function stopAuto() { if (autoRefreshTimer) { clearInterval(autoRefreshTimer); autoRefreshTimer = null; } }
|
||||
|
||||
loadSummary();
|
||||
loadProductTypes();
|
||||
loadGantt();
|
||||
startAuto();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user