forked from TencentBlueKing/bk-sops
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 流程市场嵌入画布支持-遗漏文件提交 TencentBlueKing#7626
# Reviewed, transaction id: 25854
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
frontend/desktop/src/pages/template/TemplatePreview/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |