@@ -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 }} & nbsp ; 装数 : {{ 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 = "t otalAmount" title = "盘后总金额" >
< vxe-column field = "pdT otalAmount" 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 ( ) / / 商 品 选 择 对 话 框 r e f
const linkCgPlanDialogRef = ref ( ) / / 关 联 采 购 申 请 单 对 话 框 r e f
const barCodeEnterRef = ref ( ) / / 条 码 录 入 对 话 框 r e f
const baseDataFormRef = ref ( ) / / 基 本 数 据 表 单 r e f
const editableTableRef = ref < VxeTableInstance < any > > ( ) / / 可 编 辑 表 格 r e f
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 }
} ) / / 为 新 增 的 数 据 项 添 加 i s N e w , 若 该 项 原 本 已 经 存 在 , 则 不 添 加 i s N e w
} )
/ / 仅 添 加 新 勾 选 的 项
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 : 6 px 0 ;
}
< / style >