fastadmin图片前台导出

devtools/2025/2/12 19:34:54/

参考 https://github.com/hhurz/tableExport.jquery.plugin#options

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {$(document).ready(function(){$('#table').bootstrapTable('refreshOptions', {exportOptions: {onMsoNumberFormat: DoOnMsoNumberFormat}});});function DoOnMsoNumberFormat(cell, row, col) {return (row > 0 ) ? '\\@' : '';}var Controller = {index: function () {// 初始化表格参数配置Table.api.init({extend: {index_url: 'register/index' + location.search,add_url: 'register/add',edit_url: 'register/edit',del_url: 'register/del',multi_url: 'register/multi',table: 'register',},//fastadminexportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],exportOptions: {fileName: 'export_' + Moment().format("YYYY-MM-DD"),  //导出名称ignoreColumn: [0, 'operate'], //不导出字段ignoreRow: [],csvSeparator: "----",//文本分割htmlContent: true,onMsoNumberFormat: DoOnMsoNumberFormat},//fastadmin});var table = $("#table");// 初始化表格table.bootstrapTable({url: $.fn.bootstrapTable.defaults.extend.index_url,pk: 'id',sortName: 'id',exportOptions: {fileName: 'export_' + Moment().format("YYYY-MM-DD"), // 原方法 定义生成的文件名ignoreColumn: [0, 'operate'] ,// 原方法 默认跳过输出多选框和操作列//  FA专家 大饼博士代码htmlContent: true,mso:{onMsoNumberFormat:function(cell,row,col,htmlData){if ($(cell).children().children().hasClass('img-center')) {var img=$(cell).children().children();var src =img.attr('src');return src;}return !isNaN($(cell).text())?'\\@':'';},},onCellHtmlData:function (cell,row,col){console.log(cell.html())if ($(cell).children().children().hasClass('img-center')) {console.log(111)var img=$(cell).children().children();var src =img.attr('src');if (src.indexOf('http') === -1) {img.attr('src', window.location.origin + src);}img.attr("width", "100").attr("height", "100").attr('class', '');//result += '<div>' + $(this).get(0).outerHTML + '</div>';result = '<div>' + img.parent().html()+ '</div>';return result;}else {return $(cell).text();}}},columns: [[{checkbox: true},{field: 'id', title: __('Id')},{field: 'name', title: __('Name')},{field: 'phone', title: __('Phone')},{field: 'email', title: __('Email')},{field: 'identity_card', title: __('Identity_card')},{field: 'unit', title: __('Unit')},{field: 'form_post', title: __('Form_post')},{field: 'type_academic', title: __('Type_academic'), searchList: {"1":__('Type_academic 1'),"2":__('Type_academic 2')}, formatter: Table.api.formatter.normal},{field: 'price', title: __('Price'), operate:'BETWEEN'},{field: 'apply', title: __('报告名')},{field: 'type_pay', title: __('Type_pay'), searchList: {"1":__('Type_pay 1'),"2":__('Type_pay 2'),"3":__('Type_pay 3')}, formatter: Table.api.formatter.normal},{field: 'remark', title: __('Remark')},{field: 'person_changed', title: __('人员类型'),searchList: {"1":__('正式代表'),"2":__('学生代表')},},{field: 'student_card', title: __('学生证'),operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}]]});// 为表格绑定事件Table.api.bindevent(table);},add: function () {Controller.api.bindevent();},edit: function () {Controller.api.bindevent();},api: {bindevent: function () {Form.api.bindevent($("form[role=form]"));console.log("加载完成")}}};return Controller;
});

在这里插入图片描述
exportOptions:参数如下

csvEnclosure: '"'
csvSeparator: ','
csvUseBOM: true
date: html: 'dd/mm/yyyy'
exportHiddenCells: false
fileName: 'tableExport'
htmlContent: false
htmlHyperlink: 'content'
ignoreColumn: []
ignoreRow: []
jsonScope: 'all'
jspdf: orientation: 'p'unit:'pt'format: 'a4'margins: left: 20right: 10top: 10bottom: 10onDocCreated: nullautotable: styles: cellPadding: 2rowHeight: 12fontSize: 8fillColor: 255textColor: 50fontStyle: 'normal'overflow: 'ellipsize'halign: 'inherit'valign: 'middle'headerStyles: fillColor: [52, 73, 94]textColor: 255fontStyle: 'bold'halign: 'inherit'valign: 'middle'alternateRowStyles: fillColor: 245tableExport: doc: nullonAfterAutotable: nullonBeforeAutotable: nullonAutotableText: nullonTable: nulloutputImages: true
mso: fileFormat: 'xlshtml'onMsoNumberFormat: nullpageFormat: 'a4'pageOrientation: 'portrait'rtl: falsestyles: []worksheetName: ''xlsx: formatId: date: 14numbers: 2currency: 164format: currency: '$#,##0.00;[Red]-$#,##0.00'onHyperlink: null
numbers: html: decimalMark: '.'thousandsSeparator: ','output: decimalMark: '.'thousandsSeparator: ','
onAfterSaveToFile: null
onBeforeSaveToFile: null
onCellData: null
onCellHtmlData: null
onCellHtmlHyperlink: null
onIgnoreRow: null
onTableExportBegin: null
onTableExportEnd: null
outputMode: 'file'
pdfmake: enabled: falsedocDefinition: pageSize: 'A4'pageOrientation: 'portrait'styles: header: background: '#34495E'color: '#FFFFFF'bold: truealignment: 'center'fillColor: '#34495E'alternateRow: fillColor: '#f5f5f5'defaultStyle: color: '#000000'fontSize: 8font: 'Roboto'fonts: {}widths: '*'
preserve: leadingWS: falsetrailingWS: false
preventInjection: true
sql: tableEnclosure:  '`'columnEnclosure: '`' 
tbodySelector: 'tr'
tfootSelector: 'tr'
theadSelector: 'tr'
tableName: 'myTableName'
type: 'csv'

http://www.ppmy.cn/devtools/158293.html

相关文章

体验 DeepSeek-R1:解密 1.5B、7B、8B 版本的强大性能与应用

文章目录 &#x1f34b;引言&#x1f34b;DeepSeek 模型简介&#x1f34b;版本更新&#xff1a;1.5B、7B、8B 的区别与特点&#x1f34b;模型评估&#x1f34b;体验 DeepSeek 的过程&#x1f34b;总结 &#x1f34b;引言 随着大规模语言模型的持续发展&#xff0c;许多模型在性…

Node.js 实现简单爬虫

介绍 爬虫是一种按照一定的规则&#xff0c;自动地抓取万维网信息的程序或者脚本。 本文将使用 Nodejs 编写一个简单的爬虫脚本&#xff0c;爬取一个美食网站&#xff0c;获取菜品的标题和图片链接&#xff0c;并以表格的形式输出。 准备工作 1、初始化项目 首先&#xff0…

ESP8266配置为TCP客户端,连接电脑和手机(使用Arduino配置)

一、简介 基于 ESP8266 的 Arduino 代码&#xff0c;其主要功能是将 ESP8266 连接到指定的 Wi-Fi 网络&#xff0c;并与指定 IP 地址和端口号的服务器建立 TCP 连接。在连接成功后&#xff0c;实现了串口和网络数据的双向传输&#xff0c;也就是将从串口接收到的数据通过 Wi-Fi…

(篇五)基于PyDracula搭建一个深度学习的软件之融入大华相机

1大华python文件解读 我们正常打开MVviewer会发现这些文件。我的应用场景是PLC给我一个信号&#xff0c;我就触发拍照程序&#xff0c;那么我需要选取哪一个文件作为研究基础呢&#xff1f; 1.1 异步回调byCallBack和手动轮询byGetFrame 异步回调 采用 异步回调 (attachGr…

【Linux系统】—— 简易进度条的实现

【Linux系统】—— 简易进度条的实现 1 回车和换行2 缓冲区3 进度条的准备代码4 第一版进度条5 第二版进度条 1 回车和换行 先问大家一个问题&#xff1a;回车换行是什么&#xff0c;或者说回车和换行是同一个概念吗&#xff1f;   可能大家对回车换行有一定的误解&#xff0…

JVM(Java 虚拟机)

Java语言的解释性和编译性&#xff08;通过JVM 的执行引擎&#xff09; Java 代码&#xff08;.java 文件&#xff09;要先使用 javac 编译器编译为 .class 文件&#xff08;字节码&#xff09;&#xff0c;紧接着再通过JVM 的执行引擎&#xff08;Execution Engine&#xff09…

React受控组件的核心原理与实战精要

在 React 中&#xff0c;受控组件&#xff08;Controlled Component&#xff09; 是一种重要的模式&#xff0c;用于通过组件的状态来管理表单元素的值。这种模式不仅确保了数据的一致性和可预测性&#xff0c;还便于与其他功能&#xff08;如验证和格式化&#xff09;集成。本…

使用deepseek快速创作ppt

目录 1.在DeekSeek生成PPT脚本2.打开Kimi3.最终效果 DeepSeek作为目前最强大模型&#xff0c;其推理能力炸裂&#xff0c;但是DeepSeek官方没有提供生成PPT功能&#xff0c;如果让DeepSeek做PPT呢&#xff1f; 有个途径&#xff1a;在DeepSeek让其深度思考做出PPT脚本&#xf…