layui.config({ base: "/js/" }).use(['form', 'table', 'element', 'vue', 'layer', 'laydate', 'jquery', 'utils', 'code'], function () { var form = layui.form, layer = layui.layer, element = layui.element, laydate = layui.laydate, $ = layui.jquery; layui.code(); //引用code方法 //监听页面主按钮操作 var active = { //导出数据 }; $('.layui-btn').on('click', function () { var type = $(this).data('type'); active[type] ? active[type].call(this) : ''; }); var LayIndex = {}; $('.a-btn').on('click', function () { //将a标签DOM信息保存下来 var that = $(this); //从键值对数值中查找层的信息 if (LayIndex['layer' + $(this).data('type')] !== undefined) { //如果层已经存在,还原该层 layer.restore(LayIndex['layer' + $(this).data('type')]); } else { var index =layer.open({ type: 2, skin: 'layui-layer-molv', anim: 1, id: 'LAY_layuipro', //设定一个id,防止重复弹出 btnAlign: 'c', maxmin: true, moveType: 1, //拖拽模式,0或者1 title: $(this).html(), //不显示标题 area: ['950px', '800px'], //宽高 content: '/management/DevelopSOP/' + $(this).data('type'), //捕获的元素 scrollbar: false, btn: false, id: 'layer' + $(this).html(), //防止重复弹出 shade: 0, zIndex: layer.zIndex, //设定弹出层层叠索引 success: function (layero, index) { layer.setTop(layero); //指定该层 LayIndex['layer' + $(that).data('type')] = index; //将层的信息加入键值对数值,此处只能用$(that),回调方法中 $(this)已经不代表<a>标签 }, cancel: function (index, layero) { delete (LayIndex['layer' + $(that).data('type')]); //从键值对数值中删除层的信息,此处只能用$(that),回调方法中 $(this)已经不代表<a>标签 } }); } }); //给按钮添加快捷键 //Ctrl+I键添加,Ctrl+R键刷新,Ctrl+D键删除,Ctrl+E键编辑,Ctrl+F查询,Ctrl+S保存,Ctrl+A全选,Ctrl+Shift+A取消全选,左 上一页 右 下一页 $(document).bind("keydown", function (e) { //禁用页面F5刷新 if (e.which == 116) { e.preventDefault(); //Skip default behavior of the enter key } }); })