diff --git a/src/views/canteen/canteenErpMaterial/form.vue b/src/views/canteen/canteenErpMaterial/form.vue index 8cd475f..98820e9 100644 --- a/src/views/canteen/canteenErpMaterial/form.vue +++ b/src/views/canteen/canteenErpMaterial/form.vue @@ -1,131 +1,137 @@ diff --git a/src/views/canteen/canteenErpMaterial/index.vue b/src/views/canteen/canteenErpMaterial/index.vue index ac6ceb9..85a9201 100644 --- a/src/views/canteen/canteenErpMaterial/index.vue +++ b/src/views/canteen/canteenErpMaterial/index.vue @@ -1,23 +1,43 @@ diff --git a/src/views/canteen/canteenInventoryRecords/form.vue b/src/views/canteen/canteenInventoryRecords/form.vue index f75d176..45ee28b 100644 --- a/src/views/canteen/canteenInventoryRecords/form.vue +++ b/src/views/canteen/canteenInventoryRecords/form.vue @@ -60,16 +60,16 @@ - - - - - + + + + + @@ -154,10 +154,11 @@ const openDialog = async (id: string) => { .then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null))) .finally(() => (loading.value = false)) if (res && res.code == 0) { - Object.assign(baseForm, res.data, { items: "" }) + Object.assign(baseForm, res.data) + delete baseForm.items state.itemTableForm = res.data.items.map((item: any) => ({ ...item, - unitPrice: displayPrice(item.unitPrice, ""), + purchasePrice: item.unitPrice, realPrice: displayPrice(item.realPrice, ""), totalAmount: displayPrice(item.totalAmount, ""), })) @@ -244,7 +245,7 @@ const tableFormItems = () => id: item.isNew ? undefined : item.id, erpMaterialId: item.erpMaterialId, quantity: item.quantity, - unitPrice: storePrice(item.unitPrice), + unitPrice: item.purchasePrice, realPrice: item.realPrice ? storePrice(item.realPrice) : 0, totalAmount: storePrice((Number(item.quantity || 0) * Number(item.realPrice || 0)).toFixed(2)), stock: item.stock, @@ -253,11 +254,11 @@ const tableFormItems = () => // 提交数据 成功返回 true 失败返回 false const submitData = async () => { - const canteenInventoryRecordsItemDTOS = tableFormItems() + const items = tableFormItems() const _pa = { ...baseForm, - totalAmount: canteenInventoryRecordsItemDTOS.reduce((acc: number, cur: any) => acc + Number(cur.totalAmount), 0), - canteenInventoryRecordsItemDTOS, + totalAmount: items.reduce((acc: number, cur: any) => acc + Number(cur.totalAmount), 0), + items, } console.log("提交的数据:", _pa) diff --git a/src/views/canteen/canteenInventoryRecords/select-dialog.vue b/src/views/canteen/canteenInventoryRecords/select-dialog.vue index 6e5c0f5..e58e616 100644 --- a/src/views/canteen/canteenInventoryRecords/select-dialog.vue +++ b/src/views/canteen/canteenInventoryRecords/select-dialog.vue @@ -26,7 +26,9 @@ - + + + import { ref } from "vue" import { fetchErpMaterialPageList } from "/@/api/canteen/canteenErpMaterial" +import { displayPrice } from "/@/utils/formatMoney" const emit = defineEmits(["getSelectedRows"]) const props = withDefaults(