review:【erp 系统】purchase/order 的管理

This commit is contained in:
YunaiV
2025-08-04 22:42:59 +08:00
parent 9a305e6cbd
commit 6d99bf3a46
5 changed files with 17 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ const props = withDefaults(defineProps<Props>(), {
});
/** 概览数据 */
// TODO @nehc应该是有 8 个小卡片,少了 4 个?
const overviewItems = computed<AnalysisOverviewItem[]>(() => [
{
icon: SvgCardIcon,

View File

@@ -35,6 +35,7 @@ function onRefresh() {
gridApi.query();
}
// TODO @nehc handleRowCheckboxChange 放的位置;
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
@@ -81,6 +82,7 @@ async function handleDelete(row: ErpPurchaseOrderApi.PurchaseOrder) {
}
/** 批量删除 */
// TODO @nehc handleBatchDelete 是不是和别的模块,一个风格
async function handleBatchDelete() {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting'),
@@ -106,6 +108,7 @@ function handleUpdateStatus(
row: ErpPurchaseOrderApi.PurchaseOrder,
status: number,
) {
// TODO @nehc 是不是和别的模块,类似的 status 处理一个风格
const hideLoading = message.loading({
content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
duration: 0,

View File

@@ -1,4 +1,5 @@
<script lang="ts" setup>
// TODO @nehc看看整个逻辑和 erp 风格的主子表,能不能更统一一些;
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
import { nextTick, onMounted, ref, watch } from 'vue';
@@ -25,6 +26,7 @@ const emit = defineEmits([
'update:total-price',
]);
// TODO @nehc:这种一次性的,是不是可以不定义哈?
interface Props {
items?: ErpPurchaseOrderApi.PurchaseOrderItem[];
disabled?: boolean;
@@ -70,6 +72,7 @@ watch(
await nextTick();
tableData.value = [...items];
await nextTick();
// TODO @nehc这里是不是直接 await 下?
gridApi.grid.reloadData(tableData.value);
},
{
@@ -92,6 +95,7 @@ watch(
props.discountPercent === null
? 0
: erpPriceMultiply(totalPrice, props.discountPercent / 100);
// TODO @nehc这里的 idea 红色告警?
const finalTotalPrice = totalPrice - discountPrice;
// 发送计算结果给父组件
@@ -122,6 +126,7 @@ function handleAdd() {
stockCount: 0,
remark: '',
};
// TODO @nehc这里的红色告警哈
tableData.value.push(newRow);
gridApi.grid.insertAt(newRow, -1);
emit('update:items', [...tableData.value]);

View File

@@ -71,6 +71,7 @@ const handleUpdateTotalPrice = (totalPrice: number) => {
}
};
// TODO @nehc这里的注释使用 /** */ 和别的模块一致哈;
/**
* 创建或更新采购订单
*/
@@ -82,6 +83,7 @@ const [Modal, modalApi] = useVbenModal({
}
await nextTick();
// TODO @nehc应该不会不存在直接校验简洁一点另外可以看看别的模块主子表的处理哈
const itemFormInstance = Array.isArray(itemFormRef.value)
? itemFormRef.value[0]
: itemFormRef.value;
@@ -93,6 +95,7 @@ const [Modal, modalApi] = useVbenModal({
return;
}
} catch (error) {
// TODO @nehc这里的红色告警看看怎么处理掉
message.error(error.message || '子表单验证失败');
return;
}
@@ -144,6 +147,7 @@ const [Modal, modalApi] = useVbenModal({
// 初始化空的表单数据
formData.value = { items: [] } as ErpPurchaseOrderApi.PurchaseOrder;
await nextTick();
// TODO @nehc看看有没办法简化
const itemFormInstance = Array.isArray(itemFormRef.value)
? itemFormRef.value[0]
: itemFormRef.value;
@@ -156,7 +160,9 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getPurchaseOrder(data.id);
// 将字符串形式的文件URL转换为数组形式以适配FileUpload组件
// 将字符串形式的文件 URL 转换为数组形式以适配 FileUpload 组件
// TODO @nehc这里的 idea 会有黄色告警,看看是不是简化下?
// TODO @nehc记忆中好像不用数组的转换可以在看看
if (
formData.value.fileUrl &&
typeof formData.value.fileUrl === 'string'

View File

@@ -1,4 +1,5 @@
<script lang="ts" setup>
// TODO @nehc这里的组件名
import type { ErpStockInApi } from '#/api/erp/stock/in';
import { nextTick, onMounted, ref, watch } from 'vue';