2024-05-06 13:57:06 +08:00
|
|
|
<template>
|
|
|
|
|
<a-modal
|
|
|
|
|
title="预览"
|
|
|
|
|
:width="700"
|
|
|
|
|
:visible="visible"
|
|
|
|
|
:destroy-on-close="true"
|
|
|
|
|
:footer-style="{ textAlign: 'right' }"
|
|
|
|
|
:mask="false"
|
|
|
|
|
:confirmLoading="confirmLoading"
|
|
|
|
|
@ok="onSubmit"
|
|
|
|
|
@cancel="onClose"
|
|
|
|
|
>
|
|
|
|
|
<component ref="customFormRef" :is="customFormsLayouts" />
|
|
|
|
|
</a-modal>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="previewCustomForm">
|
|
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
import { loadComponent } from '../../customForm'
|
2024-05-06 14:59:37 +08:00
|
|
|
import { ref } from 'vue'
|
2024-05-06 13:57:06 +08:00
|
|
|
const visible = ref(false)
|
|
|
|
|
const confirmLoading = ref(false)
|
|
|
|
|
const customFormRef = ref()
|
|
|
|
|
const customFormsLayouts = ref()
|
|
|
|
|
const onOpen = (url) => {
|
|
|
|
|
if (url) {
|
|
|
|
|
visible.value = true
|
|
|
|
|
customFormsLayouts.value = loadComponent(url)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const onSubmit = () => {
|
|
|
|
|
customFormRef.value.getData().then((value) => {
|
|
|
|
|
message.info(JSON.stringify(value))
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const onClose = () => {
|
|
|
|
|
visible.value = false
|
|
|
|
|
}
|
|
|
|
|
defineExpose({
|
|
|
|
|
onOpen
|
|
|
|
|
})
|
|
|
|
|
</script>
|