fix:入库出库表尾合计;导入每日菜品成功刷新分类
This commit is contained in:
1 parent
075b4f41bb
commit
52aa57bf6f
5 files changed
+60
-20
No files matched your search
@@ -69,8 +69,16 @@
|
||||
:data="vxeTableData"
|
||||
:edit-rules="validRules"
|
||||
show-footer
|
||||
:footer-data="[{ seq: '合计', totalAmount }]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 7 }]"
|
||||
:footer-data="[
|
||||
{
|
||||
seq: '合计',
|
||||
quantity: total.quantity,
|
||||
purchasePrice: total.purchasePrice,
|
||||
realPrice: `${total.realPrice}元`,
|
||||
totalAmount: total.totalAmount,
|
||||
},
|
||||
]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 4 }]"
|
||||
@checkbox-all=""
|
||||
@checkbox-change=""
|
||||
size="mini"
|
||||
@@ -148,7 +156,7 @@
|
||||
<el-input-number v-if="row.selectedUnitObj" v-model="row.selectedUnitObj.totalAmount" :min="0" :precision="2" />
|
||||
</template>
|
||||
<template #footer="{ row }">
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ totalAmount }} 元</span>
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ total.totalAmount }}元</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="remark" title="备注" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
@@ -235,9 +243,15 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
})
|
||||
|
||||
// 合计总金额
|
||||
const totalAmount = computed(() =>
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2),
|
||||
)
|
||||
const total = computed(() => {
|
||||
const quantity = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.quantity || 0), 0).toFixed(2)
|
||||
const purchasePrice = displayPrice(
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.purchasePrice || 0), 0),
|
||||
)
|
||||
const realPrice = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.realPrice || 0), 0)
|
||||
const totalAmount = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2)
|
||||
return { quantity, purchasePrice, realPrice, totalAmount }
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getInitData()
|
||||
|
||||
@@ -97,8 +97,16 @@
|
||||
:data="vxeTableData"
|
||||
:edit-rules="validRules"
|
||||
show-footer
|
||||
:footer-data="[{ seq: '合计', totalAmount }]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 7 }]"
|
||||
:footer-data="[
|
||||
{
|
||||
seq: '合计',
|
||||
quantity: total.quantity,
|
||||
purchasePrice: total.purchasePrice,
|
||||
realPrice: `${total.realPrice}元`,
|
||||
totalAmount: total.totalAmount,
|
||||
},
|
||||
]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 4 }]"
|
||||
@checkbox-all=""
|
||||
@checkbox-change=""
|
||||
size="mini"
|
||||
@@ -176,7 +184,7 @@
|
||||
<el-input-number v-if="row.selectedUnitObj" v-model="row.selectedUnitObj.totalAmount" :min="0" :precision="2" />
|
||||
</template>
|
||||
<template #footer="{ row }">
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ totalAmount }} 元</span>
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ total.totalAmount }}元</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="remark" title="备注" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
@@ -263,9 +271,15 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
})
|
||||
|
||||
// 合计总金额
|
||||
const totalAmount = computed(() =>
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2),
|
||||
)
|
||||
const total = computed(() => {
|
||||
const quantity = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.quantity || 0), 0).toFixed(2)
|
||||
const purchasePrice = displayPrice(
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.purchasePrice || 0), 0),
|
||||
)
|
||||
const realPrice = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.realPrice || 0), 0)
|
||||
const totalAmount = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2)
|
||||
return { quantity, purchasePrice, realPrice, totalAmount }
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getInitData()
|
||||
|
||||
Reference in new issue
Block a user