feat:新增出入库单查询页面及配置文件修改

This commit is contained in:
zhouz
2026-07-22 08:54:03 +08:00
parent 6380b93774
commit 44dac0a552
56 changed files with 2986 additions and 71 deletions

View File

@@ -0,0 +1,80 @@
import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';
import { requestClient } from '#/api/request';
export namespace WmsIostorInvApi {
/** 出入库单主表信息 */
export interface IostorInv {
iostorinvId: string; // 出入单标识
billCode?: string; // 单据编号
ioType?: string; // 出入类型
billType?: string; // 单据类型
bizDate?: string | Dayjs; // 业务日期
storId: string; // 仓库标识
storCode: string; // 仓库编码
storName: string; // 仓库名称
sourceId: string; // 来源方标识
sourceName: string; // 来源方名称
sourceType: string; // 来源方类型
totalQty?: number; // 总数量
totalWeight: number; // 总重量
detailCount?: number; // 明细数
billStatus?: string; // 单据状态
remark: string; // 备注
createMode?: string; // 生成方式
disOptid: string; // 分配人
disTime?: string | Dayjs; // 分配时间
confirmOptid: string; // 确认人
confirmTime?: string | Dayjs; // 确认时间
sysdeptid: string; // 部门ID
syscompanyid: string; // 公司ID
isUpload?: string; // 是否已上传
uploadOptid: string; // 回传人
uploadTime: string; // 回传时间
}
}
/** 查询出入库单主表分页 */
export function getIostorInvPage(params: PageParam) {
return requestClient.get<PageResult<WmsIostorInvApi.IostorInv>>(
'/wms/iostor-inv/page',
{ params },
);
}
/** 查询出入库单主表详情 */
export function getIostorInv(id: number) {
return requestClient.get<WmsIostorInvApi.IostorInv>(
`/wms/iostor-inv/get?id=${id}`,
);
}
/** 新增出入库单主表 */
export function createIostorInv(data: WmsIostorInvApi.IostorInv) {
return requestClient.post('/wms/iostor-inv/create', data);
}
/** 修改出入库单主表 */
export function updateIostorInv(data: WmsIostorInvApi.IostorInv) {
return requestClient.put('/wms/iostor-inv/update', data);
}
/** 删除出入库单主表 */
export function deleteIostorInv(id: number) {
return requestClient.delete(`/wms/iostor-inv/delete?id=${id}`);
}
/** 批量删除出入库单主表 */
export function deleteIostorInvList(ids: number[]) {
return requestClient.delete(
`/wms/iostor-inv/delete-list?ids=${ids.join(',')}`,
);
}
/** 导出出入库单主表 */
export function exportIostorInv(params: any) {
return requestClient.download('/wms/iostor-inv/export-excel', { params });
}

View File

