Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-pc-cloud
This commit is contained in:
commit
e340c47593
1 file changed
+28
-35
@@ -109,20 +109,16 @@
|
||||
</vxe-column>
|
||||
<vxe-column field="unitId" title="包装单位" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<el-select v-model="row.unitId" placeholder="请选择包装单位">
|
||||
<el-option
|
||||
v-if="row.erpUnitVos?.length > 0"
|
||||
v-for="item in row.erpUnitVos"
|
||||
:key="item.id"
|
||||
:label="item.unit"
|
||||
:value="item.id"
|
||||
/>
|
||||
<el-option v-else :key="row.id" :label="row.unit" :value="row.unitId" />
|
||||
<el-select v-if="row.erpUnitVos" v-model="row.unitId" value-key="id" placeholder="请选择包装单位">
|
||||
<el-option v-for="item in row.erpUnitVos" :key="item.id" :label="item.unit" :value="item" />
|
||||
</el-select>
|
||||
<el-select v-else v-model="row.unitId" value-key="id" placeholder="请选择包装单位">
|
||||
<el-option :key="row.id" :label="row.unit" :value="row.unitId" />
|
||||
</el-select>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unitId">{{ row.unit ?? row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.unit }}</span>
|
||||
<span v-else style="color: #c0c4cf">请选择</span>
|
||||
<span v-if="row.erpUnitVos">{{ row.unitId?.unit ?? "请选择" }}</span>
|
||||
<span v-else>{{ row.unit }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="quantity" title="数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
@@ -132,32 +128,25 @@
|
||||
</vxe-column>
|
||||
<vxe-column field="unitPrice" title="原进价">
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
row.purchasePrice
|
||||
? displayPrice(row.purchasePrice)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice)
|
||||
}}
|
||||
{{ row.erpUnitVos ? displayPrice(row.unitId?.purchasePrice || 0) : displayPrice(row.purchasePrice) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="realPrice" title="实际进价" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
row.realPrice
|
||||
? displayPrice(row.realPrice)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.realPrice)
|
||||
}}
|
||||
{{ row.erpUnitVos && row.unitId ? row.unitId?.realPrice || 0 : row.realPrice }}
|
||||
</template>
|
||||
<template #edit="{ row }">
|
||||
<el-input v-model="row.realPrice" />
|
||||
<el-input v-if="row.erpUnitVos && row.unitId" v-model="row.unitId.realPrice" />
|
||||
<el-input v-else v-model="row.realPrice" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unitId && row.quantity && row.unit && !row.erpUnitVos">
|
||||
{{ Number(row.quantity * parseFloat(row.realPrice || 0)).toFixed(2) }}
|
||||
<span v-if="row.erpUnitVos && row.unitId && row.quantity">
|
||||
{{ Number(row.quantity * parseFloat(row.unitId.realPrice || 0)).toFixed(2) }}
|
||||
</span>
|
||||
<span v-if="row.unitId && row.quantity && row.erpUnitVos">
|
||||
{{ Number(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.realPrice || 0) * row.quantity).toFixed(2) }}
|
||||
<span v-else>
|
||||
{{ Number(Number(row.quantity) * row.realPrice).toFixed(2) }}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -273,7 +262,7 @@ const state = reactive<{
|
||||
const dataRules = ref({
|
||||
inventoryCode: [{ required: true, message: "出入库记录表编号不能为空", trigger: "blur" }],
|
||||
inventoryDate: [{ required: true, message: "出入库记录表单据日期不能为空", trigger: "blur" }],
|
||||
// handlerUserId: [{ required: true, message: "经办人不能为空", trigger: "blur" }],
|
||||
handlerUserId: [{ required: true, message: "经办人不能为空", trigger: "blur" }],
|
||||
supplierId: [{ required: true, message: "货商不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
@@ -298,8 +287,8 @@ const getInitData = async () => {
|
||||
|
||||
if (cgPlanData && cgPlanData.code === 0) {
|
||||
Object.assign(baseDataForm, cgPlanData.data)
|
||||
state.editableTableData = cgPlanData.data.items.map((item: any) => ({ ...item, realPrice: displayPrice(item.realPrice, "") }))
|
||||
state.erpSpuItemsMemo = cgPlanData.data.items.map((item: any) => ({ ...item, realPrice: displayPrice(item.realPrice, "") }))
|
||||
state.editableTableData = cgPlanData.data.items
|
||||
state.erpSpuItemsMemo = cgPlanData.data.items
|
||||
}
|
||||
} else {
|
||||
loading.value = true
|
||||
@@ -365,7 +354,11 @@ const getSelectedSpuRows = (selectionRows: any) => {
|
||||
.map((addItem: any) => {
|
||||
const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
||||
if (index !== -1) return state.erpSpuItemsMemo[index]
|
||||
return { ...addItem, isNew: true }
|
||||
return {
|
||||
...addItem,
|
||||
erpUnitVos: addItem.erpUnitVos.map((item: any) => ({ ...item, realPrice: displayPrice(item.purchasePrice, "") })),
|
||||
isNew: true,
|
||||
}
|
||||
})
|
||||
// 仅添加新勾选的项
|
||||
state.editableTableData = [...state.editableTableData, ...addedItems]
|
||||
@@ -393,16 +386,16 @@ const getSelectedSpuRows = (selectionRows: any) => {
|
||||
const cgPlanSpuItems = computed(() => {
|
||||
return state.editableTableData.map((item: any) => {
|
||||
if (item.erpUnitVos) {
|
||||
const unit = item.erpUnitVos.find((unitItem: any) => unitItem.id === item.unitId)
|
||||
const unitObj = item.unitId
|
||||
return {
|
||||
id: item.isNew ? undefined : item.id,
|
||||
erpSpuId: item.erpSpuId,
|
||||
quantity: item.quantity,
|
||||
unitPrice: unit.purchasePrice ? Number(unit?.purchasePrice) : 0,
|
||||
realPrice: unit.realPrice ? storePrice(unit?.realPrice) : 0,
|
||||
totalAmount: storePrice(Number(unit?.realPrice || 0) * item.quantity),
|
||||
unitPrice: unitObj.purchasePrice ? Number(unitObj?.purchasePrice) : 0,
|
||||
realPrice: unitObj.realPrice ? storePrice(unitObj?.realPrice) : 0,
|
||||
totalAmount: storePrice(Number(unitObj?.realPrice || 0) * item.quantity),
|
||||
remark: item.remark,
|
||||
unitId: item.unitId,
|
||||
unitId: unitObj.unitId,
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user