Preview.vue
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<template>
<transition name="el-zoom-in-center">
<div class="NCC-preview-main flow-form-main">
<div class="NCC-common-page-header">
<el-page-header @back="goBack" :content="'表单预览【'+setting.fullName+'】'" />
<div class="options">
<el-button @click="goBack()">{{$t('common.cancelButton')}}</el-button>
</div>
</div>
<div class="main">
<component :is="currentView" @close="goBack" ref="form"></component>
</div>
</div>
</transition>
</template>
<script>
import { FlowEngineInfo } from '@/api/workFlow/FlowEngine'
export default {
data() {
return {
currentView: '',
setting: {}
}
},
methods: {
goBack(isRefresh) {
this.$emit('close', isRefresh)
},
init(data) {
this.setting = data
FlowEngineInfo(data.flowId).then(res => {
if (!res.data || !res.data.formData) return
data.formConf = res.data.formData
data.type = res.data.type
if (data.formType == 1) {
if (res.data.formUrl) {
this.currentView = (resolve) => require([`@/views/${res.data.formUrl}`], resolve)
} else {
this.currentView = (resolve) => require([`@/views/workFlow/workFlowForm/${data.enCode}`], resolve)
}
} else {
this.currentView = (resolve) => require([`@/views/workFlow/workFlowForm/dynamicForm`], resolve)
}
setTimeout(() => {
this.$nextTick(() => {
this.$refs.form && this.$refs.form.init(data)
})
}, 300)
})
},
}
}
</script>