1、添加路径 SM2604,/layui-v2.2.5/layui.js 放在PU脚本集合中的第1个
2、
layui.use(['layer', 'form'], function () { var form = layui.form; var layer = layui.layer; $ = layui.jquery; $("#btn_val_CPMC").click(function () { var sql = "select ID,CPMC as NAME from sm_zdb_cp_vw"; var data = JsonToHtml(readDataAst(sql), 10); layer.open({ type: 1, title: ['产品选择', 'height:15px;font-size:10px;line-height:1.5;color:red'], area: ['99%', '99%'], offset: ['1%', '1%'], time: 95000, btn: ['确定'], content: data.innerHTML , yes: function () { var tzdiv = $("#tzdiv"); var checked = tzdiv.find("input:checkbox:checked"); if (checked.length == 0) { alert('未选择记录,请选择1条记录'); return false; } if (checked.length > 1) { alert('非法操作,只能选择1条记录'); return false; } $("#val_CPID").focus().keydown().val(checked.eq(0).attr("id")).blur(); $("#val_CPMC").focus().keydown().val(checked.eq(0).attr("NAME")).blur(); layer.closeAll('page'); } }); }); form.render(); /*动态渲染*/ });
标签:layer,checked,form,val,layui,弹窗,var,SM2604 From: https://www.cnblogs.com/nuaaydh/p/18586546