feat: 添加导出html的i18n的数据

This commit is contained in:
zhangyu
2022-05-06 10:50:17 +08:00
parent fe8e9a1914
commit 1b444444f6
13 changed files with 75 additions and 35 deletions

View File

@@ -99,12 +99,24 @@ if (arg === 'html') {
inlineSource: '.(js|css)$', // embed all javascript and css inline inlineSource: '.(js|css)$', // embed all javascript and css inline
hash: false, hash: false,
inject: true, inject: true,
minify: { // minify: {
removeComments: true, // removeComments: true,
collapseWhitespace: true, // collapseWhitespace: true,
removeAttributeQuotes: true // removeAttributeQuotes: true
// more options: // // more options:
// https://github.com/kangax/html-minifier#options-quick-reference // // https://github.com/kangax/html-minifier#options-quick-reference
// },
minify: { // 压缩html
collapseWhitespace: true, // 折叠空白区域
keepClosingSlash: true, // 保持闭合间隙
removeComments: true, // 移除注释
removeRedundantAttributes: true, // 删除冗余属性
removeScriptTypeAttributes: true, // 删除Script脚本类型属性
removeStyleLinkTypeAttributes: true, // 删除样式链接类型属性
useShortDoctype: true, // 使用短文档类型
preserveLineBreaks: true, // 保留换行符
minifyCSS: true, // 压缩文内css
minifyJS: true // 压缩文内js
}, },
// necessary to consistently work with multiple chunks via CommonsChunkPlugin // necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency', chunksSortMode: 'dependency',

View File

@@ -20,7 +20,7 @@ module.exports = {
}, },
// Various Dev Server settings // Various Dev Server settings
// host: '0.0.0.0', // can be overwritten by process.env.HOST // host: '0.0.0.0', // can be overwritten by process.env.HOST
host: 'localhost', // can be overwritten by process.env.HOST host: '0.0.0.0', // can be overwritten by process.env.HOST
port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false, autoOpenBrowser: false,
errorOverlay: true, errorOverlay: true,

View File

@@ -32,7 +32,7 @@
{{chartInfo.name}} {{chartInfo.name}}
<span v-show="chartInfo.param.collapse" class="collapse-content">({{chartData ? chartData.length : 0}} charts)</span> <span v-show="chartInfo.param.collapse" class="collapse-content">({{chartData ? chartData.length : 0}} charts)</span>
</div> </div>
<div class="chart-header__tools" v-if="chartInfo.type !== 'endpointInfo' && chartInfo.type !== 'assetInfo'"> <div class="chart-header__tools" v-if="chartInfo.type !== 'endpointInfo' && chartInfo.type !== 'assetInfo' && !isExportHtml">
<span v-if="chartInfo.param.link" class="chart-header__tool" @click="openUrl"> <span v-if="chartInfo.param.link" class="chart-header__tool" @click="openUrl">
<i class="nz-icon nz-icon-more-app tool__icon"></i> <i class="nz-icon nz-icon-more-app tool__icon"></i>
</span> </span>

View File

@@ -22,6 +22,10 @@ export default {
allDataLength: { allDataLength: {
type: Number, type: Number,
default: 0 default: 0
},
isExportHtml: {
type: Boolean,
default: false
} }
}, },
data () { data () {

View File

@@ -108,7 +108,10 @@ export default {
groupInfo: {}, groupInfo: {},
from: String, from: String,
dataList: Array, // 看板中所有图表信息 dataList: Array, // 看板中所有图表信息
isExportHtml: false isExportHtml: {
type: Boolean,
default: false
}
}, },
components: { components: {
GridLayout: GridLayout, GridLayout: GridLayout,
@@ -425,9 +428,9 @@ export default {
window.addEventListener('resize', this.resize) window.addEventListener('resize', this.resize)
} }
if (this.isExportHtml) { if (this.isExportHtml) {
this.$nextTick(() => { setTimeout(()=>{
this.onScroll(999999) this.onScroll(999999)
}) }, 500)
} }
}, },
beforeDestroy () { beforeDestroy () {

View File

@@ -5,6 +5,7 @@
<chart-header <chart-header
v-if="!isFullscreen&&showHeader" v-if="!isFullscreen&&showHeader"
:is-group="isGroup(chartInfo.type)" :is-group="isGroup(chartInfo.type)"
:isExportHtml="isExportHtml"
:isError="isError" :isError="isError"
:chartData="chartData" :chartData="chartData"
:chart-info="chartInfo" :chart-info="chartInfo"

View File

@@ -1,5 +1,4 @@
import bus from '@/libs/bus' import bus from '@/libs/bus'
import { hasButton } from '@/permission'
import i18n from '@/components/common/i18n' import i18n from '@/components/common/i18n'
export default { export default {
methods: { methods: {
@@ -34,9 +33,6 @@ export default {
timeFormate (time) { timeFormate (time) {
return bus.timeFormate(time) return bus.timeFormate(time)
}, },
hasButton (code) {
return hasButton(this.$store.getters.buttonList, code)
},
numberWithEConvent (num) { numberWithEConvent (num) {
if (num) { if (num) {
if ((('' + num).indexOf('E') !== -1) || (('' + num).indexOf('e') !== -1)) { if ((('' + num).indexOf('E') !== -1) || (('' + num).indexOf('e') !== -1)) {

File diff suppressed because one or more lines are too long

View File

@@ -114,7 +114,12 @@ Vue.mixin({
return this.$route.path return this.$route.path
} }
}, },
...mainMixin methods: {
hasButton (code) {
return hasButton(this.$store.getters.buttonList, code)
},
...mainMixin.methods
}
}) })
Vue.config.productionTip = false Vue.config.productionTip = false

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,8 @@
// import '@/assets/stylus/index.scss' // import '@/assets/stylus/index.scss'
// import 'element-ui/lib/theme-chalk/index.css' // import 'element-ui/lib/theme-chalk/index.css'
import 'xterm/dist/xterm.css' // import 'xterm/dist/xterm.css'
import '@/assets/css/main.scss' import '@/assets/css/main.scss'
import '@/assets/css/font/iconfont.js' // import '@/assets/css/font/iconfont.js'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import i18n from '@/components/common/i18n' import i18n from '@/components/common/i18n'
@@ -13,7 +13,7 @@ import App from './App.vue'
import router from '@/router/exportHtmlRouter' import router from '@/router/exportHtmlRouter'
import VueResource from 'vue-resource' import VueResource from 'vue-resource'
import axios from 'axios' import axios from 'axios'
import { hasPermission } from '@/permission' // import { hasPermission } from '@/permission'
import loadsh from 'lodash' import loadsh from 'lodash'
import { post, get, put, del } from '@/http.js' import { post, get, put, del } from '@/http.js'
@@ -91,6 +91,13 @@ Vue.config.productionTip = false
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(Vuex) Vue.use(Vuex)
Vue.use(VueResource) Vue.use(VueResource)
const hasPermission = {
install (Vue, options) {
Vue.directive('has', {
inserted: (el, binding, vnode) => {}
})
}
}
Vue.use(hasPermission) Vue.use(hasPermission)
/* 指令 */ /* 指令 */

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
Vue.use(Router) Vue.use(Router)
console.log('router1')
export default new Router({ export default new Router({
routes: [ routes: [
{ {