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

@@ -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>