!205 feat(@vben/web-antd): erp 模块除去收款单和付款单功能基本完成
* fix(@vben/web-antd): erp 解决冲突 * fix(@vben/web-antd): erp 更新采购和销售退货表单,修复关联订单选择功能不统一详细可编辑的问题,统一文件名称格式 * feat(@vben/web-antd): erp-finance-account 新增结算账户管理功能,包括表单、列表及相关操作 * feat(@vben/web-antd): erp-sale-return 新增销售退货管理功能,包括退货列表、表单及相关操作 * feat(@vben/web-antd): erp-sale-out 新增销售出库管理功能,包括出库列表、表单及相关操作 * feat(@vben/web-antd): erp-sale-order 新增销售订单管理功能,包括订单列表、表单及相关操作 * feat(@vben/web-antd): erp-sale-customer 新增客户管理功能,包括客户表单、列表及相关操作 * feat(@vben/web-antd): erp-purchase-return 新增采购退货管理功能,包括表单、列表及相关操作 * feat(@vben/web-antd): erp-purchase-in 新增采购入库管理功能,包括表单、列表及相关操作 * feat(@vben/web-antd): erp-stock-check 新增库存盘点单管理功能,包括表单、列表及相关操作 * feat(@vben/web-antd): erp-stock-move 新增库存调拨单管理功能,包括表单、列表及相关操作 * feat(@vben/web-antd): erp-stock-out 新增其它出库单管理功能,包括表单、列表及相关操作 * fix(@vben/web-antd): erp-stock-in 修复提交表单时清空产品项 ID,确保请求成功不报row_xxx报错
This commit is contained in:
@@ -1,34 +1,232 @@
|
||||
<script lang="ts" setup>
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpPurchaseInApi } from '#/api/erp/purchase/in';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deletePurchaseIn,
|
||||
exportPurchaseIn,
|
||||
getPurchaseInPage,
|
||||
updatePurchaseInStatus,
|
||||
} from '#/api/erp/purchase/in';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import PurchaseInForm from './modules/purchase-in-form.vue';
|
||||
|
||||
/** ERP 采购入库列表 */
|
||||
defineOptions({ name: 'ErpPurchaseIn' });
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: PurchaseInForm,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
const checkedIds = ref<number[]>([]);
|
||||
|
||||
/** 详情 */
|
||||
function handleDetail(row: ErpPurchaseInApi.PurchaseIn) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 新增 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: ErpPurchaseInApi.PurchaseIn) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
async function handleDelete(ids: number[]) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting'),
|
||||
duration: 0,
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
try {
|
||||
await deletePurchaseIn(ids);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
onRefresh();
|
||||
} catch {
|
||||
// 处理错误
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
/** 审批/反审批操作 */
|
||||
function handleUpdateStatus(row: ErpPurchaseInApi.PurchaseIn, status: number) {
|
||||
const hideLoading = message.loading({
|
||||
content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
|
||||
duration: 0,
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
updatePurchaseInStatus(row.id!, status)
|
||||
.then(() => {
|
||||
message.success({
|
||||
content: `${status === 20 ? '审批' : '反审批'}成功`,
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
onRefresh();
|
||||
})
|
||||
.catch(() => {
|
||||
// 处理错误
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出 */
|
||||
async function handleExport() {
|
||||
const data = await exportPurchaseIn(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 getPurchaseInPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpPurchaseInApi.PurchaseIn>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【采购】采购订单、入库、退货"
|
||||
url="https://doc.iocoder.cn/erp/purchase/"
|
||||
/>
|
||||
</template>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/purchase/in/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/purchase/in/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<FormModal @success="onRefresh" />
|
||||
|
||||
<Grid table-title="采购入库列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['采购入库']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['erp:purchase-in:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['erp:purchase-in:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
{
|
||||
label: '批量删除',
|
||||
type: 'primary',
|
||||
danger: true,
|
||||
disabled: isEmpty(checkedIds),
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['erp:purchase-in:delete'],
|
||||
popConfirm: {
|
||||
title: `是否删除所选中数据?`,
|
||||
confirm: () => {
|
||||
const checkboxRecords = gridApi.grid.getCheckboxRecords();
|
||||
if (checkboxRecords.length === 0) {
|
||||
message.warning('请选择要删除的数据');
|
||||
return;
|
||||
}
|
||||
handleDelete(checkboxRecords.map((item) => item.id!));
|
||||
},
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.detail'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.VIEW,
|
||||
auth: ['erp:purchase-in:query'],
|
||||
onClick: handleDetail.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['erp:purchase-in:update'],
|
||||
ifShow: () => row.status !== 20,
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: row.status === 10 ? '审批' : '反审批',
|
||||
type: 'link',
|
||||
auth: ['erp:purchase-in:update-status'],
|
||||
popConfirm: {
|
||||
title: `确认${row.status === 10 ? '审批' : '反审批'}${row.no}吗?`,
|
||||
confirm: handleUpdateStatus.bind(
|
||||
null,
|
||||
row,
|
||||
row.status === 10 ? 20 : 10,
|
||||
),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
color: 'error',
|
||||
auth: ['erp:purchase-in:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.no]),
|
||||
confirm: () => handleDelete([row.id!]),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user