review:【erp 系统】purchase/order 的管理
parent
9a305e6cbd
commit
6d99bf3a46
|
@ -32,6 +32,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
});
|
||||
|
||||
/** 概览数据 */
|
||||
// TODO @nehc:应该是有 8 个小卡片,少了 4 个?
|
||||
const overviewItems = computed<AnalysisOverviewItem[]>(() => [
|
||||
{
|
||||
icon: SvgCardIcon,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue