update
init
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user