当前位置:网站首页>避免按钮重复点击的小工具bimianchongfu.queren()
避免按钮重复点击的小工具bimianchongfu.queren()
2022-07-01 08:26:00 【海宏AA】
按钮后台可能执行很长时间,这期间如果客户等不及再次点了按钮,可能会重复触发。
比如资产折旧,运行很长时间。

所以可以做一个hf_running的hiddenfield对象,设置值1表示正在运行,0表示没有。为兼容性用的纯js。
封装好了:
//避免重复运行,需要加一个hf_running的控件。用法:
//if (!bimianchongfu.queren('确认继续吗?')) return;
//执行具体业务代码
//执行完后,清空hf_running的值或者改成0
var bimianchongfu = {
kongjian: { objRunning: "hf_running" },
//检查是否正在运行,并提示,并设置值
queren: function (AConfirmMsg, lShowAlert, strShowAlert, lMarkIsRunning) {
var rt = this.zhengzaiyunxing(lShowAlert, strShowAlert, false);//检查正在运行
if (rt) return false; //正在运行,返回
//确认
var s = AConfirmMsg;
if (AConfirmMsg == undefined || AConfirmMsg == null) s = "";
if (s != "") if (!(rt = confirm(s))) return false;
//
if (lMarkIsRunning == undefined || lMarkIsRunning == null || lMarkIsRunning == true)
this.set("1");
//
return true;
},
//读取是否正在运行
zhengzaiyunxing: function (lShowAlert, strShowAlert, lMarkIsRunning) {
var obj = this.kongjian.objRunning, v = "", l = false, s = strShowAlert, lAlert = lShowAlert;
if (obj == undefined || obj == null) obj = document.getElementById("hf_running");
else if (typeof (obj) == "string") obj = document.getElementById(obj);
if (obj == undefined || obj == null) obj = document.getElementById("hf_running");
if (obj != null && this.kongjian.objRunning == null) this.kongjian.objRunning = obj;//记下来
v = obj.value; //取值
l = !(v == undefined || v == null || v == "" || v == "0" || v == "false");
//提示信息
if (l) { //正在运行
if (lShowAlert == undefined || lShowAlert == null) lAlert = true;
if (strShowAlert == undefined || strShowAlert == null) s = "正在运行,请稍候";
if (lAlert && s != "") alert(s);
} else { //没有运行,标记为正在运行
if (lMarkIsRunning == undefined || lMarkIsRunning == null || lMarkIsRunning == true)
this.set("1");
}
//完成返回
return l;
},
//设置值
set: function (val) {
var obj = this.kongjian.objRunning, tp = typeof (obj);
if (tp == "object") obj.value = val;
else if (tp == "string") document.getElementById(obj).value = val;
else document.getElementById("hf_running").value = val;
}
};边栏推荐
- Provincial election + noi part I dynamic planning DP
- [staff] key number (key number identification position | key number marking list | a major key identification principle | F, C, G position marking ascending | F major key identification principle | B
- Yolov5进阶之七目标追踪最新环境搭建
- Using settoolkit to forge sites to steal user information
- Huawei machine test questions column subscription Guide
- P4 installation bmv2 detailed tutorial
- Hijacking a user's browser with beef
- Manually dig XSS vulnerabilities
- 长安链同步节点配置与启动
- 2022 ordinary scaffolder (special type of construction work) examination question bank and the latest analysis of ordinary scaffolder (special type of construction work)
猜你喜欢
![[detailed explanation of Huawei machine test] judgment string subsequence [2022 Q1 Q2 | 200 points]](/img/0f/972cde8c749e7b53159c9d9975c9f5.png)
[detailed explanation of Huawei machine test] judgment string subsequence [2022 Q1 Q2 | 200 points]

TypeError: __init__() got an unexpected keyword argument ‘autocompletion‘

Properties of 15MnNiNbDR low temperature vessel steel, Wugang 15MnNiDR and 15MnNiNbDR steel plates

seaborn clustermap矩阵添加颜色块

《MATLAB 神经网络43个案例分析》:第30章 基于随机森林思想的组合分类器设计——乳腺癌诊断

Li Kou 1358 -- number of substrings containing all three characters (double pointer)

Adding color blocks to Seaborn clustermap matrix

谈谈数字化转型的几个关键问题

Qt的模型与视图

Audio-AudioRecord create(一)
随机推荐
华为机试真题专栏订阅指引
Internet of things technology is widely used to promote intelligent water automation management
SPL-安装与基本使用(二)
shardingSphere
shardingSphere
分享2022上半年我读过的7本书
Qt的模型与视图
Programmer's regimen
Codeworks round 803 (Div. 2) VP supplement
深度学习训练样本扩增同时修改标签名称
C basic knowledge review (Part 4 of 4)
栈实现计算器
《单片机原理及应用》—定时器、串行通信和中断系统
What is 1cr0.5mo (H) material? 1cr0.5mo (H) tensile yield strength
Leetcode T29: 两数相除
Field agricultural irrigation system
There are many problems in sewage treatment, and the automatic control system of pump station is solved in this way
Li Kou 1358 -- number of substrings containing all three characters (double pointer)
[redis] it takes you through redis installation and connection at one go
量化交易之读书篇 - 《征服市场的人》读书笔记