31 lines
822 B
Plaintext
Raw 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>
import { useCreate } from '/admin/composables/curd/useCreate'
import { useShow } from '/admin/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 11:33:20 +08:00
primary: [String, Number],
2022-12-05 23:01:12 +08:00
api: String,
})
2024-04-29 08:49:29 +08:00
const { formData, form, loading, submitForm, close } = useCreate(props.api as string, props.primary)
2022-12-05 23:01:12 +08:00
2022-12-07 19:28:57 +08:00
if (props.primary) {
2024-04-29 08:49:29 +08:00
useShow(props.api as string, props.primary, formData)
2022-12-07 19:28:57 +08:00
}
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>