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