12 changed files with 255 additions and 13 deletions
@ -0,0 +1,41 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" title="表单详情" @ok="handleSubmit"> |
||||||
|
<VFormCreate :form-config="formConfig" /> |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
<script lang="ts" setup> |
||||||
|
import { ref } from 'vue' |
||||||
|
import { useI18n } from '@/hooks/web/useI18n' |
||||||
|
import { useMessage } from '@/hooks/web/useMessage' |
||||||
|
import { VFormCreate } from '@/components/FormDesign' |
||||||
|
import { BasicModal, useModalInner } from '@/components/Modal' |
||||||
|
import { getForm } from '@/api/bpm/form' |
||||||
|
|
||||||
|
defineOptions({ name: 'BpmFormModal' }) |
||||||
|
|
||||||
|
const { t } = useI18n() |
||||||
|
const { createMessage } = useMessage() |
||||||
|
const emit = defineEmits(['success', 'register']) |
||||||
|
const formConfig = ref({ |
||||||
|
schemas: [], |
||||||
|
rule: [], |
||||||
|
option: {} |
||||||
|
}) |
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { |
||||||
|
setModalProps({ confirmLoading: false }) |
||||||
|
const res = await getForm(data.record.id) |
||||||
|
formConfig.value.schemas = res.fields |
||||||
|
formConfig.value.option = res.conf |
||||||
|
}) |
||||||
|
|
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
closeModal() |
||||||
|
emit('success') |
||||||
|
createMessage.success(t('common.saveSuccessText')) |
||||||
|
} finally { |
||||||
|
setModalProps({ confirmLoading: false }) |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,8 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<VFormDesign /> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
<script lang="ts" setup> |
||||||
|
import { VFormDesign } from '@/components/FormDesign' |
||||||
|
</script> |
@ -0,0 +1 @@ |
|||||||
|
<template>123</template> |
Loading…
Reference in new issue