fix: erp warn
This commit is contained in:
@@ -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;
|
||||
}
|
||||
// 加载数据
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
// 加载数据
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user