| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- var ExcelData, ExcelKind;
- function ConfirmImport() {
- $.ajax({
- type: "POST",
- url: "/Admin/PrizeFlowRecord/Import?r=" + Math.random(1),
- data: "ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
- dataType: "text",
- success: function (data) {
- if (data == "success") {
- layer.msg("导入成功", { time: 2000 }, function () {
- window.location.reload();
- });
- } else {
- layer.msg(data);
- }
- }
- });
- }
- var excel;
- 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;
- //- 筛选条件-日期
-
- //excel导入
- 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; //得到字段
- });
- //列表数据
- table.render({
- elem: '#LAY-list-manage'
- , url: '/Admin/PrizeFlowRecord/IndexData' //模拟接口
- , cols: [[
- { type: 'checkbox', fixed: 'left' }
- , { field: 'Id', fixed: 'left', title: 'ID', width: 80, sort: true, unresize: true }
- , { field: 'KindName', width: 200, title: '来源类型', sort: true }
- , { field: 'CodeNumber', width: 200, title: '机具号/订单号', sort: true }
- , { field: 'CreateDate', width: 200, title: '创建时间', sort: true }
- , { field: 'Detail', width: 600, title: '描述', sort: true }
- ]]
- , where: {
- }
- , page: true
- , limit: 30
- , height: 'full-220'
- , text: '对不起,加载出现异常!'
- , done: function (res, curr, count) {
- $(".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,
- page: {
- curr: 1
- }
- });
- });
- form.on('submit(LAY-list-front-searchall)', function (data) {
- table.reload('LAY-list-manage', {
- where: null,
- page: {
- curr: 1
- }
- });
- });
- //事件
- var active = {
-
- };
- $('.layui-btn').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- });
|