{"remainingRequest":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\reform-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\reform-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\reform-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\reform-fvue\\src\\views\\BigScreen\\components\\subComponents\\previewExport.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\reform-fvue\\src\\views\\BigScreen\\components\\subComponents\\previewExport.vue","mtime":1727362433135},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\reform-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.split\";\nimport _defineProperty from \"D:/jenkins/workspace/reform-fvue/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport \"regenerator-runtime/runtime\";\nimport _asyncToGenerator from \"D:/jenkins/workspace/reform-fvue/node_modules/@babel/runtime/helpers/esm/asyncToGenerator\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/web.dom.iterable\";\nimport _toConsumableArray from \"D:/jenkins/workspace/reform-fvue/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport html2canvas from 'html2canvas';\nimport mapTarget from '@/views/BigScreen/components/subComponents/mapTarget.vue'; // 重点关注指标\n\nimport JSZip from 'jszip';\nexport default {\n components: {\n mapTarget: mapTarget\n },\n data: function data() {\n return {\n load: false,\n downloadLoading: false,\n dialogTableVisible: false,\n indexData: [],\n indeterminate: true,\n doms: null,\n len: 0\n };\n },\n mounted: function mounted() {},\n methods: {\n open: function open(lsIndex, totalGear) {\n var _this = this;\n\n this.load = true;\n var arr = [totalGear].concat(_toConsumableArray(lsIndex));\n arr.forEach(function (item) {\n item.export = true;\n item.dataURL = '';\n });\n this.indexData = JSON.parse(JSON.stringify(arr));\n this.dialogTableVisible = true;\n this.$nextTick(function () {\n _this.getScale();\n\n _this.doms = document.querySelectorAll('.index-item');\n });\n },\n getScale: function getScale() {\n this.$nextTick(function () {\n var dialogBody = document.querySelector('.el-dialog__body');\n var wh = dialogBody.clientHeight / (935 * 3);\n var ww = dialogBody.clientWidth / (1919 * 3);\n var bl = ww < wh ? ww : wh;\n var doms = document.querySelectorAll('.index-item');\n Array.from(doms).map(function (item) {\n item.style.transform = \"scale(\".concat(bl, \")\");\n item.style.transformOrigin = 'left top';\n });\n });\n },\n handleCheckAllChange: function handleCheckAllChange(e) {\n this.indexData.forEach(function (item) {\n return item.export = e;\n });\n this.indeterminate = !e;\n },\n // 将dom转化为图片\n domToImg: function () {\n var _domToImg = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n var _this2 = this;\n\n var processNext;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.len++;\n\n if (!(this.len === this.indexData.length)) {\n _context.next = 6;\n break;\n }\n\n processNext = function processNext(index) {\n if (index < _this2.indexData.length) {\n _this2.getImgUrl(index).then(function () {\n processNext(index + 1);\n });\n } else {\n _this2.load = false;\n }\n };\n\n processNext(0);\n _context.next = 7;\n break;\n\n case 6:\n return _context.abrupt(\"return\");\n\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function domToImg() {\n return _domToImg.apply(this, arguments);\n }\n\n return domToImg;\n }(),\n getImgUrl: function getImgUrl(index) {\n var _this3 = this;\n\n return new Promise(function (resolve) {\n var _html2canvas;\n\n html2canvas(_this3.doms[index], (_html2canvas = {\n allowTaint: true,\n scale: 1,\n backgroundColor: \"#072d62\",\n display: 'black',\n useCORS: true\n }, _defineProperty(_html2canvas, \"allowTaint\", true), _defineProperty(_html2canvas, \"logging\", false), _defineProperty(_html2canvas, \"removeContainer\", true), _defineProperty(_html2canvas, \"width\", 1920), _defineProperty(_html2canvas, \"height\", 935), _defineProperty(_html2canvas, \"onclone\", function onclone(e) {\n var doms = e.querySelectorAll('.index-item');\n doms[index].style.transform = \"none\";\n }), _html2canvas)).then(function (canvas) {\n var dataURL = canvas.toDataURL('image/png');\n _this3.indexData[index].dataURL = dataURL;\n resolve();\n });\n });\n },\n close: function close() {\n this.indexData = [];\n this.len = 0;\n this.doms = null;\n Object.assign(this.$data, this.$options.data());\n this.dialogTableVisible = false;\n },\n downloadImg: function downloadImg() {\n var _this4 = this;\n\n this.downloadLoading = true; // 根据目标宽度和高度将图片进行缩放\n\n function getResizedImageData(image, targetWidth, targetHeight) {\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n canvas.width = targetWidth;\n canvas.height = targetHeight;\n context.drawImage(image, 0, 0, targetWidth, targetHeight);\n return canvas.toDataURL('image/png').split(';base64,')[1];\n }\n\n var data = this.indexData.filter(function (item) {\n return item.export;\n });\n var imgUrl = [];\n var promises = data.map(function (item) {\n var img = new Image();\n img.src = item.dataURL;\n return new Promise(function (resolve) {\n img.onload = function () {\n imgUrl.push({\n name: item.title + '.png',\n url: getResizedImageData(img, 1920, 935)\n });\n resolve();\n };\n });\n });\n Promise.all(promises).then(function () {\n var zip = new JSZip();\n imgUrl.forEach(function (file) {\n zip.file(file.name, file.url, {\n base64: true\n });\n });\n zip.generateAsync({\n type: 'blob'\n }).then(function (content) {\n saveAs(content, '改革报表指标晾晒.zip');\n\n _this4.$message.success('导出文件成功');\n\n _this4.downloadLoading = false;\n });\n });\n }\n }\n};",null]}