v2.0.1更新
This commit is contained in:
@@ -197,12 +197,12 @@ async function logout() {
|
||||
|
||||
function escapeHtml(str) {
|
||||
if (!str) return '';
|
||||
return str.replace(/[&<>]/g, function(m) {
|
||||
if (m === '&') return '&';
|
||||
if (m === '<') return '<';
|
||||
if (m === '>') return '>';
|
||||
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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user