|
|
|
@@ -7,7 +7,7 @@
|
|
|
|
|
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="单据日期" prop="inventoryDate">
|
|
|
|
|
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" />
|
|
|
|
|
<el-input v-model="baseDataForm.inventoryDate" readonly style="width: 200px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="经办人" prop="handlerUserId">
|
|
|
|
|
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
|
|
|
|
@@ -45,7 +45,6 @@
|
|
|
|
|
ref="editableTableRef"
|
|
|
|
|
border
|
|
|
|
|
:loading="loading"
|
|
|
|
|
show-overflow
|
|
|
|
|
max-height="400"
|
|
|
|
|
:edit-config="{
|
|
|
|
|
trigger: 'click',
|
|
|
|
@@ -63,6 +62,15 @@
|
|
|
|
|
:resizable-config="{ dragMode: 'fixed' }"
|
|
|
|
|
:data="state.editableTableData"
|
|
|
|
|
:edit-rules="validRules"
|
|
|
|
|
class="editableTable-style"
|
|
|
|
|
:cell-class-name="
|
|
|
|
|
({ row, column }:any) => {
|
|
|
|
|
if (column.field === 'unitId') {
|
|
|
|
|
return 'table-padding'
|
|
|
|
|
}
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@checkbox-all="selectChangeEvent"
|
|
|
|
|
@checkbox-change="selectChangeEvent"
|
|
|
|
|
size="mini"
|
|
|
|
@@ -77,71 +85,58 @@
|
|
|
|
|
<span v-else>{{ row.erpSpuId && state.erpSpuSimpleAll.find((item: any) => item.id === row.erpSpuId)?.productName }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="unitId" title="包装单位" :edit-render="{}">
|
|
|
|
|
<vxe-column field="unitId" title="包装单位" min-width="60">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<div v-for="(item, index) in row.erpUnitVos" :key="index">单位:{{ item.unit }} 装数:{{ item.packageNum }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="" title="账面数量">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ row.stock }}
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="currentStock" title="实际数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }" min-width="30">
|
|
|
|
|
<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.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-input size="small" v-model="row.erpUnitVos[index].currentStock" v-for="(item, index) in row.erpUnitVos" :key="index" />
|
|
|
|
|
</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>
|
|
|
|
|
<div v-for="(item, index) in row.erpUnitVos" :key="index">
|
|
|
|
|
{{ (item.currentStock ? item.currentStock : "__") + " " + item.unit }}
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="currentStock" title="账面数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<el-input v-model="row.quantity" />
|
|
|
|
|
<vxe-column field="profit" title="盈">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<div v-for="(item, index) in row.erpUnitVos" :key="index">{{ 777 - +item.currentStock || 0 }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="currentStock" title="实际数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<el-input v-model="row.quantity" />
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="profit" title="盈" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<el-input v-model="row.quantity" />
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="loss" title="亏" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<el-input v-model="row.quantity" />
|
|
|
|
|
<vxe-column field="loss" title="亏">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<div v-for="(item, index) in row.erpUnitVos" :key="index">{{ 777 - +item.currentStock || 0 }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</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.unitPrice
|
|
|
|
|
? displayPrice(row.unitPrice)
|
|
|
|
|
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.unitPrice)
|
|
|
|
|
}}
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="pdPrice" title="盘点单价" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<el-input v-model="row.quantity" />
|
|
|
|
|
<el-input v-model="row.pdPrice" />
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="pdTotalNum" title="盘后总数" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<el-input v-model="row.quantity" />
|
|
|
|
|
<el-input v-model="row.pdTotalNum" />
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="totalAmount" title="盘后总金额">
|
|
|
|
|
<vxe-column field="pdTotalAmount" title="盘后总金额">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<span v-if="row.unitId && row.quantity && row.unit && !row.erpUnitVos">
|
|
|
|
|
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice)) }}
|
|
|
|
|
</span>
|
|
|
|
|
<span v-if="row.unitId && row.quantity && row.erpUnitVos">
|
|
|
|
|
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity) }}
|
|
|
|
|
</span>
|
|
|
|
|
{{ parseFloat(row.pdPrice) * parseFloat(row.pdTotalNum) }}
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="remark" title="备注" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
|
|
|
@@ -171,14 +166,6 @@
|
|
|
|
|
@getSelectedSpuRows="getSelectedSpuRows"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<linkCodeDialog
|
|
|
|
|
ref="linkCgPlanDialogRef"
|
|
|
|
|
v-model="state.linkCgPlanDialogVisible"
|
|
|
|
|
title="关联采购订单"
|
|
|
|
|
:getTableData="getCgddPage"
|
|
|
|
|
@getSelectedLinkCode="getSelectedLinkCode"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<barCodeEnter ref="barCodeEnterRef" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@@ -192,36 +179,26 @@ import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryReco
|
|
|
|
|
import { getPlanCode, getErpSpuSimpleAll, getCgddPage } from "/@/api/supermarketerp/common"
|
|
|
|
|
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
|
|
|
|
import { formatDate } from "/@/utils/formatTime"
|
|
|
|
|
import { Search } from "@element-plus/icons-vue"
|
|
|
|
|
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
|
|
|
|
|
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
|
|
|
|
|
import barCodeEnter from "./barCodeEnter.vue"
|
|
|
|
|
import { displayPrice } from "/@/utils/formatMoney"
|
|
|
|
|
import { useDict } from "/@/hooks/dict"
|
|
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const loading = ref(false) // 采购计划加载
|
|
|
|
|
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
|
|
|
|
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
|
|
|
|
const barCodeEnterRef = ref() // 条码录入对话框ref
|
|
|
|
|
const baseDataFormRef = ref() // 基本数据表单ref
|
|
|
|
|
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
|
|
|
|
const { check_status } = useDict("check_status")
|
|
|
|
|
// 基本信息表单数据
|
|
|
|
|
const baseDataForm = reactive<any>({
|
|
|
|
|
id: "",
|
|
|
|
|
inventoryCode: "",
|
|
|
|
|
inventoryDate: formatDate(new Date(), "YYYY-mm-dd"),
|
|
|
|
|
handlerUserId: "",
|
|
|
|
|
checkStatus: "",
|
|
|
|
|
checkUserId: "",
|
|
|
|
|
checkTime: "",
|
|
|
|
|
supplierId: "",
|
|
|
|
|
remark: "",
|
|
|
|
|
inventoryType: "7",
|
|
|
|
|
orderType: "",
|
|
|
|
|
totalAmount: "",
|
|
|
|
|
})
|
|
|
|
|
const state = reactive<{
|
|
|
|
|
editableTableData: any[]
|
|
|
|
@@ -284,19 +261,6 @@ const getInitData = async () => {
|
|
|
|
|
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 点击关联采购申请编号
|
|
|
|
|
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog(2)
|
|
|
|
|
|
|
|
|
|
// 获取选择的采购申请
|
|
|
|
|
const getSelectedLinkCode = (selectionRows: any) => {
|
|
|
|
|
console.log("被选择的关联数据", selectionRows)
|
|
|
|
|
|
|
|
|
|
baseDataForm.linkCode = selectionRows.code
|
|
|
|
|
state.editableTableData = selectionRows.items
|
|
|
|
|
state.erpSpuItemsMemo = selectionRows.items
|
|
|
|
|
state.linkCgPlanDialogVisible = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 顶部表格行新增
|
|
|
|
|
const addEvent = () => {
|
|
|
|
|
const newRow: any = {
|
|
|
|
@@ -395,7 +359,7 @@ const getSelectedSpuRows = (selectionRows: any) => {
|
|
|
|
|
const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
|
|
|
|
if (index !== -1) return state.erpSpuItemsMemo[index]
|
|
|
|
|
return { ...addItem, isNew: true }
|
|
|
|
|
}) // 为新增的数据项添加isNew,若该项原本已经存在,则不添加isNew
|
|
|
|
|
})
|
|
|
|
|
// 仅添加新勾选的项
|
|
|
|
|
state.editableTableData = [...state.editableTableData, ...addedItems]
|
|
|
|
|
|
|
|
|
@@ -543,3 +507,9 @@ onMounted(() => {
|
|
|
|
|
getInitData()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
::v-deep(.editableTable-style.vxe-table .vxe-body--column.table-padding) {
|
|
|
|
|
padding: 6px 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|