Skip to content

Commit

Permalink
fix: 流程市场嵌入画布支持-遗漏文件提交 TencentBlueKing#7626
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 25854
  • Loading branch information
ywywZhou committed Dec 4, 2024
1 parent e5c54d4 commit 1242200
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions frontend/desktop/src/pages/template/TemplatePreview/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template>
<nodePreview
:preview-data-loading="templateLoading"
:canvas-data="templateData"
:preview-bread="[]">
</nodePreview>
</template>
<script>
import { mapActions } from 'vuex'
import nodePreview from '../../task/NodePreview.vue'
import { formatCanvasData } from '@/utils/checkDataType'
export default {
components: {
nodePreview
},
props: {
project_id: [Number, String],
template_id: [Number, String],
common: [Number, String]
},
data () {
return {
templateLoading: true,
templateData: {
location: [],
line: [],
gateways: {},
constants: []
}
}
},
created () {
this.getTemplateData()
},
methods: {
...mapActions('template/', [
'loadTemplateData'
]),
async getTemplateData () {
try {
this.templateLoading = true
const resp = await this.loadTemplateData({
templateId: this.template_id,
common: this.common
})
const pipelineTree = JSON.parse(resp.pipeline_tree)
this.templateData = formatCanvasData('perview', pipelineTree)
} catch (e) {
console.log(e)
} finally {
this.templateLoading = false
}
}
}
}
</script>

0 comments on commit 1242200

Please sign in to comment.