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 <= 2) { if (endDate.month - date.month == 2 && endDate.date > date.date) { op = false; layCreateDate.hint('日期范围请不要超过2个月'); setTimeout(function () { $(".laydate-btns-confirm").addClass("laydate-disabled"); }, 1); } } else { op = false; layCreateDate.hint('日期范围请不要超过2个月'); 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/ChildrenData' //模拟接口 , cols: [[ { type: 'checkbox', fixed: 'left' } , { field: 'Id', width: 100, title: 'ID', sort: true } , { field: 'MakerCode', width: 200, title: '创客编号', sort: true, templet: '#MakerCodeTpl' } , { field: 'RealName', width: 200, title: '创客姓名', sort: true } , { field: 'TotalAmtfc', width: 200, title: '刷卡交易总额(扶)', sort: true } , { field: 'DAmtfc', width: 200, title: '贷记卡交易额(扶)', sort: true } , { field: 'JAmtfc', width: 200, title: '借记卡非封顶交易额(扶)', sort: true } , { field: 'JfAmtfc', width: 200, title: '借记卡封顶交易额(扶)', sort: true } , { field: 'JCountfc', width: 200, title: '借记卡交易笔数(扶)', sort: true } , { field: 'YAmtfc', width: 200, title: '云闪付小额交易额(扶)', sort: true } , { field: 'TotalAmtwd', width: 200, title: '刷卡交易总额(稳)', sort: true } , { field: 'DAmtwd', width: 200, title: '贷记卡交易额(稳)', sort: true } , { field: 'JAmtwd', width: 200, title: '借记卡非封顶交易额(稳)', sort: true } , { field: 'JfAmtwd', width: 200, title: '借记卡封顶交易额(稳)', sort: true } , { field: 'JCountwd', width: 200, title: '借记卡交易笔数(稳)', sort: true } , { field: 'YAmtwd', width: 200, title: '云闪付小额交易额(稳)', sort: true } , { field: 'TotalAmtyl', width: 200, title: '刷卡交易总额(盈)', sort: true } , { field: 'DAmtyl', width: 200, title: '贷记卡交易额(盈)', sort: true } , { field: 'JAmtyl', width: 200, title: '借记卡非封顶交易额(盈)', sort: true } , { field: 'JfAmtyl', width: 200, title: '借记卡封顶交易额(盈)', sort: true } , { field: 'JCountyl', width: 200, title: '借记卡交易笔数(盈)', sort: true } , { field: 'YAmtyl', width: 200, title: '云闪付小额交易额(盈)', sort: true } , { field: 'TBCount', width: 200, title: '团队机具绑定总数', sort: true } , { field: 'TACount', width: 200, title: '团队机具激活总数', sort: true } // , { field: 'HelpInfo', width: 400, title: '扶持期商户交易信息', sort: true } // , { field: 'NotHelpInfo', width: 400, title: '稳定期商户交易信息', sort: true } ]] , where: { ParentId: ParentId, MakerCode: MakerCode } , page: true , limit: 30 , height: 'full-' + String($('.layui-card-header').height() + 130) , text: '对不起,加载出现异常!' , done: function (res, curr, count) { $("#TotalAmtfc").text(res.other.TotalAmtfc); $("#DAmtfc").text(res.other.DAmtfc); $("#JAmtfc").text(res.other.JAmtfc); $("#JfAmtfc").text(res.other.JfAmtfc); $("#JCountfc").text(res.other.JCountfc); $("#YAmtfc").text(res.other.YAmtfc); $("#TotalAmtwd").text(res.other.TotalAmtwd); $("#DAmtwd").text(res.other.DAmtwd); $("#JAmtwd").text(res.other.JAmtwd); $("#JfAmtwd").text(res.other.JfAmtwd); $("#JCountwd").text(res.other.JCountwd); $("#YAmtwd").text(res.other.YAmtwd); $("#TotalAmtyl").text(res.other.TotalAmtyl); $("#DAmtyl").text(res.other.DAmtyl); $("#JAmtyl").text(res.other.JAmtyl); $("#JfAmtyl").text(res.other.JfAmtyl); $("#JCountyl").text(res.other.JCountyl); $("#YAmtyl").text(res.other.YAmtyl); $("#TotalAmtfc1").text(res.other.TotalAmtfc1); $("#DAmtfc1").text(res.other.DAmtfc1); $("#JAmtfc1").text(res.other.JAmtfc1); $("#JfAmtfc1").text(res.other.JfAmtfc1); $("#JCountfc1").text(res.other.JCountfc1); $("#YAmtfc1").text(res.other.YAmtfc1); $("#TotalAmtwd1").text(res.other.TotalAmtwd1); $("#DAmtwd1").text(res.other.DAmtwd1); $("#JAmtwd1").text(res.other.JAmtwd1); $("#JfAmtwd1").text(res.other.JfAmtwd1); $("#JCountwd1").text(res.other.JCountwd1); $("#YAmtwd1").text(res.other.YAmtwd1); $("#TotalAmtyl1").text(res.other.TotalAmtyl1); $("#DAmtyl1").text(res.other.DAmtyl1); $("#JAmtyl1").text(res.other.JAmtyl1); $("#JfAmtyl1").text(res.other.JfAmtyl1); $("#JCountyl1").text(res.other.JCountyl1); $("#YAmtyl1").text(res.other.YAmtyl1); $("#BCount").text(res.other.BCount); $("#ACount").text(res.other.ACount); $("#PBCount").text(res.other.PBCount); $("#PACount").text(res.other.PACount); $("#TBCount").text(res.other.TBCount); $("#TACount").text(res.other.TACount); $(".layui-none").text("无数据"); } }); //监听工具条 table.on('tool(LAY-list-manage)', function (obj) { var data = obj.data; }); //监听搜索 form.on('submit(LAY-list-front-search)', function (data) { var field = data.field; //执行重载 table.reload('LAY-list-manage', { where: field }); }); form.on('submit(LAY-list-front-searchall)', function (data) { table.reload('LAY-list-manage', { where: { SelfId: SelfId, ParentId: ParentId, MakerCode: MakerCode } }); }); $('.layui-btn').on('click', function () { var type = $(this).data('type'); active[type] ? active[type].call(this) : ''; }); });