fix: 完善日计划开始确认与取消入口
This commit is contained in:
@@ -84,6 +84,7 @@ export namespace LmsDailyPlanApi {
|
||||
|
||||
export interface StartReq extends VersionReq {
|
||||
appendQty: number;
|
||||
planQty: number;
|
||||
}
|
||||
|
||||
export interface AppendReq extends VersionReq {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getDailyPlanManagementPage } from '#/api/lms/dailyplan';
|
||||
|
||||
import Operation from '../work/modules/operation.vue';
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Detail from './modules/detail.vue';
|
||||
import Form from './modules/form.vue';
|
||||
@@ -27,6 +28,10 @@ const [StartOrderModal, startOrderModalApi] = useVbenModal({
|
||||
connectedComponent: StartOrder,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
const [OperationModal, operationModalApi] = useVbenModal({
|
||||
connectedComponent: Operation,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
@@ -48,6 +53,10 @@ function handleStart(row: LmsDailyPlanApi.DailyPlan) {
|
||||
startOrderModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
function handleCancel(row: LmsDailyPlanApi.DailyPlan) {
|
||||
operationModalApi.setData({ row, type: 'cancelOrder' }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
@@ -82,6 +91,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<FormDrawer @success="handleRefresh" />
|
||||
<DetailDrawer />
|
||||
<StartOrderModal @success="handleRefresh" />
|
||||
<OperationModal @success="handleRefresh" />
|
||||
<Grid table-title="日计划管理">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
@@ -126,6 +136,14 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
ifShow: row.orderStatus === ORDER_NOT_STARTED,
|
||||
onClick: handleStart.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: '取消订单',
|
||||
type: 'link',
|
||||
danger: true,
|
||||
auth: ['lms:daily-plan:operate'],
|
||||
ifShow: row.orderStatus === ORDER_NOT_STARTED,
|
||||
onClick: handleCancel.bind(null, row),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -11,12 +11,17 @@ import { startDailyPlanOrder } from '#/api/lms/dailyplan';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const row = ref<LmsDailyPlanApi.DailyPlan>();
|
||||
const planQty = ref(1);
|
||||
const appendQty = ref(0);
|
||||
const totalAfterStart = computed(() => (row.value?.totalQty ?? 0) + appendQty.value);
|
||||
const totalAfterStart = computed(() => planQty.value + (row.value?.appendQty ?? 0) + appendQty.value);
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
if (!row.value) return;
|
||||
if (!Number.isInteger(planQty.value) || planQty.value <= 0) {
|
||||
message.warning('确认计划数量必须为正整数');
|
||||
return;
|
||||
}
|
||||
if (!Number.isInteger(appendQty.value) || appendQty.value < 0) {
|
||||
message.warning('追加数量必须为不小于 0 的整数');
|
||||
return;
|
||||
@@ -26,6 +31,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
await startDailyPlanOrder({
|
||||
id: row.value.dailyPlanId,
|
||||
version: row.value.version,
|
||||
planQty: planQty.value,
|
||||
appendQty: appendQty.value,
|
||||
});
|
||||
await modalApi.close();
|
||||
@@ -38,10 +44,12 @@ const [Modal, modalApi] = useVbenModal({
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
row.value = undefined;
|
||||
planQty.value = 1;
|
||||
appendQty.value = 0;
|
||||
return;
|
||||
}
|
||||
row.value = modalApi.getData<LmsDailyPlanApi.DailyPlan>();
|
||||
planQty.value = row.value.planQty;
|
||||
appendQty.value = 0;
|
||||
},
|
||||
});
|
||||
@@ -52,7 +60,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<Descriptions v-if="row" bordered :column="1" size="small">
|
||||
<DescriptionsItem label="日计划编号">{{ row.planCode }}</DescriptionsItem>
|
||||
<DescriptionsItem label="管芯">{{ row.materialCode }} / {{ row.materialName }}</DescriptionsItem>
|
||||
<DescriptionsItem label="当前计划数量">{{ row.planQty }}</DescriptionsItem>
|
||||
<DescriptionsItem label="原计划数量">{{ row.planQty }}</DescriptionsItem>
|
||||
<DescriptionsItem label="确认计划数量">
|
||||
<InputNumber v-model:value="planQty" :min="1" :precision="0" class="w-full" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="已有追加数量">{{ row.appendQty }}</DescriptionsItem>
|
||||
<DescriptionsItem label="本次追加数量">
|
||||
<InputNumber v-model:value="appendQty" :min="0" :precision="0" class="w-full" />
|
||||
|
||||
Reference in New Issue
Block a user