fix: erp warn

This commit is contained in:
xingyu4j
2025-10-22 15:32:50 +08:00
parent 66647802af
commit 2884ca72f7
33 changed files with 499 additions and 473 deletions

View File

@@ -20,9 +20,9 @@ export namespace ErpFinancePaymentApi {
export interface FinancePayment {
id?: number; // 付款单编号
no: string; // 付款单号
supplierId: number; // 供应商编号
supplierId?: number; // 供应商编号
supplierName?: string; // 供应商名称
paymentTime: Date; // 付款时间
paymentTime?: Date; // 付款时间
totalPrice: number; // 合计金额,单位:元
discountPrice: number; // 优惠金额
paymentPrice: number; // 实际付款金额

View File

@@ -26,30 +26,32 @@ const formData = ref<
}
>({
id: undefined,
no: undefined,
no: '',
supplierId: undefined,
accountId: undefined,
financeUserId: undefined,
paymentTime: undefined,
remark: undefined,
remark: '',
fileUrl: undefined,
totalPrice: 0,
discountPrice: 0,
paymentPrice: 0,
items: [],
status: 0,
});
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['付款单'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['付款单'])
: '付款单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['付款单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['付款单']);
} else {
return '付款单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -81,30 +83,28 @@ const [Form, formApi] = useVbenForm({
});
/** 更新付款项 */
const handleUpdateItems = (
items: ErpFinancePaymentApi.FinancePaymentItem[],
) => {
function handleUpdateItems(items: ErpFinancePaymentApi.FinancePaymentItem[]) {
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 更新总金额 */
const handleUpdateTotalPrice = (totalPrice: number) => {
function handleUpdateTotalPrice(totalPrice: number) {
formData.value.totalPrice = totalPrice;
formApi.setValues({
totalPrice: formData.value.totalPrice,
});
};
}
/** 更新付款金额 */
const handleUpdatePaymentPrice = (paymentPrice: number) => {
function handleUpdatePaymentPrice(paymentPrice: number) {
formData.value.paymentPrice = paymentPrice;
formApi.setValues({
paymentPrice: formData.value.paymentPrice,
});
};
}
/** 创建或更新付款单 */
const [Modal, modalApi] = useVbenModal({
@@ -141,7 +141,7 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
formData.value = {} as ErpFinancePaymentApi.FinancePayment;
return;
}
// 加载数据

View File

@@ -212,81 +212,89 @@ defineExpose({ validate });
</script>
<template>
<Grid class="w-full">
<template #paymentPrice="{ row }">
<InputNumber
v-model:value="row.paymentPrice"
:precision="2"
:disabled="disabled"
:formatter="erpPriceInputFormatter"
placeholder="请输入本次付款"
@change="handleRowChange(row)"
/>
</template>
<template #remark="{ row }">
<Input
v-model:value="row.remark"
:disabled="disabled"
placeholder="请输入备注"
@change="handleRowChange(row)"
/>
</template>
<template #actions="{ row }">
<TableAction
v-if="!disabled"
:actions="[
{
label: '删除',
type: 'link',
danger: true,
popConfirm: {
title: '确认删除该付款明细吗?',
confirm: handleDelete.bind(null, row),
<div>
<Grid class="w-full">
<template #paymentPrice="{ row }">
<InputNumber
v-model:value="row.paymentPrice"
:precision="2"
:disabled="disabled"
:formatter="erpPriceInputFormatter"
placeholder="请输入本次付款"
@change="handleRowChange(row)"
/>
</template>
<template #remark="{ row }">
<Input
v-model:value="row.remark"
:disabled="disabled"
placeholder="请输入备注"
@change="handleRowChange(row)"
/>
</template>
<template #actions="{ row }">
<TableAction
v-if="!disabled"
:actions="[
{
label: '删除',
type: 'link',
danger: true,
popConfirm: {
title: '确认删除该付款明细吗?',
confirm: handleDelete.bind(null, row),
},
},
},
]"
/>
</template>
]"
/>
</template>
<template #bottom>
<div class="border-border bg-muted mt-2 rounded border p-2">
<div class="text-muted-foreground flex justify-between text-sm">
<span class="text-foreground font-medium">合计</span>
<div class="flex space-x-4">
<span>
合计付款{{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
<span>
已付金额{{ erpPriceInputFormatter(summaries.paidPrice) }}
</span>
<span>
本次付款
{{ erpPriceInputFormatter(summaries.paymentPrice) }}
</span>
<template #bottom>
<div class="border-border bg-muted mt-2 rounded border p-2">
<div class="text-muted-foreground flex justify-between text-sm">
<span class="text-foreground font-medium">合计</span>
<div class="flex space-x-4">
<span>
合计付款{{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
<span>
已付金额{{ erpPriceInputFormatter(summaries.paidPrice) }}
</span>
<span>
本次付款
{{ erpPriceInputFormatter(summaries.paymentPrice) }}
</span>
</div>
</div>
</div>
</div>
<TableAction
v-if="!disabled"
class="mt-2 flex justify-center"
:actions="[
{
label: '添加采购入库单',
type: 'default',
onClick: handleOpenPurchaseIn,
},
{
label: '添加采购退货单',
type: 'default',
onClick: handleOpenSaleReturn,
},
]"
/>
</template>
</Grid>
<TableAction
v-if="!disabled"
class="mt-2 flex justify-center"
:actions="[
{
label: '添加采购入库单',
type: 'default',
onClick: handleOpenPurchaseIn,
},
{
label: '添加采购退货单',
type: 'default',
onClick: handleOpenSaleReturn,
},
]"
/>
</template>
</Grid>
<!-- 采购入库单选择组件 -->
<PurchaseInSelect ref="purchaseInSelectRef" @success="handleAddPurchaseIn" />
<!-- 采购退货单选择组件 -->
<SaleReturnSelect ref="saleReturnSelectRef" @success="handleAddSaleReturn" />
<!-- 采购入库单选择组件 -->
<PurchaseInSelect
ref="purchaseInSelectRef"
@success="handleAddPurchaseIn"
/>
<!-- 采购退货单选择组件 -->
<SaleReturnSelect
ref="saleReturnSelectRef"
@success="handleAddSaleReturn"
/>
</div>
</template>

View File

@@ -69,7 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
/** 打开弹窗 */
const openModal = (id: number) => {
function openModal(id: number) {
// 重置数据
supplierId.value = id;
open.value = true;
@@ -78,17 +78,17 @@ const openModal = (id: number) => {
gridApi.formApi?.resetForm();
gridApi.formApi?.setValues({ supplierId: id });
gridApi.query();
};
}
/** 确认选择采购入库单 */
const handleOk = () => {
function handleOk() {
if (selectedRows.value.length === 0) {
message.warning('请选择要添加的采购入库单');
return;
}
emit('success', selectedRows.value);
open.value = false;
};
}
defineExpose({ open: openModal });
</script>

View File

@@ -73,7 +73,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
/** 打开弹窗 */
const openModal = (id: number) => {
function openModal(id: number) {
// 重置数据
supplierId.value = id;
open.value = true;
@@ -82,17 +82,17 @@ const openModal = (id: number) => {
gridApi.formApi?.resetForm();
gridApi.formApi?.setValues({ supplierId: id });
gridApi.query();
};
}
/** 确认选择 */
const handleOk = () => {
function handleOk() {
if (selectedRows.value.length === 0) {
message.warning('请选择要添加的采购退货单');
return;
}
emit('success', selectedRows.value);
open.value = false;
};
}
defineExpose({ open: openModal });
</script>

View File

@@ -43,14 +43,15 @@ const formData = ref<
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['收款单'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['收款单'])
: '收款单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['收款单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['收款单']);
} else {
return '收款单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -82,30 +83,28 @@ const [Form, formApi] = useVbenForm({
});
/** 更新收款项 */
const handleUpdateItems = (
items: ErpFinanceReceiptApi.FinanceReceiptItem[],
) => {
function handleUpdateItems(items: ErpFinanceReceiptApi.FinanceReceiptItem[]) {
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 更新总金额 */
const handleUpdateTotalPrice = (totalPrice: number) => {
function handleUpdateTotalPrice(totalPrice: number) {
formData.value.totalPrice = totalPrice;
formApi.setValues({
totalPrice: formData.value.totalPrice,
});
};
}
/** 更新收款金额 */
const handleUpdateReceiptPrice = (receiptPrice: number) => {
function handleUpdateReceiptPrice(receiptPrice: number) {
formData.value.receiptPrice = receiptPrice;
formApi.setValues({
receiptPrice: formData.value.receiptPrice,
});
};
}
/** 创建或更新收款单 */
const [Modal, modalApi] = useVbenModal({

View File

@@ -118,15 +118,15 @@ watch(
/** 添加销售出库单 */
const saleOutSelectRef = ref();
const handleOpenSaleOut = () => {
function handleOpenSaleOut() {
if (!props.customerId) {
message.error('请选择客户');
return;
}
saleOutSelectRef.value?.open(props.customerId);
};
}
const handleAddSaleOut = (rows: ErpSaleOutApi.SaleOut[]) => {
function handleAddSaleOut(rows: ErpSaleOutApi.SaleOut[]) {
rows.forEach((row) => {
const newItem: ErpFinanceReceiptApi.FinanceReceiptItem = {
bizId: row.id,
@@ -140,19 +140,19 @@ const handleAddSaleOut = (rows: ErpSaleOutApi.SaleOut[]) => {
tableData.value.push(newItem);
});
emit('update:items', [...tableData.value]);
};
}
/** 添加销售退货单 */
const saleReturnSelectRef = ref();
const handleOpenSaleReturn = () => {
function handleOpenSaleReturn() {
if (!props.customerId) {
message.error('请选择客户');
return;
}
saleReturnSelectRef.value?.open(props.customerId);
};
}
const handleAddSaleReturn = (rows: ErpSaleReturnApi.SaleReturn[]) => {
function handleAddSaleReturn(rows: ErpSaleReturnApi.SaleReturn[]) {
rows.forEach((row) => {
const newItem: ErpFinanceReceiptApi.FinanceReceiptItem = {
bizId: row.id,
@@ -166,10 +166,10 @@ const handleAddSaleReturn = (rows: ErpSaleReturnApi.SaleReturn[]) => {
tableData.value.push(newItem);
});
emit('update:items', [...tableData.value]);
};
}
/** 删除行 */
const handleDelete = async (row: any) => {
function handleDelete(row: any) {
const index = tableData.value.findIndex(
(item) => item.bizId === row.bizId && item.bizType === row.bizType,
);
@@ -178,10 +178,10 @@ const handleDelete = async (row: any) => {
}
// 通知父组件更新
emit('update:items', [...tableData.value]);
};
}
/** 处理行数据变更 */
const handleRowChange = (row: any) => {
function handleRowChange(row: any) {
const index = tableData.value.findIndex(
(item) => item.bizId === row.bizId && item.bizType === row.bizType,
);
@@ -191,10 +191,10 @@ const handleRowChange = (row: any) => {
tableData.value[index] = row;
}
emit('update:items', [...tableData.value]);
};
}
/** 表单校验 */
const validate = () => {
function validate() {
// 检查是否有明细
if (tableData.value.length === 0) {
throw new Error('请添加收款明细');
@@ -206,87 +206,92 @@ const validate = () => {
throw new Error(`${i + 1}本次收款必须大于0`);
}
}
};
}
defineExpose({ validate });
</script>
<template>
<Grid class="w-full">
<template #receiptPrice="{ row }">
<InputNumber
v-model:value="row.receiptPrice"
:precision="2"
:disabled="disabled"
:formatter="erpPriceInputFormatter"
placeholder="请输入本次收款"
@change="handleRowChange(row)"
/>
</template>
<template #remark="{ row }">
<Input
v-model:value="row.remark"
:disabled="disabled"
placeholder="请输入备注"
@change="handleRowChange(row)"
/>
</template>
<template #actions="{ row }">
<TableAction
v-if="!disabled"
:actions="[
{
label: '删除',
type: 'link',
danger: true,
popConfirm: {
title: '确认删除该收款明细吗?',
confirm: handleDelete.bind(null, row),
<div>
<Grid class="w-full">
<template #receiptPrice="{ row }">
<InputNumber
v-model:value="row.receiptPrice"
:precision="2"
:disabled="disabled"
:formatter="erpPriceInputFormatter"
placeholder="请输入本次收款"
@change="handleRowChange(row)"
/>
</template>
<template #remark="{ row }">
<Input
v-model:value="row.remark"
:disabled="disabled"
placeholder="请输入备注"
@change="handleRowChange(row)"
/>
</template>
<template #actions="{ row }">
<TableAction
v-if="!disabled"
:actions="[
{
label: '删除',
type: 'link',
danger: true,
popConfirm: {
title: '确认删除该收款明细吗?',
confirm: handleDelete.bind(null, row),
},
},
},
]"
/>
</template>
]"
/>
</template>
<template #bottom>
<div class="border-border bg-muted mt-2 rounded border p-2">
<div class="text-muted-foreground flex justify-between text-sm">
<span class="text-foreground font-medium">合计</span>
<div class="flex space-x-4">
<span>
合计收款{{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
<span>
已收金额{{ erpPriceInputFormatter(summaries.receiptedPrice) }}
</span>
<span>
本次收款
{{ erpPriceInputFormatter(summaries.receiptPrice) }}
</span>
<template #bottom>
<div class="border-border bg-muted mt-2 rounded border p-2">
<div class="text-muted-foreground flex justify-between text-sm">
<span class="text-foreground font-medium">合计</span>
<div class="flex space-x-4">
<span>
合计收款{{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
<span>
已收金额{{ erpPriceInputFormatter(summaries.receiptedPrice) }}
</span>
<span>
本次收款
{{ erpPriceInputFormatter(summaries.receiptPrice) }}
</span>
</div>
</div>
</div>
</div>
<TableAction
v-if="!disabled"
class="mt-2 flex justify-center"
:actions="[
{
label: '添加销售出库单',
type: 'default',
onClick: handleOpenSaleOut,
},
{
label: '添加销售退货单',
type: 'default',
onClick: handleOpenSaleReturn,
},
]"
/>
</template>
</Grid>
<TableAction
v-if="!disabled"
class="mt-2 flex justify-center"
:actions="[
{
label: '添加销售出库单',
type: 'default',
onClick: handleOpenSaleOut,
},
{
label: '添加销售退货单',
type: 'default',
onClick: handleOpenSaleReturn,
},
]"
/>
</template>
</Grid>
<!-- 销售出库单选择组件 -->
<SaleOutSelect ref="saleOutSelectRef" @success="handleAddSaleOut" />
<!-- 销售退货单选择组件 -->
<SaleReturnSelect ref="saleReturnSelectRef" @success="handleAddSaleReturn" />
<!-- 销售出库单选择组件 -->
<SaleOutSelect ref="saleOutSelectRef" @success="handleAddSaleOut" />
<!-- 销售退货单选择组件 -->
<SaleReturnSelect
ref="saleReturnSelectRef"
@success="handleAddSaleReturn"
/>
</div>
</template>

View File

@@ -65,7 +65,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
/** 打开弹窗 */
const openModal = (id: number) => {
function openModal(id: number) {
// 重置数据
customerId.value = id;
open.value = true;
@@ -74,17 +74,17 @@ const openModal = (id: number) => {
gridApi.formApi?.resetForm();
gridApi.formApi?.setValues({ customerId: id });
gridApi.query();
};
}
/** 确认选择销售出库单 */
const handleOk = () => {
function handleOk() {
if (selectedRows.value.length === 0) {
message.warning('请选择要添加的销售出库单');
return;
}
emit('success', selectedRows.value);
open.value = false;
};
}
defineExpose({ open: openModal });
</script>

View File

@@ -69,7 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
/** 打开弹窗 */
const openModal = (id: number) => {
function openModal(id: number) {
// 重置数据
customerId.value = id;
open.value = true;
@@ -78,17 +78,17 @@ const openModal = (id: number) => {
gridApi.formApi?.resetForm();
gridApi.formApi?.setValues({ customerId: id });
gridApi.query();
};
}
/** 确认选择销售退货单 */
const handleOk = () => {
function handleOk() {
if (selectedRows.value.length === 0) {
message.warning('请选择要添加的销售退货单');
return;
}
emit('success', selectedRows.value);
open.value = false;
};
}
defineExpose({ open: openModal });
</script>

View File

@@ -49,14 +49,15 @@ const formData = ref<
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['采购入库'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['采购入库'])
: '采购入库详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['采购入库']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['采购入库']);
} else {
return '采购入库详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -170,7 +171,7 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
formData.value = {} as ErpPurchaseInApi.PurchaseIn;
return;
}
// 加载数据

View File

@@ -96,7 +96,7 @@ watch(
await gridApi.grid.reloadData(tableData.value);
// 更新表格列配置(目的:原数量、已入库动态列)
const columns = useFormItemColumns(tableData.value);
await gridApi.grid.reloadColumn(columns);
await gridApi.grid.reloadColumn(columns || []);
},
{
immediate: true,
@@ -140,14 +140,14 @@ function handleDelete(row: ErpPurchaseInApi.PurchaseInItem) {
}
/** 处理仓库变更 */
const handleWarehouseChange = async (row: ErpPurchaseInApi.PurchaseInItem) => {
async function handleWarehouseChange(row: ErpPurchaseInApi.PurchaseInItem) {
const stockCount = await getWarehouseStockCount({
productId: row.productId!,
warehouseId: row.warehouseId!,
});
row.stockCount = stockCount || 0;
handleRowChange(row);
};
}
/** 处理行数据变更 */
function handleRowChange(row: any) {
@@ -161,14 +161,14 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpPurchaseInApi.PurchaseInItem): void => {
function initRow(row: ErpPurchaseInApi.PurchaseInItem) {
if (row.productPrice && row.count) {
row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
row.totalPrice = row.totalProductPrice + row.taxPrice;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -78,40 +78,42 @@ function handleSelectOrder(selectOrder: ErpPurchaseOrderApi.PurchaseOrder) {
}
/** 确认选择采购订单 */
const handleOk = () => {
function handleOk() {
if (!order.value) {
message.warning('请选择一个采购订单');
return;
}
emit('update:order', order.value);
open.value = false;
};
}
</script>
<template>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="采购订单列表(仅展示可退货)" />
</Modal>
<div>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="采购订单列表(仅展示可退货)" />
</Modal>
</div>
</template>

View File

@@ -24,14 +24,15 @@ const formData = ref<ErpPurchaseOrderApi.PurchaseOrder>();
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof PurchaseOrderItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['采购订单'])
: formType.value === 'update'
? $t('ui.actionTitle.edit', ['采购订单'])
: '采购订单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['采购订单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['采购订单']);
} else {
return '采购订单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -53,27 +54,27 @@ const [Form, formApi] = useVbenForm({
});
/** 更新采购订单项 */
const handleUpdateItems = (items: ErpPurchaseOrderApi.PurchaseOrderItem[]) => {
function handleUpdateItems(items: ErpPurchaseOrderApi.PurchaseOrderItem[]) {
formData.value = modalApi.getData<ErpPurchaseOrderApi.PurchaseOrder>();
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 更新优惠金额 */
const handleUpdateDiscountPrice = (discountPrice: number) => {
function handleUpdateDiscountPrice(discountPrice: number) {
formApi.setValues({
discountPrice,
});
};
}
/** 更新总金额 */
const handleUpdateTotalPrice = (totalPrice: number) => {
function handleUpdateTotalPrice(totalPrice: number) {
formApi.setValues({
totalPrice,
});
};
}
/** 创建或更新采购订单 */
const [Modal, modalApi] = useVbenModal({

View File

@@ -179,14 +179,14 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpPurchaseOrderApi.PurchaseOrderItem): void => {
function initRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
if (row.productPrice && row.count) {
row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
row.totalPrice = row.totalProductPrice + row.taxPrice;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -83,38 +83,36 @@ const [Form, formApi] = useVbenForm({
});
/** 更新采购退货项 */
const handleUpdateItems = (
items: ErpPurchaseReturnApi.PurchaseReturnItem[],
) => {
function handleUpdateItems(items: ErpPurchaseReturnApi.PurchaseReturnItem[]) {
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 更新其他费用 */
const handleUpdateOtherPrice = (otherPrice: number) => {
function handleUpdateOtherPrice(otherPrice: number) {
formApi.setValues({
otherPrice,
});
};
}
/** 更新优惠金额 */
const handleUpdateDiscountPrice = (discountPrice: number) => {
function handleUpdateDiscountPrice(discountPrice: number) {
formApi.setValues({
discountPrice,
});
};
}
/** 更新总金额 */
const handleUpdateTotalPrice = (totalPrice: number) => {
function handleUpdateTotalPrice(totalPrice: number) {
formApi.setValues({
totalPrice,
});
};
}
/** 选择采购订单 */
const handleUpdateOrder = (order: ErpPurchaseOrderApi.PurchaseOrder) => {
function handleUpdateOrder(order: ErpPurchaseOrderApi.PurchaseOrder) {
formData.value = {
...formData.value,
orderId: order.id,
@@ -136,7 +134,7 @@ const handleUpdateOrder = (order: ErpPurchaseOrderApi.PurchaseOrder) => {
(item) => item.count && item.count > 0,
) as ErpPurchaseReturnApi.PurchaseReturnItem[];
formApi.setValues(formData.value, false);
};
}
/** 创建或更新采购退货 */
const [Modal, modalApi] = useVbenModal({
@@ -173,7 +171,7 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
formData.value = {} as ErpPurchaseReturnApi.PurchaseReturn;
return;
}
// 加载数据

View File

@@ -96,7 +96,7 @@ watch(
await gridApi.grid.reloadData(tableData.value);
// 更新表格列配置(目的:已入库、已退货动态列)
const columns = useFormItemColumns(tableData.value);
await gridApi.grid.reloadColumn(columns);
await gridApi.grid.reloadColumn(columns || []);
},
{
immediate: true,
@@ -140,16 +140,16 @@ function handleDelete(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
}
/** 处理仓库变更 */
const handleWarehouseChange = async (
async function handleWarehouseChange(
row: ErpPurchaseReturnApi.PurchaseReturnItem,
) => {
) {
const stockCount = await getWarehouseStockCount({
productId: row.productId!,
warehouseId: row.warehouseId!,
});
row.stockCount = stockCount || 0;
handleRowChange(row);
};
}
/** 处理行数据变更 */
function handleRowChange(row: any) {
@@ -163,14 +163,14 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpPurchaseReturnApi.PurchaseReturnItem): void => {
function initRow(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
if (row.productPrice && row.count) {
row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
row.totalPrice = row.totalProductPrice + row.taxPrice;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -78,40 +78,42 @@ function handleSelectOrder(selectOrder: ErpPurchaseOrderApi.PurchaseOrder) {
}
/** 确认选择采购订单 */
const handleOk = () => {
function handleOk() {
if (!order.value) {
message.warning('请选择一个采购订单');
return;
}
emit('update:order', order.value);
open.value = false;
};
}
</script>
<template>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="采购订单列表(仅展示可退货)" />
</Modal>
<div>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="采购订单列表(仅展示可退货)" />
</Modal>
</div>
</template>

View File

@@ -24,14 +24,15 @@ const formData = ref<ErpSaleOrderApi.SaleOrder>();
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['销售订单'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['销售订单'])
: '销售订单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['销售订单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['销售订单']);
} else {
return '销售订单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -53,27 +54,27 @@ const [Form, formApi] = useVbenForm({
});
/** 更新销售订单项 */
const handleUpdateItems = (items: ErpSaleOrderApi.SaleOrderItem[]) => {
function handleUpdateItems(items: ErpSaleOrderApi.SaleOrderItem[]) {
formData.value = modalApi.getData<ErpSaleOrderApi.SaleOrder>();
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 更新优惠金额 */
const handleUpdateDiscountPrice = (discountPrice: number) => {
function handleUpdateDiscountPrice(discountPrice: number) {
formApi.setValues({
discountPrice,
});
};
}
/** 更新总金额 */
const handleUpdateTotalPrice = (totalPrice: number) => {
function handleUpdateTotalPrice(totalPrice: number) {
formApi.setValues({
totalPrice,
});
};
}
/** 创建或更新销售订单 */
const [Modal, modalApi] = useVbenModal({

View File

@@ -179,14 +179,14 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpSaleOrderApi.SaleOrderItem): void => {
function initRow(row: ErpSaleOrderApi.SaleOrderItem) {
if (row.productPrice && row.count) {
row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
row.totalPrice = row.totalProductPrice + row.taxPrice;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -79,36 +79,36 @@ const [Form, formApi] = useVbenForm({
});
/** 更新销售出库项 */
const handleUpdateItems = (items: ErpSaleOutApi.SaleOutItem[]) => {
function handleUpdateItems(items: ErpSaleOutApi.SaleOutItem[]) {
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 更新其他费用 */
const handleUpdateOtherPrice = (otherPrice: number) => {
function handleUpdateOtherPrice(otherPrice: number) {
formApi.setValues({
otherPrice,
});
};
}
/** 更新优惠金额 */
const handleUpdateDiscountPrice = (discountPrice: number) => {
function handleUpdateDiscountPrice(discountPrice: number) {
formApi.setValues({
discountPrice,
});
};
}
/** 更新总金额 */
const handleUpdateTotalPrice = (totalPrice: number) => {
function handleUpdateTotalPrice(totalPrice: number) {
formApi.setValues({
totalPrice,
});
};
}
/** 选择销售订单 */
const handleUpdateOrder = (order: ErpSaleOrderApi.SaleOrder) => {
function handleUpdateOrder(order: ErpSaleOrderApi.SaleOrder) {
formData.value = {
...formData.value,
orderId: order.id,
@@ -130,7 +130,7 @@ const handleUpdateOrder = (order: ErpSaleOrderApi.SaleOrder) => {
(item) => item.count && item.count > 0,
) as ErpSaleOutApi.SaleOutItem[];
formApi.setValues(formData.value, false);
};
}
/** 创建或更新销售出库 */
const [Modal, modalApi] = useVbenModal({
@@ -166,7 +166,7 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
formData.value = {} as ErpSaleOutApi.SaleOut;
return;
}
// 加载数据

View File

@@ -96,7 +96,7 @@ watch(
await gridApi.grid.reloadData(tableData.value);
// 更新表格列配置(目的:原数量、已出库动态列)
const columns = useFormItemColumns(tableData.value);
await gridApi.grid.reloadColumn(columns);
await gridApi.grid.reloadColumn(columns || []);
},
{
immediate: true,
@@ -140,14 +140,14 @@ function handleDelete(row: ErpSaleOutApi.SaleOutItem) {
}
/** 处理仓库变更 */
const handleWarehouseChange = async (row: ErpSaleOutApi.SaleOutItem) => {
async function handleWarehouseChange(row: ErpSaleOutApi.SaleOutItem) {
const stockCount = await getWarehouseStockCount({
productId: row.productId!,
warehouseId: row.warehouseId!,
});
row.stockCount = stockCount || 0;
handleRowChange(row);
};
}
/** 处理行数据变更 */
function handleRowChange(row: any) {
@@ -161,14 +161,14 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpSaleOutApi.SaleOutItem): void => {
function initRow(row: ErpSaleOutApi.SaleOutItem) {
if (row.productPrice && row.count) {
row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
row.totalPrice = row.totalProductPrice + row.taxPrice;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -78,40 +78,42 @@ function handleSelectOrder(selectOrder: ErpSaleOrderApi.SaleOrder) {
}
/** 确认选择销售订单 */
const handleOk = () => {
function handleOk() {
if (!order.value) {
message.warning('请选择一个销售订单');
return;
}
emit('update:order', order.value);
open.value = false;
};
}
</script>
<template>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="销售订单列表(仅展示可出库)" />
</Modal>
<div>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="销售订单列表(仅展示可出库)" />
</Modal>
</div>
</template>

View File

@@ -49,14 +49,15 @@ const formData = ref<
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['销售退货'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['销售退货'])
: '销售退货详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['销售退货']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['销售退货']);
} else {
return '销售退货详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -83,36 +84,36 @@ const [Form, formApi] = useVbenForm({
});
/** 更新销售退货项 */
const handleUpdateItems = (items: ErpSaleReturnApi.SaleReturnItem[]) => {
function handleUpdateItems(items: ErpSaleReturnApi.SaleReturnItem[]) {
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 更新其他费用 */
const handleUpdateOtherPrice = (otherPrice: number) => {
function handleUpdateOtherPrice(otherPrice: number) {
formApi.setValues({
otherPrice,
});
};
}
/** 更新优惠金额 */
const handleUpdateDiscountPrice = (discountPrice: number) => {
function handleUpdateDiscountPrice(discountPrice: number) {
formApi.setValues({
discountPrice,
});
};
}
/** 更新总金额 */
const handleUpdateTotalPrice = (totalPrice: number) => {
function handleUpdateTotalPrice(totalPrice: number) {
formApi.setValues({
totalPrice,
});
};
}
/** 选择销售订单 */
const handleUpdateOrder = (order: ErpSaleOrderApi.SaleOrder) => {
function handleUpdateOrder(order: ErpSaleOrderApi.SaleOrder) {
formData.value = {
...formData.value,
orderId: order.id,
@@ -134,7 +135,7 @@ const handleUpdateOrder = (order: ErpSaleOrderApi.SaleOrder) => {
(item) => item.count && item.count > 0,
) as ErpSaleReturnApi.SaleReturnItem[];
formApi.setValues(formData.value, false);
};
}
/** 创建或更新销售退货 */
const [Modal, modalApi] = useVbenModal({
@@ -170,7 +171,7 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
formData.value = {} as ErpSaleReturnApi.SaleReturn;
return;
}
// 加载数据

View File

@@ -96,7 +96,7 @@ watch(
await gridApi.grid.reloadData(tableData.value);
// 更新表格列配置(目的:已出库、已出库动态列)
const columns = useFormItemColumns(tableData.value);
await gridApi.grid.reloadColumn(columns);
await gridApi.grid.reloadColumn(columns || []);
},
{
immediate: true,
@@ -140,14 +140,14 @@ function handleDelete(row: ErpSaleReturnApi.SaleReturnItem) {
}
/** 处理仓库变更 */
const handleWarehouseChange = async (row: ErpSaleReturnApi.SaleReturnItem) => {
async function handleWarehouseChange(row: ErpSaleReturnApi.SaleReturnItem) {
const stockCount = await getWarehouseStockCount({
productId: row.productId!,
warehouseId: row.warehouseId!,
});
row.stockCount = stockCount || 0;
handleRowChange(row);
};
}
/** 处理行数据变更 */
function handleRowChange(row: any) {
@@ -161,14 +161,14 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpSaleReturnApi.SaleReturnItem): void => {
function initRow(row: ErpSaleReturnApi.SaleReturnItem) {
if (row.productPrice && row.count) {
row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
row.taxPrice =
erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
row.totalPrice = row.totalProductPrice + row.taxPrice;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -78,40 +78,42 @@ function handleSelectOrder(selectOrder: ErpSaleOrderApi.SaleOrder) {
}
/** 确认选择销售订单 */
const handleOk = () => {
function handleOk() {
if (!order.value) {
message.warning('请选择一个销售订单');
return;
}
emit('update:order', order.value);
open.value = false;
};
}
</script>
<template>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="销售订单列表(仅展示可退货)" />
</Modal>
<div>
<Input
readonly
:value="orderNo"
:disabled="disabled"
@click="() => !disabled && (open = true)"
>
<template #addonAfter>
<div>
<IconifyIcon
class="h-full w-6 cursor-pointer"
icon="ant-design:setting-outlined"
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
@click="() => !disabled && (open = true)"
/>
</div>
</template>
</Input>
<Modal
class="!w-[50vw]"
v-model:open="open"
title="选择关联订单"
@ok="handleOk"
>
<Grid class="max-h-[600px]" table-title="销售订单列表(仅展示可退货)" />
</Modal>
</div>
</template>

View File

@@ -23,14 +23,15 @@ const formData = ref<ErpStockCheckApi.StockCheck>();
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['库存盘点单'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['库存盘点单'])
: '库存盘点单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['库存盘点单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['库存盘点单']);
} else {
return '库存盘点单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -46,13 +47,13 @@ const [Form, formApi] = useVbenForm({
});
/** 更新盘点单项 */
const handleUpdateItems = (items: ErpStockCheckApi.StockCheckItem[]) => {
function handleUpdateItems(items: ErpStockCheckApi.StockCheckItem[]) {
formData.value = modalApi.getData<ErpStockCheckApi.StockCheck>();
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 创建或更新库存盘点单 */
const [Modal, modalApi] = useVbenModal({

View File

@@ -174,11 +174,11 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpStockCheckApi.StockCheckItem): void => {
function initRow(row: ErpStockCheckApi.StockCheckItem) {
if (row.productPrice && row.count) {
row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -19,14 +19,15 @@ const formData = ref<ErpStockInApi.StockIn>();
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['其它入库单'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['其它入库单'])
: '其它入库单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['其它入库单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['其它入库单']);
} else {
return '其它入库单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -42,13 +43,13 @@ const [Form, formApi] = useVbenForm({
});
/** 更新入库单项 */
const handleUpdateItems = (items: ErpStockInApi.StockInItem[]) => {
function handleUpdateItems(items: ErpStockInApi.StockInItem[]) {
formData.value = modalApi.getData<ErpStockInApi.StockIn>();
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 创建或更新其它入库单 */
const [Modal, modalApi] = useVbenModal({

View File

@@ -160,11 +160,11 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpStockInApi.StockInItem): void => {
function initRow(row: ErpStockInApi.StockInItem) {
if (row.productPrice && row.count) {
row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -23,14 +23,15 @@ const formData = ref<ErpStockMoveApi.StockMove>();
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['库存调拨单'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['库存调拨单'])
: '库存调拨单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['库存调拨单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['库存调拨单']);
} else {
return '库存调拨单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -46,13 +47,13 @@ const [Form, formApi] = useVbenForm({
});
/** 更新调拨单项 */
const handleUpdateItems = (items: ErpStockMoveApi.StockMoveItem[]) => {
function handleUpdateItems(items: ErpStockMoveApi.StockMoveItem[]) {
formData.value = modalApi.getData<ErpStockMoveApi.StockMove>();
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 创建或更新库存调拨单 */
const [Modal, modalApi] = useVbenModal({

View File

@@ -99,7 +99,7 @@ function handleAdd() {
totalPrice: undefined,
remark: undefined,
};
tableData.value.push(newRow);
tableData.value.push(newRow as any);
// 通知父组件更新
emit('update:items', [...tableData.value]);
}
@@ -169,11 +169,11 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpStockMoveApi.StockMoveItem): void => {
function initRow(row: ErpStockMoveApi.StockMoveItem) {
if (row.productPrice && row.count) {
row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
}
};
}
/** 表单校验 */
function validate() {

View File

@@ -23,14 +23,15 @@ const formData = ref<ErpStockOutApi.StockOut>();
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
/* eslint-disable unicorn/no-nested-ternary */
const getTitle = computed(() =>
formType.value === 'create'
? $t('ui.actionTitle.create', ['其它出库单'])
: formType.value === 'edit'
? $t('ui.actionTitle.edit', ['其它出库单'])
: '其它出库单详情',
);
const getTitle = computed(() => {
if (formType.value === 'create') {
return $t('ui.actionTitle.create', ['其它出库单']);
} else if (formType.value === 'edit') {
return $t('ui.actionTitle.edit', ['其它出库单']);
} else {
return '其它出库单详情';
}
});
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -46,13 +47,13 @@ const [Form, formApi] = useVbenForm({
});
/** 更新出库单项 */
const handleUpdateItems = (items: ErpStockOutApi.StockOutItem[]) => {
function handleUpdateItems(items: ErpStockOutApi.StockOutItem[]) {
formData.value = modalApi.getData<ErpStockOutApi.StockOut>();
formData.value.items = items;
formApi.setValues({
items,
});
};
}
/** 创建或更新其它出库单 */
const [Modal, modalApi] = useVbenModal({

View File

@@ -158,11 +158,11 @@ function handleRowChange(row: any) {
}
/** 初始化行数据 */
const initRow = (row: ErpStockOutApi.StockOutItem): void => {
function initRow(row: ErpStockOutApi.StockOutItem) {
if (row.productPrice && row.count) {
row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
}
};
}
/** 表单校验 */
function validate() {