From 066cc73fcd29788138cf9a3f7c483f791c09f41b Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Mon, 17 Jun 2024 10:30:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E9=87=8D=E5=A4=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BasicForm/src/BasicForm.vue | 10 +--------- src/components/XButton/src/ButtonBase.vue | 13 +++++++------ .../strategy/supplieDeliveryStrategy/AddForm.vue | 8 +------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index e03a33ada..0bf3d3ee8 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -571,15 +571,7 @@ const buttonBaseClick = (val) => { } // 保存 else if (val == 'save') { - let timer = null - if(!timer){ - submitForm() - timer = setTimeout(()=>{ - if(timer){ - clearTimeout(timer) - } - },2000) - } + submitForm() } // 关闭 else if (val == 'close') { diff --git a/src/components/XButton/src/ButtonBase.vue b/src/components/XButton/src/ButtonBase.vue index adf88fab7..4ebcad026 100644 --- a/src/components/XButton/src/ButtonBase.vue +++ b/src/components/XButton/src/ButtonBase.vue @@ -71,18 +71,19 @@ const props = defineProps({ // 传递给父类 const emit = defineEmits(['buttonBaseClick', 'updataTableColumns']) +let timer = ref(null) const buttonBaseClick = (val, item, $event) => { - let timer = null - if(!timer){ + if(!timer.value){ clearButtonBlurHandle($event) //解决el-button点击后颜色不恢复问题 emit('buttonBaseClick', val, item, $event) - timer = setTimeout(()=>{ - if(timer){ - clearTimeout(timer) + timer.value = setTimeout(()=>{ + if(timer.value){ + console.log('清空timer',timer.value) + clearTimeout(timer.value) + timer.value = null } },2000) } - } const popoverVisible = ref(false) // 关闭页面 diff --git a/src/views/wms/basicDataManage/strategySetting/strategy/supplieDeliveryStrategy/AddForm.vue b/src/views/wms/basicDataManage/strategySetting/strategy/supplieDeliveryStrategy/AddForm.vue index 53b7e8806..c5c0335e4 100644 --- a/src/views/wms/basicDataManage/strategySetting/strategy/supplieDeliveryStrategy/AddForm.vue +++ b/src/views/wms/basicDataManage/strategySetting/strategy/supplieDeliveryStrategy/AddForm.vue @@ -425,13 +425,7 @@ const getFormLocationList = async () => { options.originLocationList = await getLocationList({ type: 'TRANSPORT' }) options.locationList = [...options.originLocationList] }else{ - options.locationList = [] - let timer = setTimeout(()=>{ - options.locationList = [...options.originLocationList] - if(timer){ - clearTimeout(timer) - } - },2000) + options.locationList = [...options.originLocationList] } }