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[]>(() => [ const overviewItems = computed<AnalysisOverviewItem[]>(() => [
{ {
icon: SvgCardIcon, icon: SvgCardIcon,

View File

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

View File

@@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
// TODO @nehc看看整个逻辑和 erp 风格的主子表,能不能更统一一些;
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order'; import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
import { nextTick, onMounted, ref, watch } from 'vue'; import { nextTick, onMounted, ref, watch } from 'vue';
@@ -25,6 +26,7 @@ const emit = defineEmits([
'update:total-price', 'update:total-price',
]); ]);
// TODO @nehc:这种一次性的,是不是可以不定义哈?
interface Props { interface Props {
items?: ErpPurchaseOrderApi.PurchaseOrderItem[]; items?: ErpPurchaseOrderApi.PurchaseOrderItem[];
disabled?: boolean; disabled?: boolean;
@@ -70,6 +72,7 @@ watch(
await nextTick(); await nextTick();
tableData.value = [...items]; tableData.value = [...items];
await nextTick(); await nextTick();
// TODO @nehc这里是不是直接 await 下?
gridApi.grid.reloadData(tableData.value); gridApi.grid.reloadData(tableData.value);
}, },
{ {
@@ -92,6 +95,7 @@ watch(
props.discountPercent === null props.discountPercent === null
? 0 ? 0
: erpPriceMultiply(totalPrice, props.discountPercent / 100); : erpPriceMultiply(totalPrice, props.discountPercent / 100);
// TODO @nehc这里的 idea 红色告警?
const finalTotalPrice = totalPrice - discountPrice; const finalTotalPrice = totalPrice - discountPrice;
// 发送计算结果给父组件 // 发送计算结果给父组件
@@ -122,6 +126,7 @@ function handleAdd() {
stockCount: 0, stockCount: 0,
remark: '', remark: '',
}; };
// TODO @nehc这里的红色告警哈
tableData.value.push(newRow); tableData.value.push(newRow);
gridApi.grid.insertAt(newRow, -1); gridApi.grid.insertAt(newRow, -1);
emit('update:items', [...tableData.value]); 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(); await nextTick();
// TODO @nehc应该不会不存在直接校验简洁一点另外可以看看别的模块主子表的处理哈
const itemFormInstance = Array.isArray(itemFormRef.value) const itemFormInstance = Array.isArray(itemFormRef.value)
? itemFormRef.value[0] ? itemFormRef.value[0]
: itemFormRef.value; : itemFormRef.value;
@@ -93,6 +95,7 @@ const [Modal, modalApi] = useVbenModal({
return; return;
} }
} catch (error) { } catch (error) {
// TODO @nehc这里的红色告警看看怎么处理掉
message.error(error.message || '子表单验证失败'); message.error(error.message || '子表单验证失败');
return; return;
} }
@@ -144,6 +147,7 @@ const [Modal, modalApi] = useVbenModal({
// 初始化空的表单数据 // 初始化空的表单数据
formData.value = { items: [] } as ErpPurchaseOrderApi.PurchaseOrder; formData.value = { items: [] } as ErpPurchaseOrderApi.PurchaseOrder;
await nextTick(); await nextTick();
// TODO @nehc看看有没办法简化
const itemFormInstance = Array.isArray(itemFormRef.value) const itemFormInstance = Array.isArray(itemFormRef.value)
? itemFormRef.value[0] ? itemFormRef.value[0]
: itemFormRef.value; : itemFormRef.value;
@@ -156,7 +160,9 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock(); modalApi.lock();
try { try {
formData.value = await getPurchaseOrder(data.id); formData.value = await getPurchaseOrder(data.id);
// 将字符串形式的文件URL转换为数组形式以适配FileUpload组件 // 将字符串形式的文件 URL 转换为数组形式以适配 FileUpload 组件
// TODO @nehc这里的 idea 会有黄色告警,看看是不是简化下?
// TODO @nehc记忆中好像不用数组的转换可以在看看
if ( if (
formData.value.fileUrl && formData.value.fileUrl &&
typeof formData.value.fileUrl === 'string' typeof formData.value.fileUrl === 'string'

View File

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