feat:【antd】【erp 系统】sale/order 部分代码优化(form 基本完善)
This commit is contained in:
@@ -330,7 +330,15 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
allowClear: true,
|
allowClear: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// TODO @AI:备注缺少;/Users/yunai/Java/yudao-ui-admin-vue3/src/views/erp/sale/order/index.vue
|
{
|
||||||
|
fieldName: 'remark',
|
||||||
|
label: '备注',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'outStatus',
|
fieldName: 'outStatus',
|
||||||
label: '出库状态',
|
label: '出库状态',
|
||||||
|
|||||||
@@ -66,20 +66,21 @@ async function handleDelete(ids: number[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 审批/反审批操作 */
|
/** 审批/反审批操作 */
|
||||||
function handleUpdateStatus(row: ErpSaleOrderApi.SaleOrder, status: number) {
|
async function handleUpdateStatus(
|
||||||
|
row: ErpSaleOrderApi.SaleOrder,
|
||||||
|
status: number,
|
||||||
|
) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
|
content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
// TODO @AI:改成 await 写法
|
try {
|
||||||
updateSaleOrderStatus(row.id!, status)
|
await updateSaleOrderStatus(row.id!, status);
|
||||||
.then(() => {
|
|
||||||
message.success(`${status === 20 ? '审批' : '反审批'}成功`);
|
message.success(`${status === 20 ? '审批' : '反审批'}成功`);
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
})
|
} finally {
|
||||||
.finally(() => {
|
|
||||||
hideLoading();
|
hideLoading();
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkedIds = ref<number[]>([]);
|
const checkedIds = ref<number[]>([]);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { $t } from '#/locales';
|
|||||||
|
|
||||||
import { useFormSchema } from '../data';
|
import { useFormSchema } from '../data';
|
||||||
import ItemForm from './item-form.vue';
|
import ItemForm from './item-form.vue';
|
||||||
|
import {getAccountSimpleList} from '#/api/erp/finance/account';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<ErpSaleOrderApi.SaleOrder>();
|
const formData = ref<ErpSaleOrderApi.SaleOrder>();
|
||||||
@@ -38,7 +39,6 @@ const [Form, formApi] = useVbenForm({
|
|||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
},
|
},
|
||||||
labelWidth: 120,
|
labelWidth: 120,
|
||||||
// disabled: !['create', 'edit'].includes(formType.value), // TODO @芋艿:这里晚点处理下;
|
|
||||||
},
|
},
|
||||||
wrapperClass: 'grid-cols-3',
|
wrapperClass: 'grid-cols-3',
|
||||||
layout: 'vertical',
|
layout: 'vertical',
|
||||||
@@ -116,7 +116,14 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||||
formType.value = data.type;
|
formType.value = data.type;
|
||||||
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
|
// 新增时,默认选中账户
|
||||||
|
const accountList = await getAccountSimpleList();
|
||||||
|
const defaultAccount = accountList.find((item) => item.defaultStatus);
|
||||||
|
if (defaultAccount) {
|
||||||
|
await formApi.setValues({ accountId: defaultAccount.id });
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
@@ -124,7 +131,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
formData.value = await getSaleOrder(data.id);
|
formData.value = await getSaleOrder(data.id);
|
||||||
// 设置到 values
|
// 设置到 values
|
||||||
await formApi.setValues(formData.value);
|
await formApi.setValues(formData.value);
|
||||||
// TODO @AI:默认账户;缺少;
|
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
@@ -134,19 +140,14 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal
|
<Modal
|
||||||
v-bind="$attrs"
|
|
||||||
:title="getTitle"
|
:title="getTitle"
|
||||||
class="w-3/4"
|
class="w-3/4"
|
||||||
:closable="true"
|
|
||||||
:mask-closable="true"
|
|
||||||
:show-confirm-button="formType !== 'detail'"
|
:show-confirm-button="formType !== 'detail'"
|
||||||
>
|
>
|
||||||
<Form class="mx-3">
|
<Form class="mx-3">
|
||||||
<template #items="slotProps">
|
<template #items>
|
||||||
<ItemForm
|
<ItemForm
|
||||||
v-bind="slotProps"
|
|
||||||
ref="itemFormRef"
|
ref="itemFormRef"
|
||||||
class="w-full"
|
|
||||||
:items="formData?.items ?? []"
|
:items="formData?.items ?? []"
|
||||||
:disabled="formType === 'detail'"
|
:disabled="formType === 'detail'"
|
||||||
:discount-percent="formData?.discountPercent ?? 0"
|
:discount-percent="formData?.discountPercent ?? 0"
|
||||||
|
|||||||
@@ -2,9 +2,13 @@
|
|||||||
import type { ErpProductApi } from '#/api/erp/product/product';
|
import type { ErpProductApi } from '#/api/erp/product/product';
|
||||||
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
|
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
|
||||||
|
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { erpPriceMultiply } from '@vben/utils';
|
import {
|
||||||
|
erpCountInputFormatter,
|
||||||
|
erpPriceInputFormatter,
|
||||||
|
erpPriceMultiply,
|
||||||
|
} from '@vben/utils';
|
||||||
|
|
||||||
import { Input, InputNumber, Select } from 'ant-design-vue';
|
import { Input, InputNumber, Select } from 'ant-design-vue';
|
||||||
|
|
||||||
@@ -84,6 +88,7 @@ watch(
|
|||||||
}
|
}
|
||||||
items.forEach((item) => initRow(item));
|
items.forEach((item) => initRow(item));
|
||||||
tableData.value = [...items];
|
tableData.value = [...items];
|
||||||
|
await nextTick(); // 特殊:保证 gridApi 已经初始化
|
||||||
await gridApi.grid.reloadData(tableData.value);
|
await gridApi.grid.reloadData(tableData.value);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -274,10 +279,14 @@ onMounted(async () => {
|
|||||||
<div class="text-muted-foreground flex justify-between text-sm">
|
<div class="text-muted-foreground flex justify-between text-sm">
|
||||||
<span class="text-foreground font-medium">合计:</span>
|
<span class="text-foreground font-medium">合计:</span>
|
||||||
<div class="flex space-x-4">
|
<div class="flex space-x-4">
|
||||||
<span>数量:{{ summaries.count }}</span>
|
<span>数量:{{ erpCountInputFormatter(summaries.count) }}</span>
|
||||||
<span>金额:{{ summaries.totalProductPrice }}</span>
|
<span>
|
||||||
<span>税额:{{ summaries.taxPrice }}</span>
|
金额:{{ erpPriceInputFormatter(summaries.totalProductPrice) }}
|
||||||
<span>税额合计:{{ summaries.totalPrice }}</span>
|
</span>
|
||||||
|
<span>税额:{{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
|
||||||
|
<span>
|
||||||
|
税额合计:{{ erpPriceInputFormatter(summaries.totalPrice) }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user