31 lines
792 B
Plaintext
Raw Permalink Normal View History

2022-12-05 23:01:12 +08:00
<template>
<el-form :model="formData" label-width="120px" ref="form" v-loading="loading" class="pr-4">
{formItems}
<div class="flex justify-end">
<el-button type="primary" @click="submitForm(form)">{{ $t('system.confirm') }}</el-button>
</div>
</el-form>
</template>
<script lang="ts" setup>
2024-07-06 14:54:32 +08:00
import { useCreate } from '@/composables/curd/useCreate'
import { useShow } from '@/composables/curd/useShow'
2022-12-07 19:28:57 +08:00
import { onMounted } from 'vue'
2022-12-05 23:01:12 +08:00
const props = defineProps({
2024-04-26 09:20:34 +08:00
primary: [String, Number],
2022-12-05 23:01:12 +08:00
api: String,
})
2022-12-07 19:28:57 +08:00
const { formData, form, loading, submitForm, close } = useCreate(props.api, props.primary)
2022-12-05 23:01:12 +08:00
2022-12-07 19:28:57 +08:00
if (props.primary) {
useShow(props.api, props.primary, formData)
}
2022-12-05 23:01:12 +08:00
2022-12-07 19:28:57 +08:00
const emit = defineEmits(['close'])
2022-12-05 23:01:12 +08:00
onMounted(() => {
2022-12-07 19:28:57 +08:00
close(() => emit('close'))
2022-12-05 23:01:12 +08:00
})
</script>