fix(RealTimeInventory): 添加单元格点击事件防抖处理

防止快速双击时同时触发单击和双击事件,通过设置延时器和清除机制来区分单击和双击操作
master
huangjinysf 2 months ago
parent 8d1c853226
commit 24268d7d2b

@ -195,6 +195,10 @@ const transitionProbabilitiesMap = ref(new Map()) // 存储转移概率数据
const transitionColorsMap = ref(new Map()) // const transitionColorsMap = ref(new Map()) //
const activeCells = ref(new Set()) // const activeCells = ref(new Set()) //
//
let clickTimeoutId = null; //
const DBL_CLICK_DELAY = 250; //
// WMS // WMS
const wmsDialogVisible = ref(false) const wmsDialogVisible = ref(false)
const currentWmsModel = ref('') const currentWmsModel = ref('')
@ -892,7 +896,16 @@ const getDifferenceClass = (difference) => {
}; };
// - // -
// -
const handleCellClick = async (row, column, cell, event) => { const handleCellClick = async (row, column, cell, event) => {
//
if (clickTimeoutId) {
clearTimeout(clickTimeoutId);
clickTimeoutId = null;
}
//
clickTimeoutId = setTimeout(async () => {
const cellValue = row[column.property]; const cellValue = row[column.property];
// //
@ -1011,10 +1024,17 @@ const handleCellClick = async (row, column, cell, event) => {
activeCells.value.add(keyWithSpec); activeCells.value.add(keyWithSpec);
ElMessage.success('转移概率数据已加载并显示'); ElMessage.success('转移概率数据已加载并显示');
} }
}, DBL_CLICK_DELAY);
}; };
// - WMS // - WMS
const handleCellDblClick = (row, column, cell, event) => { const handleCellDblClick = (row, column, cell, event) => {
//
if (clickTimeoutId) {
clearTimeout(clickTimeoutId);
clickTimeoutId = null;
console.log('双击事件已清除单击延时器');
}
const cellValue = row[column.property]; const cellValue = row[column.property];
// //

Loading…
Cancel
Save