Merge branch 'master' of ssh://188.166.251.33:2222/colden/basicBench
This commit is contained in:
@@ -258,7 +258,7 @@
|
||||
<tr class="header-row">
|
||||
<td colspan="3" align="center">
|
||||
<h1>内部库存管控系统 V4.2 (非密级)</h1>
|
||||
<p>当前登录: OPERATOR_8821 | <a href="#" onclick="alert('模拟注销')">[注销]</a> | <a href="#">[切换节点]</a> | <a href="#">[系统日志]</a> | <a href="#">[报错]</a></p>
|
||||
<p>当前登录: OPERATOR_8821 | <a href="#" onclick="showCustomAlert('模拟注销')">[注销]</a> | <a href="#">[切换节点]</a> | <a href="#">[系统日志]</a> | <a href="#">[报错]</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -708,12 +708,70 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 6. 通用确认 模态框 -->
|
||||
<div class="modal-overlay" id="confirmModal">
|
||||
<div class="modal-window" style="width: 400px; min-height: auto;">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">操作确认</h3>
|
||||
<span class="modal-close" onclick="closeModal('confirmModal')">×</span>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="confirmMessage" style="font-size: 1rem; color: #334155;">确定执行此操作?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="page-btn" onclick="closeModal('confirmModal')">取消</button>
|
||||
<button class="page-btn active" id="confirmBtnAction">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 7. 通用提示 模态框 (替代 alert) -->
|
||||
<div class="modal-overlay" id="alertModal">
|
||||
<div class="modal-window" style="width: 400px; min-height: auto;">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">系统提示</h3>
|
||||
<span class="modal-close" onclick="closeModal('alertModal')">×</span>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="alertMessage" style="font-size: 1rem; color: #334155; white-space: pre-line;"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="page-btn active" onclick="closeModal('alertModal')">知道了</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Toast 通知容器 -->
|
||||
<div class="toast-container" id="toastContainer"></div>
|
||||
|
||||
<script>
|
||||
// === JavaScript 核心逻辑重构 (SPA模式) ===
|
||||
|
||||
// --- 自定义弹窗逻辑 (替代原生 alert/confirm) ---
|
||||
let onConfirmCallback = null;
|
||||
|
||||
function showCustomAlert(msg) {
|
||||
document.getElementById('alertMessage').innerText = msg;
|
||||
openModal('alertModal');
|
||||
}
|
||||
|
||||
function showCustomConfirm(msg, callback) {
|
||||
document.getElementById('confirmMessage').innerText = msg;
|
||||
onConfirmCallback = callback;
|
||||
openModal('confirmModal');
|
||||
}
|
||||
|
||||
// 初始化绑定 Confirm 按钮事件
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.getElementById('confirmBtnAction').addEventListener('click', () => {
|
||||
if (typeof onConfirmCallback === 'function') {
|
||||
onConfirmCallback();
|
||||
}
|
||||
closeModal('confirmModal');
|
||||
});
|
||||
});
|
||||
|
||||
// 配置与状态
|
||||
const CONFIG = {
|
||||
totalItems: 358, // 模拟总数据量
|
||||
@@ -1094,17 +1152,17 @@
|
||||
}
|
||||
|
||||
function printDetail() {
|
||||
alert("正在连接打印机... \n(模拟: 发送指令 PCL_PRINT_JOB_001)");
|
||||
showCustomAlert("正在连接打印机... \n(模拟: 发送指令 PCL_PRINT_JOB_001)");
|
||||
}
|
||||
|
||||
// 删除项目
|
||||
function deleteItem(id, btnElement) {
|
||||
if(confirm(`确定要删除物料 ${id} 吗?`)) {
|
||||
// 这只是前端模拟,实际应该发请求
|
||||
showCustomConfirm(`确定要删除物料 ${id} 吗?`, () => {
|
||||
// 这只是前端模拟,实际应该发请求
|
||||
state.data = state.data.filter(d => d.id !== id);
|
||||
applyFilter(); // 重新走一遍筛选和排序
|
||||
showToast(`物料 ${id} 已删除`, "warning");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 批量操作
|
||||
|
||||
Reference in New Issue
Block a user