123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- (function(doc, win) {
- var docEl = doc.documentElement,
- resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
- recalc = function() {
- var clientWidth = docEl.clientWidth;
- if (!clientWidth) return;
- if (clientWidth >= 1080) {
- docEl.style.fontSize = '100px';
- } else {
- docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
- }
- };
- if (!doc.addEventListener) return;
- win.addEventListener(resizeEvt, recalc, false);
- doc.addEventListener('DOMContentLoaded', recalc, false);
- var docEl = document.documentElement;
- var clientWidth = docEl.clientHeight;
- })(document, window);
- // 导出
- function downloadExcel(data, fileName) {
- if (!data) {
- return
- }
- const a = moment().format('YYYYMMDDHHmmss')
- const fname = fileName + a
- const blob = new Blob([data], {
- type: 'application/vnd.ms-excel'
- })
- if (window.navigator && window.navigator.msSaveOrOpenBlob) {
- navigator.msSaveBlob(blob, fname + '.xlsx')
- } else {
- const link = document.createElement('a')
- link.style.display = 'none'
- var href = URL.createObjectURL(blob)
- link.href = href
- link.setAttribute('download', fname + '.xlsx')
- document.body.appendChild(link)
- link.click()
- document.body.removeChild(link)
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }
- }
- function toThousands(num, decimal) {
- let numInfo = num ? num : 0
- return parseFloat(numInfo).toFixed(decimal)
- }
|