fix: 使用标准弹窗维护日计划
This commit is contained in:
@@ -16,7 +16,7 @@ import StartOrder from './modules/start-order.vue';
|
||||
const SOURCE_MANUAL = 2;
|
||||
const ORDER_NOT_STARTED = 0;
|
||||
|
||||
const [FormDrawer, formDrawerApi] = useVbenDrawer({
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
@@ -38,11 +38,11 @@ function handleRefresh() {
|
||||
}
|
||||
|
||||
function handleCreate() {
|
||||
formDrawerApi.setData({ isUpdate: false }).open();
|
||||
formModalApi.setData({ isUpdate: false }).open();
|
||||
}
|
||||
|
||||
function handleEdit(row: LmsDailyPlanApi.DailyPlan) {
|
||||
formDrawerApi.setData({ isUpdate: true, row }).open();
|
||||
formModalApi.setData({ isUpdate: true, row }).open();
|
||||
}
|
||||
|
||||
function handleDetail(row: LmsDailyPlanApi.DailyPlan) {
|
||||
@@ -88,7 +88,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<FormDrawer @success="handleRefresh" />
|
||||
<FormModal @success="handleRefresh" />
|
||||
<DetailDrawer />
|
||||
<StartOrderModal @success="handleRefresh" />
|
||||
<OperationModal @success="handleRefresh" />
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { LmsDailyPlanApi } from '#/api/lms/dailyplan';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer, useVbenModal } from '@vben/common-ui';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'antdv-next';
|
||||
|
||||
@@ -66,11 +66,11 @@ const [Form, formApi] = useVbenForm({
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Drawer, drawerApi] = useVbenDrawer({
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
drawerApi.lock();
|
||||
modalApi.lock();
|
||||
try {
|
||||
const values = await formApi.getValues();
|
||||
if (formData.value) {
|
||||
@@ -78,18 +78,18 @@ const [Drawer, drawerApi] = useVbenDrawer({
|
||||
} else {
|
||||
await createDailyPlan(values as LmsDailyPlanApi.CreateReq);
|
||||
}
|
||||
await drawerApi.close();
|
||||
await modalApi.close();
|
||||
message.success('操作成功');
|
||||
emit('success');
|
||||
} finally {
|
||||
drawerApi.unlock();
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
return;
|
||||
}
|
||||
const data = drawerApi.getData<DrawerData>();
|
||||
const data = modalApi.getData<DrawerData>();
|
||||
isUpdate.value = Boolean(data?.isUpdate);
|
||||
await formApi.resetForm();
|
||||
if (!data?.row) {
|
||||
@@ -104,8 +104,8 @@ const [Drawer, drawerApi] = useVbenDrawer({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Drawer :title="title" class="w-[720px]">
|
||||
<Modal :title="title" class="w-[720px]">
|
||||
<Form class="mx-4" />
|
||||
<MaterialSelectModal @select="handleMaterialSelect" />
|
||||
</Drawer>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user