var ExcelData, ExcelKind; function ConfirmImport() { $.ajax({ type: "POST", url: "/Admin/Users/Import?r=" + Math.random(1), data: "Kind=" + ExcelKind + "&ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)), dataType: "text", success: function (data) { if (data == "success") { layer.msg("导入成功", { time: 2000 }, function () { window.location.reload(); }); } else if (data.indexOf("warning") == 0) { var datalist = data.split('|'); layer.alert(datalist[0], { time: 20000 }, function () { window.location.reload(); }); } else { layer.msg(data); } } }); } layui.config({ base: '/layuiadmin/' //静态资源所在路径 }).extend({ myexcel: 'layui/lay/modules/excel', index: 'lib/index' //主入口模块 }).use(['index', 'table', 'excel', 'laydate'], function () { var $ = layui.$ , form = layui.form , table = layui.table; //- 筛选条件-日期 var laydate = layui.laydate; var layCreateDate = laydate.render({ elem: '#CreateDate', type: 'date', range: true, trigger: 'click', change: function (value, date, endDate) { var op = true; if (date.year == endDate.year && endDate.month - date.month <= 1) { if (endDate.month - date.month == 1 && endDate.date > date.date) { op = false; layCreateDate.hint('日期范围请不要超过1个月'); setTimeout(function () { $(".laydate-btns-confirm").addClass("laydate-disabled"); }, 1); } } else { op = false; layCreateDate.hint('日期范围请不要超过1个月'); setTimeout(function () { $(".laydate-btns-confirm").addClass("laydate-disabled"); }, 1); } if (op) { $('#CreateDate').val(value); } } }); //excel导入 var excel = layui.excel; $('#ExcelFile').change(function (e) { var files = e.target.files; excel.importExcel(files, {}, function (data) { ExcelData = data[0].Sheet1; }); }); //监听单元格编辑 table.on('edit(LAY-list-manage)', function (obj) { var value = obj.value //得到修改后的值 , data = obj.data //得到所在行所有键值 , field = obj.field; //得到字段 if (field == "Sort") { $.ajax({ type: "POST", url: "/Admin/Users/Sort?r=" + Math.random(1), data: "Id=" + data.Id + "&Sort=" + value, dataType: "text", success: function (data) { } }); } }); //列表数据 table.render({ elem: '#LAY-list-manage' , url: '/Admin/Users/SanIndexData' //模拟接口 , cols: [[ { type: 'checkbox', fixed: 'left' } , { field: 'Id', width: 100, title: 'ID', sort: true } , { field: 'MakerCode', width: 200, title: '创客编号', sort: true } , { field: 'RealName', width: 200, title: '创客姓名', sort: true } , { field: 'UserLevel', width: 200, title: '创客等级', sort: true } , { field: 'UserYsLevel', width: 200, title: '预设等级', sort: true } , { field: 'IsLeader', width: 200, title: '是否盟主', sort: true } , { field: 'IsOp', width: 200, title: '是否运营中心', sort: true } , { field: 'AgentAreas', width: 200, title: '展业地区', sort: true } , { field: 'SettleAmount', width: 200, title: '提现金额(元)', sort: true } , { field: 'FreezeAmount', width: 200, title: '冻结金额(元)', sort: true } , { field: 'CertId', width: 200, title: '身份证号', sort: true } , { field: 'Mobile', width: 200, title: '联系手机', sort: true } , { field: 'MerchantType', width: 200, title: '商户创客类型', sort: true } , { field: 'MerchantDate', width: 200, title: '成为商户创客时间', sort: true } , { field: 'ParentMakerCode', width: 200, title: '直属创客编号', sort: true } , { field: 'ParentRealName', width: 200, title: '直属创客名称', sort: true } , { field: 'AuthFlagName', width: 200, title: '实名状态', sort: true } , { field: 'RiskFlagName', width: 200, title: '风控状态', sort: true } , { field: 'CreateDate', width: 200, title: '注册时间', sort: true } ]] , where: { } , page: true , limit: 30 , height: 'full-' + String($('.layui-card-header').height() + 130) , text: '对不起,加载出现异常!' , done: function (res, curr, count) { $(".layui-none").text("无数据"); } }); //监听工具条 //监听搜索 form.on('submit(LAY-list-front-search)', function (data) { var field = data.field; field.ShowFlag = 1; if (field.MakerCode == "" && field.CreateDateData == "" && field.IsLeader == "" && field.IsOp == "" && field.UserLevel == "" && field.UserYsLevel == "") { layer.alert('请输入查询条件'); } else { //执行重载 table.reload('LAY-list-manage', { where: field }); } }); form.on('submit(LAY-list-front-searchall)', function (data) { var field = data.field; field.ShowFlag = 1; field.MakerCode = ""; field.CreateDateData = ""; field.IsLeader = ""; field.IsOp = ""; field.UserLevel = ""; field.UserYsLevel = ""; table.reload('LAY-list-manage', { where: field, page: { curr: 1 } }); }); // $('.layui-btn').on('click', function () { // var type = $(this).data('type'); // active[type] ? active[type].call(this) : ''; // }); });