From 0c46b250c029ddef193041487b9a9f90bbc95825 Mon Sep 17 00:00:00 2001 From: weiwei Date: Fri, 23 May 2025 09:56:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A3=9F=E6=9D=90?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=9A=84=E5=8E=9F=E8=BF=9B=E4=BB=B7=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/canteen/canteenInventoryRecords/form.vue | 14 +++++++------- .../canteenInventoryRecords/select-dialog.vue | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/views/canteen/canteenInventoryRecords/form.vue b/src/views/canteen/canteenInventoryRecords/form.vue index f75d176..1701ddb 100644 --- a/src/views/canteen/canteenInventoryRecords/form.vue +++ b/src/views/canteen/canteenInventoryRecords/form.vue @@ -60,16 +60,16 @@ - - - - - + + + + + @@ -157,7 +157,7 @@ const openDialog = async (id: string) => { Object.assign(baseForm, res.data, { 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 +244,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, diff --git a/src/views/canteen/canteenInventoryRecords/select-dialog.vue b/src/views/canteen/canteenInventoryRecords/select-dialog.vue index 137a0ad..8e69df4 100644 --- a/src/views/canteen/canteenInventoryRecords/select-dialog.vue +++ b/src/views/canteen/canteenInventoryRecords/select-dialog.vue @@ -26,6 +26,9 @@ + + + import { ref } from "vue" import { fetchErpMaterialPageList } from "/@/api/canteen/canteenErpMaterial" +import { displayPrice } from "/@/utils/formatMoney" const emit = defineEmits(["getSelectedRows"]) const props = withDefaults( From 0a7cfe3df0991bd2eb2b3ee6508e5bccd14ea6e6 Mon Sep 17 00:00:00 2001 From: weiwei Date: Fri, 23 May 2025 10:13:14 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=A3=9F=E6=9D=90=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=BF=9B=E4=BB=B7=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/canteen/canteenErpMaterial/form.vue | 190 +++++++++--------- .../canteen/canteenErpMaterial/index.vue | 183 +++++++++-------- .../canteen/canteenInventoryRecords/form.vue | 3 +- 3 files changed, 204 insertions(+), 172 deletions(-) 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 82e609a..a92c985 100644 --- a/src/views/canteen/canteenErpMaterial/index.vue +++ b/src/views/canteen/canteenErpMaterial/index.vue @@ -1,58 +1,90 @@ diff --git a/src/views/canteen/canteenInventoryRecords/form.vue b/src/views/canteen/canteenInventoryRecords/form.vue index 1701ddb..d16209d 100644 --- a/src/views/canteen/canteenInventoryRecords/form.vue +++ b/src/views/canteen/canteenInventoryRecords/form.vue @@ -154,7 +154,8 @@ 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, purchasePrice: item.unitPrice, From 5a1850f9a442809bb839287c3488865678087aa5 Mon Sep 17 00:00:00 2001 From: weiwei Date: Fri, 23 May 2025 10:20:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A3=9F=E6=9D=90=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/canteen/canteenInventoryRecords/form.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/canteen/canteenInventoryRecords/form.vue b/src/views/canteen/canteenInventoryRecords/form.vue index d16209d..45ee28b 100644 --- a/src/views/canteen/canteenInventoryRecords/form.vue +++ b/src/views/canteen/canteenInventoryRecords/form.vue @@ -254,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)