feat:【antd】【erp 系统】sale/out 部分重构(列表 ok)
This commit is contained in:
@@ -11,30 +11,31 @@ import { getProductSimpleList } from '#/api/erp/product/product';
|
|||||||
import { getCustomerSimpleList } from '#/api/erp/sale/customer';
|
import { getCustomerSimpleList } from '#/api/erp/sale/customer';
|
||||||
import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
||||||
import { getSimpleUserList } from '#/api/system/user';
|
import { getSimpleUserList } from '#/api/system/user';
|
||||||
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 表单的配置项 */
|
/** 表单的配置项 */
|
||||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
component: 'Input',
|
|
||||||
componentProps: {
|
|
||||||
style: { display: 'none' },
|
|
||||||
},
|
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
label: 'ID',
|
component: 'Input',
|
||||||
hideLabel: true,
|
dependencies: {
|
||||||
formItemClass: 'hidden',
|
triggerFields: [''],
|
||||||
|
show: () => false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'no',
|
||||||
|
label: '出库单号',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '系统自动生成',
|
placeholder: '系统自动生成',
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
fieldName: 'no',
|
|
||||||
label: '出库单号',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'customerId',
|
||||||
|
label: '客户',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: true,
|
disabled: true,
|
||||||
@@ -47,8 +48,6 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
|||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fieldName: 'customerId',
|
|
||||||
label: '客户',
|
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -63,6 +62,8 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'outTime',
|
||||||
|
label: '出库时间',
|
||||||
component: 'DatePicker',
|
component: 'DatePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: formType === 'detail',
|
disabled: formType === 'detail',
|
||||||
@@ -70,28 +71,25 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
|||||||
showTime: true,
|
showTime: true,
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
valueFormat: 'x',
|
valueFormat: 'x',
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
},
|
||||||
fieldName: 'outTime',
|
|
||||||
label: '出库时间',
|
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'remark',
|
||||||
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入备注',
|
placeholder: '请输入备注',
|
||||||
disabled: formType === 'detail',
|
|
||||||
autoSize: { minRows: 1, maxRows: 1 },
|
autoSize: { minRows: 1, maxRows: 1 },
|
||||||
class: 'w-full',
|
disabled: formType === 'detail',
|
||||||
},
|
},
|
||||||
fieldName: 'remark',
|
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
label: '备注',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'fileUrl',
|
||||||
|
label: '附件',
|
||||||
component: 'FileUpload',
|
component: 'FileUpload',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: formType === 'detail',
|
|
||||||
maxNumber: 1,
|
maxNumber: 1,
|
||||||
maxSize: 10,
|
maxSize: 10,
|
||||||
accept: [
|
accept: [
|
||||||
@@ -105,69 +103,65 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
|||||||
'jpeg',
|
'jpeg',
|
||||||
'png',
|
'png',
|
||||||
],
|
],
|
||||||
showDescription: true,
|
showDescription: formType !== 'detail',
|
||||||
|
disabled: formType === 'detail',
|
||||||
},
|
},
|
||||||
fieldName: 'fileUrl',
|
|
||||||
label: '附件',
|
|
||||||
formItemClass: 'col-span-3',
|
formItemClass: 'col-span-3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'product',
|
fieldName: 'items',
|
||||||
label: '产品清单',
|
label: '产品清单',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
formItemClass: 'col-span-3',
|
formItemClass: 'col-span-3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'InputNumber',
|
|
||||||
fieldName: 'discountPercent',
|
fieldName: 'discountPercent',
|
||||||
|
label: '优惠率(%)',
|
||||||
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '优惠率',
|
placeholder: '请输入优惠率',
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
disabled: true,
|
|
||||||
precision: 2,
|
precision: 2,
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
},
|
||||||
|
rules: z.number().min(0).optional(),
|
||||||
label: '优惠率(%)',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'discountPrice',
|
||||||
|
label: '付款优惠',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '付款优惠',
|
placeholder: '付款优惠',
|
||||||
precision: 2,
|
precision: 2,
|
||||||
formatter: erpPriceInputFormatter,
|
formatter: erpPriceInputFormatter,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
},
|
||||||
fieldName: 'discountPrice',
|
|
||||||
label: '付款优惠',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'discountedPrice',
|
||||||
|
label: '优惠后金额',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '优惠后金额',
|
placeholder: '优惠后金额',
|
||||||
precision: 2,
|
precision: 2,
|
||||||
formatter: erpPriceInputFormatter,
|
formatter: erpPriceInputFormatter,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
},
|
||||||
fieldName: 'discountedPrice',
|
|
||||||
label: '优惠后金额',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'otherPrice',
|
||||||
|
label: '其他费用',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: formType === 'detail',
|
disabled: formType === 'detail',
|
||||||
placeholder: '请输入其他费用',
|
placeholder: '请输入其他费用',
|
||||||
precision: 2,
|
precision: 2,
|
||||||
formatter: erpPriceInputFormatter,
|
formatter: erpPriceInputFormatter,
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
},
|
||||||
fieldName: 'otherPrice',
|
|
||||||
label: '其他费用',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'accountId',
|
||||||
|
label: '结算账户',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择结算账户',
|
placeholder: '请选择结算账户',
|
||||||
@@ -180,26 +174,22 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
|||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fieldName: 'accountId',
|
|
||||||
label: '结算账户',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
fieldName: 'totalPrice',
|
||||||
|
label: '应收金额',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
precision: 2,
|
precision: 2,
|
||||||
style: { width: '100%' },
|
|
||||||
disabled: true,
|
|
||||||
min: 0,
|
min: 0,
|
||||||
},
|
},
|
||||||
fieldName: 'totalPrice',
|
|
||||||
label: '应收金额',
|
|
||||||
rules: z.number().min(0).optional(),
|
rules: z.number().min(0).optional(),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 采购订单项表格列定义 */
|
/** 表单的明细表格列 */
|
||||||
export function useSaleOutItemTableColumns(): VxeTableGridOptions['columns'] {
|
export function useFormItemColumns(): VxeTableGridOptions['columns'] {
|
||||||
return [
|
return [
|
||||||
{ type: 'seq', title: '序号', minWidth: 50, fixed: 'left' },
|
{ type: 'seq', title: '序号', minWidth: 50, fixed: 'left' },
|
||||||
{
|
{
|
||||||
@@ -216,7 +206,7 @@ export function useSaleOutItemTableColumns(): VxeTableGridOptions['columns'] {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'stockCount',
|
field: 'stockCount',
|
||||||
title: '仓库库存',
|
title: '库存',
|
||||||
minWidth: 80,
|
minWidth: 80,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -315,10 +305,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
label: '出库时间',
|
label: '出库时间',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: ['开始时间', '结束时间'],
|
...getRangePickerDefaultProps(),
|
||||||
showTime: true,
|
allowClear: true,
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -390,12 +378,12 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
label: '状态',
|
label: '审批状态',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择状态',
|
|
||||||
allowClear: true,
|
|
||||||
options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'),
|
options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'),
|
||||||
|
placeholder: '请选择审批状态',
|
||||||
|
allowClear: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -473,7 +461,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
title: '状态',
|
title: '审批状态',
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
@@ -482,7 +470,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
minWidth: 250,
|
width: 220,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
slots: { default: 'actions' },
|
slots: { default: 'actions' },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import SaleOutForm from './modules/sale-out-form.vue';
|
import SaleOutForm from './modules/form.vue';
|
||||||
|
|
||||||
/** ERP 销售出库列表 */
|
/** ERP 销售出库列表 */
|
||||||
defineOptions({ name: 'ErpSaleOut' });
|
defineOptions({ name: 'ErpSaleOut' });
|
||||||
@@ -30,11 +30,56 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @Xuzhiqiang:批量删除待实现
|
/** 导出表格 */
|
||||||
|
async function handleExport() {
|
||||||
|
const data = await exportSaleOut(await gridApi.formApi.getValues());
|
||||||
|
downloadFileFromBlobPart({ fileName: '销售出库.xls', source: data });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增销售出库 */
|
||||||
|
function handleCreate() {
|
||||||
|
formModalApi.setData({ type: 'create' }).open();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 编辑销售出库 */
|
||||||
|
function handleEdit(row: ErpSaleOutApi.SaleOut) {
|
||||||
|
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除销售出库 */
|
||||||
|
async function handleDelete(ids: number[]) {
|
||||||
|
const hideLoading = message.loading({
|
||||||
|
content: $t('ui.actionMessage.deleting'),
|
||||||
|
duration: 0,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await deleteSaleOut(ids);
|
||||||
|
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 审批/反审批操作 */
|
||||||
|
async function handleUpdateStatus(row: ErpSaleOutApi.SaleOut, status: number) {
|
||||||
|
const hideLoading = message.loading({
|
||||||
|
content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
|
||||||
|
duration: 0,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await updateSaleOutStatus(row.id!, status);
|
||||||
|
message.success(`${status === 20 ? '审批' : '反审批'}成功`);
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const checkedIds = ref<number[]>([]);
|
const checkedIds = ref<number[]>([]);
|
||||||
function handleRowCheckboxChange({
|
function handleRowCheckboxChange({
|
||||||
records,
|
records,
|
||||||
@@ -44,69 +89,11 @@ function handleRowCheckboxChange({
|
|||||||
checkedIds.value = records.map((item) => item.id!);
|
checkedIds.value = records.map((item) => item.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 详情 */
|
/** 查看详情 */
|
||||||
function handleDetail(row: ErpSaleOutApi.SaleOut) {
|
function handleDetail(row: ErpSaleOutApi.SaleOut) {
|
||||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增 */
|
|
||||||
function handleCreate() {
|
|
||||||
formModalApi.setData({ type: 'create' }).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 编辑 */
|
|
||||||
function handleEdit(row: ErpSaleOutApi.SaleOut) {
|
|
||||||
formModalApi.setData({ type: 'update', 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 deleteSaleOut(ids);
|
|
||||||
message.success({
|
|
||||||
content: $t('ui.actionMessage.deleteSuccess'),
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 审批/反审批操作 */
|
|
||||||
function handleUpdateStatus(row: ErpSaleOutApi.SaleOut, status: number) {
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
|
|
||||||
duration: 0,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
updateSaleOutStatus({ id: row.id!, status })
|
|
||||||
.then(() => {
|
|
||||||
message.success({
|
|
||||||
content: `${status === 20 ? '审批' : '反审批'}成功`,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
onRefresh();
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
// 处理错误
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoading();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出 */
|
|
||||||
async function handleExport() {
|
|
||||||
const data = await exportSaleOut(await gridApi.formApi.getValues());
|
|
||||||
downloadFileFromBlobPart({ fileName: '销售出库.xls', source: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
@@ -150,8 +137,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
url="https://doc.iocoder.cn/erp/sale/"
|
url="https://doc.iocoder.cn/erp/sale/"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<FormModal @success="onRefresh" />
|
|
||||||
|
|
||||||
|
<FormModal @success="handleRefresh" />
|
||||||
<Grid table-title="销售出库列表">
|
<Grid table-title="销售出库列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
@@ -178,11 +165,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['erp:sale-out:delete'],
|
auth: ['erp:sale-out:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
disabled: isEmpty(checkedIds),
|
|
||||||
title: `是否删除所选中数据?`,
|
title: `是否删除所选中数据?`,
|
||||||
confirm: () => {
|
confirm: handleDelete.bind(null, checkedIds),
|
||||||
handleDelete(checkedIds);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
@@ -227,7 +211,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
auth: ['erp:sale-out:delete'],
|
auth: ['erp:sale-out:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: $t('ui.actionMessage.deleteConfirm', [row.no]),
|
title: $t('ui.actionMessage.deleteConfirm', [row.no]),
|
||||||
confirm: () => handleDelete([row.id!]),
|
confirm: handleDelete.bind(null, [row.id!]),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { useVbenForm } from '#/adapter/form';
|
|||||||
import { createSaleOut, getSaleOut, updateSaleOut } from '#/api/erp/sale/out';
|
import { createSaleOut, getSaleOut, updateSaleOut } from '#/api/erp/sale/out';
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
import { useFormSchema } from '../data';
|
||||||
import SaleOutItemForm from './sale-out-item-form.vue';
|
import ItemForm from './item-form.vue';
|
||||||
import SelectSaleOrderForm from './select-sale-order-form.vue';
|
import SelectSaleOrderForm from './select-sale-order-form.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
@@ -42,8 +42,8 @@ const formData = ref<
|
|||||||
discountedPrice: 0,
|
discountedPrice: 0,
|
||||||
items: [],
|
items: [],
|
||||||
});
|
});
|
||||||
const formType = ref('');
|
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||||
const itemFormRef = ref();
|
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||||
|
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
if (formType.value === 'create') return '添加销售出库';
|
if (formType.value === 'create') return '添加销售出库';
|
||||||
@@ -74,7 +74,7 @@ const [Form, formApi] = useVbenForm({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 更新销售出库项
|
/** 更新销售出库项 */
|
||||||
const handleUpdateItems = async (items: ErpSaleOutApi.SaleOutItem[]) => {
|
const handleUpdateItems = async (items: ErpSaleOutApi.SaleOutItem[]) => {
|
||||||
if (formData.value) {
|
if (formData.value) {
|
||||||
const data = await formApi.getValues();
|
const data = await formApi.getValues();
|
||||||
@@ -83,7 +83,7 @@ const handleUpdateItems = async (items: ErpSaleOutApi.SaleOutItem[]) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 选择采购订单
|
/** 选择销售订单 */
|
||||||
const handleUpdateOrder = (order: ErpSaleOrderApi.SaleOrder) => {
|
const handleUpdateOrder = (order: ErpSaleOrderApi.SaleOrder) => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
...formData.value,
|
...formData.value,
|
||||||
@@ -95,7 +95,7 @@ const handleUpdateOrder = (order: ErpSaleOrderApi.SaleOrder) => {
|
|||||||
discountPercent: order.discountPercent!,
|
discountPercent: order.discountPercent!,
|
||||||
fileUrl: order.fileUrl!,
|
fileUrl: order.fileUrl!,
|
||||||
};
|
};
|
||||||
// 将订单项设置到入库单项
|
// 将订单项设置到出库单项
|
||||||
order.items!.forEach((item: any) => {
|
order.items!.forEach((item: any) => {
|
||||||
item.totalCount = item.count;
|
item.totalCount = item.count;
|
||||||
item.count = item.totalCount - item.outCount;
|
item.count = item.totalCount - item.outCount;
|
||||||
@@ -286,8 +286,8 @@ defineExpose({ modalApi });
|
|||||||
:show-confirm-button="formType !== 'detail'"
|
:show-confirm-button="formType !== 'detail'"
|
||||||
>
|
>
|
||||||
<Form class="mx-3">
|
<Form class="mx-3">
|
||||||
<template #product="slotProps">
|
<template #items="slotProps">
|
||||||
<SaleOutItemForm
|
<ItemForm
|
||||||
v-bind="slotProps"
|
v-bind="slotProps"
|
||||||
ref="itemFormRef"
|
ref="itemFormRef"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
@@ -12,7 +12,12 @@ import { getProductSimpleList } from '#/api/erp/product/product';
|
|||||||
import { getWarehouseStockCount } from '#/api/erp/stock/stock';
|
import { getWarehouseStockCount } from '#/api/erp/stock/stock';
|
||||||
import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
||||||
|
|
||||||
import { useSaleOutItemTableColumns } from '../data';
|
import { useFormItemColumns } from '../data';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
items?: ErpSaleOutApi.SaleOutItem[];
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
items: () => [],
|
items: () => [],
|
||||||
@@ -21,11 +26,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
|
|
||||||
const emit = defineEmits(['update:items', 'update:totalPrice']);
|
const emit = defineEmits(['update:items', 'update:totalPrice']);
|
||||||
|
|
||||||
interface Props {
|
|
||||||
items?: ErpSaleOutApi.SaleOutItem[];
|
|
||||||
disabled?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const tableData = ref<ErpSaleOutApi.SaleOutItem[]>([]);
|
const tableData = ref<ErpSaleOutApi.SaleOutItem[]>([]);
|
||||||
const productOptions = ref<any[]>([]);
|
const productOptions = ref<any[]>([]);
|
||||||
const warehouseOptions = ref<any[]>([]);
|
const warehouseOptions = ref<any[]>([]);
|
||||||
@@ -37,7 +37,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
trigger: 'click',
|
trigger: 'click',
|
||||||
mode: 'cell',
|
mode: 'cell',
|
||||||
},
|
},
|
||||||
columns: useSaleOutItemTableColumns(),
|
columns: useFormItemColumns(),
|
||||||
data: tableData.value,
|
data: tableData.value,
|
||||||
border: true,
|
border: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
Reference in New Issue
Block a user