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[]>(() => [
|
const overviewItems = computed<AnalysisOverviewItem[]>(() => [
|
||||||
{
|
{
|
||||||
icon: SvgCardIcon,
|
icon: SvgCardIcon,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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]);
|
||||||
|
|
|
@ -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'
|
||||||
|
|
|
@ -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';
|
||||||
|
|
Loading…
Reference in New Issue