zoukankan      html  css  js  c++  java
  • fastadmin导出图片

                // 初始化表格参数配置
                Table.api.init({
                    extend: {
                        index_url: 'miaomuku/index' + location.search,
                        add_url: 'miaomuku/add',
                        edit_url: 'miaomuku/edit',
                        del_url: 'miaomuku/del',
                        multi_url: 'miaomuku/multi',
                        import_url: 'miaomuku/import',
                        table: 'miaomuku',
                    },
                    search: false,
                    showToggle: false,
                    showColumns: false,
                    dblClickToEdit: false,
                    showColumns: false,
                    fixedColumns:true,
                    fixedRightNumber:1,
                    exportTypes: ['excel'],
                    exportOptions: {
                        ignoreColumn: [0, 'operate'],
                        onBeforeSaveToFile: function (data, fileName, type, charset, encoding, bom) {
                            return $.fn.bootstrapTable.defaults.extend.savestatus;
                        },
                        onCellHtmlHyperlink: function ($cell, rowIndex, colIndex, href, htmlData) {
                            var html = $.parseHTML(htmlData);
                            var inputidx = 0;
                            var selectidx = 0;
                            var result = '';
    
                            $.each(html, function () {
                                if ($(this).is("input")) {
                                    result += $cell.find('input').eq(inputidx++).val();
                                } else if ($(this).is("select")) {
                                    result += $cell.find('select option:selected').eq(selectidx++).text();
                                } else if ($(this).is("img")) {
                                    var src = $(this).attr('src');
                                    if (src.indexOf('http') === -1) {
                                        $(this).attr('src', window.location.origin + src);
                                    }
                                    $(this).attr("width", "40").attr("height", "40").attr('class', '');
                                    result += '<div>' + $(this).get(0).outerHTML + '</div>';
                                } else {
                                    if (typeof $(this).html() === 'undefined') {
                                        result += $(this).text();
                                    } else if (jQuery().bootstrapTable === undefined ||
                                        ($(this).hasClass('filterControl') !== true &&
                                            $cell.parents('.detail-view').length === 0)) {
                                        result += $(this).html();
                                    }
                                }
                            });
                            return result;
                        }
                    }
                });
    
                var table = $("#table");
    ╰︶﹉⋛⋋⊱⋋๑๑⋌⊰⋌⋚﹉︶╯
  • 相关阅读:
    机器学习入门-贝叶斯垃圾邮件过滤(原理)
    机器学习入门-贝叶斯拼写纠错实例
    机器学习入门-贝叶斯算法(原理)
    机器学习入门-集成算法(bagging, boosting, stacking)
    高并发网站技术架构
    Nginx教程
    Shell脚本部分语法
    关于文本处理sort-cut-wc详解
    vim操作命令
    修改Linux基本配置
  • 原文地址:https://www.cnblogs.com/zhangcheng001/p/15692613.html
Copyright © 2011-2022 走看看