@@ -0,0 +1,447 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { WmsIostorInvApi } from '#/api/wms/iostorinv';
import { getRangePickerDefaultProps } from '#/utils';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'iostorinvId',
component: 'Input',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
fieldName: 'billCode',
label: '单据编号',
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入单据编号',
},
},
{
fieldName: 'ioType',
label: '出入类型',
rules: 'required',
component: 'Select',
componentProps: {
options: [],
placeholder: '请选择出入类型',
},
},
{
fieldName: 'billType',
label: '单据类型',
rules: 'required',
component: 'Select',
componentProps: {
options: [],
placeholder: '请选择单据类型',
},
},
{
fieldName: 'bizDate',
label: '业务日期',
rules: 'required',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
},
},
{
fieldName: 'storId',
label: '仓库标识',
component: 'Input',
componentProps: {
placeholder: '请输入仓库标识',
},
},
{
fieldName: 'storCode',
label: '仓库编码',
component: 'Input',
componentProps: {
placeholder: '请输入仓库编码',
},
},
{
fieldName: 'storName',
label: '仓库名称',
component: 'Input',
componentProps: {
placeholder: '请输入仓库名称',
},
},
{
fieldName: 'sourceId',
label: '来源方标识',
component: 'Input',
componentProps: {
placeholder: '请输入来源方标识',
},
},
{
fieldName: 'sourceName',
label: '来源方名称',
component: 'Input',
componentProps: {
placeholder: '请输入来源方名称',
},
},
{
fieldName: 'sourceType',
label: '来源方类型',
component: 'Select',
componentProps: {
options: [],
placeholder: '请选择来源方类型',
},
},
{
fieldName: 'totalQty',
label: '总数量',
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入总数量',
},
},
{
fieldName: 'totalWeight',
label: '总重量',
component: 'Input',
componentProps: {
placeholder: '请输入总重量',
},
},
{
fieldName: 'detailCount',
label: '明细数',
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入明细数',
},
},
{
fieldName: 'billStatus',
label: '单据状态',
rules: 'required',
component: 'RadioGroup',
componentProps: {
options: [],
buttonStyle: 'solid',
optionType: 'button',
},
},
{
fieldName: 'remark',
label: '备注',
component: 'Input',
componentProps: {
placeholder: '请输入备注',
},
},
{
fieldName: 'createMode',
label: '生成方式',
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入生成方式',
},
},
{
fieldName: 'disOptid',
label: '分配人',
component: 'Input',
componentProps: {
placeholder: '请输入分配人',
},
},
{
fieldName: 'disTime',
label: '分配时间',
rules: 'required',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
},
},
{
fieldName: 'confirmOptid',
label: '确认人',
component: 'Input',
componentProps: {
placeholder: '请输入确认人',
},
},
{
fieldName: 'confirmTime',
label: '确认时间',
rules: 'required',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
},
},
{
fieldName: 'sysdeptid',
label: '部门ID',
component: 'Input',
componentProps: {
placeholder: '请输入部门ID',
},
},
{
fieldName: 'syscompanyid',
label: '公司ID',
component: 'Input',
componentProps: {
placeholder: '请输入公司ID',
},
},
{
fieldName: 'isUpload',
label: '是否已上传',
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入是否已上传',
},
},
{
fieldName: 'uploadOptid',
label: '回传人',
component: 'Input',
componentProps: {
placeholder: '请输入回传人',
},
},
{
fieldName: 'uploadTime',
label: '回传时间',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
},
},
];
}
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'billCode',
label: '单据编号',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入单据编号',
},
},
{
fieldName: 'billType',
label: '单据类型',
component: 'Select',
componentProps: {
allowClear: true,
options: [],
placeholder: '请选择单据类型',
},
},
{
fieldName: 'bizDate',
label: '业务日期',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},
{
fieldName: 'storId',
label: '仓库标识',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入仓库标识',
},
},
{
fieldName: 'billStatus',
label: '单据状态',
component: 'Select',
componentProps: {
allowClear: true,
options: [],
placeholder: '请选择单据状态',
},
},
{
fieldName: 'createTime',
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},
{
fieldName: 'isUpload',
label: '是否已回传',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入是否已回传',
},
}
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<WmsIostorInvApi.IostorInv>['columns'] {
return [
{ type: 'checkbox', width: 40 },
{
field: 'billCode',
title: '单据编号',
minWidth: 120,
},
{
field: 'billType',
title: '单据类型',
minWidth: 120,
},
{
field: 'bizDate',
title: '业务日期',
minWidth: 120,
formatter: 'formatDateTime',
},
{
field: 'storId',
title: '仓库标识',
minWidth: 120,
},
{
field: 'sourceId',
title: '来源方标识',
minWidth: 120,
},
{
field: 'sourceName',
title: '来源方名称',
minWidth: 120,
},
{
field: 'sourceType',
title: '来源方类型',
minWidth: 120,
},
{
field: 'totalQty',
title: '总数量',
minWidth: 120,
},
{
field: 'totalWeight',
title: '总重量',
minWidth: 120,
},
{
field: 'detailCount',
title: '明细数',
minWidth: 120,
},
{
field: 'billStatus',
title: '单据状态',
minWidth: 120,
},
{
field: 'remark',
title: '备注',
minWidth: 120,
},
{
field: 'createMode',
title: '生成方式',
minWidth: 120,
},
{
field: 'createTime',
title: '创建时间',
minWidth: 120,
formatter: 'formatDateTime',
},
{
field: 'disOptid',
title: '分配人',
minWidth: 120,
},
{
field: 'disTime',
title: '分配时间',
minWidth: 120,
formatter: 'formatDateTime',
},
{
field: 'confirmOptid',
title: '确认人',
minWidth: 120,
},
{
field: 'confirmTime',
title: '确认时间',
minWidth: 120,
formatter: 'formatDateTime',
},
{
field: 'sysdeptid',
title: '部门ID',
minWidth: 120,
},
{
field: 'syscompanyid',
title: '公司ID',
minWidth: 120,
},
{
field: 'isUpload',
title: '是否已上传',
minWidth: 120,
},
{
field: 'uploadOptid',
title: '回传人',
minWidth: 120,
},
{
field: 'uploadTime',
title: '回传时间',
minWidth: 120,
},
{
title: '操作',
width: 200,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@@ -0,0 +1,186 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { WmsIostorInvApi } from '#/api/wms/iostorinv';
import { ref } from 'vue';
import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { message } from 'antdv-next';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteIostorInv,
deleteIostorInvList,
exportIostorInv,
getIostorInvPage,
} from '#/api/wms/iostorinv';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
/** 刷新表格 */
function handleRefresh() {
gridApi.query();
}
/** 创建出入库单主表 */
function handleCreate() {
formModalApi.setData(null).open();
}
/** 编辑出入库单主表 */
function handleEdit(row: WmsIostorInvApi.IostorInv) {
formModalApi.setData(row).open();
}
/** 删除出入库单主表 */
async function handleDelete(row: WmsIostorInvApi.IostorInv) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.iostorinvId]),
duration: 0,
});
try {
await deleteIostorInv(row.iostorinvId!);
message.success($t('ui.actionMessage.deleteSuccess', [row.iostorinvId]));
handleRefresh();
} finally {
hideLoading();
}
}
/** 批量删除出入库单主表 */
async function handleDeleteBatch() {
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
const hideLoading = message.loading({
content: $t('ui.actionMessage.deletingBatch'),
duration: 0,
});
try {
await deleteIostorInvList(checkedIds.value);
checkedIds.value = [];
message.success($t('ui.actionMessage.deleteSuccess'));
handleRefresh();
} finally {
hideLoading();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: WmsIostorInvApi.IostorInv[];
}) {
checkedIds.value = records.map((item) => item.iostorinvId!);
}
/** 导出表格 */
async function handleExport() {
const data = await exportIostorInv(await gridApi.formApi.getValues());
downloadFileFromBlobPart({ fileName: '出入库单主表.xls', source: data });
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
height: 'auto',
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getIostorInvPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'iostorinvId',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<WmsIostorInvApi.IostorInv>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
</script>
<template>
<Page auto-content-height>
<FormModal @success="handleRefresh" />
<Grid table-title="出入库单主表列表">
<template #toolbar-tools>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', ['出入库单主表']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['wms:iostor-inv:create'],
onClick: handleCreate,
},
{
label: $t('ui.actionTitle.export'),
type: 'primary',
icon: ACTION_ICON.DOWNLOAD,
auth: ['wms:iostor-inv:export'],
onClick: handleExport,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'primary',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['wms:iostor-inv:delete'],
disabled: isEmpty(checkedIds),
onClick: handleDeleteBatch,
},
]"
/>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.edit'),
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['wms:iostor-inv:update'],
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['wms:iostor-inv:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.iostorinvId]),
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@@ -0,0 +1,82 @@
<script lang="ts" setup>
import type { WmsIostorInvApi } from '#/api/wms/iostorinv';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'antdv-next';
import { useVbenForm } from '#/adapter/form';
import { createIostorInv, getIostorInv, updateIostorInv } from '#/api/wms/iostorinv';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<WmsIostorInvApi.IostorInv>();
const getTitle = computed(() => {
return formData.value?.iostorinvId
? $t('ui.actionTitle.edit', ['出入库单主表'])
: $t('ui.actionTitle.create', ['出入库单主表']);
});
const [Form, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
},
formItemClass: 'col-span-2',
labelWidth: 80,
},
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
modalApi.lock();
// 提交表单
const data = (await formApi.getValues()) as WmsIostorInvApi.IostorInv;
try {
await (formData.value?.iostorinvId ? updateIostorInv(data) : createIostorInv(data));
// 关闭并提示
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
return;
}
// 加载数据
const data = modalApi.getData<WmsIostorInvApi.IostorInv>();
if (!data || !data.iostorinvId) {
return;
}
modalApi.lock();
try {
formData.value = await getIostorInv(data.iostorinvId);
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
},
});
</script>
<template>
<Modal :title="getTitle">
<Form class="mx-4" />
</Modal>
</template>