v2.0.1更新

This commit is contained in:
2026-05-26 08:39:12 +08:00
parent cb0c367eb7
commit c575d711ee
34 changed files with 750 additions and 204 deletions

View File

@@ -197,12 +197,12 @@ async function logout() {
function escapeHtml(str) {
if (!str) return '';
return str.replace(/[&<>]/g, function(m) {
if (m === '&') return '&amp;';
if (m === '<') return '&lt;';
if (m === '>') return '&gt;';
return m;
});
return String(str)
.replace(/&/g, '\x26amp;')
.replace(/</g, '\x26lt;')
.replace(/>/g, '\x26gt;')
.replace(/"/g, '\x26quot;')
.replace(/'/g, '\x26#x27;');
}
/**
@@ -336,6 +336,36 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
function toggleActionDropdown(el) {
var dropdown = el.closest('.action-dropdown');
if (!dropdown) return;
var menu = dropdown.querySelector('.action-dropdown-menu');
if (!menu) return;
var isOpen = menu.classList.contains('show');
// 先关闭所有
document.querySelectorAll('.action-dropdown-menu.show').forEach(function(m) {
m.classList.remove('show');
var toggle = m.closest('.action-dropdown').querySelector('.action-dropdown-toggle');
if (toggle) toggle.classList.remove('open');
});
if (!isOpen) {
menu.classList.add('show');
el.classList.add('open');
}
}
document.addEventListener('click', function(e) {
if (!e.target.closest('.action-dropdown')) {
document.querySelectorAll('.action-dropdown-menu.show').forEach(function(m) {
m.classList.remove('show');
var toggle = m.closest('.action-dropdown').querySelector('.action-dropdown-toggle');
if (toggle) toggle.classList.remove('open');
});
}
});
// 全局textarea键盘事件Enter提交表单Ctrl+Enter换行
document.addEventListener('keydown', function(e) {
if (e.target.tagName !== 'TEXTAREA') return;
@@ -351,4 +381,28 @@ document.addEventListener('keydown', function(e) {
}
}
// Ctrl+Enter和Shift+Enter保持默认换行行为不拦截
});
});
window.selectDeductionType = function(points, reason) {
var pointsEl = document.getElementById('pointsChange');
var reasonEl = document.getElementById('pointsReason');
if (points === 0 && reason === '') {
// 自定义模式 - 清空分值和原因,聚焦原因输入框
if (pointsEl) pointsEl.value = '';
if (reasonEl) {
reasonEl.value = '';
reasonEl.focus();
}
} else if (points === null || points === undefined) {
// 类别模式 - 仅填充原因,聚焦分值输入框
if (reasonEl) reasonEl.value = reason;
if (pointsEl) {
pointsEl.value = '';
pointsEl.focus();
}
} else {
// 预设模式 - 同时填充分值和原因
if (pointsEl) pointsEl.value = points;
if (reasonEl) reasonEl.value = reason;
}
};