|
|
@@ -1,67 +1,75 @@
|
|
|
<template>
|
|
|
- <data-template-render-preview
|
|
|
- :visible="dialogVisible"
|
|
|
- :data="dataTemplate"
|
|
|
- :dynamic-params="dynamicParams"
|
|
|
- @close="handleClose"
|
|
|
- @action-event="handleActionEvent"
|
|
|
- />
|
|
|
+ <data-template-render-preview
|
|
|
+ :visible="dialogVisible"
|
|
|
+ :data="dataTemplate"
|
|
|
+ :dynamic-params="dynamicParams"
|
|
|
+ @close="handleClose"
|
|
|
+ @action-event="handleActionEvent"
|
|
|
+ />
|
|
|
</template>
|
|
|
<script>
|
|
|
import { getByKey } from '@/api/platform/data/dataTemplate'
|
|
|
import DataTemplateRenderPreview from './index'
|
|
|
export default {
|
|
|
- components: {
|
|
|
- DataTemplateRenderPreview
|
|
|
- },
|
|
|
- props: {
|
|
|
- visible: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
+ components: {
|
|
|
+ DataTemplateRenderPreview
|
|
|
},
|
|
|
- templateKey: {
|
|
|
- type: String
|
|
|
+ props: {
|
|
|
+ visible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ templateKey: {
|
|
|
+ type: String
|
|
|
+ },
|
|
|
+ dynamicParams: {
|
|
|
+ type: Object
|
|
|
+ },
|
|
|
+ previousDataTemplate: {
|
|
|
+ type: Object
|
|
|
+ }
|
|
|
},
|
|
|
- dynamicParams: {
|
|
|
- type: Object
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- dialogVisible: false,
|
|
|
- dataTemplate: {}
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- visible: {
|
|
|
- handler: function(val, oldVal) {
|
|
|
- if (val) {
|
|
|
- this.loadData()
|
|
|
- } else {
|
|
|
- this.dataTemplate = {}
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ dialogVisible: false,
|
|
|
+ dataTemplate: {}
|
|
|
}
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- loadData() {
|
|
|
- this.dataTemplate = {}
|
|
|
- getByKey({
|
|
|
- dataTemplateKey: this.templateKey
|
|
|
- }).then(response => {
|
|
|
- // 从后台获取数据
|
|
|
- this.dataTemplate = this.$utils.parseData(response.data)
|
|
|
- this.dialogVisible = true
|
|
|
- }).catch(() => {
|
|
|
- })
|
|
|
},
|
|
|
- handleClose(visible) {
|
|
|
- this.$emit('close', visible)
|
|
|
+ watch: {
|
|
|
+ visible: {
|
|
|
+ handler: function (val, oldVal) {
|
|
|
+ if (val) {
|
|
|
+ this.loadData()
|
|
|
+ } else {
|
|
|
+ this.dataTemplate = {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
},
|
|
|
- handleActionEvent(key, data) {
|
|
|
- this.$emit('action-event', key, data)
|
|
|
+ methods: {
|
|
|
+ loadData () {
|
|
|
+ this.dataTemplate = {}
|
|
|
+ getByKey({
|
|
|
+ dataTemplateKey: this.templateKey
|
|
|
+ }).then(response => {
|
|
|
+ console.log('53 response', response)
|
|
|
+
|
|
|
+ // 从后台获取数据
|
|
|
+ this.dataTemplate = this.$utils.parseData(response.data)
|
|
|
+ this.dialogVisible = true
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleClose (visible) {
|
|
|
+ console.log('62 visible', visible)
|
|
|
+ console.log('62 vithis.previousDataTemplatesible', this.previousDataTemplate)
|
|
|
+
|
|
|
+ this.$emit('close', visible, this.previousDataTemplate)
|
|
|
+ },
|
|
|
+ handleActionEvent (key, data) {
|
|
|
+ this.$emit('action-event', key, data)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
</script>
|