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