feat:载具信息批量新增

This commit is contained in:
2026-07-22 16:36:46 +08:00
parent d9e76de039
commit 586ce7ed40
10 changed files with 213 additions and 20 deletions

View File

@@ -59,6 +59,18 @@ export function deleteStorageVehicleInfoList(ids: number[]) {
);
}
/** 批量生成载具信息 */
export interface BatchCreateStorageVehicleInfoReqVO {
storageVehicleType: string;
storageVehicleTypeLabel: string;
count: number;
}
/** 批量生成载具信息 */
export function batchCreateStorageVehicleInfo(data: BatchCreateStorageVehicleInfoReqVO) {
return requestClient.post<number[]>('/wms/storage-vehicle-info/batch-create', data);
}
/** 导出载具信息 */
export function exportStorageVehicleInfo(params: any) {
return requestClient.download('/wms/storage-vehicle-info/export-excel', { params });

View File

@@ -269,16 +269,16 @@ export function useGridColumns(): VxeTableGridOptions<WmsStorageVehicleInfoApi.S
title: '载具名称',
minWidth: 120,
},
{
field: 'oneCode',
title: '一维码',
minWidth: 120,
},
{
field: 'twoCode',
title: '二维码',
minWidth: 120,
},
// {
// field: 'oneCode',
// title: '一维码',
// minWidth: 120,
// },
// {
// field: 'twoCode',
// title: '二维码',
// minWidth: 120,
// },
{
field: 'isUsed',
title: '是否启用',
@@ -336,22 +336,12 @@ export function useGridColumns(): VxeTableGridOptions<WmsStorageVehicleInfoApi.S
title: '外部标识',
minWidth: 120,
},
{
field: 'creator',
title: '创建者',
minWidth: 120,
},
{
field: 'createTime',
title: '创建时间',
minWidth: 120,
formatter: 'formatDateTime',
},
{
field: 'updater',
title: '更新者',
minWidth: 120,
},
{
field: 'updateTime',
title: '更新时间',

View File

@@ -19,6 +19,7 @@ import {
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import BatchForm from './modules/batch-form.vue';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
@@ -26,6 +27,11 @@ const [FormModal, formModalApi] = useVbenModal({
destroyOnClose: true,
});
const [BatchFormModal, batchFormModalApi] = useVbenModal({
connectedComponent: BatchForm,
destroyOnClose: true,
});
/** 刷新表格 */
function handleRefresh() {
gridApi.query();
@@ -36,6 +42,11 @@ function handleCreate() {
formModalApi.setData(null).open();
}
/** 批量生成载具信息 */
function handleBatchCreate() {
batchFormModalApi.open();
}
/** 编辑载具信息 */
function handleEdit(row: WmsStorageVehicleInfoApi.StorageVehicleInfo) {
formModalApi.setData(row).open();
@@ -127,6 +138,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template>
<Page auto-content-height>
<FormModal @success="handleRefresh" />
<BatchFormModal @success="handleRefresh" />
<Grid table-title="载具信息列表">
<template #toolbar-tools>
<TableAction
@@ -138,6 +150,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
auth: ['wms:storage-vehicle-info:create'],
onClick: handleCreate,
},
{
label: '批量生成',
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['wms:storage-vehicle-info:create'],
onClick: handleBatchCreate,
},
{
label: $t('ui.actionTitle.export'),
type: 'primary',

View File

@@ -0,0 +1,90 @@
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'antdv-next';
import { useVbenForm } from '#/adapter/form';
import { batchCreateStorageVehicleInfo } from '#/api/wms/storagevehicleinfo';
import type { BatchCreateStorageVehicleInfoReqVO } from '#/api/wms/storagevehicleinfo';
import { $t } from '#/locales';
import {getDictOptions} from "@vben/hooks";
import {DICT_TYPE} from "@vben/constants";
const emit = defineEmits(['success']);
const [Form, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
},
formItemClass: 'col-span-2',
labelWidth: 100,
},
layout: 'horizontal',
schema: [
{
fieldName: 'storageVehicleType',
label: '载具类型',
rules: 'required',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.WMS_VEHICLE_TYPE),
placeholder: '请选择载具类型',
},
},
{
fieldName: 'count',
label: '生成数量',
rules: 'required',
component: 'InputNumber',
componentProps: {
class: '!w-full',
min: 1,
placeholder: '请输入生成数量',
},
defaultValue: 1,
},
],
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
modalApi.lock();
try {
const formValues = await formApi.getValues();
// 找到选中类型的 label
const dictOptions = getDictOptions(DICT_TYPE.WMS_VEHICLE_TYPE);
const selected = dictOptions.find((opt) => opt.value === formValues.storageVehicleType);
const data: BatchCreateStorageVehicleInfoReqVO = {
storageVehicleType: formValues.storageVehicleType,
storageVehicleTypeLabel: selected?.label || formValues.storageVehicleType,
count: formValues.count,
};
await batchCreateStorageVehicleInfo(data);
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
return;
}
},
});
</script>
<template>
<Modal title="批量生成载具信息">
<Form class="mx-4" />
</Modal>
</template>