赋值变量 tableTest
再调用tableTest()
var tableTest = function() {
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#meg'
, url: '/order/orderEmployeeList'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
, cols: [[
{field: 'id', title: '揽收员编号', align: 'center', width: 150}
, {field: 'username', title: '揽收员', align: 'center', width: 100}
, {field: 'tel', title: '联系电话', align: 'center', width: 150}
, {field: 'address', title: '段道', align: 'center', width: 303}
]]
// ,height:295
, page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
//,curr: 5 //设定初始在第 5 页
, groups: 1 //只显示 1 个连续页码
, first: false //不显示首页
, last: false //不显示尾页
}
, id: 'testReload'
, request: {
pageName: 'page' //页码的参数名称,默认:page
, limitName: 'pageSize' //每页数据量的参数名,默认:limit
, statusName: 'status'//数据状态的字段名称,默认:code
, statusCode: 200 //成功的状态码,默认:0
}
, where: {
orgCode: orgCode
}
});
$('.layui-btn').click(function () {
var inputVal = $('.layui-input').val()
table.reload('testReload', {
url: ' '
// ,methods:"post"
, request: {
pageName: 'page' //页码的参数名称,默认:page
, limitName: 'pageSize' //每页数据量的参数名,默认:limit
}
, where: {
query: inputVal
}
, page: {
curr: 1
}
});
})
$('.btn2').on('click', function () {
var userCode = $("#id").val();
var userName = $("#username").val();
layer.closeAll()
});
});
}
function loadOrderEmployeeList() {
layui.use('layer', function(){
var layer = layui.layer;
layer.open({
title:"揽收员列表",
type: 1,
area: ['765px', '455px'],
content: $("#table"),
shadeClose:true,
move : false, //拖拽模式
shade: 0.4
});
tableTest()
});
}
var $ = layui.$, active = { getCheckData:function(){ var checkStatus = table.checkStatus('orderReload') ,data = checkStatus.data; if(checkStatus.data.length==0){ layer.msg('请选择进行人工调度操作的订单!', {icon: 2}); return ; } var codeId= ""; for(var i=0;i<checkStatus.data.length;i++){ codeId += checkStatus.data[i].id; } // window.location.href = "http://www.baidu.com.html?id="+codeId; loadOrderEmployeeList(); } }; $('.layui-btn').on('click', function(){ var type = $(this).data('type'); active[type] ? active[type].call(this) : ''; });