js中各种事件监听

   html.push('<input type="button" id="autocount_' + sysTime + '" class="layui-btn layui-btn-xs layui-btn-danger" value="自动计算">' );

点击事件

$("#sydcdel_"+sysTime).click(function () {
//删除的时候校验是否有已投入的相关信息,如果有则不能直接删除
var pihao = $("#sydcpihao_"+sysTime).val();
var url = "xunhuantouru/"+pihao+"," + "GF01030004";
febs.get(ctx + url, null, function (result) {
if('' == result.data || undefined == result.data){
layer.msg(result.data);
return false;
}
})
});

 

select下拉选中事件

form.on('select(sydcpihao_' + sysTime + ')', function(data){
var pihao = data.value;
if(pihao!='' && pihao!=null){
var url = "xunhuanDaohuo/getXunhuanDaohuo?pihao="+pihao;
febs.get(ctx + url, null, function (result) {
//获取废旧三元电池重量
var sydcweight = $("#sydcweight_"+sysTime).val();
var data = result.data;
$("#sydczhanbi_"+sysTime).val(data.zhanbi);
$("#sydcniHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.niJinshu/100)).toFixed(4));
$("#sydccoHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.coJinshu/100)).toFixed(4));
$("#sydcmnHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.mnJinshu/100)).toFixed(4));
$("#sydcliHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.liJinshu/100)).toFixed(4));
})
}
});

 

input 输入后事件

$("#sydcweight_"+sysTime).on('input propertychange', function(e) {
var sydcweight = $("#sydcweight_"+sysTime).val();
var pihao = $("#sydcpihao_"+sysTime).val();
if(pihao!=null && pihao!=''){
var url = "xunhuanDaohuo/getXunhuanDaohuo?pihao="+pihao;
febs.get(ctx + url, null, function (result) {
var data = result.data;
$("#sydczhanbi_"+sysTime).val(data.zhanbi);
$("#sydcniHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.niJinshu/100)).toFixed(4));
$("#sydccoHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.coJinshu/100)).toFixed(4));
$("#sydcmnHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.mnJinshu/100)).toFixed(4));
$("#sydcliHanliang_"+sysTime).val((sydcweight*(data.zhanbi/100)*(data.liJinshu/100)).toFixed(4));
})
}
});

posted @ 2022-08-15 14:47  青衣跪下  阅读(457)  评论(0编辑  收藏  举报