feat:导出 压缩包
This commit is contained in:
@@ -25,8 +25,8 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
|||||||
clientLogLevel: 'warning',
|
clientLogLevel: 'warning',
|
||||||
historyApiFallback: {
|
historyApiFallback: {
|
||||||
rewrites: [
|
rewrites: [
|
||||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
hot: true,
|
hot: true,
|
||||||
contentBase: false, // since we use CopyWebpackPlugin.
|
contentBase: false, // since we use CopyWebpackPlugin.
|
||||||
@@ -37,12 +37,12 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
|||||||
overlay: config.dev.errorOverlay
|
overlay: config.dev.errorOverlay
|
||||||
? { warnings: false, errors: true }
|
? { warnings: false, errors: true }
|
||||||
: false,
|
: false,
|
||||||
publicPath: "/",
|
publicPath: '/',
|
||||||
/*publicPath: config.dev.assetsPublicPath,*/
|
/* publicPath: config.dev.assetsPublicPath, */
|
||||||
proxy: config.dev.proxyTable,
|
proxy: config.dev.proxyTable,
|
||||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
poll: config.dev.poll,
|
poll: config.dev.poll
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -64,6 +64,11 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
|||||||
from: path.resolve(__dirname, '../static'),
|
from: path.resolve(__dirname, '../static'),
|
||||||
to: config.dev.assetsSubDirectory,
|
to: config.dev.assetsSubDirectory,
|
||||||
ignore: ['.*']
|
ignore: ['.*']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, '../src/components/chart'),
|
||||||
|
to: 'components/chart',
|
||||||
|
ignore: ['.*']
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
@@ -83,11 +88,11 @@ module.exports = new Promise((resolve, reject) => {
|
|||||||
// Add FriendlyErrorsPlugin
|
// Add FriendlyErrorsPlugin
|
||||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
||||||
compilationSuccessInfo: {
|
compilationSuccessInfo: {
|
||||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`]
|
||||||
},
|
},
|
||||||
onErrors: config.dev.notifyOnErrors
|
onErrors: config.dev.notifyOnErrors
|
||||||
? utils.createNotifierCallback()
|
? utils.createNotifierCallback()
|
||||||
: undefined
|
: undefined
|
||||||
}))
|
}))
|
||||||
|
|
||||||
resolve(devWebpackConfig)
|
resolve(devWebpackConfig)
|
||||||
|
|||||||
@@ -13,24 +13,24 @@ const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
|||||||
const fileManagerPlugin = require('filemanager-webpack-plugin')
|
const fileManagerPlugin = require('filemanager-webpack-plugin')
|
||||||
const WebpackZipPlugin = require('webpack-zip-plugin')
|
const WebpackZipPlugin = require('webpack-zip-plugin')
|
||||||
// const GitRevisionPlugin = require('git-revision-webpack-plugin')
|
// const GitRevisionPlugin = require('git-revision-webpack-plugin')
|
||||||
const GenerateAssetPlugin = require('generate-asset-webpack-plugin');
|
const GenerateAssetPlugin = require('generate-asset-webpack-plugin')
|
||||||
const WebpackShellPlugin = require('webpack-shell-plugin');
|
const WebpackShellPlugin = require('webpack-shell-plugin')
|
||||||
|
|
||||||
const serverConfig = require('../static/config.json')//引入根目录下的配置文件
|
const serverConfig = require('../static/config.json')// 引入根目录下的配置文件
|
||||||
|
|
||||||
// const gitRevisionPlugin = new GitRevisionPlugin();
|
// const gitRevisionPlugin = new GitRevisionPlugin();
|
||||||
const createJson = function() {
|
const createJson = function () {
|
||||||
// serverConfig.version=config.build.version +"-"+gitRevisionPlugin.commithash();
|
// serverConfig.version=config.build.version +"-"+gitRevisionPlugin.commithash();
|
||||||
serverConfig.version=config.build.version;
|
serverConfig.version = config.build.version
|
||||||
return JSON.stringify(serverConfig);
|
return JSON.stringify(serverConfig)
|
||||||
};
|
}
|
||||||
|
|
||||||
const env = require('../config/prod.env')
|
const env = require('../config/prod.env')
|
||||||
/*const GenerateAssetPlugin = require('generate-asset-webpack-plugin');
|
/* const GenerateAssetPlugin = require('generate-asset-webpack-plugin');
|
||||||
const createConfig = function(compilation){
|
const createConfig = function(compilation){
|
||||||
let cfgJson={baseUrl:"http://192.168.40.247:8080/nz-admin"};
|
let cfgJson={baseUrl:"http://192.168.40.247:8080/nz-admin"};
|
||||||
return JSON.stringify(cfgJson);
|
return JSON.stringify(cfgJson);
|
||||||
}*/
|
} */
|
||||||
const webpackConfig = merge(baseWebpackConfig, {
|
const webpackConfig = merge(baseWebpackConfig, {
|
||||||
module: {
|
module: {
|
||||||
rules: utils.styleLoaders({
|
rules: utils.styleLoaders({
|
||||||
@@ -46,13 +46,13 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||||||
chunkFilename: utils.assetsPath('js/[name].[chunkhash].js')
|
chunkFilename: utils.assetsPath('js/[name].[chunkhash].js')
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
/*new GenerateAssetPlugin({
|
/* new GenerateAssetPlugin({
|
||||||
filename: 'config.json',
|
filename: 'config.json',
|
||||||
fn: (compilation, cb) => {
|
fn: (compilation, cb) => {
|
||||||
cb(null, createConfig(compilation));
|
cb(null, createConfig(compilation));
|
||||||
},
|
},
|
||||||
extraFiles: []
|
extraFiles: []
|
||||||
}),*/
|
}), */
|
||||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': env
|
'process.env': env
|
||||||
@@ -74,7 +74,7 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||||
allChunks: true,
|
allChunks: true
|
||||||
}),
|
}),
|
||||||
// Compress extracted CSS. We are using this plugin so that possible
|
// Compress extracted CSS. We are using this plugin so that possible
|
||||||
// duplicated CSS from different components can be deduped.
|
// duplicated CSS from different components can be deduped.
|
||||||
@@ -89,7 +89,7 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: config.build.index,
|
filename: config.build.index,
|
||||||
template: 'index.html',
|
template: 'index.html',
|
||||||
hash:false,
|
hash: false,
|
||||||
inject: true,
|
inject: true,
|
||||||
minify: {
|
minify: {
|
||||||
removeComments: true,
|
removeComments: true,
|
||||||
@@ -104,8 +104,8 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||||||
new GenerateAssetPlugin({
|
new GenerateAssetPlugin({
|
||||||
filename: 'static/config.json',
|
filename: 'static/config.json',
|
||||||
fn: (compilation, cb) => {
|
fn: (compilation, cb) => {
|
||||||
cb(null, createJson());
|
cb(null, createJson())
|
||||||
},
|
}
|
||||||
}),
|
}),
|
||||||
// keep module.id stable when vendor modules does not change
|
// keep module.id stable when vendor modules does not change
|
||||||
new webpack.HashedModuleIdsPlugin(),
|
new webpack.HashedModuleIdsPlugin(),
|
||||||
@@ -147,47 +147,52 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||||||
from: path.resolve(__dirname, '../static'),
|
from: path.resolve(__dirname, '../static'),
|
||||||
to: config.build.assetsSubDirectory,
|
to: config.build.assetsSubDirectory,
|
||||||
ignore: ['*']
|
ignore: ['*']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, '../src/components/chart'),
|
||||||
|
to: 'components',
|
||||||
|
ignore: ['.*']
|
||||||
}
|
}
|
||||||
]),
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
if(process.env.NODE_ENV == 'development'){
|
if (process.env.NODE_ENV == 'development') {
|
||||||
webpackConfig.plugins.push(
|
webpackConfig.plugins.push(
|
||||||
new fileManagerPlugin({
|
new fileManagerPlugin({
|
||||||
onStart:[
|
onStart: [
|
||||||
{
|
{
|
||||||
delete:[path.join(__dirname,'../dist/') ]
|
delete: [path.join(__dirname, '../dist/')]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
onEnd: [
|
onEnd: [
|
||||||
{
|
{
|
||||||
move:[
|
move: [
|
||||||
{ source: path.join(__dirname,'../dist','/static/config.json'), destination: path.join(__dirname,'../dist/config.json') },
|
{ source: path.join(__dirname, '../dist', '/static/config.json'), destination: path.join(__dirname, '../dist/config.json') }
|
||||||
|
|
||||||
],
|
],
|
||||||
mkdir:[
|
mkdir: [
|
||||||
path.join(__dirname,'../dist','/static')
|
path.join(__dirname, '../dist', '/static')
|
||||||
],
|
],
|
||||||
copy:[
|
copy: [
|
||||||
{ source: path.join(__dirname,'../dist','/config.json'), destination: path.join(__dirname,'../dist','/static/config.json') }
|
{ source: path.join(__dirname, '../dist', '/config.json'), destination: path.join(__dirname, '../dist', '/static/config.json') }
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
delete:[
|
|
||||||
path.join(__dirname,'../dist','/config.json')
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
archive:[
|
delete: [
|
||||||
{ source: path.join(__dirname,'../dist'), destination: path.join(__dirname,'../dist','/nz-gui.zip') }
|
path.join(__dirname, '../dist', '/config.json')
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
archive: [
|
||||||
|
{ source: path.join(__dirname, '../dist'), destination: path.join(__dirname, '../dist', '/nz-gui.zip') }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}),
|
})
|
||||||
|
|
||||||
)
|
)
|
||||||
}else{
|
} else {
|
||||||
webpackConfig.plugins.push(
|
webpackConfig.plugins.push(
|
||||||
// new WebpackZipPlugin({
|
// new WebpackZipPlugin({
|
||||||
// initialFile: './dist',
|
// initialFile: './dist',
|
||||||
@@ -196,9 +201,9 @@ if(process.env.NODE_ENV == 'development'){
|
|||||||
// behindShell: 'cd '+path.join(__dirname,'../dist/')+";md5=`md5sum nz-gui.zip |awk '{print $1}'|cut -c 1-8`;mv nz-gui.zip nz-gui-${md5}.zip;"+(process.env.BUILD_MODE=='all'?'mkdir -p ./dist/static;echo "start add map picture to zip file,it will take a few moment,please wait...";cp -r ../static/Tiles dist/static/;zip -gr nz-gui-${md5}.zip dist/static/Tiles>/dev/null;rm -rf dist;':'')
|
// behindShell: 'cd '+path.join(__dirname,'../dist/')+";md5=`md5sum nz-gui.zip |awk '{print $1}'|cut -c 1-8`;mv nz-gui.zip nz-gui-${md5}.zip;"+(process.env.BUILD_MODE=='all'?'mkdir -p ./dist/static;echo "start add map picture to zip file,it will take a few moment,please wait...";cp -r ../static/Tiles dist/static/;zip -gr nz-gui-${md5}.zip dist/static/Tiles>/dev/null;rm -rf dist;':'')
|
||||||
// }),
|
// }),
|
||||||
new WebpackShellPlugin({
|
new WebpackShellPlugin({
|
||||||
onBuildStart: ['/bin/bash '+path.join(__dirname,'script')+'/buildStart.sh'],
|
onBuildStart: ['/bin/bash ' + path.join(__dirname, 'script') + '/buildStart.sh'],
|
||||||
onBuildEnd: ['/bin/bash '+path.join(__dirname,'script')+'/buildEnd.sh '+process.env.BUILD_MODE]
|
onBuildEnd: ['/bin/bash ' + path.join(__dirname, 'script') + '/buildEnd.sh ' + process.env.BUILD_MODE]
|
||||||
}),
|
})
|
||||||
// new fileManagerPlugin({
|
// new fileManagerPlugin({
|
||||||
// onStart:[
|
// onStart:[
|
||||||
// {
|
// {
|
||||||
|
|||||||
32
nezha-fronted/package-lock.json
generated
32
nezha-fronted/package-lock.json
generated
@@ -7138,6 +7138,11 @@
|
|||||||
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
|
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"immediate": {
|
||||||
|
"version": "3.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||||
|
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
|
||||||
|
},
|
||||||
"import-cwd": {
|
"import-cwd": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz",
|
||||||
@@ -7802,6 +7807,17 @@
|
|||||||
"verror": "1.10.0"
|
"verror": "1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"jszip": {
|
||||||
|
"version": "3.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.9.1.tgz",
|
||||||
|
"integrity": "sha512-H9A60xPqJ1CuC4Ka6qxzXZeU8aNmgOeP5IFqwJbQQwtu2EUYxota3LdsiZWplF7Wgd9tkAd0mdu36nceSaPuYw==",
|
||||||
|
"requires": {
|
||||||
|
"lie": "~3.3.0",
|
||||||
|
"pako": "~1.0.2",
|
||||||
|
"readable-stream": "~2.3.6",
|
||||||
|
"set-immediate-shim": "~1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"keyv": {
|
"keyv": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz",
|
||||||
@@ -7884,6 +7900,14 @@
|
|||||||
"type-check": "~0.4.0"
|
"type-check": "~0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"lie": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
|
||||||
|
"requires": {
|
||||||
|
"immediate": "~3.0.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"load-json-file": {
|
"load-json-file": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
|
||||||
@@ -9292,8 +9316,7 @@
|
|||||||
"pako": {
|
"pako": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz",
|
||||||
"integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==",
|
"integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"parallel-transform": {
|
"parallel-transform": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
@@ -13012,6 +13035,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
||||||
},
|
},
|
||||||
|
"set-immediate-shim": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E="
|
||||||
|
},
|
||||||
"set-value": {
|
"set-value": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
"file-saver": "^2.0.2",
|
"file-saver": "^2.0.2",
|
||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"jspdf": "^2.5.1",
|
"jspdf": "^2.5.1",
|
||||||
|
"jszip": "^3.9.1",
|
||||||
"leaflet": "^1.7.1",
|
"leaflet": "^1.7.1",
|
||||||
"moment-timezone": "^0.5.33",
|
"moment-timezone": "^0.5.33",
|
||||||
"mqtt": "4.2.6",
|
"mqtt": "4.2.6",
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default {
|
|||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
title: 0,
|
title: 0,
|
||||||
value: 0,
|
value: 0,
|
||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -106,7 +106,8 @@ export default {
|
|||||||
isGroup: Boolean,
|
isGroup: Boolean,
|
||||||
groupInfo: {},
|
groupInfo: {},
|
||||||
from: String,
|
from: String,
|
||||||
dataList: Array // 看板中所有图表信息
|
dataList: Array, // 看板中所有图表信息
|
||||||
|
isExportHtml: false
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
GridLayout: GridLayout,
|
GridLayout: GridLayout,
|
||||||
|
|||||||
2
nezha-fronted/src/components/chart/panelTemp/js/axios.js
Normal file
2
nezha-fronted/src/components/chart/panelTemp/js/axios.js
Normal file
File diff suppressed because one or more lines are too long
95168
nezha-fronted/src/components/chart/panelTemp/js/echarts.js
Normal file
95168
nezha-fronted/src/components/chart/panelTemp/js/echarts.js
Normal file
File diff suppressed because it is too large
Load Diff
386
nezha-fronted/src/components/chart/panelTemp/js/httpVueLoader.js
Normal file
386
nezha-fronted/src/components/chart/panelTemp/js/httpVueLoader.js
Normal file
@@ -0,0 +1,386 @@
|
|||||||
|
(function umd (root, factory) {
|
||||||
|
if (typeof module === 'object' && typeof exports === 'object') { module.exports = factory() } else if (typeof define === 'function' && define.amd) { define([], factory) } else { root.httpVueLoader = factory() }
|
||||||
|
})(this, function factory () {
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
let scopeIndex = 0
|
||||||
|
|
||||||
|
StyleContext.prototype = {
|
||||||
|
|
||||||
|
withBase: function (callback) {
|
||||||
|
let tmpBaseElt
|
||||||
|
if (this.component.baseURI) {
|
||||||
|
// firefox and chrome need the <base> to be set while inserting or modifying <style> in a document.
|
||||||
|
tmpBaseElt = document.createElement('base')
|
||||||
|
tmpBaseElt.href = this.component.baseURI
|
||||||
|
|
||||||
|
const headElt = this.component.getHead()
|
||||||
|
headElt.insertBefore(tmpBaseElt, headElt.firstChild)
|
||||||
|
}
|
||||||
|
|
||||||
|
callback.call(this)
|
||||||
|
|
||||||
|
if (tmpBaseElt) { this.component.getHead().removeChild(tmpBaseElt) }
|
||||||
|
},
|
||||||
|
|
||||||
|
scopeStyles: function (styleElt, scopeName) {
|
||||||
|
function process () {
|
||||||
|
const sheet = styleElt.sheet
|
||||||
|
const rules = sheet.cssRules
|
||||||
|
|
||||||
|
for (let i = 0; i < rules.length; ++i) {
|
||||||
|
const rule = rules[i]
|
||||||
|
if (rule.type !== 1) { continue }
|
||||||
|
|
||||||
|
var scopedSelectors = []
|
||||||
|
|
||||||
|
rule.selectorText.split(/\s*,\s*/).forEach(function (sel) {
|
||||||
|
scopedSelectors.push(scopeName + ' ' + sel)
|
||||||
|
const segments = sel.match(/([^ :]+)(.+)?/)
|
||||||
|
scopedSelectors.push(segments[1] + scopeName + (segments[2] || ''))
|
||||||
|
})
|
||||||
|
|
||||||
|
const scopedRule = scopedSelectors.join(',') + rule.cssText.substr(rule.selectorText.length)
|
||||||
|
sheet.deleteRule(i)
|
||||||
|
sheet.insertRule(scopedRule, i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// firefox may fail sheet.cssRules with InvalidAccessError
|
||||||
|
process()
|
||||||
|
} catch (ex) {
|
||||||
|
if (ex instanceof DOMException && ex.code === DOMException.INVALID_ACCESS_ERR) {
|
||||||
|
styleElt.sheet.disabled = true
|
||||||
|
styleElt.addEventListener('load', function onStyleLoaded () {
|
||||||
|
styleElt.removeEventListener('load', onStyleLoaded)
|
||||||
|
|
||||||
|
// firefox need this timeout otherwise we have to use document.importNode(style, true)
|
||||||
|
setTimeout(function () {
|
||||||
|
process()
|
||||||
|
styleElt.sheet.disabled = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
throw ex
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
compile: function () {
|
||||||
|
const hasTemplate = this.template !== null
|
||||||
|
|
||||||
|
const scoped = this.elt.hasAttribute('scoped')
|
||||||
|
|
||||||
|
if (scoped) {
|
||||||
|
// no template, no scopable style needed
|
||||||
|
if (!hasTemplate) { return }
|
||||||
|
|
||||||
|
// firefox does not tolerate this attribute
|
||||||
|
this.elt.removeAttribute('scoped')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.withBase(function () {
|
||||||
|
this.component.getHead().appendChild(this.elt)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (scoped) { this.scopeStyles(this.elt, '[' + this.component.getScopeId() + ']') }
|
||||||
|
|
||||||
|
return Promise.resolve()
|
||||||
|
},
|
||||||
|
|
||||||
|
getContent: function () {
|
||||||
|
return this.elt.textContent
|
||||||
|
},
|
||||||
|
|
||||||
|
setContent: function (content) {
|
||||||
|
this.withBase(function () {
|
||||||
|
this.elt.textContent = content
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function StyleContext (component, elt) {
|
||||||
|
this.component = component
|
||||||
|
this.elt = elt
|
||||||
|
}
|
||||||
|
|
||||||
|
ScriptContext.prototype = {
|
||||||
|
|
||||||
|
getContent: function () {
|
||||||
|
return this.elt.textContent
|
||||||
|
},
|
||||||
|
|
||||||
|
setContent: function (content) {
|
||||||
|
this.elt.textContent = content
|
||||||
|
},
|
||||||
|
|
||||||
|
compile: function (module) {
|
||||||
|
const childModuleRequire = function (childURL) {
|
||||||
|
return httpVueLoader.require(resolveURL(this.component.baseURI, childURL))
|
||||||
|
}.bind(this)
|
||||||
|
|
||||||
|
const childLoader = function (childURL, childName) {
|
||||||
|
return httpVueLoader(resolveURL(this.component.baseURI, childURL), childName)
|
||||||
|
}.bind(this)
|
||||||
|
|
||||||
|
try {
|
||||||
|
Function('exports', 'require', 'httpVueLoader', 'module', this.getContent()).call(this.module.exports, this.module.exports, childModuleRequire, childLoader, this.module)
|
||||||
|
} catch (ex) {
|
||||||
|
if (!('lineNumber' in ex)) {
|
||||||
|
return Promise.reject(ex)
|
||||||
|
}
|
||||||
|
const vueFileData = responseText.replace(/\r?\n/g, '\n')
|
||||||
|
const lineNumber = vueFileData.substr(0, vueFileData.indexOf(script)).split('\n').length + ex.lineNumber - 1
|
||||||
|
throw new (ex.constructor)(ex.message, url, lineNumber)
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve(this.module.exports)
|
||||||
|
.then(httpVueLoader.scriptExportsHandler.bind(this))
|
||||||
|
.then(function (exports) {
|
||||||
|
this.module.exports = exports
|
||||||
|
}.bind(this))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ScriptContext (component, elt) {
|
||||||
|
this.component = component
|
||||||
|
this.elt = elt
|
||||||
|
this.module = { exports: {} }
|
||||||
|
}
|
||||||
|
|
||||||
|
TemplateContext.prototype = {
|
||||||
|
|
||||||
|
getContent: function () {
|
||||||
|
return this.elt.innerHTML
|
||||||
|
},
|
||||||
|
|
||||||
|
setContent: function (content) {
|
||||||
|
this.elt.innerHTML = content
|
||||||
|
},
|
||||||
|
|
||||||
|
getRootElt: function () {
|
||||||
|
let tplElt = this.elt.content || this.elt
|
||||||
|
|
||||||
|
if ('firstElementChild' in tplElt) { return tplElt.firstElementChild }
|
||||||
|
|
||||||
|
for (tplElt = tplElt.firstChild; tplElt !== null; tplElt = tplElt.nextSibling) {
|
||||||
|
if (tplElt.nodeType === Node.ELEMENT_NODE) { return tplElt }
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
},
|
||||||
|
|
||||||
|
compile: function () {
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function TemplateContext (component, elt) {
|
||||||
|
this.component = component
|
||||||
|
this.elt = elt
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.prototype = {
|
||||||
|
|
||||||
|
getHead: function () {
|
||||||
|
return document.head || document.getElementsByTagName('head')[0]
|
||||||
|
},
|
||||||
|
|
||||||
|
getScopeId: function () {
|
||||||
|
if (this._scopeId === '') {
|
||||||
|
this._scopeId = 'data-s-' + (scopeIndex++).toString(36)
|
||||||
|
this.template.getRootElt().setAttribute(this._scopeId, '')
|
||||||
|
}
|
||||||
|
return this._scopeId
|
||||||
|
},
|
||||||
|
|
||||||
|
load: function (componentURL) {
|
||||||
|
return httpVueLoader.httpRequest(componentURL)
|
||||||
|
.then(function (responseText) {
|
||||||
|
this.baseURI = componentURL.substr(0, componentURL.lastIndexOf('/') + 1)
|
||||||
|
const doc = document.implementation.createHTMLDocument('')
|
||||||
|
|
||||||
|
// IE requires the <base> to come with <style>
|
||||||
|
doc.body.innerHTML = (this.baseURI ? '<base href="' + this.baseURI + '">' : '') + responseText
|
||||||
|
|
||||||
|
for (let it = doc.body.firstChild; it; it = it.nextSibling) {
|
||||||
|
switch (it.nodeName) {
|
||||||
|
case 'TEMPLATE':
|
||||||
|
this.template = new TemplateContext(this, it)
|
||||||
|
break
|
||||||
|
case 'SCRIPT':
|
||||||
|
this.script = new ScriptContext(this, it)
|
||||||
|
break
|
||||||
|
case 'STYLE':
|
||||||
|
this.styles.push(new StyleContext(this, it))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
||||||
|
}.bind(this))
|
||||||
|
},
|
||||||
|
|
||||||
|
_normalizeSection: function (eltCx) {
|
||||||
|
let p
|
||||||
|
|
||||||
|
if (eltCx === null || !eltCx.elt.hasAttribute('src')) {
|
||||||
|
p = Promise.resolve(null)
|
||||||
|
} else {
|
||||||
|
p = httpVueLoader.httpRequest(eltCx.elt.getAttribute('src'))
|
||||||
|
.then(function (content) {
|
||||||
|
eltCx.elt.removeAttribute('src')
|
||||||
|
return content
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return p
|
||||||
|
.then(function (content) {
|
||||||
|
if (eltCx !== null && eltCx.elt.hasAttribute('lang')) {
|
||||||
|
const lang = eltCx.elt.getAttribute('lang')
|
||||||
|
eltCx.elt.removeAttribute('lang')
|
||||||
|
return httpVueLoader.langProcessor[lang.toLowerCase()].call(this, content === null ? eltCx.getContent() : content)
|
||||||
|
}
|
||||||
|
return content
|
||||||
|
}.bind(this))
|
||||||
|
.then(function (content) {
|
||||||
|
if (content !== null) { eltCx.setContent(content) }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
normalize: function () {
|
||||||
|
return Promise.all(Array.prototype.concat(
|
||||||
|
this._normalizeSection(this.template),
|
||||||
|
this._normalizeSection(this.script),
|
||||||
|
this.styles.map(this._normalizeSection)
|
||||||
|
))
|
||||||
|
.then(function () {
|
||||||
|
return this
|
||||||
|
}.bind(this))
|
||||||
|
},
|
||||||
|
|
||||||
|
compile: function () {
|
||||||
|
return Promise.all(Array.prototype.concat(
|
||||||
|
this.template && this.template.compile(),
|
||||||
|
this.script && this.script.compile(),
|
||||||
|
this.styles.map(function (style) { return style.compile() })
|
||||||
|
))
|
||||||
|
.then(function () {
|
||||||
|
return this
|
||||||
|
}.bind(this))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Component (name) {
|
||||||
|
this.name = name
|
||||||
|
this.template = null
|
||||||
|
this.script = null
|
||||||
|
this.styles = []
|
||||||
|
this._scopeId = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function identity (value) {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseComponentURL (url) {
|
||||||
|
const comp = url.match(/(.*?)([^/]+?)\/?(\.vue)?(\?.*|#.*|$)/)
|
||||||
|
return {
|
||||||
|
name: comp[2],
|
||||||
|
url: comp[1] + comp[2] + (comp[3] === undefined ? '/index.vue' : comp[3]) + comp[4]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveURL (baseURL, url) {
|
||||||
|
if (url.substr(0, 2) === './' || url.substr(0, 3) === '../') {
|
||||||
|
return baseURL + url
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
|
httpVueLoader.load = function (url, name) {
|
||||||
|
return function () {
|
||||||
|
return new Component(name).load(url)
|
||||||
|
.then(function (component) {
|
||||||
|
return component.normalize()
|
||||||
|
})
|
||||||
|
.then(function (component) {
|
||||||
|
return component.compile()
|
||||||
|
})
|
||||||
|
.then(function (component) {
|
||||||
|
const exports = component.script !== null ? component.script.module.exports : {}
|
||||||
|
|
||||||
|
if (component.template !== null) { exports.template = component.template.getContent() }
|
||||||
|
|
||||||
|
if (exports.name === undefined) {
|
||||||
|
if (component.name !== undefined) { exports.name = component.name }
|
||||||
|
}
|
||||||
|
|
||||||
|
exports._baseURI = component.baseURI
|
||||||
|
|
||||||
|
return exports
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
httpVueLoader.register = function (Vue, url) {
|
||||||
|
const comp = parseComponentURL(url)
|
||||||
|
Vue.component(comp.name, httpVueLoader.load(comp.url))
|
||||||
|
}
|
||||||
|
|
||||||
|
httpVueLoader.install = function (Vue) {
|
||||||
|
Vue.mixin({
|
||||||
|
|
||||||
|
beforeCreate: function () {
|
||||||
|
const components = this.$options.components
|
||||||
|
|
||||||
|
for (const componentName in components) {
|
||||||
|
if (typeof (components[componentName]) === 'string' && components[componentName].substr(0, 4) === 'url:') {
|
||||||
|
const comp = parseComponentURL(components[componentName].substr(4))
|
||||||
|
|
||||||
|
const componentURL = ('_baseURI' in this.$options) ? resolveURL(this.$options._baseURI, comp.url) : comp.url
|
||||||
|
|
||||||
|
if (isNaN(componentName)) { components[componentName] = httpVueLoader.load(componentURL, componentName) } else { components[componentName] = Vue.component(comp.name, httpVueLoader.load(componentURL, comp.name)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
httpVueLoader.require = function (moduleName) {
|
||||||
|
return window[moduleName]
|
||||||
|
}
|
||||||
|
|
||||||
|
httpVueLoader.httpRequest = function (url) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
const xhr = new XMLHttpRequest()
|
||||||
|
xhr.open('GET', url)
|
||||||
|
xhr.responseType = 'text'
|
||||||
|
|
||||||
|
xhr.onreadystatechange = function () {
|
||||||
|
if (xhr.readyState === 4) {
|
||||||
|
if (xhr.status >= 200 && xhr.status < 300) { resolve(xhr.responseText) } else { reject(xhr.status) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.send(null)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
httpVueLoader.langProcessor = {
|
||||||
|
html: identity,
|
||||||
|
js: identity,
|
||||||
|
css: identity
|
||||||
|
}
|
||||||
|
|
||||||
|
httpVueLoader.scriptExportsHandler = identity
|
||||||
|
|
||||||
|
function httpVueLoader (url, name) {
|
||||||
|
const comp = parseComponentURL(url)
|
||||||
|
return httpVueLoader.load(comp.url, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpVueLoader
|
||||||
|
})
|
||||||
1
nezha-fronted/src/components/chart/panelTemp/js/vue.js
Normal file
1
nezha-fronted/src/components/chart/panelTemp/js/vue.js
Normal file
File diff suppressed because one or more lines are too long
1205
nezha-fronted/src/components/chart/panelTemp/js/vuex.js
Normal file
1205
nezha-fronted/src/components/chart/panelTemp/js/vuex.js
Normal file
File diff suppressed because it is too large
Load Diff
60
nezha-fronted/src/components/chart/panelTemp/jsData.json
Normal file
60
nezha-fronted/src/components/chart/panelTemp/jsData.json
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"data": [
|
||||||
|
"panelTemp/js/vue.js",
|
||||||
|
"panelTemp/js/echarts.js",
|
||||||
|
"panelTemp/js/httpVueLoader.js",
|
||||||
|
"chart.vue",
|
||||||
|
"chartDetail.vue",
|
||||||
|
"chartFormat.js",
|
||||||
|
"chartHeader.vue",
|
||||||
|
"chartHeaderMixin.js",
|
||||||
|
"chartList.vue",
|
||||||
|
"chartMixin.js",
|
||||||
|
"ChartScreenHeader.vue",
|
||||||
|
"defaultLineData.js",
|
||||||
|
"defaultLogData.js",
|
||||||
|
"defaultTableData.js",
|
||||||
|
"logsData.js",
|
||||||
|
"panelChart.vue",
|
||||||
|
"tempGroup.js",
|
||||||
|
"chart/chartAssetInfo.vue",
|
||||||
|
"chart/chartAutotopology.vue",
|
||||||
|
"chart/chartBar.vue",
|
||||||
|
"chart/chartClock.vue",
|
||||||
|
"chart/chartDiagram.vue",
|
||||||
|
"chart/chartEndpointInfo.vue",
|
||||||
|
"chart/chartGauge.vue",
|
||||||
|
"chart/chartGroup.vue",
|
||||||
|
"chart/chartHexagonD3.vue",
|
||||||
|
"chart/chartLog.vue",
|
||||||
|
"chart/chartMap.vue",
|
||||||
|
"chart/chartNoData.vue",
|
||||||
|
"chart/chartPie.vue",
|
||||||
|
"chart/chartStat.vue",
|
||||||
|
"chart/chartTable.vue",
|
||||||
|
"chart/chartText.vue",
|
||||||
|
"chart/chartTimeSeries.vue",
|
||||||
|
"chart/chartTopology.vue",
|
||||||
|
"chart/chartTreemap.vue",
|
||||||
|
"chart/chartUrl.vue",
|
||||||
|
"chart/legend.vue",
|
||||||
|
"chart/tools.js",
|
||||||
|
"chart/grid/aspectRatio.js",
|
||||||
|
"chart/grid/CustomDragElement.vue",
|
||||||
|
"chart/grid/DOM.js",
|
||||||
|
"chart/grid/draggableUtils.js",
|
||||||
|
"chart/grid/GridItem.vue",
|
||||||
|
"chart/grid/GridLayout.vue",
|
||||||
|
"chart/grid/index.js",
|
||||||
|
"chart/grid/responsiveUtils.js",
|
||||||
|
"chart/grid/TestElement.vue",
|
||||||
|
"chart/grid/utils.js",
|
||||||
|
"chart/options/chartBar.js",
|
||||||
|
"chart/options/chartClock.js",
|
||||||
|
"chart/options/chartGauge.js",
|
||||||
|
"chart/options/chartHexagonD3.js",
|
||||||
|
"chart/options/chartPie.js",
|
||||||
|
"chart/options/chartTimeSeries.js",
|
||||||
|
"chart/options/chartTreemap.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
92
nezha-fronted/src/components/common/mixin/exportHtml.js
Normal file
92
nezha-fronted/src/components/common/mixin/exportHtml.js
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import JSZip from 'jszip'
|
||||||
|
import { saveAs } from 'file-saver'
|
||||||
|
import Vue from 'vue'
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
fileName: 'panel'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
exportHtml () {
|
||||||
|
// 创建一个JSZIP实例
|
||||||
|
const zip = new JSZip()
|
||||||
|
// 在zip压缩包中创建一个文件夹,用来放相关依赖
|
||||||
|
const panel = zip.folder('panel')
|
||||||
|
const packages = panel.folder('packages')
|
||||||
|
const fileArr = []
|
||||||
|
let filename = []
|
||||||
|
// 引入含有html字符串的js文件,构造html文件
|
||||||
|
this.returnHtml().then((modules) => {
|
||||||
|
panel.file('index.html', modules)
|
||||||
|
Vue.http.get('components/chart/panelTemp/jsData.json').then((res) => {
|
||||||
|
filename = res.body.data
|
||||||
|
for (const i in res.body.data) {
|
||||||
|
fileArr.push(Vue.http.get(`components/chart/${res.body.data[i]}`))
|
||||||
|
}
|
||||||
|
Promise.all(fileArr).then((contents) => {
|
||||||
|
for (const i in contents) {
|
||||||
|
packages.file(filename[i], contents[i].data)
|
||||||
|
}
|
||||||
|
// console.log(chartList)
|
||||||
|
// packages.file('vue/chartList.vue', chartList)
|
||||||
|
zip.generateAsync({
|
||||||
|
type: 'blob'
|
||||||
|
}).then((content) => {
|
||||||
|
// 此处采用file-saver的saveAs方法和直接创建a标签下载的效果是一样的,只是saveAs写起来更简便写
|
||||||
|
saveAs(content, `${this.fileName}.zip`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
returnHtml (data) {
|
||||||
|
data = [{
|
||||||
|
id: 1
|
||||||
|
}]
|
||||||
|
let str = ''
|
||||||
|
str += `<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Panel</title>
|
||||||
|
</head>
|
||||||
|
<script src="./packages/panelTemp/js/vue.js"></script>
|
||||||
|
<script src="./packages/panelTemp/js/echarts.js"></script>
|
||||||
|
<script src="./packages/panelTemp/js/httpVueLoader.js"></script>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<div>
|
||||||
|
<chartList
|
||||||
|
:data-list="dataList"
|
||||||
|
:isExportHtml="true"
|
||||||
|
></chartList>
|
||||||
|
</div>
|
||||||
|
{{message}}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var app = new Vue({
|
||||||
|
el: '#app',
|
||||||
|
components:{
|
||||||
|
chartList: httpVueLoader('/packages/chartList.vue')
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
message: 'Hello Vue!',
|
||||||
|
dataList: ${JSON.stringify(data)}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
// axios.get('./data.json').then(res=>{
|
||||||
|
// console.log(res)
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
|
`
|
||||||
|
return new Promise(resolve => {
|
||||||
|
resolve(str)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,6 +77,9 @@
|
|||||||
<el-dropdown-item v-has="'main_add'">
|
<el-dropdown-item v-has="'main_add'">
|
||||||
<div id="chart-htmltopdf" @click="htmlToPdf"><i class="nz-icon nz-icon-download1"></i>{{ $t('overall.downloadToPdf') }}</div>
|
<div id="chart-htmltopdf" @click="htmlToPdf"><i class="nz-icon nz-icon-download1"></i>{{ $t('overall.downloadToPdf') }}</div>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item v-has="'main_add'">
|
||||||
|
<div id="chart-export-html" @click="exportHtml"><i class="nz-icon nz-icon-download1"></i>{{ $t('overall.downloadToPdf') }}</div>
|
||||||
|
</el-dropdown-item>
|
||||||
</template>
|
</template>
|
||||||
</top-tool-more-options>
|
</top-tool-more-options>
|
||||||
</div>
|
</div>
|
||||||
@@ -163,11 +166,12 @@ import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
|
|||||||
import { lineChartMove } from '@/components/common/js/common'
|
import { lineChartMove } from '@/components/common/js/common'
|
||||||
import routerPathParams from '@/components/common/mixin/routerPathParams'
|
import routerPathParams from '@/components/common/mixin/routerPathParams'
|
||||||
import htmlToPdfMixin from '@/components/common/mixin/htmlToPdfMixin'
|
import htmlToPdfMixin from '@/components/common/mixin/htmlToPdfMixin'
|
||||||
|
import exportHtmlMixin from '@/components/common/mixin/exportHtml'
|
||||||
// import chartData from './testData'
|
// import chartData from './testData'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'panel',
|
name: 'panel',
|
||||||
mixins: [routerPathParams, htmlToPdfMixin],
|
mixins: [routerPathParams, htmlToPdfMixin, exportHtmlMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
fromRoute,
|
fromRoute,
|
||||||
@@ -832,7 +836,7 @@ export default {
|
|||||||
this.panelReloadOnlyPanel()
|
this.panelReloadOnlyPanel()
|
||||||
},
|
},
|
||||||
htmlToPdf () {
|
htmlToPdf () {
|
||||||
let dom = document.getElementsByClassName(this.pdfId)[0]
|
const dom = document.getElementsByClassName(this.pdfId)[0]
|
||||||
if (dom) {
|
if (dom) {
|
||||||
// dom = dom.getElementsByClassName('vue-grid-layout')[0]
|
// dom = dom.getElementsByClassName('vue-grid-layout')[0]
|
||||||
this.scrollbarWrap.scrollTop = this.scrollbarWrap.scrollHeight
|
this.scrollbarWrap.scrollTop = this.scrollbarWrap.scrollHeight
|
||||||
|
|||||||
Reference in New Issue
Block a user