抖音_南瓜淘效期导出

效期导出脚本

// ==UserScript==
// @name         抖音_南瓜淘效期导出
// @namespace    manji
// @license      manji
// @version      0.0.1
// @description  效期导出脚本
// @match        http://www.nanguatao.com/#/merchantCenter/inventoryExpiry
// @author       You
// @grant        GM_xmlhttpRequest
// @require      https://unpkg.com/[email protected]/dist/xlsx.full.min.js
// ==/UserScript==

(function() {
    'use strict';

    // 插入导出按钮
    let  titleElement = document.querySelector(".subtitle");
    titleElement.innerHTML += `<button id = 'getOuterExcel'>导出EXCEL</button>`;


    // html table js 导出excel表格
    document.querySelector("#getOuterExcel").addEventListener('click', function() {
        function base64 (content) {
            return window.btoa(unescape(encodeURIComponent(content)));         
        }
        function exportOffice(tableID){
                var type = 'excel';
                var table = document.querySelector(tableID);
                var excelContent = table.innerHTML;

                var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:"+type+"' xmlns='http://www.w3.org/TR/REC-html40'>";
                excelFile += "<head>";
                excelFile += "<!--[if gte mso 9]>";
                excelFile += "<xml>";
                excelFile += "<x:ExcelWorkbook>";
                excelFile += "<x:ExcelWorksheets>";
                excelFile += "<x:ExcelWorksheet>";
                excelFile += "<x:Name>";
                excelFile += "{worksheet}";
                excelFile += "</x:Name>";
                excelFile += "<x:WorksheetOptions>";
                excelFile += "<x:DisplayGridlines/>";
                excelFile += "</x:WorksheetOptions>";
                excelFile += "</x:ExcelWorksheet>";
                excelFile += "</x:ExcelWorksheets>";
                excelFile += "</x:ExcelWorkbook>";
                excelFile += "</xml>";
                excelFile += "<![endif]-->";
                excelFile += "</head>";
                excelFile += "<body>";
                excelFile += "<table>";
                excelFile += excelContent;
                excelFile += "</table>";
                excelFile += "</body>";
                excelFile += "</html>";
                var base64data = "base64," + base64(excelFile);
                switch(type){
                    case 'excel':
                        window.open('data:application/vnd.ms-'+type+';'+base64data);
                    break;
                    case 'powerpoint':
                        window.open('data:application/vnd.ms-'+type+';'+base64data);
                    break;
                }
        };  

        // 执行导出函数
        exportOffice('.v-table-rightview');
    });



    // Your code here...
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址