Merge branch 'dev-3.2' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.3
# Conflicts: # nezha-fronted/src/components/common/js/htmlToPdf.js
This commit is contained in:
2070
nezha-fronted/package-lock.json
generated
2070
nezha-fronted/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@johmun/vue-tags-input": "^2.1.0",
|
"@johmun/vue-tags-input": "^2.1.0",
|
||||||
"@riophae/vue-treeselect": "^0.4.0",
|
"@riophae/vue-treeselect": "^0.4.0",
|
||||||
"@svgdotjs/svg.js": "^3.0.16",
|
"@svgdotjs/svg.js": "3.0.16",
|
||||||
"@svgdotjs/svg.panzoom.js": "^2.1.1",
|
"@svgdotjs/svg.panzoom.js": "2.1.1",
|
||||||
"@topology/activity-diagram": "^0.3.0",
|
"@topology/activity-diagram": "^0.3.0",
|
||||||
"@topology/chart-diagram": "^0.3.0",
|
"@topology/chart-diagram": "^0.3.0",
|
||||||
"@topology/class-diagram": "^0.3.0",
|
"@topology/class-diagram": "^0.3.0",
|
||||||
|
|||||||
@@ -41,6 +41,9 @@
|
|||||||
<el-dropdown-item v-has="'main_edit'">
|
<el-dropdown-item v-has="'main_edit'">
|
||||||
<div id="chart-temp-sync" @click="chartBySync"><i class="nz-icon nz-icon-sync"></i>{{ $t('overall.syncChart') }}</div>
|
<div id="chart-temp-sync" @click="chartBySync"><i class="nz-icon nz-icon-sync"></i>{{ $t('overall.syncChart') }}</div>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item v-has="'main_edit'">
|
||||||
|
<div id="chart-htmltopdf" @click="htmlToPdf"><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>
|
||||||
@@ -72,6 +75,9 @@
|
|||||||
<el-dropdown-item v-has="'main_edit'">
|
<el-dropdown-item v-has="'main_edit'">
|
||||||
<div id="chart-temp-sync" @click="chartBySync"><i class="nz-icon nz-icon-sync"></i>{{ $t('overall.syncChart') }}</div>
|
<div id="chart-temp-sync" @click="chartBySync"><i class="nz-icon nz-icon-sync"></i>{{ $t('overall.syncChart') }}</div>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item v-has="'main_edit'">
|
||||||
|
<div id="chart-htmltopdf" @click="htmlToPdf"><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>
|
||||||
@@ -146,9 +152,10 @@ import chartTempBox from '@/components/common/rightBox/chartTempBox'
|
|||||||
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
||||||
import detailViewRightMixin from '@/components/common/mixin/detailViewRightMixin'
|
import detailViewRightMixin from '@/components/common/mixin/detailViewRightMixin'
|
||||||
import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
|
import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
|
||||||
|
import htmlToPdfMixin from '@/components/common/mixin/htmlToPdfMixin'
|
||||||
export default {
|
export default {
|
||||||
name: 'panelTabNew',
|
name: 'panelTabNew',
|
||||||
mixins: [subDataListMixin, detailViewRightMixin],
|
mixins: [subDataListMixin, detailViewRightMixin, htmlToPdfMixin],
|
||||||
props: {
|
props: {
|
||||||
from: String,
|
from: String,
|
||||||
obj: Object,
|
obj: Object,
|
||||||
@@ -172,6 +179,7 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
fromRoute,
|
fromRoute,
|
||||||
|
pdfId: 'pdfDom',
|
||||||
panelTabLoading: false,
|
panelTabLoading: false,
|
||||||
showTopBtn: false, // top按钮
|
showTopBtn: false, // top按钮
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -724,6 +732,42 @@ export default {
|
|||||||
if (type === 'duplicate') {
|
if (type === 'duplicate') {
|
||||||
this.editChart(chartInfo, true)
|
this.editChart(chartInfo, true)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
htmlToPdf () {
|
||||||
|
const dom = document.getElementsByClassName(this.pdfId)[0]
|
||||||
|
if (dom) {
|
||||||
|
// dom = dom.getElementsByClassName('vue-grid-layout')[0]
|
||||||
|
this.scrollbarWrap.scrollTop = this.scrollbarWrap.scrollHeight
|
||||||
|
this.$refs.chartList.onScroll(this.scrollbarWrap.scrollTop)
|
||||||
|
let flag = true
|
||||||
|
this.showScreenLoading(true)
|
||||||
|
let timer = setInterval(() => {
|
||||||
|
flag = true
|
||||||
|
this.$refs.chartList.copyDataList.forEach(chart => {
|
||||||
|
if (chart.type !== 'group') {
|
||||||
|
flag = flag && chart.loaded
|
||||||
|
} else if (chart.collapse) {
|
||||||
|
chart.children.forEach(groupChart => {
|
||||||
|
flag = flag && groupChart.loaded
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (flag) {
|
||||||
|
clearInterval(timer)
|
||||||
|
timer = null
|
||||||
|
setTimeout(() => {
|
||||||
|
document.body.style.height = 'auto'
|
||||||
|
// document.getElementsByTagName('html')[0].style.overflow = 'visible'
|
||||||
|
const position = dom.getBoundingClientRect()
|
||||||
|
console.log(position)
|
||||||
|
this.getPdf(dom, -1 * position.left, -1 * position.top)
|
||||||
|
// this.getPdf(dom, 0, 0)
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
} else {
|
||||||
|
this.showScreenLoading(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
Reference in New Issue
Block a user