48 lines
1.5 KiB
Vue
48 lines
1.5 KiB
Vue
<template>
|
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="50%" @ok="handleSubmit">
|
|
<BasicForm @register="registerForm" :disabled="onlyRead" />
|
|
</BasicModal>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue';
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import BasicForm from '/@/components/Form/src/BasicForm.vue';
|
|
import { useForm } from '/@/components/Form';
|
|
import { schemas } from '/@/views/archive/healthCabin/healthEquipment/healthEquipment.data';
|
|
const title = ref('新增');
|
|
const isUpdate = ref();
|
|
const onlyRead = ref('false');
|
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
console.log(data);
|
|
await resetFields();
|
|
title.value = data.title;
|
|
isUpdate.value = data.isUpdate;
|
|
onlyRead.value = data.onlyRead;
|
|
});
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
|
labelWidth: 120,
|
|
schemas,
|
|
showActionButtonGroup: false,
|
|
baseColProps: { span: 12 },
|
|
});
|
|
|
|
async function handleSubmit() {
|
|
if (onlyRead.value) {
|
|
closeModal();
|
|
return;
|
|
}
|
|
try {
|
|
let values = await validate();
|
|
setModalProps({ confirmLoading: true });
|
|
console.log(values, 1233333);
|
|
closeModal();
|
|
} finally {
|
|
setModalProps({ confirmLoading: false });
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped></style>
|